Compare commits
16 Commits
curl-7_13_
...
before_ftp
Author | SHA1 | Date | |
---|---|---|---|
![]() |
120f17ce04 | ||
![]() |
ab938bb9bd | ||
![]() |
33820cd2ac | ||
![]() |
41def21f91 | ||
![]() |
d118312922 | ||
![]() |
82b93e4945 | ||
![]() |
e36fb1ecda | ||
![]() |
e4a1788614 | ||
![]() |
7b23eff9cf | ||
![]() |
67ff8e3ea3 | ||
![]() |
2248599ae1 | ||
![]() |
29350b363b | ||
![]() |
83c470a443 | ||
![]() |
ab96e2d6e9 | ||
![]() |
6b81cf4bc9 | ||
![]() |
0d9301539e |
15
CHANGES
15
CHANGES
@@ -6,6 +6,21 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Daniel (8 February 2005)
|
||||||
|
- Gisle fixed problems when libcurl runs out of memory, and worked on making
|
||||||
|
sure the proper error code is returned for those occations.
|
||||||
|
|
||||||
|
Daniel (7 February 2005)
|
||||||
|
- Maruko pointed out a problem with inflate decompressing exactly 64K
|
||||||
|
contents.
|
||||||
|
|
||||||
|
Daniel (5 February 2005)
|
||||||
|
- Eric Vergnaud found a use of an uninitialised variable in the ftp when doing
|
||||||
|
PORT on ipv6-enabled hosts.
|
||||||
|
|
||||||
|
- David Byron pointed out we could use BUFSIZE to read data (in
|
||||||
|
lib/transfer.c) instead of using BUFSIZE -1.
|
||||||
|
|
||||||
Version 7.13.0 (1 February 2005)
|
Version 7.13.0 (1 February 2005)
|
||||||
|
|
||||||
Daniel (31 January 2005)
|
Daniel (31 January 2005)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
Curl and libcurl 7.13.0
|
Curl and libcurl 7.13.1
|
||||||
|
|
||||||
Public curl release number: 85
|
Public curl release number: 86
|
||||||
Releases counted from the very beginning: 112
|
Releases counted from the very beginning: 113
|
||||||
Available command line options: 104
|
Available command line options: 104
|
||||||
Available curl_easy_setopt() options: 122
|
Available curl_easy_setopt() options: 122
|
||||||
Number of public functions in libcurl: 46
|
Number of public functions in libcurl: 46
|
||||||
@@ -10,51 +10,18 @@ Curl and libcurl 7.13.0
|
|||||||
|
|
||||||
This release includes the following changes:
|
This release includes the following changes:
|
||||||
|
|
||||||
o added --ftp-account and CURLOPT_FTP_ACCOUNT
|
o
|
||||||
o added CURLOPT_SOURCE_URL and CURLOPT_SOURCE_QUOTE
|
|
||||||
o obsoleted CURLOPT_SOURCE_HOST, CURLOPT_SOURCE_PATH, CURLOPT_SOURCE_PORT
|
|
||||||
and CURLOPT_PASV_HOST
|
|
||||||
o added --3p-url, --3p-user and --3p-quote
|
|
||||||
o -Q "+[command]" was added
|
|
||||||
o src/getpass.c license issue sorted (code was rewritten)
|
|
||||||
o curl -w now supports 'http_connect' for the proxy's response to CONNECT
|
|
||||||
o introducing "curl-config --protocols"
|
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
o re-sending a request when retrying on a fresh connection with multi
|
o
|
||||||
interface
|
|
||||||
o improved valgrind report parser in the test suite
|
|
||||||
o several valgrind reports
|
|
||||||
o CURLOPT_FTPPORT and -P work when built ipv6-enabled
|
|
||||||
o FTP third party transfers was much improved
|
|
||||||
o proxy environment variables are now ignored when built HTTP-disabled
|
|
||||||
o CURLOPT_PROXY can now disable HTTP proxy even when built HTTP-disabled
|
|
||||||
o "curl dictionary.com" no longer assumes DICT protocol
|
|
||||||
o re-invoke some system calls on EINTR
|
|
||||||
o duplicate Host: when failed connection re-use
|
|
||||||
o SOCKS5 version check
|
|
||||||
o memory problem with cleaning up multi interface
|
|
||||||
o SSL certificate name memory leak
|
|
||||||
o -d with -G to multiple URLs crashed
|
|
||||||
o double va_list access crash fixed
|
|
||||||
o minor memory leak when "version" is set in a cookie header
|
|
||||||
o builds fine on BeOS and NetBSD
|
|
||||||
o builds and runs fine on FreeBSD
|
|
||||||
|
|
||||||
Other curl-related news since the previous public release:
|
Other curl-related news since the previous public release:
|
||||||
|
|
||||||
o cURLpp 0.3.2 - https://rrette.com/curlpp.html
|
o
|
||||||
o pycURL 7.12.3 - http://pycurl.sourceforge.net/
|
|
||||||
o new web mirror: http://curl.mirrormonster.com/ (US, California)
|
|
||||||
|
|
||||||
This release would not have looked like this without help, code, reports and
|
This release would not have looked like this without help, code, reports and
|
||||||
advice from friends like these:
|
advice from friends like these:
|
||||||
|
|
||||||
Dan Fandrich, Peter Pentchev, Marcin Konicki, Rune Kleveland, David Shaw,
|
|
||||||
Werner Koch, Gisle Vanem, Alex Neblett, Kai Sommerfeld, Marty Kuhrt,
|
|
||||||
Hzhijun, Pavel Orehov, Bruce Mitchener, Cyrill Osterwalder, Dan Torop,
|
|
||||||
Martijn Koster, Alex aka WindEagle, Cody Jones, Samuel D<>az Garc<72>a,
|
|
||||||
Stephan Bergmann, Philippe Hameau, Ian Ford, Stephen More, Lars Nilsson
|
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
@@ -3,6 +3,14 @@ join in and help us correct one or more of these! Also be sure to check the
|
|||||||
changelog of the current development status, as one or more of these problems
|
changelog of the current development status, as one or more of these problems
|
||||||
may have been fixed since this was written!
|
may have been fixed since this was written!
|
||||||
|
|
||||||
|
20. valgrind errors occur too often when 'make test' is used. It is because
|
||||||
|
too many third-party libs and tools have problems. When curl is built
|
||||||
|
without --disable-shared, the testing is done with a front-end script which
|
||||||
|
makes the valgrind testing include (ba)sh as well and that often causes
|
||||||
|
valgrind errors. Either we improve the valgrind error scanner a lot to
|
||||||
|
better identify (lib)curl errors only, or we disable valgrind checking by
|
||||||
|
default.
|
||||||
|
|
||||||
19. FTP 3rd party transfers with the multi interface doesn't work. Test:
|
19. FTP 3rd party transfers with the multi interface doesn't work. Test:
|
||||||
define CURL_MULTIEASY, rebuild curl, run test case 230 - 232.
|
define CURL_MULTIEASY, rebuild curl, run test case 230 - 232.
|
||||||
|
|
||||||
|
@@ -628,6 +628,9 @@ dynamically.
|
|||||||
Write output to a local file named like the remote file we get. (Only the file
|
Write output to a local file named like the remote file we get. (Only the file
|
||||||
part of the remote file is used, the path is cut off.)
|
part of the remote file is used, the path is cut off.)
|
||||||
|
|
||||||
|
The remote file name to use for saving is extracted from the given URL.
|
||||||
|
Nothing else
|
||||||
|
|
||||||
You may use this option as many times as you have number of URLs.
|
You may use this option as many times as you have number of URLs.
|
||||||
.IP "--pass <phrase>"
|
.IP "--pass <phrase>"
|
||||||
(SSL) Pass phrase for the private key
|
(SSL) Pass phrase for the private key
|
||||||
|
@@ -10,7 +10,7 @@ EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \
|
|||||||
post-callback.c multi-app.c multi-double.c multi-single.c \
|
post-callback.c multi-app.c multi-double.c multi-single.c \
|
||||||
multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \
|
multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \
|
||||||
multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c debug.c \
|
multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c debug.c \
|
||||||
anyauthput.c htmltitle.cc
|
anyauthput.c htmltitle.cc htmltidy.c
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@echo "done"
|
@echo "done"
|
||||||
|
@@ -37,7 +37,7 @@ void *myrealloc(void *ptr, size_t size)
|
|||||||
size_t
|
size_t
|
||||||
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
{
|
{
|
||||||
register int realsize = size * nmemb;
|
size_t realsize = size * nmemb;
|
||||||
struct MemoryStruct *mem = (struct MemoryStruct *)data;
|
struct MemoryStruct *mem = (struct MemoryStruct *)data;
|
||||||
|
|
||||||
mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
|
mem->memory = (char *)myrealloc(mem->memory, mem->size + realsize + 1);
|
||||||
|
118
docs/examples/htmltidy.c
Normal file
118
docs/examples/htmltidy.c
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* _ _ ____ _
|
||||||
|
* Project ___| | | | _ \| |
|
||||||
|
* / __| | | | |_) | |
|
||||||
|
* | (__| |_| | _ <| |___
|
||||||
|
* \___|\___/|_| \_\_____|
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Download a document and use libtidy to parse the HTML.
|
||||||
|
* Written by Jeff Pohlmeyer
|
||||||
|
*
|
||||||
|
* LibTidy => http://tidy.sourceforge.net
|
||||||
|
*
|
||||||
|
* gcc -Wall -I/usr/local/include tidycurl.c -lcurl -ltidy -o tidycurl
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <tidy/tidy.h>
|
||||||
|
#include <tidy/buffio.h>
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
/* curl write callback, to fill tidy's input buffer... */
|
||||||
|
uint write_cb(char *in, uint size, uint nmemb, TidyBuffer *out)
|
||||||
|
{
|
||||||
|
uint r;
|
||||||
|
r = size * nmemb;
|
||||||
|
tidyBufAppend( out, in, r );
|
||||||
|
return(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Traverse the document tree */
|
||||||
|
void dumpNode(TidyDoc doc, TidyNode tnod, int indent )
|
||||||
|
{
|
||||||
|
TidyNode child;
|
||||||
|
for ( child = tidyGetChild(tnod); child; child = tidyGetNext(child) )
|
||||||
|
{
|
||||||
|
ctmbstr name = tidyNodeGetName( child );
|
||||||
|
if ( name )
|
||||||
|
{
|
||||||
|
/* if it has a name, then it's an HTML tag ... */
|
||||||
|
TidyAttr attr;
|
||||||
|
printf( "%*.*s%s ", indent, indent, "<", name);
|
||||||
|
/* walk the attribute list */
|
||||||
|
for ( attr=tidyAttrFirst(child); attr; attr=tidyAttrNext(attr) ) {
|
||||||
|
printf(tidyAttrName(attr));
|
||||||
|
tidyAttrValue(attr)?printf("=\"%s\" ",
|
||||||
|
tidyAttrValue(attr)):printf(" ");
|
||||||
|
}
|
||||||
|
printf( ">\n");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* if it doesn't have a name, then it's probably text, cdata, etc... */
|
||||||
|
TidyBuffer buf;
|
||||||
|
tidyBufInit(&buf);
|
||||||
|
tidyNodeGetText(doc, child, &buf);
|
||||||
|
printf("%*.*s\n", indent, indent, buf.bp?(char *)buf.bp:"");
|
||||||
|
tidyBufFree(&buf);
|
||||||
|
}
|
||||||
|
dumpNode( doc, child, indent + 4 ); /* recursive */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char **argv )
|
||||||
|
{
|
||||||
|
CURL *curl;
|
||||||
|
char curl_errbuf[CURL_ERROR_SIZE];
|
||||||
|
TidyDoc tdoc;
|
||||||
|
TidyBuffer docbuf = {0};
|
||||||
|
TidyBuffer tidy_errbuf = {0};
|
||||||
|
int err;
|
||||||
|
if ( argc == 2) {
|
||||||
|
curl = curl_easy_init();
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, argv[1]);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_errbuf);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, no);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_VERBOSE, yes);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);
|
||||||
|
|
||||||
|
tdoc = tidyCreate();
|
||||||
|
tidyOptSetBool(tdoc, TidyForceOutput, yes); /* try harder */
|
||||||
|
tidyOptSetInt(tdoc, TidyWrapLen, 4096);
|
||||||
|
tidySetErrorBuffer( tdoc, &tidy_errbuf );
|
||||||
|
tidyBufInit(&docbuf);
|
||||||
|
|
||||||
|
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &docbuf);
|
||||||
|
err=curl_easy_perform(curl);
|
||||||
|
if ( !err ) {
|
||||||
|
err = tidyParseBuffer(tdoc, &docbuf); /* parse the input */
|
||||||
|
if ( err >= 0 ) {
|
||||||
|
err = tidyCleanAndRepair(tdoc); /* fix any problems */
|
||||||
|
if ( err >= 0 ) {
|
||||||
|
err = tidyRunDiagnostics(tdoc); /* load tidy error buffer */
|
||||||
|
if ( err >= 0 ) {
|
||||||
|
dumpNode( tdoc, tidyGetRoot(tdoc), 0 ); /* walk the tree */
|
||||||
|
fprintf(stderr, "%s\n", tidy_errbuf.bp); /* show errors */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fprintf(stderr, "%s\n", curl_errbuf);
|
||||||
|
|
||||||
|
/* clean-up */
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
tidyBufFree(&docbuf);
|
||||||
|
tidyBufFree(&tidy_errbuf);
|
||||||
|
tidyRelease(tdoc);
|
||||||
|
return(err);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf( "usage: %s <url>\n", argv[0] );
|
||||||
|
|
||||||
|
return(0);
|
||||||
|
}
|
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
/* This is the version number of the libcurl package from which this header
|
/* This is the version number of the libcurl package from which this header
|
||||||
file origins: */
|
file origins: */
|
||||||
#define LIBCURL_VERSION "7.13.0-CVS"
|
#define LIBCURL_VERSION "7.13.1-CVS"
|
||||||
|
|
||||||
/* This is the numeric version of the libcurl version number, meant for easier
|
/* This is the numeric version of the libcurl version number, meant for easier
|
||||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||||
@@ -44,12 +44,12 @@
|
|||||||
always a greater number in a more recent release. It makes comparisons with
|
always a greater number in a more recent release. It makes comparisons with
|
||||||
greater than and less than work.
|
greater than and less than work.
|
||||||
*/
|
*/
|
||||||
#define LIBCURL_VERSION_NUM 0x070d00
|
#define LIBCURL_VERSION_NUM 0x070d01
|
||||||
|
|
||||||
/* The numeric version number is also available "in parts" by using these
|
/* The numeric version number is also available "in parts" by using these
|
||||||
defines: */
|
defines: */
|
||||||
#define LIBCURL_VERSION_MAJOR 7
|
#define LIBCURL_VERSION_MAJOR 7
|
||||||
#define LIBCURL_VERSION_MINOR 13
|
#define LIBCURL_VERSION_MINOR 13
|
||||||
#define LIBCURL_VERSION_PATCH 0
|
#define LIBCURL_VERSION_PATCH 1
|
||||||
|
|
||||||
#endif /* __CURL_CURLVER_H */
|
#endif /* __CURL_CURLVER_H */
|
||||||
|
@@ -128,7 +128,7 @@ inflate_stream(struct SessionHandle *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Done with these bytes, exit */
|
/* Done with these bytes, exit */
|
||||||
if (status == Z_OK && z->avail_in == 0 && z->avail_out > 0) {
|
if (status == Z_OK && z->avail_in == 0) {
|
||||||
free(decomp);
|
free(decomp);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
18
lib/dict.c
18
lib/dict.c
@@ -136,12 +136,12 @@ CURLcode Curl_dict(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_sendf(sockfd, conn,
|
result = Curl_sendf(sockfd, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
||||||
"MATCH "
|
"MATCH "
|
||||||
"%s " /* database */
|
"%s " /* database */
|
||||||
"%s " /* strategy */
|
"%s " /* strategy */
|
||||||
"%s\n" /* word */
|
"%s\r\n" /* word */
|
||||||
"QUIT\n",
|
"QUIT\r\n",
|
||||||
|
|
||||||
database,
|
database,
|
||||||
strategy,
|
strategy,
|
||||||
@@ -180,11 +180,11 @@ CURLcode Curl_dict(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_sendf(sockfd, conn,
|
result = Curl_sendf(sockfd, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
||||||
"DEFINE "
|
"DEFINE "
|
||||||
"%s " /* database */
|
"%s " /* database */
|
||||||
"%s\n" /* word */
|
"%s\r\n" /* word */
|
||||||
"QUIT\n",
|
"QUIT\r\n",
|
||||||
database,
|
database,
|
||||||
word);
|
word);
|
||||||
if(result)
|
if(result)
|
||||||
@@ -209,9 +209,9 @@ CURLcode Curl_dict(struct connectdata *conn)
|
|||||||
ppath[i] = ' ';
|
ppath[i] = ' ';
|
||||||
}
|
}
|
||||||
result = Curl_sendf(sockfd, conn,
|
result = Curl_sendf(sockfd, conn,
|
||||||
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
|
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\r\n"
|
||||||
"%s\n"
|
"%s\r\n"
|
||||||
"QUIT\n", ppath);
|
"QUIT\r\n", ppath);
|
||||||
if(result)
|
if(result)
|
||||||
failf(data, "Failed sending DICT request");
|
failf(data, "Failed sending DICT request");
|
||||||
else
|
else
|
||||||
|
@@ -1127,7 +1127,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct addrinfo hints, *res, *ai;
|
struct addrinfo *res, *ai;
|
||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
socklen_t sslen;
|
socklen_t sslen;
|
||||||
char hbuf[NI_MAXHOST]="";
|
char hbuf[NI_MAXHOST]="";
|
||||||
@@ -1190,7 +1190,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
|||||||
* Workaround for AIX5 getaddrinfo() problem (it doesn't set ai_socktype):
|
* Workaround for AIX5 getaddrinfo() problem (it doesn't set ai_socktype):
|
||||||
*/
|
*/
|
||||||
if (ai->ai_socktype == 0)
|
if (ai->ai_socktype == 0)
|
||||||
ai->ai_socktype = hints.ai_socktype;
|
ai->ai_socktype = SOCK_STREAM;
|
||||||
|
|
||||||
portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
|
||||||
if (portsock == CURL_SOCKET_BAD) {
|
if (portsock == CURL_SOCKET_BAD) {
|
||||||
@@ -2754,10 +2754,9 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
|
|||||||
|
|
||||||
ftp->dirdepth = 0;
|
ftp->dirdepth = 0;
|
||||||
ftp->diralloc = 5; /* default dir depth to allocate */
|
ftp->diralloc = 5; /* default dir depth to allocate */
|
||||||
ftp->dirs = (char **)malloc(ftp->diralloc * sizeof(ftp->dirs[0]));
|
ftp->dirs = (char **)calloc(ftp->diralloc, sizeof(ftp->dirs[0]));
|
||||||
if(!ftp->dirs)
|
if(!ftp->dirs)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
ftp->dirs[0] = NULL; /* to start with */
|
|
||||||
|
|
||||||
/* parse the URL path into separate path components */
|
/* parse the URL path into separate path components */
|
||||||
while((slash_pos=strchr(cur_pos, '/'))) {
|
while((slash_pos=strchr(cur_pos, '/'))) {
|
||||||
@@ -2795,6 +2794,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
|
|||||||
ftp->diralloc *= 2; /* double the size each time */
|
ftp->diralloc *= 2; /* double the size each time */
|
||||||
bigger = realloc(ftp->dirs, ftp->diralloc * sizeof(ftp->dirs[0]));
|
bigger = realloc(ftp->dirs, ftp->diralloc * sizeof(ftp->dirs[0]));
|
||||||
if(!bigger) {
|
if(!bigger) {
|
||||||
|
ftp->dirdepth--;
|
||||||
freedirs(ftp);
|
freedirs(ftp);
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@@ -249,7 +249,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
|
|
||||||
/* close the connection, since we can't return failure here without
|
/* close the connection, since we can't return failure here without
|
||||||
cleaning up this connection properly */
|
cleaning up this connection properly */
|
||||||
Curl_disconnect(conn);
|
conn->bits.close = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@@ -291,7 +291,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
|||||||
|
|
||||||
/* areschannel is already setup in the Curl_open() function */
|
/* areschannel is already setup in the Curl_open() function */
|
||||||
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
|
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
|
||||||
Curl_addrinfo4_callback, conn);
|
(ares_host_callback)Curl_addrinfo4_callback, conn);
|
||||||
|
|
||||||
*waitp = TRUE; /* please wait for the response */
|
*waitp = TRUE; /* please wait for the response */
|
||||||
}
|
}
|
||||||
|
@@ -108,12 +108,13 @@
|
|||||||
*
|
*
|
||||||
* The storage operation locks and unlocks the DNS cache.
|
* The storage operation locks and unlocks the DNS cache.
|
||||||
*/
|
*/
|
||||||
static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
static CURLcode addrinfo_callback(void *arg, /* "struct connectdata *" */
|
||||||
int status,
|
int status,
|
||||||
void *addr)
|
void *addr)
|
||||||
{
|
{
|
||||||
struct connectdata *conn = (struct connectdata *)arg;
|
struct connectdata *conn = (struct connectdata *)arg;
|
||||||
struct Curl_dns_entry *dns = NULL;
|
struct Curl_dns_entry *dns = NULL;
|
||||||
|
CURLcode rc = CURLE_OK;
|
||||||
|
|
||||||
conn->async.status = status;
|
conn->async.status = status;
|
||||||
|
|
||||||
@@ -135,13 +136,17 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
|||||||
dns = Curl_cache_addr(data, ai,
|
dns = Curl_cache_addr(data, ai,
|
||||||
conn->async.hostname,
|
conn->async.hostname,
|
||||||
conn->async.port);
|
conn->async.port);
|
||||||
if(!dns)
|
if(!dns) {
|
||||||
/* failed to store, cleanup and return error */
|
/* failed to store, cleanup and return error */
|
||||||
Curl_freeaddrinfo(ai);
|
Curl_freeaddrinfo(ai);
|
||||||
|
rc = CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if(data->share)
|
if(data->share)
|
||||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
rc = CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->async.dns = dns;
|
conn->async.dns = dns;
|
||||||
@@ -153,21 +158,22 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
|||||||
|
|
||||||
/* ipv4: The input hostent struct will be freed by ares when we return from
|
/* ipv4: The input hostent struct will be freed by ares when we return from
|
||||||
this function */
|
this function */
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
|
CURLcode Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
|
||||||
int status,
|
int status,
|
||||||
struct hostent *hostent)
|
struct hostent *hostent)
|
||||||
{
|
{
|
||||||
addrinfo_callback(arg, status, hostent);
|
return addrinfo_callback(arg, status, hostent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CURLRES_IPV6
|
#ifdef CURLRES_IPV6
|
||||||
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
|
CURLcode Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
|
||||||
int status,
|
int status,
|
||||||
struct addrinfo *ai)
|
struct addrinfo *ai)
|
||||||
{
|
{
|
||||||
addrinfo_callback(arg, status, ai);
|
return addrinfo_callback(arg, status, ai);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
12
lib/hostip.h
12
lib/hostip.h
@@ -199,14 +199,14 @@ int curl_dogetnameinfo(const struct sockaddr *sa, socklen_t salen,
|
|||||||
|
|
||||||
/* This is the callback function that is used when we build with asynch
|
/* This is the callback function that is used when we build with asynch
|
||||||
resolve, ipv4 */
|
resolve, ipv4 */
|
||||||
void Curl_addrinfo4_callback(void *arg,
|
CURLcode Curl_addrinfo4_callback(void *arg,
|
||||||
int status,
|
int status,
|
||||||
struct hostent *hostent);
|
struct hostent *hostent);
|
||||||
/* This is the callback function that is used when we build with asynch
|
/* This is the callback function that is used when we build with asynch
|
||||||
resolve, ipv6 */
|
resolve, ipv6 */
|
||||||
void Curl_addrinfo6_callback(void *arg,
|
CURLcode Curl_addrinfo6_callback(void *arg,
|
||||||
int status,
|
int status,
|
||||||
struct addrinfo *ai);
|
struct addrinfo *ai);
|
||||||
|
|
||||||
|
|
||||||
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
||||||
|
@@ -190,7 +190,7 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
|
|||||||
curr_proc, &mutex_waiting, 0, FALSE,
|
curr_proc, &mutex_waiting, 0, FALSE,
|
||||||
DUPLICATE_SAME_ACCESS)) {
|
DUPLICATE_SAME_ACCESS)) {
|
||||||
/* failed to duplicate the mutex, no point in continuing */
|
/* failed to duplicate the mutex, no point in continuing */
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sharing the same _iob[] element with our parent thread should
|
/* Sharing the same _iob[] element with our parent thread should
|
||||||
@@ -214,12 +214,10 @@ static unsigned __stdcall gethostbyname_thread (void *arg)
|
|||||||
SetEvent(td->event_resolved);
|
SetEvent(td->event_resolved);
|
||||||
|
|
||||||
if (he) {
|
if (he) {
|
||||||
Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he);
|
rc = Curl_addrinfo4_callback(conn, CURL_ASYNC_SUCCESS, he);
|
||||||
rc = 1;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL);
|
rc = Curl_addrinfo4_callback(conn, (int)WSAGetLastError(), NULL);
|
||||||
rc = 0;
|
|
||||||
}
|
}
|
||||||
TRACE(("Winsock-error %d, addr %s\n", conn->async.status,
|
TRACE(("Winsock-error %d, addr %s\n", conn->async.status,
|
||||||
he ? inet_ntoa(*(struct in_addr*)he->h_addr) : "unknown"));
|
he ? inet_ntoa(*(struct in_addr*)he->h_addr) : "unknown"));
|
||||||
@@ -260,7 +258,7 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
|
|||||||
curr_proc, &mutex_waiting, 0, FALSE,
|
curr_proc, &mutex_waiting, 0, FALSE,
|
||||||
DUPLICATE_SAME_ACCESS)) {
|
DUPLICATE_SAME_ACCESS)) {
|
||||||
/* failed to duplicate the mutex, no point in continuing */
|
/* failed to duplicate the mutex, no point in continuing */
|
||||||
return 0;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
@@ -286,10 +284,10 @@ static unsigned __stdcall getaddrinfo_thread (void *arg)
|
|||||||
#ifdef DEBUG_THREADING_GETADDRINFO
|
#ifdef DEBUG_THREADING_GETADDRINFO
|
||||||
dump_addrinfo (conn, res);
|
dump_addrinfo (conn, res);
|
||||||
#endif
|
#endif
|
||||||
Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
|
rc = Curl_addrinfo6_callback(conn, CURL_ASYNC_SUCCESS, res);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
|
rc = Curl_addrinfo6_callback(conn, (int)WSAGetLastError(), NULL);
|
||||||
TRACE(("Winsock-error %d, no address\n", conn->async.status));
|
TRACE(("Winsock-error %d, no address\n", conn->async.status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -493,7 +491,11 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
|
|
||||||
if (!conn->async.dns) {
|
if (!conn->async.dns) {
|
||||||
/* a name was not resolved */
|
/* a name was not resolved */
|
||||||
if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
|
if (td->thread_status == CURLE_OUT_OF_MEMORY) {
|
||||||
|
rc = CURLE_OUT_OF_MEMORY;
|
||||||
|
failf(data, "Could not resolve host: %s", curl_easy_strerror(rc));
|
||||||
|
}
|
||||||
|
else if (td->thread_status == (DWORD)-1 || conn->async.status == NO_DATA) {
|
||||||
failf(data, "Resolving host timed out: %s", conn->host.name);
|
failf(data, "Resolving host timed out: %s", conn->host.name);
|
||||||
rc = CURLE_OPERATION_TIMEDOUT;
|
rc = CURLE_OPERATION_TIMEDOUT;
|
||||||
}
|
}
|
||||||
@@ -508,10 +510,8 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
|||||||
|
|
||||||
destroy_thread_data(&conn->async);
|
destroy_thread_data(&conn->async);
|
||||||
|
|
||||||
if(CURLE_OK != rc)
|
if(!conn->async.dns)
|
||||||
/* close the connection, since we must not return failure from here
|
conn->bits.close = TRUE;
|
||||||
without cleaning up this connection properly */
|
|
||||||
Curl_disconnect(conn);
|
|
||||||
|
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
|
@@ -1274,7 +1274,6 @@ CURLcode Curl_http_done(struct connectdata *conn,
|
|||||||
{
|
{
|
||||||
struct SessionHandle *data;
|
struct SessionHandle *data;
|
||||||
struct HTTP *http;
|
struct HTTP *http;
|
||||||
(void)status; /* no use for us */
|
|
||||||
|
|
||||||
data=conn->data;
|
data=conn->data;
|
||||||
http=conn->proto.http;
|
http=conn->proto.http;
|
||||||
@@ -1291,7 +1290,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
|
|||||||
|
|
||||||
free(buff->buffer);
|
free(buff->buffer);
|
||||||
free(buff);
|
free(buff);
|
||||||
http->send_buffer = NULL; /* cleaer the pointer */
|
http->send_buffer = NULL; /* clear the pointer */
|
||||||
}
|
}
|
||||||
|
|
||||||
if(HTTPREQ_POST_FORM == data->set.httpreq) {
|
if(HTTPREQ_POST_FORM == data->set.httpreq) {
|
||||||
@@ -1307,6 +1306,9 @@ CURLcode Curl_http_done(struct connectdata *conn,
|
|||||||
else if(HTTPREQ_PUT == data->set.httpreq)
|
else if(HTTPREQ_PUT == data->set.httpreq)
|
||||||
conn->bytecount = http->readbytecount + http->writebytecount;
|
conn->bytecount = http->readbytecount + http->writebytecount;
|
||||||
|
|
||||||
|
if (status != CURLE_OK)
|
||||||
|
return (status);
|
||||||
|
|
||||||
if(!conn->bits.retry &&
|
if(!conn->bits.retry &&
|
||||||
((http->readbytecount +
|
((http->readbytecount +
|
||||||
conn->headerbytecount -
|
conn->headerbytecount -
|
||||||
|
@@ -285,7 +285,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
|||||||
read or we get a EWOULDBLOCK */
|
read or we get a EWOULDBLOCK */
|
||||||
do {
|
do {
|
||||||
size_t buffersize = data->set.buffer_size?
|
size_t buffersize = data->set.buffer_size?
|
||||||
data->set.buffer_size:BUFSIZE -1;
|
data->set.buffer_size:BUFSIZE;
|
||||||
|
|
||||||
/* receive data from the network! */
|
/* receive data from the network! */
|
||||||
int readrc = Curl_read(conn, conn->sockfd, k->buf, buffersize, &nread);
|
int readrc = Curl_read(conn, conn->sockfd, k->buf, buffersize, &nread);
|
||||||
@@ -2038,6 +2038,8 @@ Curl_connect_host(struct SessionHandle *data,
|
|||||||
if(CURLE_OK == res)
|
if(CURLE_OK == res)
|
||||||
/* Resolved, continue with the connection */
|
/* Resolved, continue with the connection */
|
||||||
res = Curl_async_resolved(*conn);
|
res = Curl_async_resolved(*conn);
|
||||||
|
else
|
||||||
|
(void)Curl_disconnect(*conn);
|
||||||
}
|
}
|
||||||
if(res)
|
if(res)
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user