Compare commits
53 Commits
before_ftp
...
curl-7_13_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
874fc8228a | ||
![]() |
6f752c64bc | ||
![]() |
ccb7950c4c | ||
![]() |
750e771376 | ||
![]() |
7012a4a291 | ||
![]() |
40ab20a252 | ||
![]() |
6af315e50c | ||
![]() |
861b5e608b | ||
![]() |
f61917594e | ||
![]() |
0ddab51ad8 | ||
![]() |
9798432f56 | ||
![]() |
5faf52619d | ||
![]() |
f8b4ba80e0 | ||
![]() |
527f70e540 | ||
![]() |
19f66c7575 | ||
![]() |
b7721deb02 | ||
![]() |
5ba188ab2d | ||
![]() |
eadfd78c2e | ||
![]() |
4d815c9990 | ||
![]() |
176981b529 | ||
![]() |
85baebd0d4 | ||
![]() |
ac022b2e30 | ||
![]() |
f169b750b8 | ||
![]() |
86295eef13 | ||
![]() |
32d60b2714 | ||
![]() |
0a3065a2f2 | ||
![]() |
b98faaa8c0 | ||
![]() |
73772323c9 | ||
![]() |
98389066e2 | ||
![]() |
fb53ed4c1f | ||
![]() |
e719eb5b81 | ||
![]() |
3858063bcd | ||
![]() |
d4f5fea840 | ||
![]() |
22c1d48cb2 | ||
![]() |
e7cefd684b | ||
![]() |
d2485e4f20 | ||
![]() |
160d6b26b0 | ||
![]() |
17d61e4f29 | ||
![]() |
446b9467da | ||
![]() |
3970a7056c | ||
![]() |
74068a6d1b | ||
![]() |
8c83422fe2 | ||
![]() |
61a1e3cd01 | ||
![]() |
89cac6f25c | ||
![]() |
62082293c5 | ||
![]() |
153fd2752c | ||
![]() |
e649a40f5d | ||
![]() |
32d76a5b57 | ||
![]() |
14aa3fa258 | ||
![]() |
f5394cccb1 | ||
![]() |
64dd9c7656 | ||
![]() |
16ae0c6466 | ||
![]() |
6a2e21ec8c |
94
CHANGES
94
CHANGES
@@ -6,6 +6,100 @@
|
||||
|
||||
Changelog
|
||||
|
||||
|
||||
Version 7.13.1 (4 March 2005)
|
||||
|
||||
Daniel (4 March 2005)
|
||||
- Dave Dribin made it possible to set CURLOPT_COOKIEFILE to "" to activate
|
||||
the cookie "engine" without having to provide an empty or non-existing file.
|
||||
|
||||
- Rene Rebe fixed a -# crash when more data than expected was retrieved.
|
||||
|
||||
Daniel (22 February 2005)
|
||||
- NTLM and ftp-krb4 buffer overflow fixed, as reported here:
|
||||
http://www.securityfocus.com/archive/1/391042 and the CAN report here:
|
||||
http://cve.mitre.org/cgi-bin/cvename.cgi?name=CAN-2005-0490
|
||||
|
||||
If these security guys were serious, we'd been notified in advance and we
|
||||
could've saved a few of you a little surprise, but now we weren't.
|
||||
|
||||
Daniel (19 February 2005)
|
||||
- Ralph Mitchell reported a flaw when you used a proxy with auth, and you
|
||||
requested data from a host and then followed a redirect to another
|
||||
host. libcurl then didn't use the proxy-auth properly in the second request,
|
||||
due to the host-only check for original host name wrongly being extended to
|
||||
the proxy auth as well. Added test case 233 to verify the flaw and that the
|
||||
fix removed the problem.
|
||||
|
||||
Daniel (18 February 2005)
|
||||
- Mike Dobbs reported a mingw build failure due to the lack of
|
||||
BUILDING_LIBCURL being defined when libcurl is built. Now this is defined by
|
||||
configure when mingw is used.
|
||||
|
||||
Daniel (17 February 2005)
|
||||
- David in bug report #1124588 found and fixed a socket leak when libcurl
|
||||
didn't close the socket properly when returning error due to failing
|
||||
localbind
|
||||
|
||||
Daniel (16 February 2005)
|
||||
- Christopher R. Palmer reported a problem with HTTP-POSTing using "anyauth"
|
||||
that picks NTLM. Thanks to David Byron letting me test NTLM against his
|
||||
servers, I could quickly repeat and fix the problem. It turned out to be:
|
||||
|
||||
When libcurl POSTs without knowing/using an authentication and it gets back
|
||||
a list of types from which it picks NTLM, it needs to either continue
|
||||
sending its data if it keeps the connection alive, or not send the data but
|
||||
close the connection. Then do the first step in the NTLM auth. libcurl
|
||||
didn't send the data nor close the connection but simply read the
|
||||
response-body and then sent the first negotiation step. Which then failed
|
||||
miserably of course. The fixed version forces a connection if there is more
|
||||
than 2000 bytes left to send.
|
||||
|
||||
Daniel (14 February 2005)
|
||||
- The configure script didn't check for ENGINE_load_builtin_engines() so it
|
||||
was never used.
|
||||
|
||||
Daniel (11 February 2005)
|
||||
- Removed all uses of strftime() since it uses the localised version of the
|
||||
week day names and month names and servers don't like that.
|
||||
|
||||
Daniel (10 February 2005)
|
||||
- Now the test script disables valgrind-testing when the test suite runs if
|
||||
libcurl is built shared. Otherwise valgrind only tests the shell that runs
|
||||
the wrapper-script named 'curl' that is a front-end to curl in this case.
|
||||
This should also fix the huge amount of reports of false positives when
|
||||
valgrind has identified leaks in (ba)sh and not in curl and people report
|
||||
that as curl bugs. Bug report #1116672 is one example.
|
||||
|
||||
Also, the valgrind report parser has been adapted to check that at least one
|
||||
of the sources in a stack strace is one of (lib)curl's source files or
|
||||
otherwise it will not consider the problem to concern (lib)curl.
|
||||
|
||||
- Marty Kuhrt streamlined the VMS build.
|
||||
|
||||
Daniel (9 February 2005)
|
||||
- David Byron fixed his SSL problems, initially mentioned here:
|
||||
http://curl.haxx.se/mail/lib-2005-01/0240.html. It turned out we didn't use
|
||||
SSL_pending() as we should.
|
||||
|
||||
- Converted lots of FTP code to a statemachine, so that the multi interface
|
||||
doesn't block while communicating commands-responses with an FTP server.
|
||||
|
||||
I've added a comment like BLOCKING in the code on all spots I could find
|
||||
where we still have blocking operations. When we change curl_easy_perform()
|
||||
to use the multi interface, we'll also be able to simplify the code since
|
||||
there will only be one "internal interface".
|
||||
|
||||
While doing this, I've now made CURLE_FTP_ACCESS_DENIED separate from the
|
||||
new CURLE_LOGIN_DENIED. The first one is now access denied to a function,
|
||||
like changing directory or retrieving a file, while the second means that we
|
||||
were denied login.
|
||||
|
||||
The CVS tag 'before_ftp_statemachine' was set just before this went in, in
|
||||
case of future need.
|
||||
|
||||
- Gisle made the DICT code send CRLF and not just LF as the spec says so.
|
||||
|
||||
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.
|
||||
|
@@ -5,23 +5,43 @@ Curl and libcurl 7.13.1
|
||||
Available command line options: 104
|
||||
Available curl_easy_setopt() options: 122
|
||||
Number of public functions in libcurl: 46
|
||||
Amount of public web site mirrors: 15
|
||||
Number of known libcurl bindings: 29
|
||||
Amount of public web site mirrors: 18
|
||||
Number of known libcurl bindings: 30
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o
|
||||
o CURLOPT_COOKIEFILE set to "" is now activating the cookie engine
|
||||
o FTP code overhaul => multi interface much less blocking
|
||||
o Added CURLE_LOGIN_DENIED to be returned when curl is denied login to FTP
|
||||
servers
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o
|
||||
o -# crash when more data than expected was retrieved
|
||||
o NTLM/krb4 buffer overflow fixed (CAN-2005-0490)
|
||||
o proxy auth bug when following redirects to another host
|
||||
o socket leak when local bind failed
|
||||
o HTTP POST with --anyauth picking NTLM
|
||||
o SSL problems when downloading exactly 16KB data
|
||||
o out of memory conditions preserve error codes better
|
||||
o a few crashes at out of memory
|
||||
o inflate buffer usage bugfix
|
||||
o better DICT protocol adherence
|
||||
o disable valgrind-checking while testing if libcurl is built shared
|
||||
o locale names in some date strings
|
||||
|
||||
Other curl-related news since the previous public release:
|
||||
|
||||
o
|
||||
o libcurl-vb 1.0 http://sf.net/projects/libcurl-vb/
|
||||
o pycurl 7.13.0: http://pycurl.sf.net/
|
||||
o new german mirror: http://curl.mons-new-media.de
|
||||
o new US mirror: http://curl.islandofpoker.com
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Gisle Vanem, David Byron, Marty Kuhrt, Maruko, Eric Vergnaud, Christopher
|
||||
R. Palmer, Mike Dobbs, David in bug report #1124588, Ralph Mitchell,
|
||||
Rene Rebe, Dave Dribin, Dan Fandrich
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
10
TODO-RELEASE
10
TODO-RELEASE
@@ -1,20 +1,18 @@
|
||||
Issues not sorted in any particular order.
|
||||
|
||||
To get fixed in 7.13.1 (planned release: April 2005)
|
||||
To get fixed in 7.13.2 (planned release: April 2005)
|
||||
======================
|
||||
|
||||
58 - Fix KNOWN_BUGS #19: "FTP 3rd party transfers with the multi interface
|
||||
doesn't work"
|
||||
|
||||
59 - Figure out a fix for David Byron's SSL problems:
|
||||
http://curl.haxx.se/mail/lib-2005-01/0240.html
|
||||
|
||||
47 - Peter Sylvester's patch for SRP on the TLS layer
|
||||
Awaits OpenSSL support for this, no need to support this in libcurl before
|
||||
there's an OpenSSL release that does it.
|
||||
|
||||
54 - Turn the FTP code into a state machine to support the multi interface
|
||||
100% non-blocking.
|
||||
58 - SSPI for libcurl on Windows
|
||||
|
||||
59 - --form-string and --form-file as discussed on curl-users list
|
||||
|
||||
To get fixed in 7.14.0
|
||||
======================
|
||||
|
@@ -185,24 +185,24 @@ SOURCE=..\..\getopt.c
|
||||
!IF "$(CFG)" == "adig - Win32 Release"
|
||||
|
||||
"areslib - Win32 Release" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
|
||||
cd "..\adig"
|
||||
|
||||
"areslib - Win32 ReleaseCLEAN" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
|
||||
cd "..\adig"
|
||||
|
||||
!ELSEIF "$(CFG)" == "adig - Win32 Debug"
|
||||
|
||||
"areslib - Win32 Debug" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
|
||||
cd "..\adig"
|
||||
|
||||
"areslib - Win32 DebugCLEAN" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
|
||||
cd "..\adig"
|
||||
|
||||
|
@@ -195,24 +195,24 @@ SOURCE=..\..\ahost.c
|
||||
!IF "$(CFG)" == "ahost - Win32 Release"
|
||||
|
||||
"areslib - Win32 Release" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
|
||||
cd "..\ahost"
|
||||
|
||||
"areslib - Win32 ReleaseCLEAN" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
|
||||
cd "..\ahost"
|
||||
|
||||
!ELSEIF "$(CFG)" == "ahost - Win32 Debug"
|
||||
|
||||
"areslib - Win32 Debug" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
|
||||
cd "..\ahost"
|
||||
|
||||
"areslib - Win32 DebugCLEAN" :
|
||||
cd "\ARES-1.1.1\vc\areslib"
|
||||
cd ".\areslib"
|
||||
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
|
||||
cd "..\ahost"
|
||||
|
||||
|
20
configure.ac
20
configure.ac
@@ -116,6 +116,17 @@ esac
|
||||
AC_MSG_RESULT($mimpure)
|
||||
AM_CONDITIONAL(MIMPURE, test x$mimpure = xyes)
|
||||
|
||||
AC_MSG_CHECKING([if we need BUILDING_LIBCURL])
|
||||
case $host in
|
||||
*-*-mingw*)
|
||||
AC_DEFINE(BUILDING_LIBCURL, 1, [when building libcurl itself])
|
||||
AC_MSG_RESULT(yes)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl The install stuff has already been taken care of by the automake stuff
|
||||
dnl AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
@@ -838,8 +849,12 @@ dnl **********************************************************************
|
||||
|
||||
if test X"$OPENSSL_ENABLED" = X"1"; then
|
||||
dnl If the ENGINE library seems to be around, check for the OpenSSL engine
|
||||
dnl header, it is kind of "separated" from the main SSL check
|
||||
AC_CHECK_FUNC(ENGINE_init, [ AC_CHECK_HEADERS(openssl/engine.h) ])
|
||||
dnl stuff, it is kind of "separated" from the main SSL check
|
||||
AC_CHECK_FUNC(ENGINE_init,
|
||||
[
|
||||
AC_CHECK_HEADERS(openssl/engine.h)
|
||||
AC_CHECK_FUNCS( ENGINE_load_builtin_engines )
|
||||
])
|
||||
|
||||
AC_MSG_CHECKING([CA cert bundle install path])
|
||||
|
||||
@@ -1254,7 +1269,6 @@ AC_CHECK_FUNCS( strtoll \
|
||||
strdup \
|
||||
strstr \
|
||||
strtok_r \
|
||||
strftime \
|
||||
uname \
|
||||
strcasecmp \
|
||||
stricmp \
|
||||
|
@@ -87,8 +87,8 @@ Mono
|
||||
|
||||
.NET
|
||||
|
||||
Written by Jeffrey Phillips
|
||||
http://www.seasideresearch.com/downloads.html
|
||||
libcurl-net Written by Jeffrey Phillips
|
||||
http://sourceforge.net/projects/libcurl-net/
|
||||
|
||||
Object-Pascal
|
||||
|
||||
@@ -150,6 +150,11 @@ Tcl
|
||||
Tclcurl is written by Andr<64>s Garc<72>a
|
||||
http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html
|
||||
|
||||
Visual Basic
|
||||
|
||||
libcurl-vb is written by Jeffrey Phillips
|
||||
http://sourceforge.net/projects/libcurl-vb/
|
||||
|
||||
Q
|
||||
|
||||
http://q-lang.sourceforge.net/
|
||||
|
@@ -380,6 +380,11 @@ or
|
||||
|
||||
\fBcurl\fP -F "name=daniel;type=text/foo" url.com
|
||||
|
||||
You can also explicitly change the name field of an file upload part by
|
||||
setting filename=, like this:
|
||||
|
||||
\fBcurl\fP -F "file=@localfile;filename=nameinpost" url.com
|
||||
|
||||
See further examples and details in the MANUAL.
|
||||
|
||||
This option can be used multiple times.
|
||||
|
@@ -131,7 +131,7 @@ static bool init(CURL *&conn, char *url)
|
||||
// libxml start element callback function
|
||||
//
|
||||
|
||||
static void startElement(void *voidContext,
|
||||
static void StartElement(void *voidContext,
|
||||
const xmlChar *name,
|
||||
const xmlChar **attributes)
|
||||
{
|
||||
@@ -148,7 +148,7 @@ static void startElement(void *voidContext,
|
||||
// libxml end element callback function
|
||||
//
|
||||
|
||||
static void endElement(void *voidContext,
|
||||
static void EndElement(void *voidContext,
|
||||
const xmlChar *name)
|
||||
{
|
||||
Context *context = (Context *)voidContext;
|
||||
@@ -173,7 +173,7 @@ static void handleCharacters(Context *context,
|
||||
// libxml PCDATA callback function
|
||||
//
|
||||
|
||||
static void characters(void *voidContext,
|
||||
static void Characters(void *voidContext,
|
||||
const xmlChar *chars,
|
||||
int length)
|
||||
{
|
||||
@@ -215,10 +215,10 @@ static htmlSAXHandler saxHandler =
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
startElement,
|
||||
endElement,
|
||||
StartElement,
|
||||
EndElement,
|
||||
NULL,
|
||||
characters,
|
||||
Characters,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
|
@@ -617,9 +617,9 @@ name of your file holding cookie data to read. The cookie data may be in
|
||||
Netscape / Mozilla cookie data format or just regular HTTP-style headers
|
||||
dumped to a file.
|
||||
|
||||
Given an empty or non-existing file, this option will enable cookies for this
|
||||
curl handle, making it understand and parse received cookies and then use
|
||||
matching cookies in future request.
|
||||
Given an empty or non-existing file or by passing the empty string (""), this
|
||||
option will enable cookies for this curl handle, making it understand and
|
||||
parse received cookies and then use matching cookies in future request.
|
||||
.IP CURLOPT_COOKIEJAR
|
||||
Pass a file name as char *, zero terminated. This will make libcurl write all
|
||||
internally known cookies to the specified file when \fIcurl_easy_cleanup(3)\fP
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH libcurl-errors 3 "27 Apr 2004" "libcurl 7.12" "libcurl errors"
|
||||
.TH libcurl-errors 3 "9 Feb 2005" "libcurl 7.13.1" "libcurl errors"
|
||||
.SH NAME
|
||||
libcurl-errors \- error codes in libcurl
|
||||
.SH DESCRIPTION
|
||||
@@ -187,6 +187,13 @@ Invalid LDAP URL
|
||||
Maximum file size exceeded
|
||||
.IP "CURLE_FTP_SSL_FAILED (64)"
|
||||
Requested FTP SSL level failed
|
||||
.IP "CURLE_SEND_FAIL_REWIND (65)"
|
||||
When doing a send operation curl had to rewind the data to retransmit, but the
|
||||
rewinding operation failed
|
||||
.IP "CURLE_SSL_ENGINE_INITFAILED (66)"
|
||||
Initiating the SSL Engine failed
|
||||
.IP "CURLE_LOGIN_DENIED (67)"
|
||||
The remote server denied curl to login (Added in 7.13.1)
|
||||
.SH "CURLMcode"
|
||||
This is the generic return code used by functions in the libcurl multi
|
||||
interface. Also consider \fIcurl_multi_strerror(3)\fI.
|
||||
|
@@ -245,7 +245,9 @@ typedef enum {
|
||||
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
|
||||
CURLE_COULDNT_CONNECT, /* 7 */
|
||||
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
|
||||
CURLE_FTP_ACCESS_DENIED, /* 9 */
|
||||
CURLE_FTP_ACCESS_DENIED, /* 9 a service was denied by the FTP server
|
||||
due to lack of access - when login fails
|
||||
this is not returned. */
|
||||
CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
|
||||
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
|
||||
CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
|
||||
@@ -305,6 +307,8 @@ typedef enum {
|
||||
CURLE_SEND_FAIL_REWIND, /* 65 - Sending the data requires a rewind
|
||||
that failed */
|
||||
CURLE_SSL_ENGINE_INITFAILED, /* 66 - failed to initialise ENGINE */
|
||||
CURLE_LOGIN_DENIED, /* 67 - user, password or similar was not
|
||||
accepted and we failed to login */
|
||||
CURL_LAST /* never use! */
|
||||
} CURLcode;
|
||||
|
||||
|
@@ -17,4 +17,4 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
|
||||
http_chunks.h strtok.h connect.h llist.h hash.h content_encoding.h \
|
||||
share.h md5.h http_digest.h http_negotiate.h http_ntlm.h ca-bundle.h \
|
||||
inet_pton.h strtoofft.h strerror.h inet_ntop.h curlx.h memory.h \
|
||||
setup.h transfer.h select.h easyif.h multiif.h
|
||||
setup.h transfer.h select.h easyif.h multiif.h parsedate.h
|
||||
|
40
lib/base64.c
40
lib/base64.c
@@ -76,10 +76,10 @@ static void decodeQuantum(unsigned char *dest, const char *src)
|
||||
/*
|
||||
* Curl_base64_decode()
|
||||
*
|
||||
* Given a base64 string at src, decode it into the memory pointed to by
|
||||
* dest. Returns the length of the decoded data.
|
||||
* Given a base64 string at src, decode it and return an allocated memory in
|
||||
* the *outptr. Returns the length of the decoded data.
|
||||
*/
|
||||
size_t Curl_base64_decode(const char *src, char *dest)
|
||||
size_t Curl_base64_decode(const char *src, unsigned char **outptr)
|
||||
{
|
||||
int length = 0;
|
||||
int equalsTerm = 0;
|
||||
@@ -87,25 +87,49 @@ size_t Curl_base64_decode(const char *src, char *dest)
|
||||
int numQuantums;
|
||||
unsigned char lastQuantum[3];
|
||||
size_t rawlen=0;
|
||||
unsigned char *newstr;
|
||||
|
||||
*outptr = NULL;
|
||||
|
||||
while((src[length] != '=') && src[length])
|
||||
length++;
|
||||
while(src[length+equalsTerm] == '=')
|
||||
/* A maximum of two = padding characters is allowed */
|
||||
if(src[length] == '=') {
|
||||
equalsTerm++;
|
||||
|
||||
if(src[length+equalsTerm] == '=')
|
||||
equalsTerm++;
|
||||
}
|
||||
numQuantums = (length + equalsTerm) / 4;
|
||||
|
||||
/* Don't allocate a buffer if the decoded length is 0 */
|
||||
if (numQuantums <= 0)
|
||||
return 0;
|
||||
|
||||
rawlen = (numQuantums * 3) - equalsTerm;
|
||||
|
||||
/* The buffer must be large enough to make room for the last quantum
|
||||
(which may be partially thrown out) and the zero terminator. */
|
||||
newstr = malloc(rawlen+4);
|
||||
if(!newstr)
|
||||
return 0;
|
||||
|
||||
*outptr = newstr;
|
||||
|
||||
/* Decode all but the last quantum (which may not decode to a
|
||||
multiple of 3 bytes) */
|
||||
for(i = 0; i < numQuantums - 1; i++) {
|
||||
decodeQuantum((unsigned char *)dest, src);
|
||||
dest += 3; src += 4;
|
||||
decodeQuantum((unsigned char *)newstr, src);
|
||||
newstr += 3; src += 4;
|
||||
}
|
||||
|
||||
/* This final decode may actually read slightly past the end of the buffer
|
||||
if the input string is missing pad bytes. This will almost always be
|
||||
harmless. */
|
||||
decodeQuantum(lastQuantum, src);
|
||||
for(i = 0; i < 3 - equalsTerm; i++)
|
||||
dest[i] = lastQuantum[i];
|
||||
newstr[i] = lastQuantum[i];
|
||||
|
||||
newstr[i] = 0; /* zero terminate */
|
||||
return rawlen;
|
||||
}
|
||||
|
||||
|
@@ -23,5 +23,5 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
size_t Curl_base64_encode(const char *input, size_t size, char **str);
|
||||
size_t Curl_base64_decode(const char *source, char *dest);
|
||||
size_t Curl_base64_decode(const char *source, unsigned char **outptr);
|
||||
#endif
|
||||
|
@@ -640,9 +640,11 @@ singleipconnect(struct connectdata *conn,
|
||||
/* user selected to bind the outgoing socket to a specified "device"
|
||||
before doing connect */
|
||||
CURLcode res = bindlocal(conn, sockfd);
|
||||
if(res)
|
||||
if(res) {
|
||||
sclose(sockfd); /* close socket and bail out */
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/* set socket non-blocking */
|
||||
Curl_nonblock(sockfd, TRUE);
|
||||
|
@@ -651,6 +651,10 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
fp = stdin;
|
||||
fromfile=FALSE;
|
||||
}
|
||||
else if(file && !*file) {
|
||||
/* points to a "" string */
|
||||
fp = NULL;
|
||||
}
|
||||
else
|
||||
fp = file?fopen(file, "r"):NULL;
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -85,7 +85,7 @@
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
CURLcode Curl_dict(struct connectdata *conn)
|
||||
CURLcode Curl_dict(struct connectdata *conn, bool *done)
|
||||
{
|
||||
char *word;
|
||||
char *ppath;
|
||||
@@ -100,6 +100,8 @@ CURLcode Curl_dict(struct connectdata *conn)
|
||||
char *path = conn->path;
|
||||
curl_off_t *bytecount = &conn->bytecount;
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
|
||||
if(conn->bits.user_passwd) {
|
||||
/* AUTH is missing */
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -24,7 +24,7 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_DICT
|
||||
CURLcode Curl_dict(struct connectdata *conn);
|
||||
CURLcode Curl_dict(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_dict_done(struct connectdata *conn);
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -201,7 +201,8 @@ CURLcode curl_global_init(long flags)
|
||||
Curl_ccalloc = (curl_calloc_callback)calloc;
|
||||
|
||||
if (flags & CURL_GLOBAL_SSL)
|
||||
Curl_SSL_init();
|
||||
if (!Curl_SSL_init())
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
if (flags & CURL_GLOBAL_WIN32)
|
||||
if (win32_init() != CURLE_OK)
|
||||
|
20
lib/file.c
20
lib/file.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -87,6 +87,7 @@
|
||||
#include "transfer.h"
|
||||
#include "url.h"
|
||||
#include "memory.h"
|
||||
#include "parsedate.h" /* for the week day and month names */
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -266,7 +267,7 @@ static CURLcode file_upload(struct connectdata *conn)
|
||||
* opposed to sockets) we instead perform the whole do-operation in this
|
||||
* function.
|
||||
*/
|
||||
CURLcode Curl_file(struct connectdata *conn)
|
||||
CURLcode Curl_file(struct connectdata *conn, bool *done)
|
||||
{
|
||||
/* This implementation ignores the host name in conformance with
|
||||
RFC 1738. Only local files (reachable via the standard file system)
|
||||
@@ -286,6 +287,8 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
int fd;
|
||||
struct timeval now = Curl_tvnow();
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
|
||||
Curl_readwrite_init(conn);
|
||||
Curl_initinfo(data);
|
||||
Curl_pgrsStartNow(data);
|
||||
@@ -319,7 +322,6 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
if(fstated) {
|
||||
struct tm *tm;
|
||||
time_t clock = (time_t)statbuf.st_mtime;
|
||||
@@ -330,11 +332,17 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
tm = gmtime(&clock);
|
||||
#endif
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S GMT\r\n",
|
||||
tm);
|
||||
snprintf(buf, BUFSIZE-1,
|
||||
"Last-Modified: %s, %02d %s %4d %02d:%02d:%02d GMT\r\n",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -24,7 +24,7 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
CURLcode Curl_file(struct connectdata *);
|
||||
CURLcode Curl_file(struct connectdata *, bool *done);
|
||||
CURLcode Curl_file_done(struct connectdata *, CURLcode);
|
||||
CURLcode Curl_file_connect(struct connectdata *);
|
||||
#endif
|
||||
|
19
lib/ftp.h
19
lib/ftp.h
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -24,14 +24,21 @@
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
CURLcode Curl_ftp(struct connectdata *conn);
|
||||
CURLcode Curl_ftp(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode);
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_ftp_disconnect(struct connectdata *conn);
|
||||
CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...);
|
||||
CURLcode Curl_nbftpsendf(struct connectdata *, const char *fmt, ...);
|
||||
CURLcode Curl_GetFTPResponse(ssize_t *nread, struct connectdata *conn,
|
||||
int *ftpcode);
|
||||
CURLcode Curl_ftp_nextconnect(struct connectdata *conn);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
CURLcode Curl_ftp_multi_statemach(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_ftp_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
CURLcode Curl_ftp_doing(struct connectdata *conn,
|
||||
bool *dophase_done);
|
||||
#endif /* CURL_DISABLE_FTP */
|
||||
#endif /* __FTP_H */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -99,7 +99,7 @@
|
||||
#ifdef CURLRES_ARES
|
||||
|
||||
/*
|
||||
* Curl_fdset() is called when someone from the outside world (using
|
||||
* Curl_resolv_fdset() is called when someone from the outside world (using
|
||||
* curl_multi_fdset()) wants to get our fd_set setup and we're talking with
|
||||
* ares. The caller must make sure that this function is only called when we
|
||||
* have a working ares channel.
|
||||
@@ -107,7 +107,7 @@
|
||||
* Returns: CURLE_OK always!
|
||||
*/
|
||||
|
||||
CURLcode Curl_fdset(struct connectdata *conn,
|
||||
CURLcode Curl_resolv_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp)
|
||||
|
@@ -67,11 +67,6 @@
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
||||
#undef in_addr_t
|
||||
#define in_addr_t unsigned long
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
|
@@ -67,11 +67,6 @@
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
||||
#undef in_addr_t
|
||||
#define in_addr_t unsigned long
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
|
@@ -159,10 +159,10 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
|
||||
CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
struct Curl_dns_entry **dnsentry);
|
||||
|
||||
/* Curl_fdset() is a generic function that exists in multiple versions
|
||||
/* Curl_resolv_fdset() is a generic function that exists in multiple versions
|
||||
depending on what name resolve technology we've built to use. The function
|
||||
is called from the curl_multi_fdset() function */
|
||||
CURLcode Curl_fdset(struct connectdata *conn,
|
||||
CURLcode Curl_resolv_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
|
@@ -67,11 +67,6 @@
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
||||
#undef in_addr_t
|
||||
#define in_addr_t unsigned long
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -67,11 +67,6 @@
|
||||
#include <process.h>
|
||||
#endif
|
||||
|
||||
#if (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
||||
#undef in_addr_t
|
||||
#define in_addr_t unsigned long
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
@@ -133,7 +128,7 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
|
||||
* It is present here to keep #ifdefs out from multi.c
|
||||
*/
|
||||
|
||||
CURLcode Curl_fdset(struct connectdata *conn,
|
||||
CURLcode Curl_resolv_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp)
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -155,7 +155,7 @@ struct thread_data {
|
||||
HANDLE thread_hnd;
|
||||
unsigned thread_id;
|
||||
DWORD thread_status;
|
||||
curl_socket_t dummy_sock; /* dummy for Curl_fdset() */
|
||||
curl_socket_t dummy_sock; /* dummy for Curl_resolv_fdset() */
|
||||
FILE *stderr_file;
|
||||
HANDLE mutex_waiting; /* marks that we are still waiting for a resolve */
|
||||
HANDLE event_resolved; /* marks that the thread obtained the information */
|
||||
@@ -404,9 +404,9 @@ static bool init_resolve_thread (struct connectdata *conn,
|
||||
destroy_thread_data(&conn->async);
|
||||
return FALSE;
|
||||
}
|
||||
/* This socket is only to keep Curl_fdset() and select() happy; should never
|
||||
* become signalled for read/write since it's unbound but Windows needs
|
||||
* atleast 1 socket in select().
|
||||
/* This socket is only to keep Curl_resolv_fdset() and select() happy;
|
||||
* should never become signalled for read/write since it's unbound but
|
||||
* Windows needs atleast 1 socket in select().
|
||||
*/
|
||||
td->dummy_sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
return TRUE;
|
||||
@@ -541,7 +541,7 @@ CURLcode Curl_is_resolved(struct connectdata *conn,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode Curl_fdset(struct connectdata *conn,
|
||||
CURLcode Curl_resolv_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp)
|
||||
|
77
lib/http.c
77
lib/http.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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,6 +95,7 @@
|
||||
#include "http.h"
|
||||
#include "memory.h"
|
||||
#include "select.h"
|
||||
#include "parsedate.h" /* for the week day and month names */
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -250,22 +251,32 @@ static CURLcode perhapsrewind(struct connectdata *conn)
|
||||
|
||||
if((expectsend == -1) || (expectsend > bytessent)) {
|
||||
/* There is still data left to send */
|
||||
if((data->state.authproxy.picked == CURLAUTH_NTLM) ||/* using NTLM */
|
||||
(data->state.authhost.picked == CURLAUTH_NTLM) ) {
|
||||
conn->bits.close = FALSE; /* don't close, keep on sending */
|
||||
if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
|
||||
(data->state.authhost.picked == CURLAUTH_NTLM)) {
|
||||
if(((expectsend - bytessent) < 2000) ||
|
||||
(conn->ntlm.state != NTLMSTATE_NONE)) {
|
||||
/* The NTLM-negotiation has started *OR* there is just a little (<2K)
|
||||
data left to send, keep on sending. */
|
||||
|
||||
/* rewind data when completely done sending! */
|
||||
if(!conn->bits.authneg)
|
||||
conn->bits.rewindaftersend = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
else {
|
||||
/* If there is more than just a little data left to send, close the
|
||||
* current connection by force.
|
||||
if(conn->bits.close)
|
||||
/* this is already marked to get closed */
|
||||
return CURLE_OK;
|
||||
|
||||
infof(data, "NTLM send, close instead of sending %ld bytes\n",
|
||||
expectsend - bytessent);
|
||||
}
|
||||
|
||||
/* This is not NTLM or NTLM with many bytes left to send: close
|
||||
*/
|
||||
conn->bits.close = TRUE;
|
||||
conn->size = 0; /* don't download any more than 0 bytes */
|
||||
}
|
||||
}
|
||||
|
||||
if(bytessent)
|
||||
return Curl_readrewind(conn);
|
||||
@@ -309,7 +320,8 @@ CURLcode Curl_http_auth_act(struct connectdata *conn)
|
||||
conn->newurl = strdup(data->change.url); /* clone URL */
|
||||
|
||||
if((data->set.httpreq != HTTPREQ_GET) &&
|
||||
(data->set.httpreq != HTTPREQ_HEAD)) {
|
||||
(data->set.httpreq != HTTPREQ_HEAD) &&
|
||||
!conn->bits.rewindaftersend) {
|
||||
code = perhapsrewind(conn);
|
||||
if(code)
|
||||
return code;
|
||||
@@ -391,13 +403,6 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
and if this is one single bit it'll be used instantly. */
|
||||
authproxy->picked = authproxy->want;
|
||||
|
||||
/* To prevent the user+password to get sent to other than the original
|
||||
host due to a location-follow, we do some weirdo checks here */
|
||||
if(!data->state.this_is_a_follow ||
|
||||
!data->state.first_host ||
|
||||
curl_strequal(data->state.first_host, conn->host.name) ||
|
||||
data->set.http_disable_hostname_check_before_authentication) {
|
||||
|
||||
/* Send proxy authentication header if needed */
|
||||
if (conn->bits.httpproxy &&
|
||||
(conn->bits.tunnel_proxy == proxytunnel)) {
|
||||
@@ -447,6 +452,13 @@ Curl_http_output_auth(struct connectdata *conn,
|
||||
with it */
|
||||
authproxy->done = TRUE;
|
||||
|
||||
/* To prevent the user+password to get sent to other than the original
|
||||
host due to a location-follow, we do some weirdo checks here */
|
||||
if(!data->state.this_is_a_follow ||
|
||||
!data->state.first_host ||
|
||||
curl_strequal(data->state.first_host, conn->host.name) ||
|
||||
data->set.http_disable_hostname_check_before_authentication) {
|
||||
|
||||
/* Send web authentication header if needed */
|
||||
{
|
||||
auth = NULL;
|
||||
@@ -1222,7 +1234,7 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
* Curl_http_connect() performs HTTP stuff to do at connect-time, called from
|
||||
* the generic Curl_connect().
|
||||
*/
|
||||
CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
|
||||
{
|
||||
struct SessionHandle *data;
|
||||
CURLcode result;
|
||||
@@ -1261,6 +1273,8 @@ CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
data->state.first_host = strdup(conn->host.name);
|
||||
}
|
||||
|
||||
*done = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -1328,7 +1342,7 @@ CURLcode Curl_http_done(struct connectdata *conn,
|
||||
* request is to be performed. This creates and sends a properly constructed
|
||||
* HTTP request.
|
||||
*/
|
||||
CURLcode Curl_http(struct connectdata *conn)
|
||||
CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
{
|
||||
struct SessionHandle *data=conn->data;
|
||||
char *buf = data->state.buffer; /* this is a short cut to the buffer */
|
||||
@@ -1342,6 +1356,11 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
Curl_HttpReq httpreq = data->set.httpreq;
|
||||
char *addcookies = NULL;
|
||||
|
||||
/* Always consider the DO phase done after this function call, even if there
|
||||
may be parts of the request that is not yet sent, since we can deal with
|
||||
the rest of the request in the PERFORM phase. */
|
||||
*done = TRUE;
|
||||
|
||||
if(!conn->proto.http) {
|
||||
/* Only allocate this struct if we don't already have it! */
|
||||
|
||||
@@ -1776,7 +1795,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
#endif
|
||||
|
||||
if(data->set.timecondition) {
|
||||
struct tm *thistime;
|
||||
struct tm *tm;
|
||||
|
||||
/* Phil Karn (Fri, 13 Apr 2001) pointed out that the If-Modified-Since
|
||||
* header family should have their times set in GMT as RFC2616 defines:
|
||||
@@ -1788,18 +1807,22 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
#ifdef HAVE_GMTIME_R
|
||||
/* thread-safe version */
|
||||
struct tm keeptime;
|
||||
thistime = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
|
||||
tm = (struct tm *)gmtime_r(&data->set.timevalue, &keeptime);
|
||||
#else
|
||||
thistime = gmtime(&data->set.timevalue);
|
||||
tm = gmtime(&data->set.timevalue);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "%a, %d %b %Y %H:%M:%S GMT", thistime);
|
||||
#else
|
||||
/* TODO: Right, we *could* write a replacement here */
|
||||
strcpy(buf, "no strftime() support");
|
||||
#endif
|
||||
snprintf(buf, BUFSIZE-1,
|
||||
"%s, %02d %s %4d %02d:%02d:%02d GMT",
|
||||
Curl_wkday[tm->tm_wday?tm->tm_wday-1:6],
|
||||
tm->tm_mday,
|
||||
Curl_month[tm->tm_mon],
|
||||
tm->tm_year + 1900,
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
|
||||
switch(data->set.timecondition) {
|
||||
case CURL_TIMECOND_IFMODSINCE:
|
||||
default:
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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,9 +34,9 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
char *hostname, int remote_port);
|
||||
|
||||
/* protocol-specific functions set up to be called by the main engine */
|
||||
CURLcode Curl_http(struct connectdata *conn);
|
||||
CURLcode Curl_http(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_http_done(struct connectdata *, CURLcode);
|
||||
CURLcode Curl_http_connect(struct connectdata *conn);
|
||||
CURLcode Curl_http_connect(struct connectdata *conn, bool *done);
|
||||
|
||||
/* The following functions are defined in http_chunks.c */
|
||||
void Curl_httpchunk_init(struct connectdata *conn);
|
||||
|
@@ -166,12 +166,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
|
||||
|
||||
len = strlen(header);
|
||||
if (len > 0) {
|
||||
int rawlen;
|
||||
input_token.length = (len+3)/4 * 3;
|
||||
input_token.value = malloc(input_token.length);
|
||||
if (input_token.value == NULL)
|
||||
return ENOMEM;
|
||||
rawlen = Curl_base64_decode(header, input_token.value);
|
||||
int rawlen = Curl_base64_decode(header, (unsigned char **)&input_token.value);
|
||||
if (rawlen < 0)
|
||||
return -1;
|
||||
input_token.length = rawlen;
|
||||
@@ -211,7 +206,7 @@ int Curl_input_negotiate(struct connectdata *conn, char *header)
|
||||
input_token.length = mechTokenLength;
|
||||
free(mechToken);
|
||||
mechToken = NULL;
|
||||
infof(conn->data, "Parse SPNEGO Target Token succeded\n");
|
||||
infof(conn->data, "Parse SPNEGO Target Token succeeded\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -292,7 +287,7 @@ CURLcode Curl_output_negotiate(struct connectdata *conn)
|
||||
neg_ctx->output_token.length = spnegoTokenLength;
|
||||
free(spnegoToken);
|
||||
spnegoToken = NULL;
|
||||
infof(conn->data, "Make SPNEGO Initial Token succeded\n");
|
||||
infof(conn->data, "Make SPNEGO Initial Token succeeded\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -103,7 +103,6 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
|
||||
header++;
|
||||
|
||||
if(checkprefix("NTLM", header)) {
|
||||
unsigned char buffer[256];
|
||||
header += strlen("NTLM");
|
||||
|
||||
while(*header && isspace((int)*header))
|
||||
@@ -123,17 +122,22 @@ CURLntlm Curl_input_ntlm(struct connectdata *conn,
|
||||
(40) Target Information (optional) security buffer(*)
|
||||
32 (48) start of data block
|
||||
*/
|
||||
|
||||
size_t size = Curl_base64_decode(header, (char *)buffer);
|
||||
size_t size;
|
||||
unsigned char *buffer;
|
||||
size = Curl_base64_decode(header, &buffer);
|
||||
if(!buffer)
|
||||
return CURLNTLM_BAD;
|
||||
|
||||
ntlm->state = NTLMSTATE_TYPE2; /* we got a type-2 */
|
||||
|
||||
if(size >= 48)
|
||||
/* the nonce of interest is index [24 .. 31], 8 bytes */
|
||||
memcpy(ntlm->nonce, &buffer[24], 8);
|
||||
/* FIX: add an else here! */
|
||||
|
||||
/* at index decimal 20, there's a 32bit NTLM flag field */
|
||||
|
||||
free(buffer);
|
||||
}
|
||||
else {
|
||||
if(ntlm->state >= NTLMSTATE_TYPE1)
|
||||
|
26
lib/krb4.c
26
lib/krb4.c
@@ -199,7 +199,8 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
{
|
||||
int ret;
|
||||
char *p;
|
||||
int len;
|
||||
unsigned char *ptr;
|
||||
size_t len;
|
||||
KTEXT_ST adat;
|
||||
MSG_DAT msg_data;
|
||||
int checksum;
|
||||
@@ -275,11 +276,17 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
p += 5;
|
||||
len = Curl_base64_decode(p, (char *)adat.dat);
|
||||
if(len < 0) {
|
||||
len = Curl_base64_decode(p, &ptr);
|
||||
if(len > sizeof(adat.dat)-1) {
|
||||
free(ptr);
|
||||
len=0;
|
||||
}
|
||||
if(!len || !ptr) {
|
||||
Curl_failf(data, "Failed to decode base64 from server");
|
||||
return AUTH_ERROR;
|
||||
}
|
||||
memcpy((char *)adat.dat, ptr, len);
|
||||
free(ptr);
|
||||
adat.length = len;
|
||||
ret = krb_rd_safe(adat.dat, adat.length, &d->key,
|
||||
(struct sockaddr_in *)hisctladdr,
|
||||
@@ -317,10 +324,11 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
char *name;
|
||||
char *p;
|
||||
char passwd[100];
|
||||
int tmp;
|
||||
size_t tmp;
|
||||
ssize_t nread;
|
||||
int save;
|
||||
CURLcode result;
|
||||
unsigned char *ptr;
|
||||
|
||||
save = Curl_set_command_prot(conn, prot_private);
|
||||
|
||||
@@ -346,12 +354,18 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
}
|
||||
|
||||
p += 2;
|
||||
tmp = Curl_base64_decode(p, (char *)tkt.dat);
|
||||
if(tmp < 0) {
|
||||
tmp = Curl_base64_decode(p, &ptr);
|
||||
if(tmp >= sizeof(tkt.dat)) {
|
||||
free(ptr);
|
||||
tmp=0;
|
||||
}
|
||||
if(!tmp || !ptr) {
|
||||
Curl_failf(conn->data, "Failed to decode base64 in reply.\n");
|
||||
Curl_set_command_prot(conn, save);
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
memcpy((char *)tkt.dat, ptr, tmp);
|
||||
free(ptr);
|
||||
tkt.length = tmp;
|
||||
tktcopy.length = tkt.length;
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -224,7 +224,7 @@ static void (*ldap_free_urldesc)(LDAPURLDesc *) = _ldap_free_urldesc;
|
||||
#endif
|
||||
|
||||
|
||||
CURLcode Curl_ldap(struct connectdata *conn)
|
||||
CURLcode Curl_ldap(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode status = CURLE_OK;
|
||||
int rc = 0;
|
||||
@@ -256,6 +256,7 @@ CURLcode Curl_ldap(struct connectdata *conn)
|
||||
int num = 0;
|
||||
struct SessionHandle *data=conn->data;
|
||||
|
||||
*done = TRUE; /* unconditionally */
|
||||
infof(data, "LDAP local: %s\n", data->change.url);
|
||||
|
||||
if (!DynaOpen(&mod_name)) {
|
||||
@@ -379,6 +380,7 @@ quit:
|
||||
|
||||
/* no data to transfer */
|
||||
Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||
conn->bits.close = TRUE;
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -473,9 +475,9 @@ static bool unescape_elements (LDAPURLDesc *ludp)
|
||||
char *new_dn = curl_unescape(dn, 0);
|
||||
|
||||
free(dn);
|
||||
ludp->lud_dn = new_dn;
|
||||
if (!new_dn)
|
||||
return (FALSE);
|
||||
ludp->lud_dn = new_dn;
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -24,6 +24,6 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_LDAP
|
||||
CURLcode Curl_ldap(struct connectdata *conn);
|
||||
CURLcode Curl_ldap(struct connectdata *conn, bool *done);
|
||||
#endif
|
||||
#endif /* __LDAP_H */
|
||||
|
191
lib/multi.c
191
lib/multi.c
@@ -45,6 +45,7 @@
|
||||
#include "memory.h"
|
||||
#include "easyif.h"
|
||||
#include "multiif.h"
|
||||
#include "sendf.h"
|
||||
|
||||
/* The last #include file should be: */
|
||||
#include "memdebug.h"
|
||||
@@ -56,11 +57,14 @@ struct Curl_message {
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
CURLM_STATE_INIT,
|
||||
CURLM_STATE_INIT, /* start in this state */
|
||||
CURLM_STATE_CONNECT, /* resolve/connect has been sent off */
|
||||
CURLM_STATE_WAITRESOLVE, /* we're awaiting the resolve to finalize */
|
||||
CURLM_STATE_WAITCONNECT, /* we're awaiting the connect to finalize */
|
||||
CURLM_STATE_DO, /* send off the request (part 1) */
|
||||
CURLM_STATE_WAITRESOLVE, /* awaiting the resolve to finalize */
|
||||
CURLM_STATE_WAITCONNECT, /* awaiting the connect to finalize */
|
||||
CURLM_STATE_PROTOCONNECT, /* completing the protocol-specific connect
|
||||
phase */
|
||||
CURLM_STATE_DO, /* start send off the request (part 1) */
|
||||
CURLM_STATE_DOING, /* sending off the request (part 1) */
|
||||
CURLM_STATE_DO_MORE, /* send off the request (part 2) */
|
||||
CURLM_STATE_PERFORM, /* transfer data */
|
||||
CURLM_STATE_DONE, /* post data transfer operation */
|
||||
@@ -111,6 +115,33 @@ struct Curl_multi {
|
||||
struct curl_hash *hostcache;
|
||||
};
|
||||
|
||||
/* always use this function to change state, to make debugging easier */
|
||||
static void multistate(struct Curl_one_easy *easy, CURLMstate state)
|
||||
{
|
||||
#ifdef CURLDEBUG
|
||||
const char *statename[]={
|
||||
"INIT",
|
||||
"CONNECT",
|
||||
"WAITRESOLVE",
|
||||
"WAITCONNECT",
|
||||
"PROTOCONNECT",
|
||||
"DO",
|
||||
"DOING",
|
||||
"DO_MORE",
|
||||
"PERFORM",
|
||||
"DONE",
|
||||
"COMPLETED",
|
||||
};
|
||||
CURLMstate oldstate = easy->state;
|
||||
#endif
|
||||
easy->state = state;
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
infof(easy->easy_handle,
|
||||
"STATE: %s => %s handle %p: \n",
|
||||
statename[oldstate], statename[easy->state], (char *)easy);
|
||||
#endif
|
||||
}
|
||||
|
||||
CURLM *curl_multi_init(void)
|
||||
{
|
||||
@@ -158,7 +189,7 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
|
||||
|
||||
/* set the easy handle */
|
||||
easy->easy_handle = easy_handle;
|
||||
easy->state = CURLM_STATE_INIT;
|
||||
multistate(easy, CURLM_STATE_INIT);
|
||||
|
||||
/* for multi interface connections, we share DNS cache automaticly */
|
||||
easy->easy_handle->hostcache = multi->hostcache;
|
||||
@@ -258,7 +289,22 @@ CURLMcode curl_multi_fdset(CURLM *multi_handle,
|
||||
break;
|
||||
case CURLM_STATE_WAITRESOLVE:
|
||||
/* waiting for a resolve to complete */
|
||||
Curl_fdset(easy->easy_conn, read_fd_set, write_fd_set, &this_max_fd);
|
||||
Curl_resolv_fdset(easy->easy_conn, read_fd_set, write_fd_set,
|
||||
&this_max_fd);
|
||||
if(this_max_fd > *max_fd)
|
||||
*max_fd = this_max_fd;
|
||||
break;
|
||||
|
||||
case CURLM_STATE_PROTOCONNECT:
|
||||
Curl_protocol_fdset(easy->easy_conn, read_fd_set, write_fd_set,
|
||||
&this_max_fd);
|
||||
if(this_max_fd > *max_fd)
|
||||
*max_fd = this_max_fd;
|
||||
break;
|
||||
|
||||
case CURLM_STATE_DOING:
|
||||
Curl_doing_fdset(easy->easy_conn, read_fd_set, write_fd_set,
|
||||
&this_max_fd);
|
||||
if(this_max_fd > *max_fd)
|
||||
*max_fd = this_max_fd;
|
||||
break;
|
||||
@@ -318,6 +364,8 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
struct Curl_message *msg = NULL;
|
||||
bool connected;
|
||||
bool async;
|
||||
bool protocol_connect;
|
||||
bool dophase_done;
|
||||
|
||||
*running_handles = 0; /* bump this once for every living handle */
|
||||
|
||||
@@ -326,10 +374,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
|
||||
easy=multi->easy.next;
|
||||
while(easy) {
|
||||
#if 0
|
||||
fprintf(stderr, "HANDLE %p: State: %x\n",
|
||||
(char *)easy, easy->state);
|
||||
#endif
|
||||
do {
|
||||
if (CURLM_STATE_WAITCONNECT <= easy->state &&
|
||||
easy->state <= CURLM_STATE_DO &&
|
||||
@@ -344,13 +388,13 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
easy->easy_handle->change.url_changed = FALSE;
|
||||
easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE);
|
||||
if(CURLE_OK == easy->result)
|
||||
easy->state = CURLM_STATE_CONNECT;
|
||||
multistate(easy, CURLM_STATE_CONNECT);
|
||||
else
|
||||
free(gotourl);
|
||||
}
|
||||
else {
|
||||
easy->result = CURLE_OUT_OF_MEMORY;
|
||||
easy->state = CURLM_STATE_COMPLETED;
|
||||
multistate(easy, CURLM_STATE_COMPLETED);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +409,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
|
||||
if(CURLE_OK == easy->result) {
|
||||
/* after init, go CONNECT */
|
||||
easy->state = CURLM_STATE_CONNECT;
|
||||
multistate(easy, CURLM_STATE_CONNECT);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
|
||||
easy->easy_handle->state.used_interface = Curl_if_multi;
|
||||
@@ -376,16 +420,22 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
/* Connect. We get a connection identifier filled in. */
|
||||
Curl_pgrsTime(easy->easy_handle, TIMER_STARTSINGLE);
|
||||
easy->result = Curl_connect(easy->easy_handle, &easy->easy_conn,
|
||||
&async);
|
||||
&async, &protocol_connect);
|
||||
|
||||
if(CURLE_OK == easy->result) {
|
||||
if(async)
|
||||
/* We're now waiting for an asynchronous name lookup */
|
||||
easy->state = CURLM_STATE_WAITRESOLVE;
|
||||
multistate(easy, CURLM_STATE_WAITRESOLVE);
|
||||
else {
|
||||
/* after the connect has been sent off, go WAITCONNECT */
|
||||
easy->state = CURLM_STATE_WAITCONNECT;
|
||||
/* after the connect has been sent off, go WAITCONNECT unless the
|
||||
protocol connect is already done and we can go directly to
|
||||
DO! */
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
|
||||
if(protocol_connect)
|
||||
multistate(easy, CURLM_STATE_DO);
|
||||
else
|
||||
multistate(easy, CURLM_STATE_WAITCONNECT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -401,14 +451,17 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
if(dns) {
|
||||
/* Perform the next step in the connection phase, and then move on
|
||||
to the WAITCONNECT state */
|
||||
easy->result = Curl_async_resolved(easy->easy_conn);
|
||||
easy->result = Curl_async_resolved(easy->easy_conn,
|
||||
&protocol_connect);
|
||||
|
||||
if(CURLE_OK != easy->result)
|
||||
/* if Curl_async_resolved() returns failure, the connection struct
|
||||
is already freed and gone */
|
||||
easy->easy_conn = NULL; /* no more connection */
|
||||
|
||||
easy->state = CURLM_STATE_WAITCONNECT;
|
||||
else {
|
||||
/* FIX: what if protocol_connect is TRUE here?! */
|
||||
multistate(easy, CURLM_STATE_WAITCONNECT);
|
||||
}
|
||||
}
|
||||
|
||||
if(CURLE_OK != easy->result) {
|
||||
@@ -425,7 +478,8 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
easy->result = Curl_is_connected(easy->easy_conn, FIRSTSOCKET,
|
||||
&connected);
|
||||
if(connected)
|
||||
easy->result = Curl_protocol_connect(easy->easy_conn);
|
||||
easy->result = Curl_protocol_connect(easy->easy_conn,
|
||||
&protocol_connect);
|
||||
|
||||
if(CURLE_OK != easy->result) {
|
||||
/* failure detected */
|
||||
@@ -435,29 +489,64 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
}
|
||||
|
||||
if(connected) {
|
||||
if(!protocol_connect) {
|
||||
/* We have a TCP connection, but 'protocol_connect' may be false
|
||||
and then we continue to 'STATE_PROTOCONNECT'. If protocol
|
||||
connect is TRUE, we move on to STATE_DO. */
|
||||
multistate(easy, CURLM_STATE_PROTOCONNECT);
|
||||
fprintf(stderr, "WAITCONNECT => PROTOCONNECT\n");
|
||||
}
|
||||
else {
|
||||
/* after the connect has completed, go DO */
|
||||
easy->state = CURLM_STATE_DO;
|
||||
multistate(easy, CURLM_STATE_DO);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLM_STATE_PROTOCONNECT:
|
||||
/* protocol-specific connect phase */
|
||||
easy->result = Curl_protocol_connecting(easy->easy_conn,
|
||||
&protocol_connect);
|
||||
if(protocol_connect) {
|
||||
/* after the connect has completed, go DO */
|
||||
multistate(easy, CURLM_STATE_DO);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
else if(easy->result) {
|
||||
/* failure detected */
|
||||
Curl_posttransfer(easy->easy_handle);
|
||||
Curl_done(&easy->easy_conn, easy->result);
|
||||
Curl_disconnect(easy->easy_conn); /* close the connection */
|
||||
easy->easy_conn = NULL; /* no more connection */
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLM_STATE_DO:
|
||||
/* Do the fetch or put request */
|
||||
easy->result = Curl_do(&easy->easy_conn);
|
||||
/* Perform the protocol's DO action */
|
||||
easy->result = Curl_do(&easy->easy_conn, &dophase_done);
|
||||
|
||||
if(CURLE_OK == easy->result) {
|
||||
|
||||
/* after do, go PERFORM... or DO_MORE */
|
||||
if(easy->easy_conn->bits.do_more) {
|
||||
if(!dophase_done) {
|
||||
/* DO was not completed in one function call, we must continue
|
||||
DOING... */
|
||||
multistate(easy, CURLM_STATE_DOING);
|
||||
result = CURLM_OK;
|
||||
}
|
||||
|
||||
/* after DO, go PERFORM... or DO_MORE */
|
||||
else if(easy->easy_conn->bits.do_more) {
|
||||
/* we're supposed to do more, but we need to sit down, relax
|
||||
and wait a little while first */
|
||||
easy->state = CURLM_STATE_DO_MORE;
|
||||
multistate(easy, CURLM_STATE_DO_MORE);
|
||||
result = CURLM_OK;
|
||||
}
|
||||
else {
|
||||
/* we're done with the DO, now PERFORM */
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
if(CURLE_OK == easy->result) {
|
||||
easy->state = CURLM_STATE_PERFORM;
|
||||
multistate(easy, CURLM_STATE_PERFORM);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
@@ -471,10 +560,39 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLM_STATE_DOING:
|
||||
/* we continue DOING until the DO phase is complete */
|
||||
easy->result = Curl_protocol_doing(easy->easy_conn, &dophase_done);
|
||||
if(CURLE_OK == easy->result) {
|
||||
if(dophase_done) {
|
||||
/* after DO, go PERFORM... or DO_MORE */
|
||||
if(easy->easy_conn->bits.do_more) {
|
||||
/* we're supposed to do more, but we need to sit down, relax
|
||||
and wait a little while first */
|
||||
multistate(easy, CURLM_STATE_DO_MORE);
|
||||
result = CURLM_OK;
|
||||
}
|
||||
else {
|
||||
/* we're done with the DO, now PERFORM */
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
if(CURLE_OK == easy->result) {
|
||||
multistate(easy, CURLM_STATE_PERFORM);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
} /* dophase_done */
|
||||
}
|
||||
else {
|
||||
/* failure detected */
|
||||
Curl_posttransfer(easy->easy_handle);
|
||||
Curl_done(&easy->easy_conn, easy->result);
|
||||
Curl_disconnect(easy->easy_conn); /* close the connection */
|
||||
easy->easy_conn = NULL; /* no more connection */
|
||||
}
|
||||
break;
|
||||
|
||||
case CURLM_STATE_DO_MORE:
|
||||
/*
|
||||
* First, check if we really are ready to do more.
|
||||
*/
|
||||
/* Ready to do more? */
|
||||
easy->result = Curl_is_connected(easy->easy_conn, SECONDARYSOCKET,
|
||||
&connected);
|
||||
if(connected) {
|
||||
@@ -487,7 +605,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
easy->result = Curl_readwrite_init(easy->easy_conn);
|
||||
|
||||
if(CURLE_OK == easy->result) {
|
||||
easy->state = CURLM_STATE_PERFORM;
|
||||
multistate(easy, CURLM_STATE_PERFORM);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +650,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
if(easy->result == CURLE_OK)
|
||||
easy->result = Curl_follow(easy->easy_handle, newurl, retry);
|
||||
if(CURLE_OK == easy->result) {
|
||||
easy->state = CURLM_STATE_CONNECT;
|
||||
multistate(easy, CURLM_STATE_CONNECT);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
else
|
||||
@@ -542,7 +660,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
}
|
||||
else {
|
||||
/* after the transfer is done, go DONE */
|
||||
easy->state = CURLM_STATE_DONE;
|
||||
multistate(easy, CURLM_STATE_DONE);
|
||||
result = CURLM_CALL_MULTI_PERFORM;
|
||||
}
|
||||
}
|
||||
@@ -553,7 +671,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
|
||||
/* after we have DONE what we're supposed to do, go COMPLETED, and
|
||||
it doesn't matter what the Curl_done() returned! */
|
||||
easy->state = CURLM_STATE_COMPLETED;
|
||||
multistate(easy, CURLM_STATE_COMPLETED);
|
||||
break;
|
||||
|
||||
case CURLM_STATE_COMPLETED:
|
||||
@@ -571,7 +689,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
/*
|
||||
* If an error was returned, and we aren't in completed state now,
|
||||
* then we go to completed and consider this transfer aborted. */
|
||||
easy->state = CURLM_STATE_COMPLETED;
|
||||
multistate(easy, CURLM_STATE_COMPLETED);
|
||||
}
|
||||
else
|
||||
/* this one still lives! */
|
||||
@@ -600,7 +718,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
|
||||
|
||||
multi->num_msgs++; /* increase message counter */
|
||||
}
|
||||
|
||||
easy = easy->next; /* operate on next handle */
|
||||
}
|
||||
|
||||
|
@@ -27,5 +27,4 @@
|
||||
* Prototypes for library-wide functions provided by multi.c
|
||||
*/
|
||||
void Curl_multi_rmeasy(void *multi, CURL *data);
|
||||
|
||||
#endif /* __MULTIIF_H */
|
||||
|
@@ -86,13 +86,13 @@
|
||||
|
||||
static time_t Curl_parsedate(const char *date);
|
||||
|
||||
static const char * const wkday[] =
|
||||
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
|
||||
const char * const Curl_wkday[] =
|
||||
{"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
|
||||
static const char * const weekday[] =
|
||||
{ "Monday", "Tuesday", "Wednesday", "Thursday",
|
||||
{ "Monday", "Tuesday", "Wednesday", "Thursday",
|
||||
"Friday", "Saturday", "Sunday" };
|
||||
static const char * const month[]=
|
||||
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
const char * const Curl_month[]=
|
||||
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
|
||||
struct tzinfo {
|
||||
@@ -161,7 +161,7 @@ static int checkday(char *check, size_t len)
|
||||
if(len > 3)
|
||||
what = &weekday[0];
|
||||
else
|
||||
what = &wkday[0];
|
||||
what = &Curl_wkday[0];
|
||||
for(i=0; i<7; i++) {
|
||||
if(curl_strequal(check, what[0])) {
|
||||
found=TRUE;
|
||||
@@ -178,7 +178,7 @@ static int checkmonth(char *check)
|
||||
const char * const *what;
|
||||
bool found= FALSE;
|
||||
|
||||
what = &month[0];
|
||||
what = &Curl_month[0];
|
||||
for(i=0; i<12; i++) {
|
||||
if(curl_strequal(check, what[0])) {
|
||||
found=TRUE;
|
||||
|
28
lib/parsedate.h
Normal file
28
lib/parsedate.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef __PARSEDATE_H
|
||||
#define __PARSEDATEL_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, 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
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
extern const char * const Curl_wkday[7];
|
||||
extern const char * const Curl_month[12];
|
||||
|
||||
#endif
|
@@ -297,13 +297,15 @@ int
|
||||
Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
|
||||
{
|
||||
int len;
|
||||
char *buf;
|
||||
unsigned char *buf;
|
||||
int code;
|
||||
|
||||
buf = malloc(strlen(s));
|
||||
len = Curl_base64_decode(s + 4, buf); /* XXX */
|
||||
|
||||
len = Curl_base64_decode(s + 4, &buf); /* XXX */
|
||||
if(len > 0)
|
||||
len = (conn->mech->decode)(conn->app_data, buf, len, level, conn);
|
||||
else
|
||||
return -1;
|
||||
|
||||
if(len < 0) {
|
||||
free(buf);
|
||||
return -1;
|
||||
@@ -314,10 +316,10 @@ Curl_sec_read_msg(struct connectdata *conn, char *s, int level)
|
||||
if(buf[3] == '-')
|
||||
code = 0;
|
||||
else
|
||||
sscanf(buf, "%d", &code);
|
||||
sscanf((char *)buf, "%d", &code);
|
||||
if(buf[len-1] == '\n')
|
||||
buf[len-1] = '\0';
|
||||
strcpy(s, buf);
|
||||
strcpy(s, (char *)buf);
|
||||
free(buf);
|
||||
return code;
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
|
80
lib/ssluse.c
80
lib/ssluse.c
@@ -169,7 +169,7 @@ int random_the_seed(struct SessionHandle *data)
|
||||
/* let the option override the define */
|
||||
nread += RAND_load_file((data->set.ssl.random_file?
|
||||
data->set.ssl.random_file:RANDOM_FILE),
|
||||
16384);
|
||||
-1); /* -1 to read the entire file */
|
||||
if(seed_enough(nread))
|
||||
return nread;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ int random_the_seed(struct SessionHandle *data)
|
||||
RAND_file_name(buf, BUFSIZE);
|
||||
if(buf[0]) {
|
||||
/* we got a file name to try */
|
||||
nread += RAND_load_file(buf, 16384);
|
||||
nread += RAND_load_file(buf, -1);
|
||||
if(seed_enough(nread))
|
||||
return nread;
|
||||
}
|
||||
@@ -450,6 +450,11 @@ int cert_stuff(struct connectdata *conn,
|
||||
}
|
||||
|
||||
ssl=SSL_new(ctx);
|
||||
if (NULL == ssl) {
|
||||
failf(data,"unable to create an SSL structure\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
x509=SSL_get_certificate(ssl);
|
||||
|
||||
/* This version was provided by Evan Jordan and is supposed to not
|
||||
@@ -515,15 +520,18 @@ static int init_ssl=0;
|
||||
static bool ssl_seeded = FALSE;
|
||||
#endif /* USE_SSLEAY */
|
||||
|
||||
/* Global init */
|
||||
void Curl_SSL_init(void)
|
||||
/**
|
||||
* Global SSL init
|
||||
*
|
||||
* @retval 0 error initializing SSL
|
||||
* @retval 1 SSL initialized successfully
|
||||
*/
|
||||
int Curl_SSL_init(void)
|
||||
{
|
||||
#ifdef USE_SSLEAY
|
||||
/* make sure this is only done once */
|
||||
if(0 != init_ssl)
|
||||
return;
|
||||
|
||||
init_ssl++; /* never again */
|
||||
if(init_ssl)
|
||||
return 1;
|
||||
|
||||
#ifdef HAVE_ENGINE_LOAD_BUILTIN_ENGINES
|
||||
ENGINE_load_builtin_engines();
|
||||
@@ -533,10 +541,16 @@ void Curl_SSL_init(void)
|
||||
SSL_load_error_strings();
|
||||
|
||||
/* Setup all the global SSL stuff */
|
||||
SSLeay_add_ssl_algorithms();
|
||||
if (!SSLeay_add_ssl_algorithms())
|
||||
return 0;
|
||||
|
||||
init_ssl++; /* never again */
|
||||
|
||||
#else
|
||||
/* SSL disabled, do nothing */
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Global cleanup */
|
||||
@@ -784,6 +798,7 @@ int Curl_SSL_Close_All(struct SessionHandle *data)
|
||||
|
||||
/* free the cache data */
|
||||
free(data->state.session);
|
||||
data->state.session = NULL;
|
||||
}
|
||||
#ifdef HAVE_OPENSSL_ENGINE_H
|
||||
if(data->state.engine) {
|
||||
@@ -798,7 +813,7 @@ int Curl_SSL_Close_All(struct SessionHandle *data)
|
||||
/*
|
||||
* Extract the session id and store it in the session cache.
|
||||
*/
|
||||
static int Store_SSL_Session(struct connectdata *conn,
|
||||
static CURLcode Store_SSL_Session(struct connectdata *conn,
|
||||
struct ssl_connect_data *ssl)
|
||||
{
|
||||
SSL_SESSION *ssl_sessionid;
|
||||
@@ -810,7 +825,7 @@ static int Store_SSL_Session(struct connectdata *conn,
|
||||
|
||||
clone_host = strdup(conn->host.name);
|
||||
if(!clone_host)
|
||||
return -1; /* bail out */
|
||||
return CURLE_OUT_OF_MEMORY; /* bail out */
|
||||
|
||||
/* ask OpenSSL, say please */
|
||||
|
||||
@@ -857,9 +872,10 @@ static int Store_SSL_Session(struct connectdata *conn,
|
||||
store->name = clone_host; /* clone host name */
|
||||
store->remote_port = conn->remote_port; /* port number */
|
||||
|
||||
Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config);
|
||||
if (!Curl_clone_ssl_config(&conn->ssl_config, &store->ssl_config))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
return 0;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static int Curl_ASN1_UTCTIME_output(struct connectdata *conn,
|
||||
@@ -1313,9 +1329,16 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
|
||||
#ifdef SSL_CTRL_SET_MSG_CALLBACK
|
||||
if (data->set.fdebug) {
|
||||
SSL_CTX_callback_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK,
|
||||
ssl_tls_trace);
|
||||
SSL_CTX_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, conn);
|
||||
if (!SSL_CTX_callback_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK,
|
||||
ssl_tls_trace)) {
|
||||
failf(data, "SSL: couldn't set callback!");
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
if (!SSL_CTX_ctrl(connssl->ctx, SSL_CTRL_SET_MSG_CALLBACK_ARG, 0, conn)) {
|
||||
failf(data, "SSL: couldn't set callback argument!");
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1409,6 +1432,10 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
|
||||
/* Lets make an SSL structure */
|
||||
connssl->handle = SSL_new(connssl->ctx);
|
||||
if (!connssl->handle) {
|
||||
failf(data, "SSL: couldn't create a context (handle)!");
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
SSL_set_connect_state(connssl->handle);
|
||||
|
||||
connssl->server_cert = 0x0;
|
||||
@@ -1418,14 +1445,22 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
can/should use here! */
|
||||
if(!Get_SSL_Session(conn, &ssl_sessionid)) {
|
||||
/* we got a session id, use it! */
|
||||
SSL_set_session(connssl->handle, ssl_sessionid);
|
||||
if (!SSL_set_session(connssl->handle, ssl_sessionid)) {
|
||||
failf(data, "SSL: SSL_set_session failed: %s",
|
||||
ERR_error_string(ERR_get_error(),NULL));
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
/* Informational message */
|
||||
infof (data, "SSL re-using session ID\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* pass the raw socket into the SSL layers */
|
||||
SSL_set_fd(connssl->handle, sockfd);
|
||||
if (!SSL_set_fd(connssl->handle, sockfd)) {
|
||||
failf(data, "SSL: SSL_set_fd failed: %s",
|
||||
ERR_error_string(ERR_get_error(),NULL));
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
int writefd;
|
||||
@@ -1563,7 +1598,11 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
if(!ssl_sessionid) {
|
||||
/* Since this is not a cached session ID, then we want to stach this one
|
||||
in the cache! */
|
||||
Store_SSL_Session(conn, connssl);
|
||||
retcode = Store_SSL_Session(conn, connssl);
|
||||
if(retcode) {
|
||||
failf(data,"failure to store ssl session");
|
||||
return retcode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1585,6 +1624,7 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
if(!str) {
|
||||
failf(data, "SSL: couldn't get X509-subject!");
|
||||
X509_free(connssl->server_cert);
|
||||
connssl->server_cert = NULL;
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
infof(data, "\t subject: %s\n", str);
|
||||
@@ -1600,6 +1640,7 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
retcode = verifyhost(conn, connssl->server_cert);
|
||||
if(retcode) {
|
||||
X509_free(connssl->server_cert);
|
||||
connssl->server_cert = NULL;
|
||||
return retcode;
|
||||
}
|
||||
}
|
||||
@@ -1637,6 +1678,7 @@ Curl_SSLConnect(struct connectdata *conn,
|
||||
}
|
||||
|
||||
X509_free(connssl->server_cert);
|
||||
connssl->server_cert = NULL;
|
||||
#else /* USE_SSLEAY */
|
||||
(void)conn;
|
||||
(void)sockindex;
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "urldata.h"
|
||||
CURLcode Curl_SSLConnect(struct connectdata *conn, int sockindex);
|
||||
|
||||
void Curl_SSL_init(void); /* Global SSL init */
|
||||
int Curl_SSL_init(void); /* Global SSL init */
|
||||
void Curl_SSL_cleanup(void); /* Global SSL cleanup */
|
||||
|
||||
/* init the SSL session ID cache */
|
||||
|
@@ -236,6 +236,9 @@ curl_easy_strerror(CURLcode error)
|
||||
case CURLE_SEND_FAIL_REWIND:
|
||||
return "Send failed since rewinding of the data stream failed";
|
||||
|
||||
case CURLE_LOGIN_DENIED:
|
||||
return "FTP: login denied";;
|
||||
|
||||
case CURLE_URL_MALFORMAT_USER: /* not used by current libcurl */
|
||||
case CURLE_MALFORMAT_USER: /* not used by current libcurl */
|
||||
case CURLE_BAD_CALLING_ORDER: /* not used by current libcurl */
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -1065,7 +1065,7 @@ CURLcode Curl_telnet_done(struct connectdata *conn, CURLcode status)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
CURLcode Curl_telnet(struct connectdata *conn)
|
||||
CURLcode Curl_telnet(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode code;
|
||||
struct SessionHandle *data = conn->data;
|
||||
@@ -1093,6 +1093,8 @@ CURLcode Curl_telnet(struct connectdata *conn)
|
||||
char *buf = data->state.buffer;
|
||||
struct TELNET *tn;
|
||||
|
||||
*done = TRUE; /* uncontionally */
|
||||
|
||||
code = init_telnet(conn);
|
||||
if(code)
|
||||
return code;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -24,7 +24,7 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_TELNET
|
||||
CURLcode Curl_telnet(struct connectdata *conn);
|
||||
CURLcode Curl_telnet(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_telnet_done(struct connectdata *conn, CURLcode);
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -242,6 +242,19 @@ CURLcode Curl_readrewind(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#ifdef USE_SSLEAY
|
||||
static int data_pending(struct connectdata *conn)
|
||||
{
|
||||
if(conn->ssl[FIRSTSOCKET].handle)
|
||||
/* SSL is in use */
|
||||
return SSL_pending(conn->ssl[FIRSTSOCKET].handle);
|
||||
|
||||
return 0; /* nothing */
|
||||
}
|
||||
#else
|
||||
/* non-SSL never have pending data */
|
||||
#define data_pending(x) 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Curl_readwrite() is the low-level function to be called when data is to
|
||||
@@ -528,6 +541,13 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(conn->bits.rewindaftersend) {
|
||||
/* We rewind after a complete send, so thus we continue
|
||||
sending now */
|
||||
infof(data, "Keep sending data to get tossed away!\n");
|
||||
k->keepon |= KEEP_WRITE;
|
||||
}
|
||||
}
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
@@ -1147,7 +1167,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|
||||
k->keepon &= ~KEEP_READ;
|
||||
}
|
||||
|
||||
} while(0);
|
||||
} while(data_pending(conn));
|
||||
|
||||
} /* if( read from socket ) */
|
||||
|
||||
@@ -2027,9 +2047,11 @@ Curl_connect_host(struct SessionHandle *data,
|
||||
|
||||
do {
|
||||
bool async;
|
||||
bool protocol_done=TRUE; /* will be TRUE always since this is only used
|
||||
within the easy interface */
|
||||
Curl_pgrsTime(data, TIMER_STARTSINGLE);
|
||||
data->change.url_changed = FALSE;
|
||||
res = Curl_connect(data, conn, &async);
|
||||
res = Curl_connect(data, conn, &async, &protocol_done);
|
||||
|
||||
if((CURLE_OK == res) && async) {
|
||||
/* Now, if async is TRUE here, we need to wait for the name
|
||||
@@ -2037,8 +2059,9 @@ Curl_connect_host(struct SessionHandle *data,
|
||||
res = Curl_wait_for_resolv(*conn, NULL);
|
||||
if(CURLE_OK == res)
|
||||
/* Resolved, continue with the connection */
|
||||
res = Curl_async_resolved(*conn);
|
||||
res = Curl_async_resolved(*conn, &protocol_done);
|
||||
else
|
||||
/* if we can't resolve, we kill this "connection" now */
|
||||
(void)Curl_disconnect(*conn);
|
||||
}
|
||||
if(res)
|
||||
@@ -2120,14 +2143,14 @@ CURLcode Curl_perform(struct SessionHandle *data)
|
||||
|
||||
if(res == CURLE_OK) {
|
||||
if (data->set.source_url) /* 3rd party transfer */
|
||||
res = Curl_pretransfersec(conn);
|
||||
res = Curl_second_connect(conn);
|
||||
else
|
||||
conn->sec_conn = NULL;
|
||||
}
|
||||
|
||||
if(res == CURLE_OK) {
|
||||
|
||||
res = Curl_do(&conn);
|
||||
bool do_done;
|
||||
res = Curl_do(&conn, &do_done);
|
||||
|
||||
/* for non 3rd party transfer only */
|
||||
if(res == CURLE_OK && !data->set.source_url) {
|
||||
@@ -2234,10 +2257,10 @@ Curl_Transfer(struct connectdata *c_conn, /* connection data */
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_pretransfersec() prepares the secondary connection (used for 3rd party
|
||||
* Curl_second_connect() makes the secondary connection (used for 3rd party
|
||||
* FTP transfers).
|
||||
*/
|
||||
CURLcode Curl_pretransfersec(struct connectdata *conn)
|
||||
CURLcode Curl_second_connect(struct connectdata *conn)
|
||||
{
|
||||
CURLcode status = CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
@@ -24,7 +24,7 @@
|
||||
***************************************************************************/
|
||||
CURLcode Curl_perform(struct SessionHandle *data);
|
||||
CURLcode Curl_pretransfer(struct SessionHandle *data);
|
||||
CURLcode Curl_pretransfersec(struct connectdata *conn);
|
||||
CURLcode Curl_second_connect(struct connectdata *conn);
|
||||
CURLcode Curl_posttransfer(struct SessionHandle *data);
|
||||
CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry);
|
||||
CURLcode Curl_readwrite(struct connectdata *conn, bool *done);
|
||||
|
145
lib/url.c
145
lib/url.c
@@ -5,7 +5,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -1989,41 +1989,117 @@ static void verboseconnect(struct connectdata *conn)
|
||||
conn->ip_addr_str, conn->port);
|
||||
}
|
||||
|
||||
CURLcode Curl_protocol_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
if(conn->curl_proto_fdset)
|
||||
res = conn->curl_proto_fdset(conn, read_fd_set, write_fd_set, max_fdp);
|
||||
return res;
|
||||
}
|
||||
|
||||
CURLcode Curl_doing_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp)
|
||||
{
|
||||
CURLcode res = CURLE_OK;
|
||||
if(conn && conn->curl_doing_fdset)
|
||||
res = conn->curl_doing_fdset(conn, read_fd_set, write_fd_set, max_fdp);
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* We are doing protocol-specific connecting and this is being called over and
|
||||
* over from the multi interface until the connection phase is done on
|
||||
* protocol layer.
|
||||
*/
|
||||
|
||||
CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(conn && conn->curl_connecting) {
|
||||
*done = FALSE;
|
||||
result = conn->curl_connecting(conn, done);
|
||||
}
|
||||
else
|
||||
*done = TRUE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* We are DOING this is being called over and over from the multi interface
|
||||
* until the DOING phase is done on protocol layer.
|
||||
*/
|
||||
|
||||
CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done)
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(conn && conn->curl_doing) {
|
||||
*done = FALSE;
|
||||
result = conn->curl_doing(conn, done);
|
||||
}
|
||||
else
|
||||
*done = TRUE;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* We have discovered that the TCP connection has been successful, we can now
|
||||
* proceed with some action.
|
||||
*
|
||||
* If we're using the multi interface, this host address pointer is most
|
||||
* likely NULL at this point as we can't keep the resolved info around. This
|
||||
* may call for some reworking, like a reference counter in the struct or
|
||||
* something.
|
||||
*/
|
||||
CURLcode Curl_protocol_connect(struct connectdata *conn)
|
||||
CURLcode Curl_protocol_connect(struct connectdata *conn, bool *protocol_done)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
if(conn->bits.tcpconnect)
|
||||
*protocol_done = FALSE;
|
||||
|
||||
if(conn->bits.tcpconnect && conn->bits.protoconnstart) {
|
||||
/* We already are connected, get back. This may happen when the connect
|
||||
worked fine in the first call, like when we connect to a local server
|
||||
or proxy. */
|
||||
or proxy. Note that we don't know if the protocol is actually done.
|
||||
|
||||
Unless this protocol doesn't have any protocol-connect callback, as
|
||||
then we know we're done. */
|
||||
if(!conn->curl_connecting)
|
||||
*protocol_done = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(!conn->bits.tcpconnect) {
|
||||
|
||||
Curl_pgrsTime(data, TIMER_CONNECT); /* connect done */
|
||||
|
||||
if(data->set.verbose)
|
||||
verboseconnect(conn);
|
||||
}
|
||||
|
||||
if(!conn->bits.protoconnstart) {
|
||||
if(conn->curl_connect) {
|
||||
/* is there a protocol-specific connect() procedure? */
|
||||
|
||||
/* set start time here for timeout purposes in the
|
||||
* connect procedure, it is later set again for the
|
||||
* progress meter purpose */
|
||||
/* Set start time here for timeout purposes in the connect procedure, it
|
||||
is later set again for the progress meter purpose */
|
||||
conn->now = Curl_tvnow();
|
||||
|
||||
/* Call the protocol-specific connect function */
|
||||
result = conn->curl_connect(conn);
|
||||
result = conn->curl_connect(conn, protocol_done);
|
||||
}
|
||||
else
|
||||
*protocol_done = TRUE;
|
||||
|
||||
/* it has started, possibly even completed but that knowledge isn't stored
|
||||
in this bit! */
|
||||
conn->bits.protoconnstart = TRUE;
|
||||
}
|
||||
|
||||
return result; /* pass back status */
|
||||
@@ -2733,6 +2809,10 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
conn->curl_do_more = Curl_ftp_nextconnect;
|
||||
conn->curl_done = Curl_ftp_done;
|
||||
conn->curl_connect = Curl_ftp_connect;
|
||||
conn->curl_connecting = Curl_ftp_multi_statemach;
|
||||
conn->curl_doing = Curl_ftp_doing;
|
||||
conn->curl_proto_fdset = Curl_ftp_fdset;
|
||||
conn->curl_doing_fdset = Curl_ftp_fdset;
|
||||
conn->curl_disconnect = Curl_ftp_disconnect;
|
||||
}
|
||||
|
||||
@@ -3385,17 +3465,21 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
||||
*/
|
||||
|
||||
static CURLcode SetupConnection(struct connectdata *conn,
|
||||
struct Curl_dns_entry *hostaddr)
|
||||
struct Curl_dns_entry *hostaddr,
|
||||
bool *protocol_done)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
CURLcode result=CURLE_OK;
|
||||
|
||||
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
|
||||
|
||||
if(conn->protocol & PROT_FILE)
|
||||
if(conn->protocol & PROT_FILE) {
|
||||
/* There's nothing in this function to setup if we're only doing
|
||||
a file:// transfer */
|
||||
*protocol_done = TRUE;
|
||||
return result;
|
||||
}
|
||||
*protocol_done = FALSE; /* default to not done */
|
||||
|
||||
/*************************************************************
|
||||
* Send user-agent to HTTP proxies even if the target protocol
|
||||
@@ -3416,13 +3500,13 @@ static CURLcode SetupConnection(struct connectdata *conn,
|
||||
conn->headerbytecount = 0;
|
||||
|
||||
if(CURL_SOCKET_BAD == conn->sock[FIRSTSOCKET]) {
|
||||
bool connected;
|
||||
bool connected = FALSE;
|
||||
|
||||
/* Connect only if not already connected! */
|
||||
result = ConnectPlease(conn, hostaddr, &connected);
|
||||
|
||||
if(connected) {
|
||||
result = Curl_protocol_connect(conn);
|
||||
result = Curl_protocol_connect(conn, protocol_done);
|
||||
if(CURLE_OK == result)
|
||||
conn->bits.tcpconnect = TRUE;
|
||||
}
|
||||
@@ -3436,6 +3520,7 @@ static CURLcode SetupConnection(struct connectdata *conn,
|
||||
else {
|
||||
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected already */
|
||||
conn->bits.tcpconnect = TRUE;
|
||||
*protocol_done = TRUE;
|
||||
if(data->set.verbose)
|
||||
verboseconnect(conn);
|
||||
}
|
||||
@@ -3460,7 +3545,8 @@ static CURLcode SetupConnection(struct connectdata *conn,
|
||||
|
||||
CURLcode Curl_connect(struct SessionHandle *data,
|
||||
struct connectdata **in_connect,
|
||||
bool *asyncp)
|
||||
bool *asyncp,
|
||||
bool *protocol_done)
|
||||
{
|
||||
CURLcode code;
|
||||
struct Curl_dns_entry *dns;
|
||||
@@ -3476,7 +3562,7 @@ CURLcode Curl_connect(struct SessionHandle *data,
|
||||
/* If an address is available it means that we already have the name
|
||||
resolved, OR it isn't async.
|
||||
If so => continue connecting from here */
|
||||
code = SetupConnection(*in_connect, dns);
|
||||
code = SetupConnection(*in_connect, dns, protocol_done);
|
||||
/* else
|
||||
response will be received and treated async wise */
|
||||
}
|
||||
@@ -3494,12 +3580,16 @@ CURLcode Curl_connect(struct SessionHandle *data,
|
||||
}
|
||||
|
||||
/* Call this function after Curl_connect() has returned async=TRUE and
|
||||
then a successful name resolve has been received */
|
||||
CURLcode Curl_async_resolved(struct connectdata *conn)
|
||||
then a successful name resolve has been received.
|
||||
|
||||
Note: this function disconnects and frees the conn data in case of
|
||||
resolve failure */
|
||||
CURLcode Curl_async_resolved(struct connectdata *conn,
|
||||
bool *protocol_done)
|
||||
{
|
||||
#if defined(USE_ARES) || defined(USE_THREADING_GETHOSTBYNAME) || \
|
||||
defined(USE_THREADING_GETADDRINFO)
|
||||
CURLcode code = SetupConnection(conn, conn->async.dns);
|
||||
CURLcode code = SetupConnection(conn, conn->async.dns, protocol_done);
|
||||
|
||||
if(code)
|
||||
/* We're not allowed to return failure with memory left allocated
|
||||
@@ -3509,6 +3599,7 @@ CURLcode Curl_async_resolved(struct connectdata *conn)
|
||||
return code;
|
||||
#else
|
||||
(void)conn;
|
||||
(void)protocol_done;
|
||||
return CURLE_OK;
|
||||
#endif
|
||||
}
|
||||
@@ -3573,7 +3664,7 @@ CURLcode Curl_done(struct connectdata **connp,
|
||||
return result;
|
||||
}
|
||||
|
||||
CURLcode Curl_do(struct connectdata **connp)
|
||||
CURLcode Curl_do(struct connectdata **connp, bool *done)
|
||||
{
|
||||
CURLcode result=CURLE_OK;
|
||||
struct connectdata *conn = *connp;
|
||||
@@ -3583,7 +3674,7 @@ CURLcode Curl_do(struct connectdata **connp)
|
||||
|
||||
if(conn->curl_do) {
|
||||
/* generic protocol-specific function pointer set in curl_connect() */
|
||||
result = conn->curl_do(conn);
|
||||
result = conn->curl_do(conn, done);
|
||||
|
||||
/* This was formerly done in transfer.c, but we better do it here */
|
||||
|
||||
@@ -3603,8 +3694,10 @@ CURLcode Curl_do(struct connectdata **connp)
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
bool async;
|
||||
bool protocol_done = TRUE;
|
||||
|
||||
/* Now, redo the connect and get a new connection */
|
||||
result = Curl_connect(data, connp, &async);
|
||||
result = Curl_connect(data, connp, &async, &protocol_done);
|
||||
if(CURLE_OK == result) {
|
||||
/* We have connected or sent away a name resolve query fine */
|
||||
|
||||
@@ -3617,13 +3710,13 @@ CURLcode Curl_do(struct connectdata **connp)
|
||||
return result;
|
||||
|
||||
/* Resolved, continue with the connection */
|
||||
result = Curl_async_resolved(conn);
|
||||
result = Curl_async_resolved(conn, &protocol_done);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* ... finally back to actually retry the DO phase */
|
||||
result = conn->curl_do(conn);
|
||||
result = conn->curl_do(conn, done);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
21
lib/url.h
21
lib/url.h
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2005, 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
|
||||
@@ -31,17 +31,28 @@ CURLcode Curl_open(struct SessionHandle **curl);
|
||||
CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...);
|
||||
CURLcode Curl_close(struct SessionHandle *data); /* opposite of curl_open() */
|
||||
CURLcode Curl_connect(struct SessionHandle *, struct connectdata **,
|
||||
bool *async);
|
||||
CURLcode Curl_async_resolved(struct connectdata *conn);
|
||||
CURLcode Curl_do(struct connectdata **);
|
||||
bool *async, bool *protocol_connect);
|
||||
CURLcode Curl_async_resolved(struct connectdata *conn,
|
||||
bool *protocol_connect);
|
||||
CURLcode Curl_do(struct connectdata **, bool *done);
|
||||
CURLcode Curl_do_more(struct connectdata *);
|
||||
CURLcode Curl_done(struct connectdata **, CURLcode);
|
||||
CURLcode Curl_disconnect(struct connectdata *);
|
||||
CURLcode Curl_protocol_connect(struct connectdata *conn);
|
||||
CURLcode Curl_protocol_connect(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done);
|
||||
bool Curl_ssl_config_matches(struct ssl_config_data* data,
|
||||
struct ssl_config_data* needle);
|
||||
bool Curl_clone_ssl_config(struct ssl_config_data* source,
|
||||
struct ssl_config_data* dest);
|
||||
void Curl_free_ssl_config(struct ssl_config_data* sslc);
|
||||
void Curl_safefree(void *ptr);
|
||||
CURLcode Curl_protocol_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
CURLcode Curl_doing_fdset(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
#endif
|
||||
|
@@ -243,6 +243,42 @@ struct HTTP {
|
||||
/****************************************************************************
|
||||
* FTP unique setup
|
||||
***************************************************************************/
|
||||
typedef enum {
|
||||
FTP_STOP, /* do nothing state, stops the state machine */
|
||||
FTP_WAIT220, /* waiting for the inintial 220 response immediately after
|
||||
a connect */
|
||||
FTP_AUTH,
|
||||
FTP_USER,
|
||||
FTP_PASS,
|
||||
FTP_ACCT,
|
||||
FTP_PBSZ,
|
||||
FTP_PROT,
|
||||
FTP_PWD,
|
||||
FTP_QUOTE, /* waiting for a response to a command sent in a quote list */
|
||||
FTP_RETR_PREQUOTE,
|
||||
FTP_STOR_PREQUOTE,
|
||||
FTP_POSTQUOTE,
|
||||
FTP_CWD, /* change dir */
|
||||
FTP_MKD, /* if the dir didn't exist */
|
||||
FTP_MDTM, /* to figure out the datestamp */
|
||||
FTP_TYPE, /* to set type when doing a head-like request */
|
||||
FTP_LIST_TYPE, /* set type when about to do a dir list */
|
||||
FTP_RETR_TYPE, /* set type when about to RETR a file */
|
||||
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_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 */
|
||||
FTP_PASV, /* generic state for PASV and EPSV, check count1 */
|
||||
FTP_LIST, /* generic state for LIST, NLST or a custom list command */
|
||||
FTP_RETR,
|
||||
FTP_STOR, /* generic state for STOR and APPE */
|
||||
FTP_QUIT,
|
||||
FTP_LAST /* never used */
|
||||
} ftpstate;
|
||||
|
||||
struct FTP {
|
||||
curl_off_t *bytecountp;
|
||||
char *user; /* user name string */
|
||||
@@ -271,6 +307,18 @@ struct FTP {
|
||||
bool cwddone; /* if it has been determined that the proper CWD combo
|
||||
already has been done */
|
||||
char *prevpath; /* conn->path from the previous transfer */
|
||||
size_t nread_resp; /* number of bytes currently read of a server response */
|
||||
int count1; /* general purpose counter for the state machine */
|
||||
int count2; /* general purpose counter for the state machine */
|
||||
int count3; /* general purpose counter for the state machine */
|
||||
char *sendthis; /* allocated pointer to a buffer that is to be sent to the
|
||||
ftp server */
|
||||
size_t sendleft; /* number of bytes left to send from the sendthis buffer */
|
||||
size_t sendsize; /* total size of the sendthis buffer */
|
||||
struct timeval response; /* set to Curl_tvnow() when a command has been sent
|
||||
off, used to time-out response reading */
|
||||
ftpstate state; /* always use ftp.c:state() to change state! */
|
||||
curl_off_t downloadsize;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@@ -309,9 +357,12 @@ struct ConnectBits {
|
||||
bool forbidchunk; /* used only to explicitly forbid chunk-upload for
|
||||
specific upload buffers. See readmoredata() in
|
||||
http.c for details. */
|
||||
bool tcpconnect; /* the tcp stream (or simimlar) is connected, this
|
||||
is set the first time on the first connect function
|
||||
call */
|
||||
|
||||
bool tcpconnect; /* the TCP layer (or simimlar) is connected, this is set
|
||||
the first time on the first connect function call */
|
||||
bool protoconnstart;/* the protocol layer has STARTED its operation after
|
||||
the TCP layer connect */
|
||||
|
||||
bool retry; /* this connection is about to get closed and then
|
||||
re-attempted at another connection. */
|
||||
bool no_body; /* CURLOPT_NO_BODY (or similar) was set */
|
||||
@@ -510,7 +561,7 @@ struct connectdata {
|
||||
|
||||
/* These two functions MUST be set by the curl_connect() function to be
|
||||
be protocol dependent */
|
||||
CURLcode (*curl_do)(struct connectdata *);
|
||||
CURLcode (*curl_do)(struct connectdata *, bool *done);
|
||||
CURLcode (*curl_done)(struct connectdata *, CURLcode);
|
||||
|
||||
/* If the curl_do() function is better made in two halves, this
|
||||
@@ -521,8 +572,29 @@ struct connectdata {
|
||||
|
||||
/* This function *MAY* be set to a protocol-dependent function that is run
|
||||
* after the connect() and everything is done, as a step in the connection.
|
||||
* The 'done' pointer points to a bool that should be set to TRUE if the
|
||||
* function completes before return. If it doesn't complete, the caller
|
||||
* should call the curl_connecting() function until it is.
|
||||
*/
|
||||
CURLcode (*curl_connect)(struct connectdata *);
|
||||
CURLcode (*curl_connect)(struct connectdata *, bool *done);
|
||||
|
||||
/* See above. Currently only used for FTP. */
|
||||
CURLcode (*curl_connecting)(struct connectdata *, bool *done);
|
||||
CURLcode (*curl_doing)(struct connectdata *, bool *done);
|
||||
|
||||
/* Called from the multi interface during the PROTOCONNECT phase, and it
|
||||
should then return a proper fd set */
|
||||
CURLcode (*curl_proto_fdset)(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
|
||||
/* Called from the multi interface during the DOING phase, and it should
|
||||
then return a proper fd set */
|
||||
CURLcode (*curl_doing_fdset)(struct connectdata *conn,
|
||||
fd_set *read_fd_set,
|
||||
fd_set *write_fd_set,
|
||||
int *max_fdp);
|
||||
|
||||
/* This function *MAY* be set to a protocol-dependent function that is run
|
||||
* by the curl_disconnect(), as a step in the disconnection.
|
||||
|
@@ -1,2 +1,4 @@
|
||||
curlmsg.h
|
||||
curlmsg.sdl
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
@@ -1,5 +1,3 @@
|
||||
EXTRA_DIST = batch_compile.com build_vms.com \
|
||||
config-vms.h_with_ssl config-vms.h_without_ssl defines.com \
|
||||
hpssl_alpha.opt hpssl_ia64.opt hpssl_vax.opt readme \
|
||||
curlmsg.h curlmsg.msg curlmsg.sdl curlmsg_vms.h \
|
||||
axp/README ia64/README vax/README
|
||||
EXTRA_DIST = batch_compile.com build_vms.com config-vms.h defines.com \
|
||||
hpssl_alpha.opt hpssl_ia64.opt hpssl_vax.opt readme curlmsg.msg \
|
||||
curlmsg_vms.h axp/README ia64/README vax/README
|
||||
|
@@ -1,3 +1,4 @@
|
||||
$! $Id$
|
||||
$! BUILD_VMS.COM
|
||||
$!
|
||||
$! I've taken the original build_vms.com, supplied by Nico Baggus, if
|
||||
@@ -38,6 +39,10 @@ $! directory before build. The .msg file will be compiled
|
||||
$! to get the .obj for messages, but the .h and .sdl files
|
||||
$! are not automatically created since they partly rely on
|
||||
$! the freeware SDL tool.
|
||||
$! 8-FEB-2005, MSK, merged the two config-vms.h* files into one that uses
|
||||
$! USE_SSLEAY to define if the target has SSL support built
|
||||
$! in. Changed the cc/define parameter accordingly.
|
||||
$! 11-FEB-2005, MSK, If [--.LIB]AMIGAOS.C and NWLIB.C are there, rename them
|
||||
$!
|
||||
$ on control_y then goto Common_Exit
|
||||
$ ctrl_y = 1556
|
||||
@@ -83,6 +88,7 @@ $ then
|
||||
$ if f$trnlnm( "OPENSSL") .nes. ""
|
||||
$ then
|
||||
$ openssl = 1
|
||||
$ cc_qual = "/define=(HAVE_CONFIG_H=1,USE_SSLEAY=1)/OBJ=OBJDIR:"
|
||||
$ if ( f$trnlnm( "SSL$INCLUDE") .nes. "") .and. -
|
||||
( f$trnlnm( "CURL_BUILD_NOHPSSL") .eqs. "")
|
||||
$ then hpssl = 1
|
||||
@@ -95,11 +101,10 @@ $!
|
||||
$ if ( openssl .eq. 1) .or. ( hpssl .eq. 1)
|
||||
$ then
|
||||
$ 'vo_c' "%CURL-I-BLDSSL, building with SSL support"
|
||||
$ config_h = "CONFIG-VMS.H_WITH_SSL"
|
||||
$ else
|
||||
$ 'vo_c' "%CURL-I-BLDNOSSL, building without SSL support"
|
||||
$ config_h = "CONFIG-VMS.H_WITHOUT_SSL"
|
||||
$ endif
|
||||
$ config_h = "CONFIG-VMS.H"
|
||||
$!
|
||||
$! Only do the copy if the source and destination files are different.
|
||||
$!
|
||||
@@ -111,6 +116,18 @@ $ call MoveIfDiff "CURLMSG.H" "[--.SRC]"
|
||||
$ call MoveIfDiff "CURLMSG.MSG" "[--.SRC]"
|
||||
$ call MoveIfDiff "CURLMSG.SDL" "[--.SRC]"
|
||||
$ call MoveIfDiff "CURLMSG_VMS.H" "[--.SRC]"
|
||||
$!
|
||||
$! The [--.LIB]amigaos.c and nwlib.c files aren't needed for the VMS build.
|
||||
$! If they are there, rename them so the brute force build works right.
|
||||
$!
|
||||
$ if f$search( "[--.lib]amigaos.c") .nes. ""
|
||||
$ then
|
||||
$ rename [--.lib]amigaos.c .c_not_used
|
||||
$ endif
|
||||
$ if f$search( "[--.lib]nwlib.c") .nes. ""
|
||||
$ then
|
||||
$ rename [--.lib]nwlib.c .c_not_used
|
||||
$ endif
|
||||
$ on control_y then goto Common_Exit
|
||||
$!
|
||||
$ call build "[--.lib]" "*.c" "objdir:curllib.olb"
|
||||
|
6
packages/vms/config-vms.h_without_ssl → packages/vms/config-vms.h
Executable file → Normal file
6
packages/vms/config-vms.h_without_ssl → packages/vms/config-vms.h
Executable file → Normal file
@@ -3,6 +3,9 @@
|
||||
/* Added HAVE_SYS_IOCTL_H, IOCTL_3_ARGS and SIZEOF_CURL_OFF_T defines */
|
||||
/* MSK, 06/04/04, Added HAVE_INET_NTOP */
|
||||
/* TES, 10/06/04, Added MAX_INITIAL_POST_SIZE, HAVE_BASENAME */
|
||||
/* MSK, 02/02/05, Changed HAVE_TERMIOS_H to an undef since the change in */
|
||||
/* getpass.c no longer undef'd it during compile. */
|
||||
/* MSK, 02/08/05, turned two config-vms files into one by using USE_SSLEAY */
|
||||
|
||||
/* Define cpu-machine-OS */
|
||||
#ifdef __ALPHA
|
||||
@@ -123,7 +126,6 @@
|
||||
/* OpenSSL section starts here */
|
||||
|
||||
/* Define if you have a working OpenSSL installation */
|
||||
#undef USE_SSLEAY
|
||||
#ifdef USE_SSLEAY
|
||||
|
||||
/* if OpenSSL is in use */
|
||||
@@ -185,7 +187,7 @@
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
#undef HAVE_TERMIOS_H
|
||||
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
@@ -1,271 +0,0 @@
|
||||
/* MSK, 02/05/04, Hand edited for trail build on Alpha V7.3, DEC C 6.5-003 */
|
||||
/* MSK, 03/09/04, Seems to work for all platforms I've built on so far. */
|
||||
/* Added HAVE_SYS_IOCTL_H, IOCTL_3_ARGS and SIZEOF_CURL_OFF_T defines */
|
||||
/* MSK, 06/04/04, Added HAVE_INET_NTOP */
|
||||
/* TES, 11/05/04, Added MAX_INITIAL_POST_SIZE, HAVE_BASENAME */
|
||||
|
||||
/* Define cpu-machine-OS */
|
||||
#ifdef __ALPHA
|
||||
#define OS "ALPHA-HP-VMS"
|
||||
#else
|
||||
#ifdef __VAX
|
||||
#define OS "VAX-HP-VMS"
|
||||
#else
|
||||
#define OS "IA64-HP-VMS"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define this to 'int' if socklen_t is not an available typedefed type */
|
||||
#define socklen_t size_t
|
||||
|
||||
/* The number of bytes in a long double. */
|
||||
#define SIZEOF_LONG_DOUBLE 8
|
||||
|
||||
/* The number of bytes in a long long. */
|
||||
#define SIZEOF_LONG_LONG 8
|
||||
|
||||
/* Define if you have the geteuid function. */
|
||||
#define HAVE_GETEUID 1
|
||||
|
||||
/* Define if you have the basename function. */
|
||||
#define HAVE_BASENAME 1
|
||||
|
||||
/* Define if you have the gethostbyaddr function. */
|
||||
#define HAVE_GETHOSTBYADDR 1
|
||||
|
||||
/* Define if you have the gethostname function. */
|
||||
#define HAVE_GETHOSTNAME 1
|
||||
|
||||
/* Define if you have the getpwuid function. */
|
||||
#define HAVE_GETPWUID 1
|
||||
|
||||
/* Define if you have the getservbyname function. */
|
||||
#define HAVE_GETSERVBYNAME 1
|
||||
|
||||
/* Define if you have the gettimeofday function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define if you have the inet_addr function. */
|
||||
#define HAVE_INET_ADDR 1
|
||||
|
||||
/* Define if you have the inet_ntoa function. */
|
||||
#define HAVE_INET_NTOA 1
|
||||
|
||||
/* Define if you have the perror function. */
|
||||
#define HAVE_PERROR 1
|
||||
|
||||
/* Define if you have the select function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define if you have the setvbuf function. */
|
||||
#define HAVE_SETVBUF 1
|
||||
|
||||
/* Define if you have the sigaction function. */
|
||||
#define HAVE_SIGACTION 1
|
||||
|
||||
/* Define if you have the signal function. */
|
||||
#define HAVE_SIGNAL 1
|
||||
|
||||
/* Define if you have the socket function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define if you have the strcmpi function. */
|
||||
#define HAVE_STRCMPI 1
|
||||
|
||||
/* Define if you have the strdup function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define if you have the strftime function. */
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Define if you have the stricmp function. */
|
||||
#define HAVE_STRICMP 1
|
||||
|
||||
/* Define if you have the strstr function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define if you have the uname function. */
|
||||
#define HAVE_UNAME 1
|
||||
|
||||
/* Define if you have the <err.h> header file. */
|
||||
#define HAVE_ERR_H 1
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* Define if you have the <getopt.h> header file. */
|
||||
#define HAVE_GETOPT_H 1
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define if you have the <net/if.h> header file. */
|
||||
#define HAVE_NET_IF_H 1
|
||||
|
||||
/* Define if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define if you have the <netinet/if_ether.h> header file. */
|
||||
#define HAVE_NETINET_IF_ETHER_H 1
|
||||
|
||||
/* Define if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* OpenSSL section starts here */
|
||||
|
||||
/* Define if you have a working OpenSSL installation */
|
||||
#define USE_SSLEAY 1
|
||||
#ifdef USE_SSLEAY
|
||||
|
||||
/* if OpenSSL is in use */
|
||||
#define USE_OPENSSL 1
|
||||
|
||||
/* Define if you have the crypto library (-lcrypto). */
|
||||
#define HAVE_LIBCRYPTO 1
|
||||
|
||||
/* Define if you have the ssl library (-lssl). */
|
||||
#define HAVE_LIBSSL 1
|
||||
|
||||
/* Define if you have the <openssl/crypto.h> header file. */
|
||||
#define HAVE_OPENSSL_CRYPTO_H 1
|
||||
|
||||
/* Define if you have the <openssl/err.h> header file. */
|
||||
#define HAVE_OPENSSL_ERR_H 1
|
||||
|
||||
/* Define if you have the <openssl/pem.h> header file. */
|
||||
#define HAVE_OPENSSL_PEM_H 1
|
||||
|
||||
/* Define if you have the <openssl/rsa.h> header file. */
|
||||
#define HAVE_OPENSSL_RSA_H 1
|
||||
|
||||
/* Define if you have the <openssl/ssl.h> header file. */
|
||||
#define HAVE_OPENSSL_SSL_H 1
|
||||
|
||||
/* Define if you have the <openssl/x509.h> header file. */
|
||||
#define HAVE_OPENSSL_X509_H 1
|
||||
|
||||
/*
|
||||
* This needs to be defined for OpenSSL 0.9.7 and other versions that have the
|
||||
* ENGINE stuff supported. If an include of "openssl/engine.h" fails, then
|
||||
* undefine the define below.
|
||||
*/
|
||||
#define HAVE_OPENSSL_ENGINE_H 1
|
||||
|
||||
#endif /* USE_SSLEAY */
|
||||
/* OpenSSL section ends here */
|
||||
|
||||
/* Define if you have the <pwd.h> header file. */
|
||||
#define HAVE_PWD_H 1
|
||||
|
||||
/* Define if you have the <sgtty.h> header file. */
|
||||
#define HAVE_SGTTY_H 1
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define if you have the resolv library (-lresolv). */
|
||||
#define HAVE_LIBRESOLV 1
|
||||
|
||||
/* Define if you have the socket library (-lsocket). */
|
||||
#define HAVE_LIBSOCKET 1
|
||||
|
||||
/* Define if getaddrinfo exists and works */
|
||||
#define HAVE_GETADDRINFO 1
|
||||
|
||||
#define HAVE_TIMEVAL_H 1
|
||||
|
||||
/* Name of this package! */
|
||||
#define PACKAGE "not-used"
|
||||
|
||||
/* Version number of this archive. */
|
||||
#define VERSION "not-used"
|
||||
|
||||
/* Define if you have the getpass function. */
|
||||
#undef HAVE_GETPASS
|
||||
|
||||
/* Define if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define if you have the `strtok_r' function. */
|
||||
/* Seems VAX V7.3 with DEC C 6.4 doesn't define this */
|
||||
#ifdef __VAX
|
||||
#undef HAVE_STRTOK_R
|
||||
#else
|
||||
#define HAVE_STRTOK_R 1
|
||||
#endif
|
||||
|
||||
/* Define if you have the `strtoll' function. */
|
||||
#define HAVE_STRTOLL 1
|
||||
|
||||
/* Define if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
#define HAVE_FIONBIO 1
|
||||
|
||||
/* Define if you have the `sigsetjmp' function. */
|
||||
#define HAVE_SIGSETJMP 1
|
||||
|
||||
/* Define to 1 if you have the <setjmp.h> header file. */
|
||||
#define HAVE_SETJMP_H 1
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/ioctl.h> header file. */
|
||||
#define HAVE_SYS_IOCTL_H 1
|
||||
|
||||
/* IOCTL_3_ARGS needs to be defined to match the ioctl in stropts.h */
|
||||
#define IOCTL_3_ARGS 1
|
||||
|
||||
/* Seems with versions of cURL after 7.11.0 you need to define */
|
||||
/* SIZEOF_CURL_OFF_T to something to get it to compile. */
|
||||
#if defined( __VAX) || (__32BITS == 1)
|
||||
#define SIZEOF_CURL_OFF_T 4
|
||||
#else
|
||||
#define SIZEOF_CURL_OFF_T 8
|
||||
#endif
|
||||
|
||||
/* Somewhere around 7.12.0 HAVE_INET_NTOP was introduced. */
|
||||
#define HAVE_INET_NTOP 1
|
@@ -1,92 +0,0 @@
|
||||
/********************************************************************************************************************************/
|
||||
/* Created: 9-MAR-2004 14:07:55 by OpenVMS SDL EV1-60 */
|
||||
/* Source: 9-MAR-2004 14:07:27 SYS$SYSDEVICE:[MARTY.CURL.CURL-7_11_1-PRE1.SRC] */
|
||||
/********************************************************************************************************************************/
|
||||
/*** MODULE $CURDEF ***/
|
||||
#pragma __member_alignment __save
|
||||
#pragma __nomember_alignment
|
||||
/* */
|
||||
/* This SDL File Generated by VAX-11 Message V04-00 on 9-MAR-2004 14:07:27.56 */
|
||||
/* */
|
||||
/* */
|
||||
/* THESE VMS ERROR CODES ARE GENERATED BY TAKING APART THE CURL.H */
|
||||
/* FILE AND PUTTING ALL THE CURLE_* ENUM STUFF INTO THIS FILE, */
|
||||
/* CURLMSG.MSG. AN .SDL FILE IS CREATED FROM THIS FILE WITH */
|
||||
/* MESSAGE/SDL. THE .H FILE IS CREATED USING THE FREEWARE SDL TOOL */
|
||||
/* AGAINST THE .SDL FILE. */
|
||||
/* */
|
||||
/* WITH THE EXCEPTION OF CURLE_OK, ALL OF THE MESSAGES ARE AT */
|
||||
/* THE ERROR SEVERITY LEVEL. WITH THE EXCEPTION OF */
|
||||
/* FTP_USER_PWD_INCORRECT, WHICH IS A SHORTENED FORM OF */
|
||||
/* FTP_USER_PASSWORD_INCORRECT, THESE ARE THE SAME NAMES AS THE */
|
||||
/* CURLE_ ONES IN INCLUDE/CURL.H */
|
||||
/* */
|
||||
#define CURL_FACILITY 3841
|
||||
#define CURL_OK 251756553
|
||||
#define CURL_UNSUPPORTED_PROTOCOL 251756562
|
||||
#define CURL_FAILED_INIT 251756570
|
||||
#define CURL_URL_MALFORMAT 251756578
|
||||
#define CURL_URL_MALFORMAT_USER 251756586
|
||||
#define CURL_COULDNT_RESOLVE_PROXY 251756594
|
||||
#define CURL_COULDNT_RESOLVE_HOST 251756602
|
||||
#define CURL_COULDNT_CONNECT 251756610
|
||||
#define CURL_FTP_WEIRD_SERVER_REPLY 251756618
|
||||
#define CURL_FTP_ACCESS_DENIED 251756626
|
||||
#define CURL_FTP_USER_PWD_INCORRECT 251756634
|
||||
#define CURL_FTP_WEIRD_PASS_REPLY 251756642
|
||||
#define CURL_FTP_WEIRD_USER_REPLY 251756650
|
||||
#define CURL_FTP_WEIRD_PASV_REPLY 251756658
|
||||
#define CURL_FTP_WEIRD_227_FORMAT 251756666
|
||||
#define CURL_FTP_CANT_GET_HOST 251756674
|
||||
#define CURL_FTP_CANT_RECONNECT 251756682
|
||||
#define CURL_FTP_COULDNT_SET_BINARY 251756690
|
||||
#define CURL_PARTIAL_FILE 251756698
|
||||
#define CURL_FTP_COULDNT_RETR_FILE 251756706
|
||||
#define CURL_FTP_WRITE_ERROR 251756714
|
||||
#define CURL_FTP_QUOTE_ERROR 251756722
|
||||
#define CURL_HTTP_RETURNED_ERROR 251756730
|
||||
#define CURL_WRITE_ERROR 251756738
|
||||
#define CURL_MALFORMAT_USER 251756746
|
||||
#define CURL_FTP_COULDNT_STOR_FILE 251756754
|
||||
#define CURL_READ_ERROR 251756762
|
||||
#define CURL_OUT_OF_MEMORY 251756770
|
||||
#define CURL_OPERATION_TIMEOUTED 251756778
|
||||
#define CURL_FTP_COULDNT_SET_ASCII 251756786
|
||||
#define CURL_FTP_PORT_FAILED 251756794
|
||||
#define CURL_FTP_COULDNT_USE_REST 251756802
|
||||
#define CURL_FTP_COULDNT_GET_SIZE 251756810
|
||||
#define CURL_HTTP_RANGE_ERROR 251756818
|
||||
#define CURL_HTTP_POST_ERROR 251756826
|
||||
#define CURL_SSL_CONNECT_ERROR 251756834
|
||||
#define CURL_BAD_DOWNLOAD_RESUME 251756842
|
||||
#define CURL_FILE_COULDNT_READ_FILE 251756850
|
||||
#define CURL_LDAP_CANNOT_BIND 251756858
|
||||
#define CURL_LDAP_SEARCH_FAILED 251756866
|
||||
#define CURL_LIBRARY_NOT_FOUND 251756874
|
||||
#define CURL_FUNCTION_NOT_FOUND 251756882
|
||||
#define CURL_ABORTED_BY_CALLBACK 251756890
|
||||
#define CURL_BAD_FUNCTION_ARGUMENT 251756898
|
||||
#define CURL_BAD_CALLING_ORDER 251756906
|
||||
#define CURL_HTTP_PORT_FAILED 251756914
|
||||
#define CURL_BAD_PASSWORD_ENTERED 251756922
|
||||
#define CURL_TOO_MANY_REDIRECTS 251756930
|
||||
#define CURL_UNKNOWN_TELNET_OPTION 251756938
|
||||
#define CURL_TELNET_OPTION_SYNTAX 251756946
|
||||
#define CURL_OBSOLETE 251756954
|
||||
#define CURL_SSL_PEER_CERTIFICATE 251756962
|
||||
#define CURL_GOT_NOTHING 251756970
|
||||
#define CURL_SSL_ENGINE_NOTFOUND 251756978
|
||||
#define CURL_SSL_ENGINE_SETFAILED 251756986
|
||||
#define CURL_SEND_ERROR 251756994
|
||||
#define CURL_RECV_ERROR 251757002
|
||||
#define CURL_SHARE_IN_USE 251757010
|
||||
#define CURL_SSL_CERTPROBLEM 251757018
|
||||
#define CURL_SSL_CIPHER 251757026
|
||||
#define CURL_SSL_CACERT 251757034
|
||||
#define CURL_BAD_CONTENT_ENCODING 251757042
|
||||
#define CURL_LDAP_INVALID_URL 251757050
|
||||
#define CURL_FILESIZE_EXCEEDED 251757058
|
||||
#define CURL_FTP_SSL_FAILED 251757066
|
||||
#define CURL_CURL_LAST 251757074
|
||||
|
||||
#pragma __member_alignment __restore
|
@@ -1,3 +1,4 @@
|
||||
! $Id$
|
||||
!
|
||||
! These VMS error codes are generated by taking apart the curl.h
|
||||
! file and putting all the CURLE_* enum stuff into this file,
|
||||
@@ -11,6 +12,8 @@
|
||||
! FTP_USER_PASSWORD_INCORRECT, these are the same names as the
|
||||
! CURLE_ ones in include/curl.h
|
||||
!
|
||||
! If you update this file also update curlmsg_vms.h so that they are in sync
|
||||
!
|
||||
.TITLE CURLMSG Message files
|
||||
.FACILITY CURL,1793 /PREFIX=CURL_
|
||||
.BASE 1
|
||||
@@ -62,7 +65,7 @@ FUNCTION_NOT_FOUND <function not found>
|
||||
ABORTED_BY_CALLBACK <aborted by callback>
|
||||
BAD_FUNCTION_ARGUMENT <bad function argument>
|
||||
BAD_CALLING_ORDER <bad calling order>
|
||||
HTTP_PORT_FAILED <HTTP port failed>
|
||||
INTERFACE_FAILED <CURLOPT_INTERFACE failed>
|
||||
BAD_PASSWORD_ENTERED <bad password entered, my_getpass() returns fail>
|
||||
TOO_MANY_REDIRECTS <too many redirects>
|
||||
UNKNOWN_TELNET_OPTION <unknown TELNET option>
|
||||
@@ -82,6 +85,9 @@ BAD_CONTENT_ENCODING <unrecognized transfer encoding>
|
||||
LDAP_INVALID_URL <LDAP invalid url>
|
||||
FILESIZE_EXCEEDED <maximum file size exceeded>
|
||||
FTP_SSL_FAILED <requested FTP SSL level failed>
|
||||
SEND_FAIL_REWIND <sending data requires a rewind that failed>
|
||||
SSL_ENGINE_INITFAILED <failed to initialise ENGINE>
|
||||
LOGIN_DENIED <user or password not accepted. failed to login>
|
||||
CURL_LAST <CURLMSG.MSG is out of sync with the source code>
|
||||
|
||||
.END
|
||||
|
@@ -1,90 +0,0 @@
|
||||
|
||||
|
||||
MODULE $CURDEF;
|
||||
|
||||
/*
|
||||
/* This SDL File Generated by VAX-11 Message V04-00 on 9-MAR-2004 14:07:27.56
|
||||
/*
|
||||
/*
|
||||
/* THESE VMS ERROR CODES ARE GENERATED BY TAKING APART THE CURL.H
|
||||
/* FILE AND PUTTING ALL THE CURLE_* ENUM STUFF INTO THIS FILE,
|
||||
/* CURLMSG.MSG. AN .SDL FILE IS CREATED FROM THIS FILE WITH
|
||||
/* MESSAGE/SDL. THE .H FILE IS CREATED USING THE FREEWARE SDL TOOL
|
||||
/* AGAINST THE .SDL FILE.
|
||||
/*
|
||||
/* WITH THE EXCEPTION OF CURLE_OK, ALL OF THE MESSAGES ARE AT
|
||||
/* THE ERROR SEVERITY LEVEL. WITH THE EXCEPTION OF
|
||||
/* FTP_USER_PWD_INCORRECT, WHICH IS A SHORTENED FORM OF
|
||||
/* FTP_USER_PASSWORD_INCORRECT, THESE ARE THE SAME NAMES AS THE
|
||||
/* CURLE_ ONES IN INCLUDE/CURL.H
|
||||
/*
|
||||
CONSTANT
|
||||
"FACILITY" EQUALS 3841 PREFIX "CURL" TAG ""
|
||||
,"OK" EQUALS %X0F018009 PREFIX "CURL" TAG ""
|
||||
,"UNSUPPORTED_PROTOCOL" EQUALS %X0F018012 PREFIX "CURL" TAG ""
|
||||
,"FAILED_INIT" EQUALS %X0F01801A PREFIX "CURL" TAG ""
|
||||
,"URL_MALFORMAT" EQUALS %X0F018022 PREFIX "CURL" TAG ""
|
||||
,"URL_MALFORMAT_USER" EQUALS %X0F01802A PREFIX "CURL" TAG ""
|
||||
,"COULDNT_RESOLVE_PROXY" EQUALS %X0F018032 PREFIX "CURL" TAG ""
|
||||
,"COULDNT_RESOLVE_HOST" EQUALS %X0F01803A PREFIX "CURL" TAG ""
|
||||
,"COULDNT_CONNECT" EQUALS %X0F018042 PREFIX "CURL" TAG ""
|
||||
,"FTP_WEIRD_SERVER_REPLY" EQUALS %X0F01804A PREFIX "CURL" TAG ""
|
||||
,"FTP_ACCESS_DENIED" EQUALS %X0F018052 PREFIX "CURL" TAG ""
|
||||
,"FTP_USER_PWD_INCORRECT" EQUALS %X0F01805A PREFIX "CURL" TAG ""
|
||||
,"FTP_WEIRD_PASS_REPLY" EQUALS %X0F018062 PREFIX "CURL" TAG ""
|
||||
,"FTP_WEIRD_USER_REPLY" EQUALS %X0F01806A PREFIX "CURL" TAG ""
|
||||
,"FTP_WEIRD_PASV_REPLY" EQUALS %X0F018072 PREFIX "CURL" TAG ""
|
||||
,"FTP_WEIRD_227_FORMAT" EQUALS %X0F01807A PREFIX "CURL" TAG ""
|
||||
,"FTP_CANT_GET_HOST" EQUALS %X0F018082 PREFIX "CURL" TAG ""
|
||||
,"FTP_CANT_RECONNECT" EQUALS %X0F01808A PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_SET_BINARY" EQUALS %X0F018092 PREFIX "CURL" TAG ""
|
||||
,"PARTIAL_FILE" EQUALS %X0F01809A PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_RETR_FILE" EQUALS %X0F0180A2 PREFIX "CURL" TAG ""
|
||||
,"FTP_WRITE_ERROR" EQUALS %X0F0180AA PREFIX "CURL" TAG ""
|
||||
,"FTP_QUOTE_ERROR" EQUALS %X0F0180B2 PREFIX "CURL" TAG ""
|
||||
,"HTTP_RETURNED_ERROR" EQUALS %X0F0180BA PREFIX "CURL" TAG ""
|
||||
,"WRITE_ERROR" EQUALS %X0F0180C2 PREFIX "CURL" TAG ""
|
||||
,"MALFORMAT_USER" EQUALS %X0F0180CA PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_STOR_FILE" EQUALS %X0F0180D2 PREFIX "CURL" TAG ""
|
||||
,"READ_ERROR" EQUALS %X0F0180DA PREFIX "CURL" TAG ""
|
||||
,"OUT_OF_MEMORY" EQUALS %X0F0180E2 PREFIX "CURL" TAG ""
|
||||
,"OPERATION_TIMEOUTED" EQUALS %X0F0180EA PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_SET_ASCII" EQUALS %X0F0180F2 PREFIX "CURL" TAG ""
|
||||
,"FTP_PORT_FAILED" EQUALS %X0F0180FA PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_USE_REST" EQUALS %X0F018102 PREFIX "CURL" TAG ""
|
||||
,"FTP_COULDNT_GET_SIZE" EQUALS %X0F01810A PREFIX "CURL" TAG ""
|
||||
,"HTTP_RANGE_ERROR" EQUALS %X0F018112 PREFIX "CURL" TAG ""
|
||||
,"HTTP_POST_ERROR" EQUALS %X0F01811A PREFIX "CURL" TAG ""
|
||||
,"SSL_CONNECT_ERROR" EQUALS %X0F018122 PREFIX "CURL" TAG ""
|
||||
,"BAD_DOWNLOAD_RESUME" EQUALS %X0F01812A PREFIX "CURL" TAG ""
|
||||
,"FILE_COULDNT_READ_FILE" EQUALS %X0F018132 PREFIX "CURL" TAG ""
|
||||
,"LDAP_CANNOT_BIND" EQUALS %X0F01813A PREFIX "CURL" TAG ""
|
||||
,"LDAP_SEARCH_FAILED" EQUALS %X0F018142 PREFIX "CURL" TAG ""
|
||||
,"LIBRARY_NOT_FOUND" EQUALS %X0F01814A PREFIX "CURL" TAG ""
|
||||
,"FUNCTION_NOT_FOUND" EQUALS %X0F018152 PREFIX "CURL" TAG ""
|
||||
,"ABORTED_BY_CALLBACK" EQUALS %X0F01815A PREFIX "CURL" TAG ""
|
||||
,"BAD_FUNCTION_ARGUMENT" EQUALS %X0F018162 PREFIX "CURL" TAG ""
|
||||
,"BAD_CALLING_ORDER" EQUALS %X0F01816A PREFIX "CURL" TAG ""
|
||||
,"HTTP_PORT_FAILED" EQUALS %X0F018172 PREFIX "CURL" TAG ""
|
||||
,"BAD_PASSWORD_ENTERED" EQUALS %X0F01817A PREFIX "CURL" TAG ""
|
||||
,"TOO_MANY_REDIRECTS" EQUALS %X0F018182 PREFIX "CURL" TAG ""
|
||||
,"UNKNOWN_TELNET_OPTION" EQUALS %X0F01818A PREFIX "CURL" TAG ""
|
||||
,"TELNET_OPTION_SYNTAX" EQUALS %X0F018192 PREFIX "CURL" TAG ""
|
||||
,"OBSOLETE" EQUALS %X0F01819A PREFIX "CURL" TAG ""
|
||||
,"SSL_PEER_CERTIFICATE" EQUALS %X0F0181A2 PREFIX "CURL" TAG ""
|
||||
,"GOT_NOTHING" EQUALS %X0F0181AA PREFIX "CURL" TAG ""
|
||||
,"SSL_ENGINE_NOTFOUND" EQUALS %X0F0181B2 PREFIX "CURL" TAG ""
|
||||
,"SSL_ENGINE_SETFAILED" EQUALS %X0F0181BA PREFIX "CURL" TAG ""
|
||||
,"SEND_ERROR" EQUALS %X0F0181C2 PREFIX "CURL" TAG ""
|
||||
,"RECV_ERROR" EQUALS %X0F0181CA PREFIX "CURL" TAG ""
|
||||
,"SHARE_IN_USE" EQUALS %X0F0181D2 PREFIX "CURL" TAG ""
|
||||
,"SSL_CERTPROBLEM" EQUALS %X0F0181DA PREFIX "CURL" TAG ""
|
||||
,"SSL_CIPHER" EQUALS %X0F0181E2 PREFIX "CURL" TAG ""
|
||||
,"SSL_CACERT" EQUALS %X0F0181EA PREFIX "CURL" TAG ""
|
||||
,"BAD_CONTENT_ENCODING" EQUALS %X0F0181F2 PREFIX "CURL" TAG ""
|
||||
,"LDAP_INVALID_URL" EQUALS %X0F0181FA PREFIX "CURL" TAG ""
|
||||
,"FILESIZE_EXCEEDED" EQUALS %X0F018202 PREFIX "CURL" TAG ""
|
||||
,"FTP_SSL_FAILED" EQUALS %X0F01820A PREFIX "CURL" TAG ""
|
||||
,"CURL_LAST" EQUALS %X0F018212 PREFIX "CURL" TAG ""
|
||||
;
|
||||
END_MODULE;
|
@@ -1,9 +1,12 @@
|
||||
/* $Id$ */
|
||||
/* CURLMSG_VMS.H */
|
||||
/* This defines the necessary bits to change CURLE_* error codes to VMS */
|
||||
/* style error codes. CURLMSG.H is built from CURLMSG.SDL which is built */
|
||||
/* from CURLMSG.MSG. The vms_cond array is used to return VMS errors by */
|
||||
/* putting the VMS error codes into the array offset based on CURLE_* code. */
|
||||
/* */
|
||||
/* If you update CURLMSG.MSG make sure to update this file to match. */
|
||||
/* */
|
||||
#include "curlmsg.h"
|
||||
int vms_show = 0;
|
||||
/*
|
||||
@@ -67,7 +70,7 @@ long vms_cond[] =
|
||||
CURL_ABORTED_BY_CALLBACK,
|
||||
CURL_BAD_FUNCTION_ARGUMENT,
|
||||
CURL_BAD_CALLING_ORDER,
|
||||
CURL_HTTP_PORT_FAILED,
|
||||
CURL_INTERFACE_FAILED,
|
||||
CURL_BAD_PASSWORD_ENTERED,
|
||||
CURL_TOO_MANY_REDIRECTS,
|
||||
CURL_UNKNOWN_TELNET_OPTION,
|
||||
@@ -87,5 +90,8 @@ long vms_cond[] =
|
||||
CURL_LDAP_INVALID_URL,
|
||||
CURL_FILESIZE_EXCEEDED,
|
||||
CURL_FTP_SSL_FAILED,
|
||||
CURL_SEND_FAIL_REWIND,
|
||||
CURL_SSL_ENGINE_INITFAILED,
|
||||
CURL_LOGIN_DENIED,
|
||||
CURL_CURL_LAST
|
||||
};
|
||||
|
@@ -1,3 +1,4 @@
|
||||
$! $Id$
|
||||
$! DEFINES.COM
|
||||
$! Define where to look for the curl include directory, where to put the
|
||||
$! exes and objects, and the openssl stuff. If you have hp's SSL product
|
||||
@@ -8,6 +9,9 @@ $! level and then try to build against hp's SSL product, you will need to
|
||||
$! deassign the openssl logical at the process level or the link will most
|
||||
$! probably fail, or define CURL_BUILD_NOHPSSL to anything.
|
||||
$!
|
||||
$! 8-FEB-2005, MSK, changed the openssl, libssl and libcrypto defines
|
||||
$! to not override previously defined logicals.
|
||||
$!
|
||||
$ proc = f$environment( "PROCEDURE")
|
||||
$ thisdev = f$parse( proc,,,"DEVICE")
|
||||
$ thisdir = f$parse( proc,,,"DIRECTORY") - ".PACKAGES.VMS]"
|
||||
@@ -29,9 +33,9 @@ $ exedir = exedir + ".IA64]"
|
||||
$ ssldir = "IA64"
|
||||
$ endif
|
||||
$ endif
|
||||
$ define/nolog exedir 'exedir'
|
||||
$ define/nolog objdir 'exedir'
|
||||
$ define/nolog lisdir 'exedir'
|
||||
$ def/nolog exedir 'exedir'
|
||||
$ def/nolog objdir 'exedir'
|
||||
$ def/nolog lisdir 'exedir'
|
||||
$!
|
||||
$ def/nolog curl 'THISDEV''THISDIR'.INCLUDE.CURL]
|
||||
$ def/nolog libsrc 'THISDEV''THISDIR'.LIB]
|
||||
@@ -40,9 +44,18 @@ $!
|
||||
$! If you're going to build against an OpenSSL dist, you'll want to define
|
||||
$! the following logicals to point to the dist location.
|
||||
$!
|
||||
$ def/nolog openssl 'THISDEV'[OPENSSL-0_9_7C.INCLUDE.OPENSSL]
|
||||
$ def/nolog libssl 'THISDEV'[OPENSSL-0_9_7C.'ssldir'.EXE.SSL]LIBSSL.OLB
|
||||
$ def/nolog libcrypto 'THISDEV'[OPENSSL-0_9_7C.'ssldir'.EXE.CRYPTO]LIBCRYPTO.OLB
|
||||
$ if ( f$trnlnm( "openssl") .eqs. "")
|
||||
$ then
|
||||
$ def/nolog openssl 'THISDEV'[OPENSSL.OPENSSL-0_9_7E.INCLUDE.OPENSSL]
|
||||
$ endif
|
||||
$ if ( f$trnlnm( "libssl") .eqs. "")
|
||||
$ then
|
||||
$ def/nolog libssl 'THISDEV'[OPENSSL.OPENSSL-0_9_7E.'ssldir'.EXE.SSL]LIBSSL.OLB
|
||||
$ endif
|
||||
$ if ( f$trnlnm( "libcrypto") .eqs. "")
|
||||
$ then
|
||||
$ def/nolog libcrypto 'THISDEV'[OPENSSL.OPENSSL-0_9_7E.'ssldir'.EXE.CRYPTO]LIBCRYPTO.OLB
|
||||
$ endif
|
||||
$!
|
||||
$! If you have hp's SSL product installed, and you still want to build
|
||||
$! against an OpenSSL distribution, you'll need to define the following
|
||||
|
@@ -1,3 +1,4 @@
|
||||
$Id$
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -9,6 +10,7 @@ History:
|
||||
|
||||
9-MAR-2004, Created this readme. file. Marty Kuhrt (MSK).
|
||||
15-MAR-2004, MSK, Updated to reflect the new files in this directory.
|
||||
14-FEB-2005, MSK, removed config-vms.h_with* file comments
|
||||
|
||||
|
||||
Prerequisites:
|
||||
@@ -27,8 +29,7 @@ BUILD_VMS.COM - The brute force build procedure that sets
|
||||
up the config files, and builds all the C
|
||||
and MSG files in the lib and src
|
||||
subdirectories.
|
||||
CONFIG-VMS.H_WITHOUT_SSL - The config file used for non-SSL builds.
|
||||
CONFIG-VMS.H_WITH_SSL - The config file used for SSL builds.
|
||||
CONFIG-VMS.H - The config file used for all builds.
|
||||
CURLMSG.H - Created with SDL/ALPHA/LANGUAGE=CC CURLMSG.SDL
|
||||
(Needs freeware SDL tool)
|
||||
CURLMSG.MSG - Source for .SDL and .H as well as the
|
||||
|
@@ -21,7 +21,6 @@
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
/* This is now designed to have its own local setup.h */
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -2611,6 +2610,10 @@ static int myprogress (void *clientp,
|
||||
curl_off_t point = (curl_off_t)dlnow + (curl_off_t)ulnow +
|
||||
bar->initial_size; /* we've come this far */
|
||||
|
||||
if(point > total)
|
||||
/* we have got more than the expected total! */
|
||||
total = point;
|
||||
|
||||
bar->calls++; /* simply count invokes */
|
||||
|
||||
if(total < 1) {
|
||||
@@ -3726,7 +3729,8 @@ operate(struct Configurable *config, int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
} /* if CURLE_OK */
|
||||
else if(CURLE_FTP_USER_PASSWORD_INCORRECT == res) {
|
||||
else if((CURLE_FTP_USER_PASSWORD_INCORRECT == res) ||
|
||||
(CURLE_LOGIN_DENIED == res)) {
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
|
||||
|
||||
if(response/100 == 5)
|
||||
|
@@ -32,7 +32,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
|
||||
test223 test224 test206 test207 test208 test209 test213 test240 \
|
||||
test241 test242 test519 test214 test215 test216 test217 test218 \
|
||||
test199 test225 test226 test227 test230 test231 test232 test228 \
|
||||
test229
|
||||
test229 test233 test234
|
||||
|
||||
# The following tests have been removed from the dist since they no longer
|
||||
# work. We need to fix the test suite's FTPS server first, then bring them
|
||||
|
@@ -21,7 +21,7 @@ REPLY USER 314 bluah you fewl!
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
12
|
||||
67
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
|
@@ -21,7 +21,7 @@ REPLY PASS 314 bluah you f00l!
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
11
|
||||
67
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
|
@@ -15,7 +15,7 @@ ftp
|
||||
FTP download with strict timeout and slow CWD
|
||||
</name>
|
||||
<command>
|
||||
ftp://%HOSTIP:%FTPPORT/path/to/file/126 -m 3
|
||||
ftp://%HOSTIP:%FTPPORT/path/to/file/190 -m 3
|
||||
</command>
|
||||
<file name="log/ftpserver.cmd">
|
||||
DELAY CWD 15
|
||||
@@ -24,6 +24,7 @@ DELAY CWD 15
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# 28 is CURLE_OPERATION_TIMEOUTED
|
||||
<errorcode>
|
||||
28
|
||||
</errorcode>
|
||||
|
@@ -21,7 +21,7 @@ REPLY PASS 530 temporarily not available
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<errorcode>
|
||||
10
|
||||
67
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
|
@@ -20,8 +20,9 @@ REPLY PASS 530 temporarily not available
|
||||
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
# 67 is CURLE_LOGIN_DENIED
|
||||
<errorcode>
|
||||
10
|
||||
67
|
||||
</errorcode>
|
||||
<protocol>
|
||||
USER anonymous
|
||||
|
81
tests/data/test233
Normal file
81
tests/data/test233
Normal file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 302 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
Location: http://goto.second.host.now/2330002
|
||||
Content-Length: 8
|
||||
Connection: close
|
||||
|
||||
contents
|
||||
</data>
|
||||
<data2>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
contents
|
||||
</data2>
|
||||
|
||||
<datacheck>
|
||||
HTTP/1.1 302 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
Location: http://goto.second.host.now/2330002
|
||||
Content-Length: 8
|
||||
Connection: close
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
contents
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP, proxy, site+proxy auth and Location: to new host
|
||||
</name>
|
||||
<command>
|
||||
http://first.host.it.is/we/want/that/page/233 -x %HOSTIP:%HTTPPORT --user iam:myself --proxy-user testing:this --location
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://first.host.it.is/we/want/that/page/233 HTTP/1.1
|
||||
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
|
||||
Authorization: Basic aWFtOm15c2VsZg==
|
||||
Host: first.host.it.is
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
|
||||
GET http://goto.second.host.now/2330002 HTTP/1.1
|
||||
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
|
||||
Host: goto.second.host.now
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
82
tests/data/test234
Normal file
82
tests/data/test234
Normal file
@@ -0,0 +1,82 @@
|
||||
#
|
||||
# Server-side
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 302 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
Location: http://goto.second.host.now/2340002
|
||||
Content-Length: 8
|
||||
Connection: close
|
||||
|
||||
contents
|
||||
</data>
|
||||
<data2>
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
contents
|
||||
</data2>
|
||||
|
||||
<datacheck>
|
||||
HTTP/1.1 302 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
Location: http://goto.second.host.now/2340002
|
||||
Content-Length: 8
|
||||
Connection: close
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Server: test-server/fake swsclose
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
contents
|
||||
</datacheck>
|
||||
</reply>
|
||||
|
||||
#
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
<name>
|
||||
HTTP, proxy, site+proxy auth and Location: to new host using location-trusted
|
||||
</name>
|
||||
<command>
|
||||
http://first.host.it.is/we/want/that/page/234 -x %HOSTIP:%HTTPPORT --user iam:myself --proxy-user testing:this --location-trusted
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<strip>
|
||||
^User-Agent:.*
|
||||
</strip>
|
||||
<protocol>
|
||||
GET http://first.host.it.is/we/want/that/page/234 HTTP/1.1
|
||||
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
|
||||
Authorization: Basic aWFtOm15c2VsZg==
|
||||
Host: first.host.it.is
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
|
||||
GET http://goto.second.host.now/2340002 HTTP/1.1
|
||||
Proxy-Authorization: Basic dGVzdGluZzp0aGlz
|
||||
Authorization: Basic aWFtOm15c2VsZg==
|
||||
Host: goto.second.host.now
|
||||
Pragma: no-cache
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
@@ -12,4 +12,3 @@ int test(char *URL)
|
||||
curl_easy_cleanup(curl);
|
||||
return (int)res;
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# Copyright (C) 1998 - 2005, 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
|
||||
@@ -29,6 +29,7 @@ use strict;
|
||||
@INC=(@INC, $ENV{'srcdir'}, ".");
|
||||
|
||||
require "getpart.pm"; # array functions
|
||||
require "valgrind.pm"; # valgrind report parser
|
||||
|
||||
my $srcdir = $ENV{'srcdir'} || '.';
|
||||
my $HOSTIP="127.0.0.1";
|
||||
@@ -94,6 +95,15 @@ if($valgrind) {
|
||||
if (($? >> 8)==0) {
|
||||
$valgrind_tool="--tool=memcheck ";
|
||||
}
|
||||
open(C, "<$CURL");
|
||||
my $l = <C>;
|
||||
if($l =~ /^\#\!/) {
|
||||
# The first line starts with "#!" which implies a shell-script.
|
||||
# This means libcurl is built shared and curl is a wrapper-script
|
||||
# Disable valgrind in this setup
|
||||
$valgrind=0;
|
||||
}
|
||||
close(C);
|
||||
}
|
||||
|
||||
my $gdb = checkcmd("gdb");
|
||||
@@ -1436,58 +1446,18 @@ sub singletest {
|
||||
last;
|
||||
}
|
||||
}
|
||||
my $leak;
|
||||
my $invalidread;
|
||||
my $uninitedvar;
|
||||
my $error;
|
||||
my $partial;
|
||||
|
||||
open(VAL, "<log/$l");
|
||||
while(<VAL>) {
|
||||
if($_ =~ /definitely lost: (\d*) bytes/) {
|
||||
$leak = $1;
|
||||
if($leak) {
|
||||
$error++;
|
||||
my $src=$ENV{'srcdir'};
|
||||
if(!$src) {
|
||||
$src=".";
|
||||
}
|
||||
last;
|
||||
}
|
||||
elsif($_ =~ /Invalid read of size (\d+)/) {
|
||||
$invalidread = $1;
|
||||
$error++;
|
||||
last;
|
||||
}
|
||||
elsif($_ =~ /Conditional jump or move/) {
|
||||
# If we require SSL, this test case most probaly makes
|
||||
# us use OpenSSL. OpenSSL produces numerous valgrind
|
||||
# errors of this kind, rendering it impossible for us to
|
||||
# detect (valid) reports on actual curl or libcurl code.
|
||||
|
||||
if(!$feature{'SSL'}) {
|
||||
$uninitedvar = 1;
|
||||
$error++;
|
||||
last;
|
||||
}
|
||||
else {
|
||||
$partial=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(VAL);
|
||||
if($error) {
|
||||
my @e = valgrindparse($src, $feature{'SSL'}, "log/$l");
|
||||
if($e[0]) {
|
||||
print " valgrind ERROR ";
|
||||
if($leak) {
|
||||
print "\n Leaked $leak bytes\n";
|
||||
}
|
||||
if($invalidread) {
|
||||
print "\n Read $invalidread invalid bytes\n";
|
||||
}
|
||||
if($uninitedvar) {
|
||||
print "\n Conditional jump or move depends on uninitialised value(s)\n";
|
||||
}
|
||||
print @e;
|
||||
return 1;
|
||||
}
|
||||
elsif(!$short) {
|
||||
printf " valgrind %s", $partial?"PARTIAL":"OK";
|
||||
printf " valgrind OK";
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@@ -61,11 +61,11 @@ char *appendstring(char *string, /* original string */
|
||||
{
|
||||
size_t len = strlen(buffer);
|
||||
size_t needed_len = len + *stringlen + 1;
|
||||
char buf64[256]; /* big enough? */
|
||||
char *buf64=NULL;
|
||||
|
||||
if(base64) {
|
||||
/* decode the given buffer first */
|
||||
len = Curl_base64_decode(buffer, buf64); /* updated len */
|
||||
len = Curl_base64_decode(buffer, (unsigned char**)&buf64); /* updated len */
|
||||
buffer = buf64;
|
||||
needed_len = len + *stringlen + 1; /* recalculate */
|
||||
}
|
||||
@@ -79,14 +79,20 @@ char *appendstring(char *string, /* original string */
|
||||
string = newptr;
|
||||
*stralloc = newsize;
|
||||
}
|
||||
else
|
||||
else {
|
||||
if(buf64)
|
||||
free(buf64);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
/* memcpy to support binary blobs */
|
||||
memcpy(&string[*stringlen], buffer, len);
|
||||
*stringlen += len;
|
||||
string[*stringlen]=0;
|
||||
|
||||
if(buf64)
|
||||
free(buf64);
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
109
tests/valgrind.pm
Normal file
109
tests/valgrind.pm
Normal file
@@ -0,0 +1,109 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2005, 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
|
||||
# are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# $Id$
|
||||
###########################################################################
|
||||
|
||||
sub valgrindparse {
|
||||
my ($srcdir, # the dir in which the runtests script resides
|
||||
$sslenabled,
|
||||
$file) = @_;
|
||||
my $leak;
|
||||
my $invalidread;
|
||||
my $uninitedvar;
|
||||
my $error;
|
||||
my $partial;
|
||||
my $us;
|
||||
|
||||
my @o;
|
||||
|
||||
my $bt=0;
|
||||
|
||||
open(VAL, "<$file");
|
||||
while(<VAL>) {
|
||||
if($bt) {
|
||||
# back trace parsing
|
||||
if($_ =~ /^==(\d+)== *(at|by) 0x([0-9A-F]+): (.*)/) {
|
||||
my $w = $4;
|
||||
if($w =~ /(.*) \(([^:]*):(\d+)/) {
|
||||
my ($func, $source, $line)=($1, $2, $3);
|
||||
|
||||
if(-f "$srcdir/../src/$source" ||
|
||||
-f "$srcdir/../lib/$source") {
|
||||
# this is our source
|
||||
# print "$func() at $source:$line\n";
|
||||
$us++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($us) {
|
||||
# the stack trace included source details about us
|
||||
|
||||
$error++;
|
||||
if($leak) {
|
||||
push @o, "\n Leaked $leak bytes\n";
|
||||
}
|
||||
if($invalidread) {
|
||||
push @o, "\n Read $invalidread invalid bytes\n";
|
||||
}
|
||||
if($uninitedvar) {
|
||||
push @o, "\n Conditional jump or move depends on uninitialised value(s)\n";
|
||||
}
|
||||
}
|
||||
$bt = 0; # no more backtrace
|
||||
$us = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($_ =~ /(\d+) bytes in (\d+) blocks are definitely lost/) {
|
||||
$leak = $1;
|
||||
if($leak) {
|
||||
$error++;
|
||||
}
|
||||
$bt = 1;
|
||||
}
|
||||
elsif($_ =~ /Invalid read of size (\d+)/) {
|
||||
$invalidread = $1;
|
||||
$error++;
|
||||
$bt = 1;
|
||||
}
|
||||
elsif($_ =~ /Conditional jump or move/) {
|
||||
# If we require SSL, this test case most probaly makes
|
||||
# us use OpenSSL. OpenSSL produces numerous valgrind
|
||||
# errors of this kind, rendering it impossible for us to
|
||||
# detect (valid) reports on actual curl or libcurl code.
|
||||
|
||||
if(!$sslenabled) {
|
||||
$uninitedvar = 1;
|
||||
$error++;
|
||||
$bt = 1;
|
||||
}
|
||||
else {
|
||||
$partial=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close(VAL);
|
||||
return @o;
|
||||
}
|
||||
|
||||
1;
|
Reference in New Issue
Block a user