1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

source cleanup: unify look, style and indent levels

By the use of a the new lib/checksrc.pl script that checks that our
basic source style rules are followed.
This commit is contained in:
Daniel Stenberg 2011-04-20 15:17:42 +02:00
parent 592eda8e3f
commit b903186fa0
88 changed files with 1411 additions and 1577 deletions

View File

@ -184,3 +184,6 @@ $(VCPROJ): vc8proj.head vc8proj.foot Makefile.am
echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \
done; \
cat $(srcdir)/vc8proj.foot $(VCPROJOUT) )
all-local:
@for i in $(CSOURCES) $(HHEADERS); do $(top_srcdir)/lib/checksrc.pl $(top_srcdir)/lib/$$i; done

View File

@ -542,10 +542,9 @@ Curl_addrinfo *Curl_resolver_getaddrinfo(struct connectdata *conn,
#ifdef ENABLE_IPV6 /* CURLRES_IPV6 */
/* Otherwise, check if this is an IPv6 address string */
if (Curl_inet_pton (AF_INET6, hostname, &in6) > 0) {
if(Curl_inet_pton (AF_INET6, hostname, &in6) > 0)
/* This must be an IPv6 address literal. */
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
}
switch(conn->ip_version) {
default:

View File

@ -225,7 +225,8 @@ int init_thread_sync_data(struct thread_sync_data * tsd,
#endif
tsd->mtx = malloc(sizeof(curl_mutex_t));
if (tsd->mtx == NULL) goto err_exit;
if(tsd->mtx == NULL)
goto err_exit;
Curl_mutex_init(tsd->mtx);
@ -235,7 +236,8 @@ int init_thread_sync_data(struct thread_sync_data * tsd,
* thread during gethostbyname execution.
*/
tsd->hostname = strdup(hostname);
if (!tsd->hostname) goto err_exit;
if(!tsd->hostname)
goto err_exit;
return 1;
@ -428,11 +430,10 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
DEBUGASSERT(conn && td);
/* wait for the thread to resolve the name */
if (Curl_thread_join(&td->thread_hnd)) {
if(Curl_thread_join(&td->thread_hnd))
rc = getaddrinfo_complete(conn);
} else {
else
DEBUGASSERT(0);
}
conn->async.done = TRUE;
@ -445,7 +446,8 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
failf(data, "Could not resolve proxy: %s; %s",
conn->async.hostname, Curl_strerror(conn, conn->async.status));
rc = CURLE_COULDNT_RESOLVE_PROXY;
} else {
}
else {
failf(data, "Could not resolve host: %s; %s",
conn->async.hostname, Curl_strerror(conn, conn->async.status));
rc = CURLE_COULDNT_RESOLVE_HOST;
@ -493,7 +495,8 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
return CURLE_COULDNT_RESOLVE_HOST;
}
*entry = conn->async.dns;
} else {
}
else {
/* poll for name lookup done with exponential backoff up to 250ms */
int elapsed = Curl_tvdiff(Curl_tvnow(), data->progress.t_startsingle);
if(elapsed < 0)

View File

@ -82,8 +82,7 @@ int Curl_axtls_cleanup(void)
static CURLcode map_error_to_curl(int axtls_err)
{
switch (axtls_err)
{
switch (axtls_err) {
case SSL_ERROR_NOT_SUPPORTED:
case SSL_ERROR_INVALID_VERSION:
case -70: /* protocol version alert from server */

118
lib/checksrc.pl Executable file
View File

@ -0,0 +1,118 @@
#!/usr/bin/perl
my $file=$ARGV[0];
my $max_column = 79;
my $indent = 2;
sub checkwarn {
my ($num, $col, $file, $line, $msg, $error) = @_;
my $w=$error?"error":"warning";
$col++;
print "$file:$num:$col: $w: $msg\n";
print " $line\n";
if($col < 80) {
my $pref = (' ' x $col);
print "${pref}^\n";
}
}
if(!$file) {
print "checksrc.pl <single C or H file>\n";
exit;
}
my $line = 1;
open(R, "<$file") || die;
my $copyright=0;
while(<R>) {
chomp;
my $l = $_;
my $column = 0;
# check for a copyright statement
if(!$copyright && ($l =~ /copyright .* \d\d\d\d/i)) {
$copyright=1;
}
# detect long lines
if(length($l) > $max_column) {
checkwarn($line, length($l), $file, $l, "Longer than $max_column columns");
}
# detect TAB characters
if($l =~ /^(.*)\t/) {
checkwarn($line, length($1), $file, $l, "Contains TAB character", 1);
}
# detect trailing white space
if($l =~ /^(\S+)[ \t]+\z/) {
checkwarn($line, length($1), $file, $l, "Trailing whitespace");
}
# detect return statements with parenthesis
# doesn't really work unless we filter off typecasts
#if($l =~ /(.*)return \(/) {
# checkwarn($line, length($1)+6, $file, $l, "return with paretheses");
#}
# check spaces after for/if/while
if($l =~ /^(.*)(for|if|while) \(/) {
if($1 =~ / *\#/) {
# this is a #if, treat it differently
}
else {
checkwarn($line, length($1)+length($2), $file, $l,
"$2 with space");
}
}
# check for "} else"
if($l =~ /^(.*)\} else/) {
checkwarn($line, length($1), $file, $l, "else after closing brace on same line");
}
# check for open brace first on line but not first column
# only alert if previous line ended with a close paren and wasn't a cpp
# line
if((($prevl =~ /\)\z/) && ($prevl !~ /^ *#/)) && ($l =~ /^( +)\{/)) {
checkwarn($line, length($1), $file, $l, "badly placed open brace");
}
# if the previous line starts with if/while/for AND ends with an open
# brace, check that this line is indented $indent more steps, if not
# a cpp line
if($prevl =~ /^( *)(if|while|for)\(.*\{\z/) {
my $first = length($1);
# this line has some character besides spaces
if(($l !~ /^ *#/) && ($l =~ /^( *)[^ ]/)) {
my $second = length($1);
my $expect = $first+$indent;
if($expect != $second) {
my $diff = $second - $first;
checkwarn($line, length($1), $file, $l,
"not indented $indent steps, uses $diff)");
}
}
}
# check for // letters, but skip them if a double quote or asterisk was
# on the same line to avoid strings and comments. Not reliable.
#if($l =~ /^([^\"*]*)\/\//) {
# checkwarn($line, length($1), $file, $l, "non-C89 compliant comment",
# 1);
#}
$line++;
$prevl = $l;
}
if(!$copyright) {
checkwarn(1, 0, $file, "", "Missing copyright statement", 1);
}
close(R);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -84,7 +84,7 @@ Example set of cookies:
#include <stdlib.h>
#include <string.h>
#define _MPRINTF_REPLACE /* without this on windows OS we get undefined reference to snprintf */
#define _MPRINTF_REPLACE
#include <curl/mprintf.h>
#include "urldata.h"
@ -531,7 +531,7 @@ Curl_cookie_add(struct SessionHandle *data,
As far as I can see, it is set to true when the cookie says
.domain.com and to false when the domain is complete www.domain.com
*/
co->tailmatch=(bool)Curl_raw_equal(ptr, "TRUE"); /* store information */
co->tailmatch=(bool)Curl_raw_equal(ptr, "TRUE");
break;
case 2:
/* It turns out, that sometimes the file format allows the path

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -51,7 +51,7 @@ static CURLcode rtmp_setup(struct connectdata *conn);
static CURLcode rtmp_do(struct connectdata *conn, bool *done);
static CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature);
static CURLcode rtmp_connect(struct connectdata *conn, bool *done);
static CURLcode rtmp_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode rtmp_disconnect(struct connectdata *conn, bool dead);
static Curl_recv rtmp_recv;
static Curl_send rtmp_send;
@ -198,11 +198,13 @@ static CURLcode rtmp_connect(struct connectdata *conn, bool *done)
r->Link.protocol |= RTMP_FEATURE_WRITE;
/* For plain streams, use the buffer toggle trick to keep data flowing */
if (!(r->Link.lFlags & RTMP_LF_LIVE) && !(r->Link.protocol & RTMP_FEATURE_HTTP))
if(!(r->Link.lFlags & RTMP_LF_LIVE) &&
!(r->Link.protocol & RTMP_FEATURE_HTTP))
r->Link.lFlags |= RTMP_LF_BUFX;
curlx_nonblock(r->m_sb.sb_socket, FALSE);
setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv));
setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO,
(char *)&tv, sizeof(tv));
if(!RTMP_Connect1(r, NULL))
return CURLE_FAILED_INIT;
@ -226,7 +228,8 @@ static CURLcode rtmp_do(struct connectdata *conn, bool *done)
if(conn->data->set.upload) {
Curl_pgrsSetUploadSize(conn->data, conn->data->set.infilesize);
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, FIRSTSOCKET, NULL);
} else
}
else
Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, NULL, -1, NULL);
*done = TRUE;
return CURLE_OK;
@ -269,7 +272,8 @@ static ssize_t rtmp_recv(struct connectdata *conn, int sockindex, char *buf,
r->m_read.status == RTMP_READ_EOF) {
conn->data->req.size = conn->data->req.bytecount;
nread = 0;
} else
}
else
*err = CURLE_RECV_ERROR;
}
return nread;
@ -284,9 +288,9 @@ static ssize_t rtmp_send(struct connectdata *conn, int sockindex,
(void)sockindex; /* unused */
num = RTMP_Write(r, (char *)buf, len);
if (num < 0) {
if(num < 0)
*err = CURLE_SEND_ERROR;
}
return num;
}
#endif /* USE_LIBRTMP */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -95,7 +95,8 @@ int Curl_thread_join(curl_thread_t *hnd)
#elif defined(USE_THREADS_WIN32)
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*), void *arg)
curl_thread_t Curl_thread_create(unsigned int (CURL_STDCALL *func) (void*),
void *arg)
{
#ifdef _WIN32_WCE
return CreateThread(NULL, 0, func, arg, 0, NULL);

View File

@ -764,8 +764,8 @@ CURLcode curl_easy_pause(CURL *curl, int action)
k->keepon = newstate;
if(!(newstate & KEEP_RECV_PAUSE) && data->state.tempwrite) {
/* we have a buffer for sending that we now seem to be able to deliver since
the receive pausing is lifted! */
/* we have a buffer for sending that we now seem to be able to deliver
since the receive pausing is lifted! */
/* get the pointer, type and length in local copies since the function may
return PAUSE again and then we'll get a new copy allocted and stored in

View File

@ -98,10 +98,9 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
while(length--) {
in = *string;
if (Curl_isunreserved(in)) {
if(Curl_isunreserved(in))
/* just copy this */
ns[strindex++]=in;
}
else {
/* encode it */
newlen += 2; /* the size grows with two, since this'll become a %XX */

View File

@ -90,7 +90,8 @@
/* The last #include file should be: */
#include "memdebug.h"
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || defined(__SYMBIAN32__)
#if defined(WIN32) || defined(MSDOS) || defined(__EMX__) || \
defined(__SYMBIAN32__)
#define DOS_FILESYSTEM 1
#endif
@ -245,8 +246,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
actual_path = real_path;
if((actual_path[0] == '/') &&
actual_path[1] &&
(actual_path[2] == ':' || actual_path[2] == '|'))
{
(actual_path[2] == ':' || actual_path[2] == '|')) {
actual_path[2] = ':';
actual_path++;
}
@ -256,7 +256,7 @@ static CURLcode file_connect(struct connectdata *conn, bool *done)
if(actual_path[i] == '/')
actual_path[i] = '\\';
fd = open_readonly(actual_path, O_RDONLY|O_BINARY); /* no CR/LF translation */
fd = open_readonly(actual_path, O_RDONLY|O_BINARY);
file->path = actual_path;
#else
fd = open_readonly(real_path, O_RDONLY);

View File

@ -20,87 +20,6 @@
*
***************************************************************************/
/*
Debug the form generator stand-alone by compiling this source file with:
gcc -DHAVE_CONFIG_H -I../ -g -D_FORM_DEBUG -DCURLDEBUG -o formdata \
-I../include formdata.c strequal.c memdebug.c mprintf.c strerror.c
(depending on circumstances you may need further externals added)
run the 'formdata' executable the output should end with:
All Tests seem to have worked ...
and the following parts should be there:
Content-Disposition: form-data; name="simple_COPYCONTENTS"
value for simple COPYCONTENTS
Content-Disposition: form-data; name="COPYCONTENTS_+_CONTENTTYPE"
Content-Type: image/gif
value for COPYCONTENTS + CONTENTTYPE
Content-Disposition: form-data; name="PRNAME_+_NAMELENGTH_+_COPYNAME_+_CONTENTSLENGTH"
vlue for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH
(or you might see P^@RNAME and v^@lue at the start)
Content-Disposition: form-data; name="simple_PTRCONTENTS"
value for simple PTRCONTENTS
Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH"
vlue for PTRCONTENTS + CONTENTSLENGTH
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE"
Content-Type: application/octet-stream
vlue for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE
(or you might see v^@lue at the start)
Content-Disposition: form-data; name="FILE1_+_CONTENTTYPE"; filename="formdata.h"
Content-Type: text/html
...
Content-Disposition: form-data; name="FILE1_+_FILE2"
Content-Type: multipart/mixed, boundary=curlz1s0dkticx49MV1KGcYP5cvfSsz
...
Content-Disposition: attachment; filename="formdata.h"
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILE1_+_FILE2_+_FILE3"
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="formdata.h"
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="formdata.h"
Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="ARRAY: FILE1_+_FILE2_+_FILE3"
Content-Type: multipart/mixed, boundary=curlirkYPmPwu6FrJ1vJ1u1BmtIufh1
...
Content-Disposition: attachment; filename="formdata.h"
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="Makefile.b32"
Content-Type: application/octet-stream
...
Content-Disposition: attachment; filename="formdata.h"
Content-Type: application/octet-stream
...
Content-Disposition: form-data; name="FILECONTENT"
...
*/
#include "setup.h"
#include <curl/curl.h>
@ -382,7 +301,7 @@ static char *memdup(const char *src, size_t buffer_length)
* CURL_FORMADD_NULL if a null pointer was given for a char
* CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
* CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
* CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or an error)
* CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
* CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
* CURL_FORMADD_MEMORY if some allocation for string copying failed.
* CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
@ -1478,168 +1397,6 @@ char *Curl_formpostheader(void *formp, size_t *len)
return header;
}
#ifdef _FORM_DEBUG
int FormAddTest(const char * errormsg,
struct curl_httppost **httppost,
struct curl_httppost **last_post,
...)
{
int result;
va_list arg;
va_start(arg, last_post);
if((result = FormAdd(httppost, last_post, arg)))
fprintf (stderr, "ERROR doing FormAdd ret: %d action: %s\n", result,
errormsg);
va_end(arg);
return result;
}
int main(int argc, argv_item_t argv[])
{
char name1[] = "simple_COPYCONTENTS";
char name2[] = "COPYCONTENTS_+_CONTENTTYPE";
char name3[] = "PTRNAME_+_NAMELENGTH_+_COPYNAME_+_CONTENTSLENGTH";
char name4[] = "simple_PTRCONTENTS";
char name5[] = "PTRCONTENTS_+_CONTENTSLENGTH";
char name6[] = "PTRCONTENTS_+_CONTENTSLENGTH_+_CONTENTTYPE";
char name7[] = "FILE1_+_CONTENTTYPE";
char name8[] = "FILE1_+_FILE2";
char name9[] = "FILE1_+_FILE2_+_FILE3";
char name10[] = "ARRAY: FILE1_+_FILE2_+_FILE3";
char name11[] = "FILECONTENT";
char value1[] = "value for simple COPYCONTENTS";
char value2[] = "value for COPYCONTENTS + CONTENTTYPE";
char value3[] = "value for PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH";
char value4[] = "value for simple PTRCONTENTS";
char value5[] = "value for PTRCONTENTS + CONTENTSLENGTH";
char value6[] = "value for PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE";
char value7[] = "formdata.h";
char value8[] = "Makefile.b32";
char type2[] = "image/gif";
char type6[] = "text/plain";
char type7[] = "text/html";
int name3length = strlen(name3);
int value3length = strlen(value3);
int value5length = strlen(value5);
int value6length = strlen(value6);
int errors = 0;
CURLcode rc;
curl_off_t size;
size_t nread;
char buffer[4096];
struct curl_httppost *httppost=NULL;
struct curl_httppost *last_post=NULL;
struct curl_forms forms[4];
struct FormData *form;
struct Form formread;
(void) argc;
(void) argv;
Curl_srand(); /* Because we do not call curl_global_init() here. */
if(FormAddTest("simple COPYCONTENTS test", &httppost, &last_post,
CURLFORM_COPYNAME, name1, CURLFORM_COPYCONTENTS, value1,
CURLFORM_END))
++errors;
if(FormAddTest("COPYCONTENTS + CONTENTTYPE test", &httppost, &last_post,
CURLFORM_COPYNAME, name2, CURLFORM_COPYCONTENTS, value2,
CURLFORM_CONTENTTYPE, type2, CURLFORM_END))
++errors;
/* make null character at start to check that contentslength works
correctly */
name3[1] = '\0';
value3[1] = '\0';
if(FormAddTest("PTRNAME + NAMELENGTH + COPYNAME + CONTENTSLENGTH test",
&httppost, &last_post,
CURLFORM_PTRNAME, name3, CURLFORM_COPYCONTENTS, value3,
CURLFORM_CONTENTSLENGTH, value3length,
CURLFORM_NAMELENGTH, name3length, CURLFORM_END))
++errors;
if(FormAddTest("simple PTRCONTENTS test", &httppost, &last_post,
CURLFORM_COPYNAME, name4, CURLFORM_PTRCONTENTS, value4,
CURLFORM_END))
++errors;
/* make null character at start to check that contentslength works
correctly */
value5[1] = '\0';
if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH test", &httppost, &last_post,
CURLFORM_COPYNAME, name5, CURLFORM_PTRCONTENTS, value5,
CURLFORM_CONTENTSLENGTH, value5length, CURLFORM_END))
++errors;
/* make null character at start to check that contentslength works
correctly */
value6[1] = '\0';
if(FormAddTest("PTRCONTENTS + CONTENTSLENGTH + CONTENTTYPE test",
&httppost, &last_post,
CURLFORM_COPYNAME, name6, CURLFORM_PTRCONTENTS, value6,
CURLFORM_CONTENTSLENGTH, value6length,
CURLFORM_CONTENTTYPE, type6, CURLFORM_END))
++errors;
if(FormAddTest("FILE + CONTENTTYPE test", &httppost, &last_post,
CURLFORM_COPYNAME, name7, CURLFORM_FILE, value7,
CURLFORM_CONTENTTYPE, type7, CURLFORM_END))
++errors;
if(FormAddTest("FILE1 + FILE2 test", &httppost, &last_post,
CURLFORM_COPYNAME, name8, CURLFORM_FILE, value7,
CURLFORM_FILE, value8, CURLFORM_END))
++errors;
if(FormAddTest("FILE1 + FILE2 + FILE3 test", &httppost, &last_post,
CURLFORM_COPYNAME, name9, CURLFORM_FILE, value7,
CURLFORM_FILE, value8, CURLFORM_FILE, value7, CURLFORM_END))
++errors;
forms[0].option = CURLFORM_FILE;
forms[0].value = value7;
forms[1].option = CURLFORM_FILE;
forms[1].value = value8;
forms[2].option = CURLFORM_FILE;
forms[2].value = value7;
forms[3].option = CURLFORM_END;
if(FormAddTest("FILE1 + FILE2 + FILE3 ARRAY test", &httppost, &last_post,
CURLFORM_COPYNAME, name10, CURLFORM_ARRAY, forms,
CURLFORM_END))
++errors;
if(FormAddTest("FILECONTENT test", &httppost, &last_post,
CURLFORM_COPYNAME, name11, CURLFORM_FILECONTENT, value7,
CURLFORM_END))
++errors;
rc = Curl_getformdata(NULL, &form, httppost, NULL, &size);
if(rc != CURLE_OK) {
if(rc != CURLE_READ_ERROR) {
const char *errortext = curl_easy_strerror(rc);
fprintf(stdout, "\n==> Curl_getformdata error: %s\n", errortext);
}
return 0;
}
Curl_FormInit(&formread, form);
for(;;) {
nread = Curl_FormReader(buffer, 1, sizeof(buffer),
(FILE *)&formread);
if(nread < 1)
break;
fwrite(buffer, nread, 1, stdout);
}
fprintf(stdout, "size: ");
fprintf(stdout, "%" FORMAT_OFF_T, size);
fprintf(stdout, "\n");
if(errors)
fprintf(stdout, "\n==> %d Test(s) failed!\n", errors);
else
fprintf(stdout, "\nAll Tests seem to have worked (please check output)\n");
return 0;
}
#endif /* _FORM_DEBUG */
#else /* CURL_DISABLE_HTTP */
CURLFORMcode curl_formadd(struct curl_httppost **httppost,
struct curl_httppost **last_post,

View File

@ -765,13 +765,12 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
port_min = port_max = 0;
strcpy(addr, string_ftpport);
ip_end = NULL; /* this got no port ! */
} else
}
else
#endif
{
/* (ipv4|domain|interface):port(-range) */
strncpy(addr, string_ftpport, ip_end - ip_start );
}
}
else
/* ipv4|interface */
strcpy(addr, string_ftpport);
@ -823,8 +822,7 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
free(addr);
return CURLE_FTP_PORT_FAILED;
}
switch(sa->sa_family)
{
switch(sa->sa_family) {
#ifdef ENABLE_IPV6
case AF_INET6:
Curl_inet_ntop(sa->sa_family, &sa6->sin6_addr, hbuf, sizeof(hbuf));
@ -2171,7 +2169,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
150 ASCII data connection for /bin/ls (137.167.104.91,37445) (0 bytes).
D:
150 Opening ASCII mode data connection for /linux/fisk/kpanelrc (0.0.0.0,0) (545 bytes).
150 Opening ASCII mode data connection for [file] (0.0.0.0,0) (545 bytes)
E:
125 Data connection already open; Transfer starting. */
@ -3561,7 +3559,7 @@ static CURLcode init_wc_data(struct connectdata *conn)
/* backup old write_function */
ftp_tmp->backup.write_function = conn->data->set.fwrite_func;
/* parsing write function (callback included directly from ftplistparser.c) */
/* parsing write function */
conn->data->set.fwrite_func = Curl_ftp_parselist;
/* backup old file descriptor */
ftp_tmp->backup.file_descriptor = conn->data->set.out;

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -66,7 +66,7 @@ typedef enum {
FTP_STOR_TYPE, /* set type when about to STOR a file */
FTP_SIZE, /* get the remote file's size for head-like request */
FTP_RETR_SIZE, /* get the remote file's size for RETR */
FTP_STOR_SIZE, /* get the size for (resumed) STOR */
FTP_STOR_SIZE, /* get the size for STOR */
FTP_REST, /* when used to check if the server supports it in head-like */
FTP_RETR_REST, /* when asking for "resume" in for RETR */
FTP_PORT, /* generic state for PORT, LPRT and EPRT, check count1 */
@ -93,7 +93,8 @@ struct ftp_wc_tmpdata {
typedef enum {
FTPFILE_MULTICWD = 1, /* as defined by RFC1738 */
FTPFILE_NOCWD = 2, /* use SIZE / RETR / STOR on the full path */
FTPFILE_SINGLECWD = 3 /* make one CWD, then SIZE / RETR / STOR on the file */
FTPFILE_SINGLECWD = 3 /* make one CWD, then SIZE / RETR / STOR on the
file */
} curl_ftpfile;
typedef enum {
@ -147,7 +148,8 @@ struct ftp_conn {
ftpstate state; /* always use ftp.c:state() to change state! */
char * server_os; /* The target server operating system. */
curl_off_t known_filesize; /* file size is different from -1, if wildcard
LIST parsing was done and wc_statemach set it */
LIST parsing was done and wc_statemach set
it */
};
#endif /* HEADER_CURL_FTP_H */

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -329,7 +329,8 @@ static CURLcode ftp_pl_insert_finfo(struct connectdata *conn,
compare = Curl_fnmatch;
/* filter pattern-corresponding filenames */
if(compare(conn->data->set.fnmatch_data, wc->pattern, finfo->filename) == 0) {
if(compare(conn->data->set.fnmatch_data, wc->pattern,
finfo->filename) == 0) {
/* discard symlink which is containing multiple " -> " */
if((finfo->filetype == CURLFILETYPE_SYMLINK) && finfo->strings.target &&
(strstr(finfo->strings.target, " -> "))) {
@ -960,7 +961,8 @@ size_t Curl_ftp_parselist(char *buffer, size_t size, size_t nmemb,
}
else {
char *endptr;
finfo->size = curlx_strtoofft(finfo->b_data + parser->item_offset,
finfo->size = curlx_strtoofft(finfo->b_data +
parser->item_offset,
&endptr, 10);
if(!*endptr) {
if(finfo->size == CURL_OFF_T_MAX ||

View File

@ -357,7 +357,8 @@ gtls_connect_step1(struct connectdata *conn,
return CURLE_OUT_OF_MEMORY;
}
rc = gnutls_srp_set_client_credentials(conn->ssl[sockindex].srp_client_cred,
rc = gnutls_srp_set_client_credentials(conn->ssl[sockindex].
srp_client_cred,
data->set.ssl.username,
data->set.ssl.password);
if(rc != GNUTLS_E_SUCCESS) {
@ -447,7 +448,8 @@ gtls_connect_step1(struct connectdata *conn,
data->set.str[STRING_CERT],
data->set.str[STRING_KEY] ?
data->set.str[STRING_KEY] : data->set.str[STRING_CERT],
do_file_type(data->set.str[STRING_CERT_TYPE]) ) != GNUTLS_E_SUCCESS) {
do_file_type(data->set.str[STRING_CERT_TYPE]) ) !=
GNUTLS_E_SUCCESS) {
failf(data, "error reading X.509 key or certificate file");
return CURLE_SSL_CONNECT_ERROR;
}
@ -458,10 +460,10 @@ gtls_connect_step1(struct connectdata *conn,
if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {
rc = gnutls_credentials_set(session, GNUTLS_CRD_SRP,
conn->ssl[sockindex].srp_client_cred);
if (rc != GNUTLS_E_SUCCESS) {
if(rc != GNUTLS_E_SUCCESS)
failf(data, "gnutls_credentials_set() failed: %s", gnutls_strerror(rc));
}
} else
else
#endif
rc = gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
conn->ssl[sockindex].cred);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -59,7 +59,8 @@ Curl_HMAC_init(const HMAC_params * hashparams,
unsigned char b;
/* Create HMAC context. */
i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize + hashparams->hmac_resultlen;
i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize +
hashparams->hmac_resultlen;
ctxt = malloc(i);
if(!ctxt)
@ -114,7 +115,8 @@ int Curl_HMAC_final(HMAC_context * ctxt, unsigned char * result)
{
const HMAC_params * hashparams = ctxt->hmac_hash;
/* Do not get result if called with a null parameter: only release storage. */
/* Do not get result if called with a null parameter: only release
storage. */
if(!result)
result = (unsigned char *) ctxt->hmac_hashctxt2 +

View File

@ -88,8 +88,8 @@ static int get_pair(const char *str, char *value, char *content,
break;
case ',':
if(!starts_with_quote) {
/* this signals the end of the content if we didn't get a starting quote
and then we do "sloppy" parsing */
/* this signals the end of the content if we didn't get a starting
quote and then we do "sloppy" parsing */
c=0; /* the end */
continue;
}

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -100,7 +100,8 @@ get_gss_name(struct connectdata *conn, bool proxy, gss_name_t *server)
}
static void
log_gss_error(struct connectdata *conn, OM_uint32 error_status, const char *prefix)
log_gss_error(struct connectdata *conn, OM_uint32 error_status,
const char *prefix)
{
OM_uint32 maj_stat, min_stat;
OM_uint32 msg_ctx = 0;

View File

@ -165,7 +165,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
}
if(!input_token) {
/* first call in a new negotiation, we have to require credentials,
/* first call in a new negotation, we have to require credentials,
and allocate memory for the context */
neg_ctx->credentials = (CredHandle *)malloc(sizeof(CredHandle));

View File

@ -25,10 +25,6 @@
http://davenport.sourceforge.net/ntlm.html
http://www.innovation.ch/java/ntlm.html
Another implementation:
http://lxr.mozilla.org/mozilla/source/security/manager/ssl/src/nsNTLMAuthModule.cpp
*/
#ifndef CURL_DISABLE_HTTP
@ -889,7 +885,8 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
#endif
DEBUG_OUT({
fprintf(stderr, "**** TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ",
fprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x "
"0x%08.8x ",
LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM|
NTLMFLAG_REQUEST_TARGET|
NTLMFLAG_NEGOTIATE_NTLM_KEY|
@ -963,13 +960,16 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
type_3.pvBuffer = ntlmbuf;
type_3.cbBuffer = sizeof(ntlmbuf);
status = s_pSecFn->InitializeSecurityContextA(&ntlm->handle, &ntlm->c_handle,
status = s_pSecFn->InitializeSecurityContextA(&ntlm->handle,
&ntlm->c_handle,
(char *) host,
ISC_REQ_CONFIDENTIALITY |
ISC_REQ_REPLAY_DETECT |
ISC_REQ_CONNECTION,
0, SECURITY_NETWORK_DREP, &type_2_desc,
0, &ntlm->c_handle, &type_3_desc,
0, SECURITY_NETWORK_DREP,
&type_2_desc,
0, &ntlm->c_handle,
&type_3_desc,
&attrs, &tsDummy);
if(status != SEC_E_OK)

View File

@ -164,7 +164,8 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
if(CURLE_OK == result) {
/* Now send off the request */
result = Curl_add_buffer_send(req_buffer, conn,
result =
Curl_add_buffer_send(req_buffer, conn,
&data->info.request_size, 0, sockindex);
}
req_buffer = NULL;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -99,7 +99,7 @@ static CURLcode imap_do(struct connectdata *conn, bool *done);
static CURLcode imap_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode imap_connect(struct connectdata *conn, bool *done);
static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode imap_disconnect(struct connectdata *conn, bool dead);
static CURLcode imap_multi_statemach(struct connectdata *conn, bool *done);
static int imap_getsock(struct connectdata *conn,
curl_socket_t *socks,

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2009 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -33,7 +33,8 @@ typedef enum {
a connect */
IMAP_LOGIN,
IMAP_STARTTLS,
IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */
IMAP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
(multi mode only) */
IMAP_SELECT,
IMAP_FETCH,
IMAP_LOGOUT,
@ -48,7 +49,7 @@ struct imap_conn {
imapstate state; /* always use imap.c:state() to change state! */
int cmdid; /* id number/index */
const char *idstr; /* pointer to a string for which to wait for as id */
bool ssldone; /* is connect() over SSL done? only relevant in multi mode */
bool ssldone; /* connect() over SSL? only relevant in multi mode */
};
extern const struct Curl_handler Curl_handler_imap;

View File

@ -69,8 +69,7 @@ static char *inet_ntop4 (const unsigned char *src, char *dst, size_t size)
((int)((unsigned char)src[3])) & 0xff);
len = strlen(tmp);
if(len == 0 || len >= size)
{
if(len == 0 || len >= size) {
SET_ERRNO(ENOSPC);
return (NULL);
}
@ -113,17 +112,14 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
best.len = 0;
cur.len = 0;
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
if(words[i] == 0)
{
for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
if(words[i] == 0) {
if(cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
}
else if(cur.base != -1)
{
else if(cur.base != -1) {
if(best.base == -1 || cur.len > best.len)
best = cur;
cur.base = -1;
@ -133,16 +129,11 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
best = cur;
if(best.base != -1 && best.len < 2)
best.base = -1;
/* Format the result.
*/
/* Format the result. */
tp = tmp;
for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++)
{
/* Are we inside the best run of 0x00's?
*/
if(best.base != -1 && i >= best.base && i < (best.base + best.len))
{
for(i = 0; i < (IN6ADDRSZ / INT16SZ); i++) {
/* Are we inside the best run of 0x00's? */
if(best.base != -1 && i >= best.base && i < (best.base + best.len)) {
if(i == best.base)
*tp++ = ':';
continue;
@ -156,10 +147,8 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
/* Is this address an encapsulated IPv4?
*/
if(i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff)))
{
if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp)))
{
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if(!inet_ntop4(src+12, tp, sizeof(tmp) - (tp - tmp))) {
SET_ERRNO(ENOSPC);
return (NULL);
}
@ -177,8 +166,7 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
/* Check for overflow, copy, and we're done.
*/
if((size_t)(tp - tmp) > size)
{
if((size_t)(tp - tmp) > size) {
SET_ERRNO(ENOSPC);
return (NULL);
}

View File

@ -7,7 +7,7 @@
*
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* Copyright (c) 2004 - 2010 Daniel Stenberg
* Copyright (c) 2004 - 2011 Daniel Stenberg
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -47,7 +47,8 @@ extern struct Curl_sec_client_mech Curl_krb5_client_mech;
#endif
CURLcode Curl_krb_kauth(struct connectdata *conn);
int Curl_sec_read_msg (struct connectdata *conn, char *, enum protection_level);
int Curl_sec_read_msg (struct connectdata *conn, char *,
enum protection_level);
void Curl_sec_end (struct connectdata *);
CURLcode Curl_sec_login (struct connectdata *);
int Curl_sec_request_prot (struct connectdata *conn, const char *level);

View File

@ -157,7 +157,8 @@ krb5_encode(void *app_data, const void *from, int length, int level, void **to,
if(maj != GSS_S_COMPLETE)
return -1;
/* malloc a new buffer, in case gss_release_buffer doesn't work as expected */
/* malloc a new buffer, in case gss_release_buffer doesn't work as
expected */
*to = malloc(enc.length);
if(!*to)
return -1;
@ -222,7 +223,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
if(maj != GSS_S_COMPLETE) {
gss_release_name(&min, &gssname);
if(service == srv_host) {
Curl_failf(data, "Error importing service name %s", input_buffer.value);
Curl_failf(data, "Error importing service name %s",
input_buffer.value);
return AUTH_ERROR;
}
service = srv_host;

View File

@ -46,7 +46,8 @@
#ifdef CURL_LDAP_WIN /* Use Windows LDAP implementation. */
# include <winldap.h>
# ifndef LDAP_VENDOR_NAME
# error Your Platform SDK is NOT sufficient for LDAP support! Update your Platform SDK, or disable LDAP support!
# error Your Platform SDK is NOT sufficient for LDAP support! \
Update your Platform SDK, or disable LDAP support!
# else
# include <winber.h>
# endif
@ -255,9 +256,9 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
goto quit;
}
ldap_option = LDAPSSL_VERIFY_SERVER;
} else {
ldap_option = LDAPSSL_VERIFY_NONE;
}
else
ldap_option = LDAPSSL_VERIFY_NONE;
rc = ldapssl_set_verify_mode(ldap_option);
if(rc != LDAP_SUCCESS) {
failf(data, "LDAP local: ERROR setting cert verify mode: %s",
@ -277,7 +278,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
/* OpenLDAP SDK supports BASE64 files. */
if((data->set.str[STRING_CERT_TYPE]) &&
(!Curl_raw_equal(data->set.str[STRING_CERT_TYPE], "PEM"))) {
failf(data, "LDAP local: ERROR OpenLDAP does only support PEM cert-type!");
failf(data, "LDAP local: ERROR OpenLDAP only supports PEM cert-type!");
status = CURLE_SSL_CERTPROBLEM;
goto quit;
}
@ -295,9 +296,10 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
goto quit;
}
ldap_option = LDAP_OPT_X_TLS_DEMAND;
} else {
ldap_option = LDAP_OPT_X_TLS_NEVER;
}
else
ldap_option = LDAP_OPT_X_TLS_NEVER;
rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &ldap_option);
if(rc != LDAP_SUCCESS) {
failf(data, "LDAP local: ERROR setting cert verify mode: %s",
@ -339,7 +341,8 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
#endif
#endif
#endif /* CURL_LDAP_USE_SSL */
} else {
}
else {
server = ldap_init(conn->host.name, (int)conn->port);
if(server == NULL) {
failf(data, "LDAP local: Cannot connect to %s:%hu",
@ -379,8 +382,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
for(num = 0, entryIterator = ldap_first_entry(server, result);
entryIterator;
entryIterator = ldap_next_entry(server, entryIterator), num++)
{
entryIterator = ldap_next_entry(server, entryIterator), num++) {
BerElement *ber = NULL;
char *attribute; /*! suspicious that this isn't 'const' */
char *dn = ldap_get_dn(server, entryIterator);
@ -394,14 +396,11 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
for(attribute = ldap_first_attribute(server, entryIterator, &ber);
attribute;
attribute = ldap_next_attribute(server, entryIterator, ber))
{
attribute = ldap_next_attribute(server, entryIterator, ber)) {
BerValue **vals = ldap_get_values_len(server, entryIterator, attribute);
if(vals != NULL)
{
for (i = 0; (vals[i] != NULL); i++)
{
if(vals != NULL) {
for(i = 0; (vals[i] != NULL); i++) {
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *) attribute, 0);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)": ", 2);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -115,7 +115,8 @@ Curl_llist_remove(struct curl_llist *list, struct curl_llist_element *e,
list->tail = NULL;
else
e->next->prev = NULL;
} else {
}
else {
e->prev->next = e->next;
if(!e->next)
list->tail = e->prev;
@ -149,7 +150,8 @@ Curl_llist_count(struct curl_llist *list)
}
int Curl_llist_move(struct curl_llist *list, struct curl_llist_element *e,
struct curl_llist *to_list, struct curl_llist_element *to_e)
struct curl_llist *to_list,
struct curl_llist_element *to_e)
{
/* Remove element from list */
if(e == NULL || list->size == 0)

View File

@ -262,7 +262,8 @@ static void Encode(unsigned char *output, UINT4 *input, unsigned int len)
/* Decodes input (unsigned char) into output (UINT4). Assumes len is
a multiple of 4.
*/
static void Decode (UINT4 *output, const unsigned char *input, unsigned int len)
static void Decode (UINT4 *output, const unsigned char *input,
unsigned int len)
{
unsigned int i, j;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -8,7 +8,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -47,8 +47,10 @@ extern FILE *logfile;
/* memory functions */
CURL_EXTERN void *curl_domalloc(size_t size, int line, const char *source);
CURL_EXTERN void *curl_docalloc(size_t elements, size_t size, int line, const char *source);
CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line, const char *source);
CURL_EXTERN void *curl_docalloc(size_t elements, size_t size, int line,
const char *source);
CURL_EXTERN void *curl_dorealloc(void *ptr, size_t size, int line,
const char *source);
CURL_EXTERN void curl_dofree(void *ptr, int line, const char *source);
CURL_EXTERN char *curl_dostrdup(const char *str, int line, const char *source);
CURL_EXTERN void curl_memdebug(const char *logname);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1999 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1999 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -548,16 +548,14 @@ static long dprintf_Pass1(const char *format, va_stack_t *vto, char **endpos,
/* Read the arg list parameters into our data list */
for(i=0; i<max_param; i++) {
if((i + 1 < max_param) && (vto[i + 1].type == FORMAT_WIDTH))
{
if((i + 1 < max_param) && (vto[i + 1].type == FORMAT_WIDTH)) {
/* Width/precision arguments must be read before the main argument
* they are attached to
*/
vto[i + 1].data.num.as_signed = (mp_intmax_t)va_arg(arglist, int);
}
switch (vto[i].type)
{
switch (vto[i].type) {
case FORMAT_STRING:
vto[i].data.str = va_arg(arglist, char *);
break;
@ -1202,45 +1200,3 @@ int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)
{
return dprintf_formatf(whereto, fputc, format, ap_save);
}
#ifdef DPRINTF_DEBUG
int main()
{
char buffer[129];
char *ptr;
#ifdef HAVE_LONG_LONG_TYPE
LONG_LONG_TYPE one=99;
LONG_LONG_TYPE two=100;
LONG_LONG_TYPE test = 0x1000000000LL;
curl_mprintf("%lld %lld %lld\n", one, two, test);
#endif
curl_mprintf("%3d %5d\n", 10, 1998);
ptr=curl_maprintf("test this then baby %s%s%s%s%s%s %d %d %d loser baby get a kiss in yer face now!", "", "pretty long string pretty long string pretty long string pretty long string pretty long string", "/", "/", "/", "pretty long string", 1998, 1999, 2001);
puts(ptr);
memset(ptr, 55, strlen(ptr)+1);
free(ptr);
#if 1
curl_mprintf(buffer, "%s %s %d", "daniel", "stenberg", 19988);
puts(buffer);
curl_mfprintf(stderr, "%s %#08x\n", "dummy", 65);
printf("%s %#08x\n", "dummy", 65);
{
double tryout = 3.14156592;
curl_mprintf(buffer, "%.2g %G %f %e %E", tryout, tryout, tryout, tryout, tryout);
puts(buffer);
printf("%.2g %G %f %e %E\n", tryout, tryout, tryout, tryout, tryout);
}
#endif
return 0;
}
#endif

View File

@ -2746,7 +2746,8 @@ static CURLMcode add_closure(struct Curl_multi *multi,
else
multi->closure = n;
free(cl);
} else {
}
else {
if(cl->easy_handle == data)
add = FALSE;

View File

@ -180,7 +180,7 @@ CURLcode Curl_convert_from_network(struct SessionHandle *data,
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_from_network iconv call failed with errno %i: %s",
"Curl_convert_from_network iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}

View File

@ -282,9 +282,9 @@ static int is_file(const char *filename)
}
/* Return on heap allocated filename/nickname of a certificate. The returned
* string should be later deallocated using free(). *is_nickname is set to TRUE
* if the given string is treated as nickname; FALSE if the given string is
* treated as file name.
* string should be later deallocated using free(). *is_nickname is set to
* TRUE if the given string is treated as nickname; FALSE if the given string
* is treated as file name.
*/
static char *fmt_nickname(struct SessionHandle *data, enum dupstring cert_kind,
bool *is_nickname)
@ -662,7 +662,8 @@ static SECStatus BadCertHandler(void *arg, PRFileDesc *sock)
if(conn->data->set.ssl.verifyhost) {
failf(conn->data, "SSL: certificate subject name '%s' does not match "
"target host name '%s'", subject_cn, conn->host.dispname);
} else {
}
else {
result = SECSuccess;
infof(conn->data, "warning: SSL: certificate subject name '%s' does not "
"match target host name '%s'\n", subject_cn, conn->host.dispname);
@ -931,7 +932,8 @@ static CURLcode init_nss(struct SessionHandle *data)
}
else {
char *certpath =
PR_smprintf("%s%s", NSS_VersionCheck("3.12.0") ? "sql:" : "", cert_dir);
PR_smprintf("%s%s", NSS_VersionCheck("3.12.0") ? "sql:" : "",
cert_dir);
rv = NSS_Initialize(certpath, "", "", "", NSS_INIT_READONLY);
PR_smprintf_free(certpath);
}
@ -972,9 +974,10 @@ CURLcode Curl_nss_force_init(struct SessionHandle *data)
{
CURLcode rv;
if(!nss_initlock) {
failf(data, "unable to initialize NSS, curl_global_init() should have been "
failf(data,
"unable to initialize NSS, curl_global_init() should have been "
"called with CURL_GLOBAL_SSL or CURL_GLOBAL_ALL");
return CURLE_OUT_OF_MEMORY;
return CURLE_FAILED_INIT;
}
PR_Lock(nss_initlock);

View File

@ -55,7 +55,8 @@
#ifndef _LDAP_PVT_H
extern int ldap_pvt_url_scheme2proto(const char *);
extern int ldap_init_fd(ber_socket_t fd, int proto, const char *url, LDAP **ld);
extern int ldap_init_fd(ber_socket_t fd, int proto, const char *url,
LDAP **ld);
#endif
static CURLcode ldap_setup(struct connectdata *conn);
@ -63,7 +64,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done);
static CURLcode ldap_done(struct connectdata *conn, CURLcode, bool);
static CURLcode ldap_connect(struct connectdata *conn, bool *done);
static CURLcode ldap_connecting(struct connectdata *conn, bool *done);
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead);
static Curl_recv ldap_recv;
@ -238,7 +239,8 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
if(res)
return res;
li->ssldone = TRUE;
} else {
}
else {
res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone);
if(res)
return res;
@ -265,7 +267,8 @@ static CURLcode ldap_connecting(struct connectdata *conn, bool *done)
if(conn->handler->flags & PROTOPT_SSL) {
/* Is the SSL handshake complete yet? */
if(!li->ssldone) {
CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &li->ssldone);
CURLcode res = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET,
&li->ssldone);
if(res || !li->ssldone)
return res;
}
@ -295,7 +298,8 @@ retry:
binddn = conn->user;
passwd.bv_val = conn->passwd;
passwd.bv_len = strlen(passwd.bv_val);
} else {
}
else {
binddn = NULL;
passwd.bv_val = NULL;
passwd.bv_len = 0;
@ -468,11 +472,13 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
failf(data, "LDAP local: search ldap_parse_result %s",
ldap_err2string(rc));
*err = CURLE_LDAP_SEARCH_FAILED;
} else if (code && code != LDAP_SIZELIMIT_EXCEEDED) {
}
else if(code && code != LDAP_SIZELIMIT_EXCEEDED) {
failf(data, "LDAP remote: search failed %s %s", ldap_err2string(rc),
info ? info : "");
*err = CURLE_LDAP_SEARCH_FAILED;
} else {
}
else {
/* successful */
if(code == LDAP_SIZELIMIT_EXCEEDED)
infof(data, "There are more than %d entries\n", lr->nument);
@ -483,9 +489,9 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
lr->msgid = 0;
ldap_memfree(info);
break;
} else if (msgtype != LDAP_RES_SEARCH_ENTRY) {
continue;
}
else if(msgtype != LDAP_RES_SEARCH_ENTRY)
continue;
lr->nument++;
rc = ldap_get_dn_ber(li->ld, ent, &ber, &bv);
@ -515,16 +521,17 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
for(i=0; bvals[i].bv_val != NULL; i++) {
int binval = 0;
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)"\t", 1);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val, bv.bv_len);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)bv.bv_val,
bv.bv_len);
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)":", 1);
data->req.bytecount += bv.bv_len + 2;
if(!binary) {
/* check for leading or trailing whitespace */
if(ISSPACE(bvals[i].bv_val[0]) ||
ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1])) {
ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1]))
binval = 1;
} else {
else {
/* check for unprintable characters */
unsigned int j;
for(j=0; j<bvals[i].bv_len; j++)
@ -548,7 +555,8 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
free(val_b64);
data->req.bytecount += val_b64_sz;
}
} else {
}
else {
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)" ", 1);
Curl_client_write(conn, CLIENTWRITE_BODY, bvals[i].bv_val,
bvals[i].bv_len);

View File

@ -160,7 +160,8 @@ static const struct tzinfo tz[]= {
{"G", +7 * 60}, /* Golf */
{"H", +8 * 60}, /* Hotel */
{"I", +9 * 60}, /* India */
/* "J", Juliet is not used as a timezone, to indicate the observer's local time */
/* "J", Juliet is not used as a timezone, to indicate the observer's local
time */
{"K", +10 * 60}, /* Kilo */
{"L", +11 * 60}, /* Lima */
{"M", +12 * 60}, /* Mike */

View File

@ -431,8 +431,8 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
/* We got an excessive line without newlines and we need to deal
with it. We keep the first bytes of the line then we throw
away the rest. */
infof(data, "Excessive server response line length received, %zd bytes."
" Stripping\n", gotbytes);
infof(data, "Excessive server response line length received, "
"%zd bytes. Stripping\n", gotbytes);
restart = TRUE;
/* we keep 40 bytes since all our pingpong protocols are only
@ -440,9 +440,9 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
clipamount = 40;
}
else if(pp->nread_resp > BUFSIZE/2) {
/* We got a large chunk of data and there's potentially still trailing
data to take care of, so we put any such part in the "cache", clear
the buffer to make space and restart. */
/* We got a large chunk of data and there's potentially still
trailing data to take care of, so we put any such part in the
"cache", clear the buffer to make space and restart. */
clipamount = perline;
restart = TRUE;
}

View File

@ -106,9 +106,9 @@ Curl_polarssl_connect(struct connectdata *conn,
if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) {
failf(data, "PolarSSL does not support SSLv2");
return CURLE_SSL_CONNECT_ERROR;
} else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3) {
sni = FALSE; /* SSLv3 has no SNI */
}
else if(data->set.ssl.version == CURL_SSLVERSION_SSLv3)
sni = FALSE; /* SSLv3 has no SNI */
havege_init(&conn->ssl[sockindex].hs);
@ -222,12 +222,13 @@ Curl_polarssl_connect(struct connectdata *conn,
#endif
for(;;) {
if (!(ret = ssl_handshake(&conn->ssl[sockindex].ssl))) {
if(!(ret = ssl_handshake(&conn->ssl[sockindex].ssl)))
break;
} else if(ret != POLARSSL_ERR_NET_TRY_AGAIN) {
else if(ret != POLARSSL_ERR_NET_TRY_AGAIN) {
failf(data, "ssl_handshake returned -0x%04X", -ret);
return CURLE_SSL_CONNECT_ERROR;
} else {
}
else {
/* wait for data from server... */
long timeout_ms = Curl_timeleft(data, NULL, TRUE);

View File

@ -100,7 +100,7 @@ static CURLcode pop3_do(struct connectdata *conn, bool *done);
static CURLcode pop3_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode pop3_connect(struct connectdata *conn, bool *done);
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead);
static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done);
static int pop3_getsock(struct connectdata *conn,
curl_socket_t *socks,

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -369,8 +369,10 @@ int Curl_pgrsUpdate(struct connectdata *conn)
data->state.resume_from);
}
fprintf(data->set.err,
" %% Total %% Received %% Xferd Average Speed Time Time Time Current\n"
" Dload Upload Total Spent Left Speed\n");
" %% Total %% Received %% Xferd Average Speed "
"Time Time Time Current\n"
" Dload Upload "
"Total Spent Left Speed\n");
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
}

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -29,7 +29,8 @@
* to be locale independent and only compare strings we know are safe for
* this.
*
* The function is capable of comparing a-z case insensitively even for non-ascii.
* The function is capable of comparing a-z case insensitively even for
* non-ascii.
*/
int Curl_raw_equal(const char *first, const char *second);
int Curl_raw_nequal(const char *first, const char *second, size_t max);

View File

@ -180,7 +180,8 @@ CURLcode Curl_rtsp_done(struct connectdata *conn,
CSeq_sent = rtsp->CSeq_sent;
CSeq_recv = rtsp->CSeq_recv;
if((data->set.rtspreq != RTSPREQ_RECEIVE) && (CSeq_sent != CSeq_recv)) {
failf(data, "The CSeq of this request %ld did not match the response %ld",
failf(data,
"The CSeq of this request %ld did not match the response %ld",
CSeq_sent, CSeq_recv);
return CURLE_RTSP_CSEQ_ERROR;
}
@ -511,7 +512,8 @@ CURLcode Curl_rtsp(struct connectdata *conn, bool *done)
}
data->state.expect100header = FALSE; /* RTSP posts are simple/small */
} else if(rtspreq == RTSPREQ_GET_PARAMETER) {
}
else if(rtspreq == RTSPREQ_GET_PARAMETER) {
/* Check for an empty GET_PARAMETER (heartbeat) request */
data->set.httpreq = HTTPREQ_HEAD;
data->set.opt_no_body = TRUE;

View File

@ -10,7 +10,7 @@
* Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
*
* Copyright (C) 2001 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2001 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* All rights reserved.
*
@ -522,7 +522,7 @@ static CURLcode choose_mech(struct connectdata *conn)
break;
default:
if(ret/100 == 5) {
infof(data, "The server does not support the security extensions.\n");
infof(data, "server does not support the security extensions\n");
return CURLE_USE_SSL_FAILED;
}
break;

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -299,7 +299,8 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
/* this is just a case of EWOULDBLOCK */
bytes_written=0;
*code = CURLE_AGAIN;
} else {
}
else {
failf(conn->data, "Send failure: %s",
Curl_strerror(conn, err));
conn->data->state.os_errno = err;
@ -354,7 +355,8 @@ ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf,
) {
/* this is just a case of EWOULDBLOCK */
*code = CURLE_AGAIN;
} else {
}
else {
failf(conn->data, "Recv failure: %s",
Curl_strerror(conn, err));
conn->data->state.os_errno = err;

View File

@ -26,7 +26,8 @@
* Define WIN32 when build target is Win32 API
*/
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && !defined(__SYMBIAN32__)
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) && \
!defined(__SYMBIAN32__)
#define WIN32
#endif
@ -523,7 +524,8 @@
#if defined(_MSC_VER) && !defined(__POCC__)
# if !defined(HAVE_WINDOWS_H) || ((_MSC_VER < 1300) && !defined(_FILETIME_))
# if !defined(ALLOW_MSVC6_WITHOUT_PSDK)
# error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. "Windows Server 2003 PSDK"
# error MSVC 6.0 requires "February 2003 Platform SDK" a.k.a. \
"Windows Server 2003 PSDK"
# else
# define CURL_DISABLE_LDAP 1
# endif
@ -551,7 +553,9 @@ int netware_init(void);
#define LIBIDN_REQUIRED_VERSION "0.4.1"
#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || defined(USE_QSOSSL) || defined(USE_POLARSSL) || defined(USE_AXTLS) || defined(USE_CYASSL)
#if defined(USE_GNUTLS) || defined(USE_SSLEAY) || defined(USE_NSS) || \
defined(USE_QSOSSL) || defined(USE_POLARSSL) || defined(USE_AXTLS) || \
defined(USE_CYASSL)
#define USE_SSL /* SSL support has been enabled */
#endif
@ -560,7 +564,8 @@ int netware_init(void);
#endif
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_NTLM)
#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || defined(USE_GNUTLS) || defined(USE_NSS)
#if defined(USE_SSLEAY) || defined(USE_WINDOWS_SSPI) || \
defined(USE_GNUTLS) || defined(USE_NSS)
#define USE_NTLM
#endif
#endif

View File

@ -96,8 +96,7 @@ curl_share_setopt(CURLSH *sh, CURLSHoption option, ...)
/* this is a type this share will no longer share */
type = va_arg(param, int);
share->specifier &= ~(1<<type);
switch( type )
{
switch( type ) {
case CURL_LOCK_DATA_DNS:
if(share->hostcache) {
Curl_hash_destroy(share->hostcache);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -106,7 +106,7 @@ static CURLcode smtp_do(struct connectdata *conn, bool *done);
static CURLcode smtp_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode smtp_connect(struct connectdata *conn, bool *done);
static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode smtp_disconnect(struct connectdata *conn, bool dead);
static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done);
static int smtp_getsock(struct connectdata *conn,
curl_socket_t *socks,
@ -359,7 +359,8 @@ static size_t smtp_auth_plain_data(struct connectdata * conn, char * * outptr)
memcpy(plainauth + ulen + 1, conn->user, ulen);
plainauth[2 * ulen + 1] = '\0';
memcpy(plainauth + 2 * ulen + 2, conn->passwd, plen);
return Curl_base64_encode(conn->data, plainauth, 2 * ulen + plen + 2, outptr);
return Curl_base64_encode(conn->data, plainauth, 2 * ulen + plen + 2,
outptr);
}
static size_t smtp_auth_login_user(struct connectdata * conn, char * * outptr)
@ -740,7 +741,8 @@ static CURLcode smtp_state_authcram_resp(struct connectdata *conn,
/* Prepare the reply. */
snprintf(reply, sizeof reply,
"%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
conn->user, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5],
conn->user, digest[0], digest[1], digest[2], digest[3], digest[4],
digest[5],
digest[6], digest[7], digest[8], digest[9], digest[10], digest[11],
digest[12], digest[13], digest[14], digest[15]);
@ -1217,7 +1219,8 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
result = status; /* use the already set error code */
}
else
/* TODO: make this work even when the socket is EWOULDBLOCK in this call! */
/* TODO: make this work even when the socket is EWOULDBLOCK in this
call! */
/* write to socket (send away data) */
result = Curl_write(conn,

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2009 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 2009 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -34,7 +34,8 @@ typedef enum {
SMTP_EHLO,
SMTP_HELO,
SMTP_STARTTLS,
SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS (multi mode only) */
SMTP_UPGRADETLS, /* asynchronously upgrade the connection to SSL/TLS
(multi mode only) */
SMTP_AUTHPLAIN,
SMTP_AUTHLOGIN,
SMTP_AUTHPASSWD,

View File

@ -296,8 +296,7 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
}
/* Result */
switch(socksreq[1])
{
switch(socksreq[1]) {
case 90:
if(protocol4a)
infof(data, "SOCKS4a request granted.\n");
@ -391,8 +390,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
ssize_t packetsize = 0;
/* RFC1928 chapter 5 specifies max 255 chars for domain name in packet */
if(!socks5_resolve_local && hostname_len > 255)
{
if(!socks5_resolve_local && hostname_len > 255) {
infof(conn->data,"SOCKS5: server resolving disabled for hostnames of "
"length > 255 [actual len=%zu]\n", hostname_len);
socks5_resolve_local = TRUE;
@ -643,9 +641,11 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
if(conn->socks5_gssapi_enctype) {
failf(data, "SOCKS5 gssapi protection not yet implemented.");
} else
}
else
#endif
code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize, &written);
code = Curl_write_plain(conn, sock, (char *)socksreq, packetsize,
&written);
if((code != CURLE_OK) || (written != packetsize)) {
failf(data, "Failed to send SOCKS5 connect request.");
return CURLE_COULDNT_CONNECT;
@ -656,7 +656,8 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
if(conn->socks5_gssapi_enctype) {
failf(data, "SOCKS5 gssapi protection not yet implemented.");
} else
}
else
#endif
result = Curl_blockread_all(conn, sock, (char *)socksreq, packetsize,
&actualread, timeout);

View File

@ -438,7 +438,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
gss_delete_sec_context(&gss_status, &gss_context, NULL);
return CURLE_COULDNT_CONNECT;
}
} else {
}
else {
code = Curl_write_plain(conn, sock, (char *)gss_w_token.value,
gss_w_token.length, &written);
if((code != CURLE_OK) || ((ssize_t)gss_w_token.length != written)) {

View File

@ -234,7 +234,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
cred_handle.dwLower = 0;
cred_handle.dwUpper = 0;
sspi_major_status = s_pSecFn->AcquireCredentialsHandleA( NULL,
sspi_major_status =
s_pSecFn->AcquireCredentialsHandleA( NULL,
(char *)"Kerberos",
SECPKG_CRED_OUTBOUND,
NULL,
@ -408,7 +409,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
service_name=NULL;
/* Everything is good so far, user was authenticated! */
sspi_major_status = s_pSecFn->QueryCredentialsAttributes( &cred_handle,
sspi_major_status =
s_pSecFn->QueryCredentialsAttributes( &cred_handle,
SECPKG_CRED_ATTR_NAMES,
&names);
s_pSecFn->FreeCredentialsHandle(&cred_handle);
@ -576,7 +578,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
s_pSecFn->DeleteSecurityContext(&sspi_context);
return CURLE_COULDNT_CONNECT;
}
} else {
}
else {
code = Curl_write_plain(conn, sock, (char *)sspi_send_token.pvBuffer,
sspi_send_token.cbBuffer, &written);
if((code != CURLE_OK) || (sspi_send_token.cbBuffer != (size_t)written)) {
@ -666,7 +669,8 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
memcpy(socksreq,sspi_w_token[1].pvBuffer,sspi_w_token[1].cbBuffer);
s_pSecFn->FreeContextBuffer(sspi_w_token[0].pvBuffer);
s_pSecFn->FreeContextBuffer(sspi_w_token[1].pvBuffer);
} else {
}
else {
if(sspi_w_token[0].cbBuffer != 1) {
failf(data, "Invalid SSPI encryption response length (%d).",
sspi_w_token[0].cbBuffer);

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1997 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1997 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -98,7 +98,7 @@ struct Curl_tree *Curl_splayinsert(struct timeval i,
struct Curl_tree *t,
struct Curl_tree *node)
{
static struct timeval KEY_NOTUSED = {-1,-1}; /* key that will *NEVER* appear */
static struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */
if(node == NULL)
return t;
@ -268,7 +268,7 @@ int Curl_splayremovebyaddr(struct Curl_tree *t,
struct Curl_tree *removenode,
struct Curl_tree **newroot)
{
static struct timeval KEY_NOTUSED = {-1,-1}; /* key that will *NEVER* appear */
static struct timeval KEY_NOTUSED = {-1,-1}; /* will *NEVER* appear */
struct Curl_tree *x;
if(!t || !removenode)
@ -350,7 +350,8 @@ void Curl_splayprint(struct Curl_tree * t, int d, char output)
#ifdef TEST_SPLAY
fprintf(stderr, "%ld[%d]", (long)t->key.tv_usec, i);
#else
fprintf(stderr, "%ld.%ld[%d]", (long)t->key.tv_sec, (long)t->key.tv_usec, i);
fprintf(stderr, "%ld.%ld[%d]", (long)t->key.tv_sec,
(long)t->key.tv_usec, i);
#endif
}

View File

@ -139,7 +139,7 @@ static CURLcode sftp_done(struct connectdata *conn,
CURLcode, bool premature);
static CURLcode sftp_doing(struct connectdata *conn,
bool *dophase_done);
static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode sftp_disconnect(struct connectdata *conn, bool dead);
static
CURLcode sftp_perform(struct connectdata *conn,
bool *connected,
@ -567,9 +567,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
/* The fingerprint points to static storage (!), don't free() it. */
infof(data, "Fingerprint: ");
for (rc = 0; rc < 16; rc++) {
for(rc = 0; rc < 16; rc++)
infof(data, "%02X ", (unsigned char) fingerprint[rc]);
}
infof(data, "\n");
#endif /* CURL_LIBSSH2_DEBUG */
@ -2521,12 +2520,10 @@ static CURLcode ssh_easy_statemach(struct connectdata *conn,
curl_socket_t sock = conn->sock[FIRSTSOCKET];
curl_socket_t fd_read = CURL_SOCKET_BAD;
curl_socket_t fd_write = CURL_SOCKET_BAD;
if (LIBSSH2_SESSION_BLOCK_INBOUND & dir) {
if(LIBSSH2_SESSION_BLOCK_INBOUND & dir)
fd_read = sock;
}
if (LIBSSH2_SESSION_BLOCK_OUTBOUND & dir) {
if(LIBSSH2_SESSION_BLOCK_OUTBOUND & dir)
fd_write = sock;
}
/* wait for the socket to become ready */
Curl_socket_ready(fd_read, fd_write,
(int)(left>1000?1000:left)); /* ignore result */
@ -2594,7 +2591,8 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
if(conn->handler->protocol & CURLPROTO_SCP) {
conn->recv[FIRSTSOCKET] = scp_recv;
conn->send[FIRSTSOCKET] = scp_send;
} else {
}
else {
conn->recv[FIRSTSOCKET] = sftp_recv;
conn->send[FIRSTSOCKET] = sftp_send;
}

View File

@ -788,10 +788,12 @@ CURLcode Curl_ossl_set_engine_default(struct SessionHandle *data)
#ifdef HAVE_OPENSSL_ENGINE_H
if(data->state.engine) {
if(ENGINE_set_default(data->state.engine, ENGINE_METHOD_ALL) > 0) {
infof(data,"set default crypto engine '%s'\n", ENGINE_get_id(data->state.engine));
infof(data,"set default crypto engine '%s'\n",
ENGINE_get_id(data->state.engine));
}
else {
failf(data, "set default crypto engine '%s' failed", ENGINE_get_id(data->state.engine));
failf(data, "set default crypto engine '%s' failed",
ENGINE_get_id(data->state.engine));
return CURLE_SSL_ENGINE_SETFAILED;
}
}
@ -1442,7 +1444,8 @@ ossl_connect_step1(struct connectdata *conn,
if(data->set.ssl.authtype == CURL_TLSAUTH_SRP) {
infof(data, "Set version TLSv1 for SRP authorisation\n");
req_method = TLSv1_client_method() ;
} else
}
else
#endif
/* we try to figure out version */
req_method = SSLv23_client_method();
@ -1960,7 +1963,8 @@ static int X509V3_ext(struct SessionHandle *data,
while((biomem->data[j] == ' ') && (j<(size_t)biomem->length))
j++;
if(j<(size_t)biomem->length)
ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, biomem->data[j]);
ptr+=snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep,
biomem->data[j]);
}
infof(data, " %s\n", buf);
@ -2273,7 +2277,8 @@ static CURLcode servercert(struct connectdata *conn,
/* e.g. match issuer name with provided issuer certificate */
if(data->set.str[STRING_SSL_ISSUERCERT]) {
if (! (fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r"))) {
fp=fopen(data->set.str[STRING_SSL_ISSUERCERT],"r");
if(!fp) {
if(strict)
failf(data, "SSL: Unable to open issuer cert (%s)\n",
data->set.str[STRING_SSL_ISSUERCERT]);

View File

@ -29,7 +29,7 @@
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
(defined(HAVE_GLIBC_STRERROR_R) && defined(HAVE_VXWORKS_STRERROR_R)) || \
(defined(HAVE_POSIX_STRERROR_R) && defined(HAVE_GLIBC_STRERROR_R))
# error "strerror_r MUST be either POSIX-style, glibc-style or vxworks-style"
# error "strerror_r MUST be either POSIX, glibc or vxworks-style"
# endif
#endif
@ -205,7 +205,8 @@ curl_easy_strerror(CURLcode error)
return "Couldn't use specified SSL cipher";
case CURLE_SSL_CACERT:
return "Peer certificate cannot be authenticated with known CA certificates";
return "Peer certificate cannot be authenticated with given CA "
"certificates";
case CURLE_SSL_CACERT_BADFILE:
return "Problem with the SSL CA cert (path? access rights?)";

View File

@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms

View File

@ -271,8 +271,7 @@ static void negotiate(struct connectdata *conn)
int i;
struct TELNET *tn = (struct TELNET *) conn->data->state.proto.telnet;
for(i = 0;i < CURL_NTELOPTS;i++)
{
for(i = 0;i < CURL_NTELOPTS;i++) {
if(tn->us_preferred[i] == CURL_YES)
set_local_option(conn, i, CURL_YES);
@ -288,21 +287,17 @@ static void printoption(struct SessionHandle *data,
const char *fmt;
const char *opt;
if(data->set.verbose)
{
if(cmd == CURL_IAC)
{
if(data->set.verbose) {
if(cmd == CURL_IAC) {
if(CURL_TELCMD_OK(option))
infof(data, "%s IAC %s\n", direction, CURL_TELCMD(option));
else
infof(data, "%s IAC %d\n", direction, option);
}
else
{
else {
fmt = (cmd == CURL_WILL) ? "WILL" : (cmd == CURL_WONT) ? "WONT" :
(cmd == CURL_DO) ? "DO" : (cmd == CURL_DONT) ? "DONT" : 0;
if(fmt)
{
if(fmt) {
if(CURL_TELOPT_OK(option))
opt = CURL_TELOPT(option);
else if(option == CURL_TELOPT_EXOPL)
@ -346,10 +341,8 @@ static
void set_remote_option(struct connectdata *conn, int option, int newstate)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
if(newstate == CURL_YES)
{
switch(tn->him[option])
{
if(newstate == CURL_YES) {
switch(tn->him[option]) {
case CURL_NO:
tn->him[option] = CURL_WANTYES;
send_negotiation(conn, CURL_DO, option);
@ -360,8 +353,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTNO:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
/* Already negotiating for CURL_YES, queue the request */
tn->himq[option] = CURL_OPPOSITE;
@ -373,8 +365,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTYES:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
/* Error: already negotiating for enable */
break;
@ -385,10 +376,8 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
}
}
else /* NO */
{
switch(tn->him[option])
{
else { /* NO */
switch(tn->him[option]) {
case CURL_NO:
/* Already disabled */
break;
@ -399,8 +388,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTNO:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
/* Already negotiating for NO */
break;
@ -411,8 +399,7 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTYES:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
tn->himq[option] = CURL_OPPOSITE;
break;
@ -428,18 +415,15 @@ static
void rec_will(struct connectdata *conn, int option)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
switch(tn->him[option])
{
switch(tn->him[option]) {
case CURL_NO:
if(tn->him_preferred[option] == CURL_YES)
{
if(tn->him_preferred[option] == CURL_YES) {
tn->him[option] = CURL_YES;
send_negotiation(conn, CURL_DO, option);
}
else
{
send_negotiation(conn, CURL_DONT, option);
}
break;
case CURL_YES:
@ -447,8 +431,7 @@ void rec_will(struct connectdata *conn, int option)
break;
case CURL_WANTNO:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
/* Error: DONT answered by WILL */
tn->him[option] = CURL_NO;
@ -462,8 +445,7 @@ void rec_will(struct connectdata *conn, int option)
break;
case CURL_WANTYES:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
tn->him[option] = CURL_YES;
break;
@ -481,8 +463,7 @@ static
void rec_wont(struct connectdata *conn, int option)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
switch(tn->him[option])
{
switch(tn->him[option]) {
case CURL_NO:
/* Already disabled */
break;
@ -493,8 +474,7 @@ void rec_wont(struct connectdata *conn, int option)
break;
case CURL_WANTNO:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
tn->him[option] = CURL_NO;
break;
@ -508,8 +488,7 @@ void rec_wont(struct connectdata *conn, int option)
break;
case CURL_WANTYES:
switch(tn->himq[option])
{
switch(tn->himq[option]) {
case CURL_EMPTY:
tn->him[option] = CURL_NO;
break;
@ -526,10 +505,8 @@ static void
set_local_option(struct connectdata *conn, int option, int newstate)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
if(newstate == CURL_YES)
{
switch(tn->us[option])
{
if(newstate == CURL_YES) {
switch(tn->us[option]) {
case CURL_NO:
tn->us[option] = CURL_WANTYES;
send_negotiation(conn, CURL_WILL, option);
@ -540,8 +517,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTNO:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
/* Already negotiating for CURL_YES, queue the request */
tn->usq[option] = CURL_OPPOSITE;
@ -553,8 +529,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTYES:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
/* Error: already negotiating for enable */
break;
@ -565,10 +540,8 @@ set_local_option(struct connectdata *conn, int option, int newstate)
break;
}
}
else /* NO */
{
switch(tn->us[option])
{
else { /* NO */
switch(tn->us[option]) {
case CURL_NO:
/* Already disabled */
break;
@ -579,8 +552,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTNO:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
/* Already negotiating for NO */
break;
@ -591,8 +563,7 @@ set_local_option(struct connectdata *conn, int option, int newstate)
break;
case CURL_WANTYES:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
tn->usq[option] = CURL_OPPOSITE;
break;
@ -608,18 +579,14 @@ static
void rec_do(struct connectdata *conn, int option)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
switch(tn->us[option])
{
switch(tn->us[option]) {
case CURL_NO:
if(tn->us_preferred[option] == CURL_YES)
{
if(tn->us_preferred[option] == CURL_YES) {
tn->us[option] = CURL_YES;
send_negotiation(conn, CURL_WILL, option);
}
else
{
send_negotiation(conn, CURL_WONT, option);
}
break;
case CURL_YES:
@ -627,8 +594,7 @@ void rec_do(struct connectdata *conn, int option)
break;
case CURL_WANTNO:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
/* Error: DONT answered by WILL */
tn->us[option] = CURL_NO;
@ -642,8 +608,7 @@ void rec_do(struct connectdata *conn, int option)
break;
case CURL_WANTYES:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
tn->us[option] = CURL_YES;
break;
@ -661,8 +626,7 @@ static
void rec_dont(struct connectdata *conn, int option)
{
struct TELNET *tn = (struct TELNET *)conn->data->state.proto.telnet;
switch(tn->us[option])
{
switch(tn->us[option]) {
case CURL_NO:
/* Already disabled */
break;
@ -673,8 +637,7 @@ void rec_dont(struct connectdata *conn, int option)
break;
case CURL_WANTNO:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
tn->us[option] = CURL_NO;
break;
@ -688,8 +651,7 @@ void rec_dont(struct connectdata *conn, int option)
break;
case CURL_WANTYES:
switch(tn->usq[option])
{
switch(tn->usq[option]) {
case CURL_EMPTY:
tn->us[option] = CURL_NO;
break;
@ -710,20 +672,16 @@ static void printsub(struct SessionHandle *data,
{
unsigned int i = 0;
if(data->set.verbose)
{
if(direction)
{
if(data->set.verbose) {
if(direction) {
infof(data, "%s IAC SB ", (direction == '<')? "RCVD":"SENT");
if(length >= 3)
{
if(length >= 3) {
int j;
i = pointer[length-2];
j = pointer[length-1];
if(i != CURL_IAC || j != CURL_SE)
{
if(i != CURL_IAC || j != CURL_SE) {
infof(data, "(terminated by ");
if(CURL_TELOPT_OK(i))
infof(data, "%s ", CURL_TELOPT(i));
@ -742,8 +700,7 @@ static void printsub(struct SessionHandle *data,
}
length -= 2;
}
if(length < 1)
{
if(length < 1) {
infof(data, "(Empty suboption?)");
return;
}
@ -809,11 +766,9 @@ static void printsub(struct SessionHandle *data,
}
if(direction)
{
infof(data, "\n");
}
}
}
static CURLcode check_telnet_options(struct connectdata *conn)
{
@ -826,8 +781,7 @@ static CURLcode check_telnet_options(struct connectdata *conn)
/* Add the user name as an environment variable if it
was given on the command line */
if(conn->bits.user_passwd)
{
if(conn->bits.user_passwd) {
snprintf(option_arg, sizeof(option_arg), "USER,%s", conn->user);
tn->telnet_vars = curl_slist_append(tn->telnet_vars, option_arg);
@ -866,7 +820,8 @@ static CURLcode check_telnet_options(struct connectdata *conn)
failf(data, "Unknown telnet option %s", head->data);
return CURLE_UNKNOWN_TELNET_OPTION;
} else {
}
else {
failf(data, "Syntax error in telnet option: %s", head->data);
return CURLE_TELNET_OPTION_SYNTAX;
}
@ -981,17 +936,13 @@ CURLcode telrcv(struct connectdata *conn,
#define bufferflush() startskipping()
while(count--)
{
while(count--) {
c = inbuf[in];
/*infof(data,"In rcv state %d char %d\n", tn->telrcv_state, c);*/
switch (tn->telrcv_state)
{
switch (tn->telrcv_state) {
case CURL_TS_CR:
tn->telrcv_state = CURL_TS_DATA;
if(c == '\0')
{
if(c == '\0') {
startskipping();
break; /* Ignore \0 after CR */
}
@ -999,24 +950,20 @@ CURLcode telrcv(struct connectdata *conn,
break;
case CURL_TS_DATA:
if(c == CURL_IAC)
{
if(c == CURL_IAC) {
tn->telrcv_state = CURL_TS_IAC;
startskipping();
break;
}
else if(c == '\r')
{
tn->telrcv_state = CURL_TS_CR;
}
writebyte();
break;
case CURL_TS_IAC:
process_iac:
DEBUGASSERT(startwrite < 0);
switch (c)
{
switch (c) {
case CURL_WILL:
tn->telrcv_state = CURL_TS_WILL;
break;
@ -1077,20 +1024,14 @@ CURLcode telrcv(struct connectdata *conn,
case CURL_TS_SB:
if(c == CURL_IAC)
{
tn->telrcv_state = CURL_TS_SE;
}
else
{
CURL_SB_ACCUM(tn,c);
}
break;
case CURL_TS_SE:
if(c != CURL_SE)
{
if(c != CURL_IAC)
{
if(c != CURL_SE) {
if(c != CURL_IAC) {
/*
* This is an error. We only expect to get "IAC IAC" or "IAC SE".
* Several things may have happened. An IAC was not doubled, the
@ -1304,7 +1245,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
objs[1] = stdin_handle;
/* Tell winsock what events we want to listen to */
if(event_select_func(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) {
if(event_select_func(sockfd, event_handle, FD_READ|FD_CLOSE) ==
SOCKET_ERROR) {
close_event_func(event_handle);
FreeLibrary(wsock2);
return CURLE_OK;
@ -1317,7 +1259,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
obj_count = 1;
/* Check stdin_handle per 100 milliseconds */
wait_timeout = 100;
} else {
}
else {
obj_count = 2;
wait_timeout = 1000;
}

View File

@ -166,7 +166,8 @@ typedef struct tftp_state_data {
static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ;
static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ;
static CURLcode tftp_connect(struct connectdata *conn, bool *done);
static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection);
static CURLcode tftp_disconnect(struct connectdata *conn,
bool dead_connection);
static CURLcode tftp_do(struct connectdata *conn, bool *done);
static CURLcode tftp_done(struct connectdata *conn,
CURLcode, bool premature);
@ -1239,10 +1240,9 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn)
timeout_ms = Curl_sleep_time(data->set.max_recv_speed,
data->progress.dlspeed, state->blksize);
}
else {
else
fd_read = state->sockfd;
}
}
if(data->set.timeout) {
timeout_ms = data->set.timeout - Curl_tvdiff(k->now, k->start);

View File

@ -629,7 +629,8 @@ static CURLcode readwrite_data(struct SessionHandle *data,
dataleft = conn->chunk.dataleft;
if(dataleft != 0) {
infof(conn->data, "Leftovers after chunking: %zu bytes", dataleft);
if(conn->data->multi && Curl_multi_canPipeline(conn->data->multi)) {
if(conn->data->multi &&
Curl_multi_canPipeline(conn->data->multi)) {
/* only attempt the rewind if we truly are pipelining */
infof(conn->data, "Rewinding %zu bytes\n",dataleft);
read_rewind(conn, dataleft);

View File

@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@ -36,7 +36,8 @@ typedef enum {
FOLLOW_LAST /* never used */
} followtype;
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, followtype type);
CURLcode Curl_follow(struct SessionHandle *data, char *newurl,
followtype type);
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);

View File

@ -347,10 +347,9 @@ static CURLcode setstropt_userpwd(char *option, char **user_storage,
}
/* store password part of option */
if (result == CURLE_OK) {
if(result == CURLE_OK)
result = setstropt(pwd_storage, separator+1);
}
}
else {
result = setstropt(user_storage, option);
}
@ -1408,7 +1407,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
#endif
#ifndef USE_HTTP_NEGOTIATE
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or WINDOWS_SSPI */
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or
WINDOWS_SSPI */
#endif
if(!auth)
return CURLE_NOT_BUILT_IN; /* no supported types left! */
@ -1468,7 +1468,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
auth &= ~CURLAUTH_NTLM; /* no NTLM without SSL */
#endif
#ifndef USE_HTTP_NEGOTIATE
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or WINDOWS_SSPI */
auth &= ~CURLAUTH_GSSNEGOTIATE; /* no GSS-Negotiate without GSSAPI or
WINDOWS_SSPI */
#endif
if(!auth)
return CURLE_NOT_BUILT_IN; /* no supported types left! */
@ -3437,7 +3438,7 @@ static void fix_hostname(struct SessionHandle *data,
host->name = host->encalloc;
}
#else
infof (data, "IDN support not present, can't parse Unicode (UTF-8) domains");
infof (data, "IDN support not present, can't parse Unicode domains");
#endif
}
}
@ -3790,7 +3791,8 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
if(!data->state.this_is_a_follow)
/* Don't honour a scope given in a Location: header */
conn->scope = (unsigned int)scope;
} else
}
else
infof(data, "Invalid IPv6 address format\n");
}
}
@ -3926,9 +3928,9 @@ static bool check_noproxy(const char* name, const char* no_proxy)
break; /* It was all trailing separator chars, no more tokens. */
for(tok_end = tok_start; tok_end < no_proxy_len &&
strchr(separator, no_proxy[tok_end]) == NULL; ++tok_end) {
strchr(separator, no_proxy[tok_end]) == NULL; ++tok_end)
/* Look for the end of the token. */
}
;
/* To match previous behaviour, where it was necessary to specify
* ".local.com" to prevent matching "notlocal.com", we will leave
@ -4133,10 +4135,10 @@ static CURLcode parse_proxy(struct SessionHandle *data,
while(*ptr && (ISXDIGIT(*ptr) || (*ptr == ':') || (*ptr == '%') ||
(*ptr == '.')))
ptr++;
if(*ptr == ']') {
if(*ptr == ']')
/* yeps, it ended nicely with a bracket as well */
*ptr++ = 0;
} else
else
infof(data, "Invalid IPv6 address format\n");
portptr = ptr;
/* Note that if this didn't end with a bracket, we still advanced the
@ -4698,9 +4700,8 @@ static CURLcode create_conn(struct SessionHandle *data,
conn->host.name[0] = 0;
result = parseurlandfillconn(data, conn, &prot_missing);
if(result != CURLE_OK) {
if(result != CURLE_OK)
return result;
}
/*************************************************************
* No protocol part in URL was used, add it!
@ -5191,7 +5192,7 @@ CURLcode Curl_done(struct connectdata **connp,
*/
if(data->set.reuse_forbid || conn->bits.close || premature ||
(-1 == conn->connectindex)) {
CURLcode res2 = Curl_disconnect(conn, premature); /* close the connection */
CURLcode res2 = Curl_disconnect(conn, premature); /* close connection */
/* If we had an error already, make sure we return that one. But
if we got a new error, return that. */

View File

@ -82,7 +82,8 @@ void Curl_close_connections(struct SessionHandle *data);
void Curl_reset_reqproto(struct connectdata *conn);
#define CURL_DEFAULT_PROXY_PORT 1080 /* default proxy port unless specified */
#define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi service */
#define CURL_DEFAULT_SOCKS5_GSSAPI_SERVICE "rcmd" /* default socks5 gssapi
service */
CURLcode Curl_connected_proxy(struct connectdata *conn);

View File

@ -1358,7 +1358,8 @@ struct UserDefined {
curl_sockopt_callback fsockopt; /* function for setting socket options */
void *sockopt_client; /* pointer to pass to the socket options callback */
curl_opensocket_callback fopensocket; /* function for checking/translating
the address and opening the socket */
the address and opening the
socket */
void* opensocket_client;
void *seek_client; /* pointer to pass to the seek callback */
@ -1380,7 +1381,8 @@ struct UserDefined {
long low_speed_limit; /* bytes/second */
long low_speed_time; /* number of seconds */
curl_off_t max_send_speed; /* high speed limit in bytes/second for upload */
curl_off_t max_recv_speed; /* high speed limit in bytes/second for download */
curl_off_t max_recv_speed; /* high speed limit in bytes/second for
download */
curl_off_t set_resume_from; /* continue [ftp] transfer from here */
struct curl_slist *headers; /* linked list of extra headers */
struct curl_httppost *httppost; /* linked list of POST data */
@ -1494,7 +1496,8 @@ struct UserDefined {
Curl_RtspReq rtspreq; /* RTSP request type */
long rtspversion; /* like httpversion, for RTSP */
bool wildcardmatch; /* enable wildcard matching */
curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer starts */
curl_chunk_bgn_callback chunk_bgn; /* called before part of transfer
starts */
curl_chunk_end_callback chunk_end; /* called after part transferring
stopped */
curl_fnmatch_callback fnmatch; /* callback to decide which file corresponds

View File

@ -126,9 +126,10 @@ char *curl_version(void)
if(RTMP_LIB_VERSION & 0xff) {
suff[0] = (RTMP_LIB_VERSION & 0xff) + 'a' - 1;
suff[1] = '\0';
} else {
suff[0] = '\0';
}
else
suff[0] = '\0';
len = snprintf(ptr, left, " librtmp/%d.%d%s",
RTMP_LIB_VERSION >> 16, (RTMP_LIB_VERSION >> 8) & 0xff, suff);
/*