Compare commits

..

97 Commits

Author SHA1 Message Date
Daniel Stenberg
ff681f7bfd 7.7 beta 2 fixes 2001-03-13 15:44:31 +00:00
Daniel Stenberg
60bbb64a81 EXTRA_DIST got too long, I shortened it now but we have to do something
else as it will grow a lot more...
2001-03-13 13:31:14 +00:00
Daniel Stenberg
c622f2bb4e failf() now respects the mute flag 2001-03-13 13:22:58 +00:00
Daniel Stenberg
cd59f13da6 Guenole Bescon's bug found on march 8 is added 2001-03-13 13:14:21 +00:00
Daniel Stenberg
11d718bf52 exchanged I and me to we and us in a lot of places
updated for persistant connections and 7.7
2001-03-13 11:47:30 +00:00
Daniel Stenberg
8e8846d876 Added test case 37, HTTP GET with name+password in the URL 2001-03-13 09:44:09 +00:00
Daniel Stenberg
7d562bb685 a whole new section on persitant connections and how they're treated
internally
2001-03-13 08:16:54 +00:00
Daniel Stenberg
20ddd35669 we speak HTTP 1.1 now
more braging about the portability
2001-03-13 08:16:25 +00:00
Daniel Stenberg
063f88cd14 close policies 2001-03-13 07:59:19 +00:00
Daniel Stenberg
87b0b7cab9 initial close policy support 2001-03-13 07:54:18 +00:00
Daniel Stenberg
70d0d9d4da Added 'created' to the connectdata struct to hold the creation date, to
be used for the close policy decision
2001-03-13 07:53:59 +00:00
Daniel Stenberg
4ae3bd71ea Curl_tvnow is now properly declared with (void) 2001-03-13 07:53:06 +00:00
Daniel Stenberg
a9390665b8 curl_getinfo is removed, not a public function 2001-03-13 07:46:19 +00:00
Daniel Stenberg
fb7a6e3423 added --random-file and --egd-file to the command line client 2001-03-12 16:02:29 +00:00
Daniel Stenberg
cc99e3f7de Added the two new seeding options 2001-03-12 15:52:18 +00:00
Daniel Stenberg
e6b40bb6ac two new random seed options for the ssl config struct 2001-03-12 15:47:41 +00:00
Daniel Stenberg
f2fd1b8856 two new random seed options: CURLOPT_RANDOM_FILE and CURLOPT_EGDSOCKET 2001-03-12 15:47:17 +00:00
Daniel Stenberg
cb4efcf275 better chunked error detection 2001-03-12 15:29:04 +00:00
Daniel Stenberg
56a27d608a Added test case 36:
[HTTP GET with badly formatted chunked Transfer-Encoding]
2001-03-12 15:27:01 +00:00
Daniel Stenberg
46c9075eab updated the comment for the chunked reading 2001-03-12 15:21:11 +00:00
Daniel Stenberg
d95fa648e9 made it return illegal hex in case no hexadecimal digit was read when at
least one was expected
2001-03-12 15:20:35 +00:00
Daniel Stenberg
563ad213dc added an error code for illegal hex values in the chunked stream 2001-03-12 15:20:02 +00:00
Daniel Stenberg
0121d7d731 Added new libcurl options in include/curl/curl.h, they're documented in
curl_easy_setopt.3 and they're partly implemented in lib/url.c

Slowly, we're getting there...
2001-03-12 15:11:38 +00:00
Daniel Stenberg
8495fac1c5 Added options for the persistant support, they're also documented in
curl_easy_setopt.3 now
2001-03-12 15:06:29 +00:00
Daniel Stenberg
38c349f751 support for a few new libcurl 7.7 CURLOPT_* options added 2001-03-12 15:05:54 +00:00
Daniel Stenberg
542df800ab Added four new options that come with the new persitant support:
CURLOPT_MAXCONNECTS, CURLOPT_CLOSEPOLICY, CURLOPT_FRESH_CONNECT and
CURLOPT_FORBID_REUSE
2001-03-12 14:54:00 +00:00
Daniel Stenberg
3e88b1cac5 the client is adjusted to work with persistant curl handles, and *gee* it
seems to be working!!!
2001-03-12 13:59:38 +00:00
Daniel Stenberg
d774b10afb Added infof() calls for persistant connection info, we are very likely to
need these at least for debugging 7.7 and probably later as well...
2001-03-12 13:58:03 +00:00
Daniel Stenberg
b449b94393 moved the libcurl init call 2001-03-12 13:57:02 +00:00
Daniel Stenberg
a6cb9b08b2 persistant updates 2001-03-12 13:55:06 +00:00
Daniel Stenberg
440a3101d0 added a note about persitant connections through HTTP proxies 2001-03-12 13:54:46 +00:00
Daniel Stenberg
9778a5356b Added some persistant notes 2001-03-12 13:54:10 +00:00
Daniel Stenberg
de7dcdbc54 modified to make the curl client with persistant connection support do
correct
2001-03-12 13:47:07 +00:00
Daniel Stenberg
070968abbc include the failed test case numbers in the end summary 2001-03-12 13:46:23 +00:00
Daniel Stenberg
e97fc2aab5 Added description of the new test case ranges support 2001-03-12 12:58:57 +00:00
Daniel Stenberg
a23ac24192 made it support test case ranges on the command line, specified as
"X to Y", where X is smaller than Y.
2001-03-12 12:58:30 +00:00
Daniel Stenberg
9ee14644a7 adjusted to work with the HTTP 1.1-speaking libcurl 2001-03-12 12:45:12 +00:00
Daniel Stenberg
c576e114b9 output the protocol data to stderr when verbose is on 2001-03-12 12:44:44 +00:00
Daniel Stenberg
639a7982ba server problems,
libcurl *works* persistant over HTTP proxy!!!!
2001-03-12 10:18:01 +00:00
Daniel Stenberg
5bbe189420 modified Curl_disconnect() so that it unlinks itself from the data struct,
it saves me from more mistakes when the connectindex is -1 ... also, there's
no point in having its parent do it as all parents would do it anyway.
2001-03-12 10:13:42 +00:00
Daniel Stenberg
93ff159e32 split up the big printf() into several ones to never use strings longer
than 509 letters (as newer gcc warns on with -Wall)
2001-03-12 09:47:23 +00:00
Daniel Stenberg
8eb8a0a8e4 bugfix: don't use the connectindex if it is -1 2001-03-12 09:44:57 +00:00
Daniel Stenberg
a4af638867 added persistant connection details 2001-03-12 09:44:08 +00:00
Daniel Stenberg
75a9a87ec2 replaced I and my with we and us 2001-03-12 09:43:43 +00:00
Daniel Stenberg
b5ba011110 updated 2001-03-12 09:42:22 +00:00
Daniel Stenberg
e9b763ff05 use the new name and hostname even though an old connection is reused, since
we can re-use a proxy connection that actually has different host names on
the same connection
2001-03-09 16:50:08 +00:00
Daniel Stenberg
ac0bad2433 remake Host: for each connection and it'll work with proxies too 2001-03-09 16:48:18 +00:00
Daniel Stenberg
67d5c0a970 for HTTP/1.0 we default to non keep-alive connections, but when we get a
1.0-reply from a proxy we use and the Proxy-Connection: keep-alive header
is used, we switch it on and live happily ever after
2001-03-09 16:02:59 +00:00
Daniel Stenberg
580896d615 Added httpversion to the progress struct, we do read it, we can just as well
store it.
2001-03-09 15:58:36 +00:00
Daniel Stenberg
11693c0faa the socklen_t check is more involved now, but works on linux at least 2001-03-09 15:38:59 +00:00
Daniel Stenberg
26cd8eda4a Added socklen_t 2001-03-09 15:24:33 +00:00
Daniel Stenberg
8cd3f44040 added a check for socklen_t
removed the tiny/Makefile that was added accidentaly before
2001-03-09 15:21:00 +00:00
Daniel Stenberg
2b30bfc349 all comments for the former public "low level" interface have been removed
since they were out-of-date and not correct anymore.

moved around some struct fields
2001-03-09 15:19:42 +00:00
Daniel Stenberg
8ec4dba599 removed handles and states from the main structs
renamed prefixes from curl_ to Curl_
made persistant connections work with http proxies (at least partly)
2001-03-09 15:18:25 +00:00
Daniel Stenberg
1efec6572e curl_transfer became Curl_perform() to better match the public name and
use the correct prefix
2001-03-09 15:17:09 +00:00
Daniel Stenberg
781dd7a9bf prefix changes curl_ to Curl_
made it work (partly) with persistant connections for HTTP/1.0 replies
moved the 'newurl' struct field for Location: to the connectdata struct
2001-03-09 15:16:28 +00:00
Daniel Stenberg
beb8761b22 #include <string.h> removed a warning 2001-03-09 15:14:51 +00:00
Daniel Stenberg
071c7de9fe removed curl_read() and curl_write() - they weren't used and the public
"low leve" interface is dumped
2001-03-09 15:14:22 +00:00
Daniel Stenberg
3e7ebcd051 uses socklen_t now 2001-03-09 15:13:34 +00:00
Daniel Stenberg
c67952fc5c curl_ prefix modified to Curl_ 2001-03-09 15:13:11 +00:00
Daniel Stenberg
7d7c24f915 accept() and getsockname() now use socklen_t types, as that was just added
to configure
2001-03-09 15:12:22 +00:00
Daniel Stenberg
0dc8c4d451 use unsigned int hex to receive the hex digit in, caused a warning with
-Wall and a new gcc
2001-03-09 15:11:39 +00:00
Daniel Stenberg
9cf4434ae2 Modified to use Curl_* functions instead of curl_* ones 2001-03-09 15:10:58 +00:00
Daniel Stenberg
8ccd8b6dbc only generate maximum 509 characters in each string 2001-03-09 13:11:28 +00:00
Daniel Stenberg
b4f70aa2c8 version 7.7-beta1 2001-03-08 12:35:51 +00:00
Daniel Stenberg
f54a282ccc persistant adjusts 2001-03-08 12:32:03 +00:00
Daniel Stenberg
2a11bdc216 HTTP HEAD tests 2001-03-08 10:39:36 +00:00
Daniel Stenberg
5cd4c3ed24 return from transfer when all headers have been received and nobody is set,
as is the case when doing HEAD requests
2001-03-08 10:32:27 +00:00
Daniel Stenberg
147a673063 updated for persistant connections 2001-03-08 09:25:09 +00:00
Daniel Stenberg
9ce5827fc1 made it split the version number on - too to make 7.7-blabla make a better
version number define in the header file
2001-03-08 09:23:11 +00:00
Daniel Stenberg
97f1c93674 added lots of numbers for the error codes as they're often printed
and used
2001-03-08 09:04:43 +00:00
Daniel Stenberg
e61ceaf1bd clarified the 0001-files use a bit, I couldn't understand it myself! :-) 2001-03-08 08:33:17 +00:00
Daniel Stenberg
1118612249 Added test #34 - HTTP GET with chunked Transfer-Encoding 2001-03-08 08:30:35 +00:00
Daniel Stenberg
a23db7b7c7 "Transfer-Encoding: chunked" support added 2001-03-07 23:51:41 +00:00
Daniel Stenberg
f6b6dff46a added the http_chunks files 2001-03-07 23:50:00 +00:00
Daniel Stenberg
55b8ceac18 chunked transfer encoding support 2001-03-07 23:28:22 +00:00
Daniel Stenberg
bcf448ee32 connection timeout is in for 7.7 2001-03-07 23:24:23 +00:00
Daniel Stenberg
91e4da7ddb initial chunked transfer-encoding support 2001-03-07 17:12:12 +00:00
Daniel Stenberg
2873c18132 removed compiler warning if HAVE_RAND_STATUS is false 2001-03-07 17:08:20 +00:00
Daniel Stenberg
5dd0a8a63e Added persistant connections blurb even if it doesn't really work yet... 2001-03-06 14:37:37 +00:00
Daniel Stenberg
2103dc41f5 cleaned up for the 7.7 fixes 2001-03-06 12:50:42 +00:00
Daniel Stenberg
2ef13230cb new seeding stuff as mentioned by Albert Chin 2001-03-06 00:04:58 +00:00
Daniel Stenberg
9479ac6dda Added a persistant connection example 2001-03-05 16:56:10 +00:00
Daniel Stenberg
4e878eae79 updated to libcurl 7.7 conditions 2001-03-05 15:51:34 +00:00
Daniel Stenberg
1e8e90a220 mucho updated with new 7.7 concepts 2001-03-05 15:38:06 +00:00
Daniel Stenberg
fe95c7dc34 removed an incorrect comment 2001-03-05 14:52:23 +00:00
Daniel Stenberg
6dae34d5da all test cases run OK now (again) 2001-03-05 14:13:15 +00:00
Daniel Stenberg
36c621c9df more details on debugging with the test suite 2001-03-05 14:08:22 +00:00
Daniel Stenberg
1717963e3d show the ftp server invoke line when -d is used 2001-03-05 14:03:48 +00:00
Daniel Stenberg
4646a1ffa9 talks more on verbose 2001-03-05 14:03:20 +00:00
Daniel Stenberg
0cb4eba002 free the struct on done 2001-03-05 14:01:13 +00:00
Daniel Stenberg
5eba359b5d telnet without any static variables 2001-03-05 13:59:43 +00:00
Daniel Stenberg
07ce7539a8 set download size properly for HTTP downloads 2001-03-05 13:40:31 +00:00
Daniel Stenberg
c21f848c1c enable persistant connections by default 2001-03-05 13:40:08 +00:00
Daniel Stenberg
84e94fda8b remade FILE:// support to look more as the other protocols 2001-03-05 13:39:01 +00:00
Daniel Stenberg
ebd6897b10 runtests -g explained 2001-03-04 18:11:25 +00:00
Daniel Stenberg
5ab8a9d32f persistant support protocol updates 2001-03-04 18:07:13 +00:00
131 changed files with 2453 additions and 1345 deletions

83
CHANGES
View File

@@ -6,7 +6,88 @@
History of Changes
** curl 7.7 DOES NOT currently WORK. **
Daniel (13 March 2001)
- Added the policy stuff to the curl_easy_setopt man page for the two supported
policies.
- Implemented some support for the CURLOPT_CLOSEPOLICY option. The policies
CURLCLOSEPOLICY_LEAST_RECENTLY_USED and CURLCLOSEPOLICY_OLDEST are now
supported, and the "least recently used" is used as default if no policy
is chosen.
Daniel (12 March 2001)
- Added CURLOPT_RANDOM_FILE and CURLOPT_EGDSOCKET to libcurl for seeding the
SSL random engine. The random seeding support was also brought to the curl
client with the new options --random-file <file> and --egd-file <file>. I
need some people to really test this to know they work as supposed. Remember
that libcurl now informs (if verbose is on) if the random seed is considered
weak (HTTPS connections).
- Made the chunked transfer-encoding engine detected bad formatted data length
and return error if so (we can't possibly extract sensible data if this is
the case). Added a test case that detects this. Number 36. Now there are 60
test cases.
- Added 5 new libcurl options to curl/curl.h that can be used to control the
persistant connection support in libcurl. They're also documented (fairly
thoroughly) in the curl_easy_setopt.3 man page. Three of them are now
implemented, although not really tested at this point... Anyway, the new
implemented options are named CURLOPT_MAXCONNECTS, CURLOPT_FRESH_CONNECT,
CURLOPT_FORBID_REUSE. The ones still left to write code for are:
CURLOPT_CLOSEPOLICY and its related option CURLOPT_CLOSEFUNCTION.
- Made curl (the actual command line tool) use the new libcurl 7.7 persistant
connection support by re-using the same curl handle for every specified file
transfer and after some more test case tweaking we have 100% test case OK.
I made some test cases return HTTP/1.0 now to make sure that works as well.
- Had to add 'Connection: close' to the headers of a bunch of test cases so
that curl behaves "old-style" since the test http server doesn't do multiple
connections... Now I get 100% test case OK.
- The curl.haxx.se site, the main curl mailing list and my personal email are
all dead today due to power blackout in the area where the main servers are
located. Horrible.
- I've made persistance work over a squid HTTP proxy. I find it disturbing
that it uses headers that aren't present in any HTTP standard though
(Proxy-Connection:) and that makes me feel that I'm now on the edge of what
the standard actually defines. I need to get this code excercised on a lot
of different HTTP proxies before I feel safe.
Now I'm facing the problem with my test suite servers (both FTP and HTTP)
not supporting persistant connections and libcurl is doing them now. I have
to fix the test servers to get all the test cases do OK.
Daniel (8 March 2001)
- Guenole Bescon reported that libcurl did output errors to stderr even if
MUTE and NOPROGRESS was set. It turned out to be a bug and happens if
there's an error and no ERRORBUFFER is set. This is now corrected.
Version 7.7-beta1
Daniel (8 March 2001)
- "Transfer-Encoding: chunked" is no longer any trouble for libcurl. I've
added two source files and I've run some test downloads that look fine.
- HTTP HEAD works too, even on 1.1 servers.
Daniel (5 March 2001)
- The current 57 test cases now pass OK. It would suggest that libcurl works
using the old-style with one connection per handle. The test suite doesn't
handle multiple connections yet so there are no test cases for this.
- I patched the telnet.c heavily to not use any global variables anymore. It
should make it a lot nicer library-wise.
- The file:// support was modified slightly to use the internal connect-first-
then-do approach.
Daniel (4 March 2001)
- More bugs erased.
Version 7.7-alpha2
Daniel (4 March 2001)
- Now, there's even a basic check that a re-used connection is still alive

View File

@@ -43,3 +43,11 @@
/* Define this to 'int' if ssize_t is not an available typedefed type */
#undef ssize_t
/* Define this to 'int' if socklen_t is not an available typedefed type */
#undef socklen_t
/* Define this as a suitable file to read random data from */
#undef RANDOM_FILE
/* Define this to your Entropy Gathering Daemon socket pathname */
#undef EGD_SOCKET

View File

@@ -391,6 +391,36 @@ AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
dnl dl lib?
AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
dnl **********************************************************************
dnl Check for the random seed preferences
dnl **********************************************************************
AC_ARG_WITH(egd-socket,
[ --with-egd-socket=FILE Entropy Gathering Daemon socket pathname],
[ EGD_SOCKET="$withval" ]
)
if test -n "$EGD_SOCKET" ; then
AC_DEFINE_UNQUOTED(EGD_SOCKET, "$EGD_SOCKET")
fi
dnl Check for user-specified random device
AC_ARG_WITH(random,
[ --with-random=FILE read randomness from FILE (default=/dev/urandom)],
[ RANDOM_FILE="$withval" ],
[
dnl Check for random device
AC_CHECK_FILE("/dev/urandom",
[
RANDOM_FILE="/dev/urandom";
]
)
]
)
if test -n "$RANDOM_FILE" ; then
AC_SUBST(RANDOM_FILE)
AC_DEFINE_UNQUOTED(RANDOM_FILE, "$RANDOM_FILE")
fi
dnl **********************************************************************
dnl Check for the presence of Kerberos4 libraries and headers
dnl **********************************************************************
@@ -545,7 +575,8 @@ else
dnl these can only exist if openssl exists
AC_CHECK_FUNCS( RAND_status \
RAND_screen )
RAND_screen \
RAND_egd )
fi
@@ -662,6 +693,28 @@ AC_CHECK_SIZEOF(long long, 4)
# check for ssize_t
AC_CHECK_TYPE(ssize_t, int)
dnl
dnl We can't just AC_CHECK_TYPE() for socklen_t since it doesn't appear
dnl in the standard headers. We egrep for it in the socket headers and
dnl if it is used there we assume we have the type defined, otherwise
dnl we search for it with AC_CHECK_TYPE() the "normal" way
dnl
if test "$ac_cv_header_sys_socket_h" = "yes"; then
AC_MSG_CHECKING(for socklen_t in sys/socket.h)
AC_EGREP_HEADER(socklen_t,
sys/socket.h,
socklen_t=yes
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
fi
if test "$socklen_t" != "yes"; then
# check for socklen_t the standard way if it wasn't found before
AC_CHECK_TYPE(socklen_t, int)
fi
dnl Get system canonical name
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(OS, "${host}")
@@ -733,6 +786,5 @@ AC_OUTPUT( Makefile \
packages/Linux/Makefile \
packages/Linux/RPM/Makefile \
packages/Linux/RPM/curl.spec \
packages/Linux/RPM/curl-ssl.spec \
tiny/Makefile )
packages/Linux/RPM/curl-ssl.spec )

View File

@@ -6,9 +6,9 @@
BUGS
Curl has grown substantially from that day, several years ago, when I
started fiddling with it. When I write this, there are 16500 lines of source
code, and by the time you read this it has probably grown even more.
Curl and libcurl have grown substantially since the beginning. At the time
of writing (mid March 2001), there are 23000 lines of source code, and by
the time you read this it has probably grown even more.
Of course there are lots of bugs left. And lots of misfeatures.
@@ -21,10 +21,11 @@ BUGS
http://sourceforge.net/bugs/?group_id=976
When reporting a bug, you should include information that will help us
understand what's wrong, what's expected and how to repeat it. You therefore
need to supply your operating system's name and version number (uname -a
under a unix is fine), what version of curl you're using (curl -v is fine),
what URL you were working with and anything else you think matters.
understand what's wrong, what you expected to happen and how to repeat the
bad behaviour. You therefore need to supply your operating system's name and
version number (uname -a under a unix is fine), what version of curl you're
using (curl -V is fine), what URL you were working with and anything else
you think matters.
If curl crashed, causing a core dump (in unix), there is hardly any use to
send that huge file to anyone of us. Unless we have an exact same system
@@ -32,7 +33,7 @@ BUGS
a stack trace and send that (much smaller) output to us instead!
The address and how to subscribe to the mailing list is detailed in the
README.curl file.
MANUAL file.
HOW TO GET A STACK TRACE with a common unix debugger
====================================================

View File

@@ -13,7 +13,7 @@ To Think About When Contributing Source Code
The License Issue
When contributing with code, you agree to put your changes and new code under
the same license curl and libcurl is already using.
the same license curl and libcurl is already using unless stated otherwise.
If you add a larger piece of code, you can opt to make that file or set of
files to use a different license as long as they don't enfore any changes to
@@ -26,19 +26,19 @@ Naming
Try using a non-confusing naming scheme for your new functions and variable
names. It doesn't necessarily have to mean that you should use the same as in
other places of the code, just that the names should be logical,
understandable and be named according to what they're used for.
understandable and be named according to what they're used for. File-local
functions should be made static.
Indenting
Please try using the same indenting levels and bracing method as all the
other code already does. It makes the source code a lot easier to follow if
all of it is written using the same style. I don't ask you to like it, I just
ask you to follow the tradition! ;-)
all of it is written using the same style. We don't ask you to like it, we
just ask you to follow the tradition! ;-)
Commenting
Comment your source code extensively. I don't see myself as a very good
source commenter, but I try to become one. Commented code is quality code and
Comment your source code extensively. Commented code is quality code and
enables future modifications much more. Uncommented code much more risk being
completely replaced when someone wants to extend things, since other persons'
source code can get quite hard to read.
@@ -71,9 +71,9 @@ Separate Patches Doing Different Things
Patch Against Recent Sources
Please try to get the latest available sources to make your patches
against. It makes my life so much easier. The very best is if you get the
most up-to-date sources from the CVS repository, but the latest release
archive is quite OK as well!
against. It makes the life of the developers so much easier. The very best is
if you get the most up-to-date sources from the CVS repository, but the
latest release archive is quite OK as well!
Document
@@ -91,9 +91,9 @@ Write Access to CVS Repository
Test Cases
Since the introduction of the test suite, we will get the possibility to
quickly verify that the main features are working as supposed to. To maintain
this situation and improve it, all new features and functions that are added
need tro be tested. Every feature that is added should get at least one valid
Since the introduction of the test suite, we can quickly verify that the main
features are working as they're supposed to. To maintain this situation and
improve it, all new features and functions that are added need to be tested
in the test suite. Every feature that is added should get at least one valid
test case that verifies that it works as documented. If every submitter also
post a few test cases, it won't end up as a heavy burden on a single person!

114
docs/FAQ
View File

@@ -1,4 +1,4 @@
Updated: February 16, 2001 (http://curl.haxx.se/docs/faq.shtml)
Updated: March 13, 2001 (http://curl.haxx.se/docs/faq.shtml)
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -31,7 +31,7 @@ FAQ
3.7 Can I use curl to delete/rename a file through FTP?
3.8 How do I tell curl to follow HTTP redirects?
3.9 How do I use curl in PHP?
3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
4. Running Problems
4.1 Problems connecting to SSL servers.
@@ -112,29 +112,30 @@ FAQ
1.4 When will you make curl do XXXX ?
I love suggestions of what to change in order to make curl and libcurl
better. I do however believe in a few rules when it comes to the future of
We love suggestions of what to change in order to make curl and libcurl
better. We do however believe in a few rules when it comes to the future of
curl:
* It is to remain a command line tool. If you want GUIs or fancy scripting
* Curl is to remain a command line tool. If you want GUIs or fancy scripting
capabilities, you're free to write another tool that uses libcurl and that
offers this. There's no point in having one single tool that does every
offers this. There's no point in having a single tool that does every
imaginable thing. That's also one of the great advantages of having the
core of curl as a library: libcurl.
core of curl as a library.
* I do not add things to curl that other small and available tools already
* We do not add things to curl that other small and available tools already
do very fine at the side. Curl's output is fine to pipe into another
program or redirect to another file for the next program to interpret.
* I focus on protocol related issues and improvements. If you wanna do more
* We focus on protocol related issues and improvements. If you wanna do more
magic with the supported protocols than curl currently does, chances are
big I will agree. If you wanna add more protocols, I may very well
agree.
* If you want me to make all the work while you wait for me to implement it
for you, that is not a very friendly attitude. I spend a considerable time
already on maintaining and developing curl. In order to get more out of
me, I trust you will offer some of your time and efforts in return.
* If you want someone else to make all the work while you wait for us to
implement it for you, that is not a very friendly attitude. We spend a
considerable time already on maintaining and developing curl. In order to
get more out of us, you should consider trading in some of your time and
efforts in return.
* If you write the code, chances are bigger that it will get into curl
faster.
@@ -182,23 +183,24 @@ FAQ
2.2. Does curl work/build with other SSL libraries?
Curl has been written to use OpenSSL, although I doubt there would be much
Curl has been written to use OpenSSL, although there should not be much
problems using a different library. If anyone does "port" curl to use a
different SSL library, I am of course very interested in getting the patch!
different SSL library, we are of course very interested in getting the
patch!
2.3. Where can I find a copy of LIBEAY32.DLL?
That is an OpenSSL binary built for Windows.
Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
on a windows machine to do https://. Check out the curl web page to find
on a windows machine to do https://. Check out the curl web site to find
accurate and up-to-date pointers to recent OpenSSL DDLs and other binary
packages.
2.4. Does cURL support Socks (RFC 1928) ?
No. Nobody has wanted it that badly yet. I would appriciate patches that
brings this functionality.
No. Nobody has wanted it that badly yet. We appriciate patches that bring
this functionality.
3. Usage problems
@@ -220,7 +222,7 @@ FAQ
3.2. How do I tell curl to resume a transfer?
Curl supports resume both ways on FTP, download ways on HTTP.
Curl supports resumed transfers both ways on both FTP and HTTP.
Try the -C option.
@@ -232,10 +234,10 @@ FAQ
use the -F type. In all the most common cases, you should use -d which then
causes a posting with the type 'application/x-www-form-urlencoded'.
I have described this in some detail in the README.curl file, and if you
don't understand it the first time, read it again before you post questions
about this to the mailing list. I would also suggest that you read through
the mailing list archives for old postings and questions regarding this.
This is described in some detail in the README.curl file, and if you don't
understand it the first time, read it again before you post questions about
this to the mailing list. Also, try reading through the mailing list
archives for old postings and questions regarding this.
3.4. How do I tell curl to run custom FTP commands?
@@ -292,7 +294,7 @@ FAQ
invoke the curl tool using a command line. This is the way to use curl if
you're using PHP3 or PHP4 built without curl module support.
3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
Curl adheres to the HTTP spec, which basically means you can play with *any*
protocol that is built ontop of HTTP. Protocols such as SOAP, WEBDAV and
@@ -306,9 +308,9 @@ FAQ
4.1. Problems connecting to SSL servers.
It took a very long time before I could sort out why curl had problems
to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+.
The error sometimes showed up similar to:
It took a very long time before we could sort out why curl had problems to
connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The
error sometimes showed up similar to:
16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
@@ -316,12 +318,12 @@ FAQ
requests properly. To correct this problem, tell curl to select SSLv2 from
the command line (-2/--sslv2).
I have also seen examples where the remote server didn't like the SSLv2
There has also been examples where the remote server didn't like the SSLv2
request and instead you had to force curl to use SSLv3 with -3/--sslv3.
4.2. Why do I get problems when I use & or % in the URL?
In general unix shells, the & letter is treated special and when used it
In general unix shells, the & letter is treated special and when used, it
runs the specified command in the background. To safely send the & as a part
of a URL, you should qoute the entire URL by using single (') or double (")
quotes around it.
@@ -346,8 +348,8 @@ FAQ
curl '{curl,www}.haxx.se'
To be able to use those letters as actual parts of the URL (without using
them for the curl URL "globbing" system), use the -g/--globoff option
(included in curl 7.6 and later):
them for the curl URL "globbing" system), use the -g/--globoff option (curl
7.6 and later):
curl -g 'www.site.com/weirdname[].html'
@@ -363,8 +365,8 @@ FAQ
4.5 Why do I get return code XXX from a HTTP server?
RFC2616 clearly explains the return codes. I'll make a short transcript
here. Go read the RFC for exact details:
RFC2616 clearly explains the return codes. This is a short transcript. Go
read the RFC for exact details:
4.5.1 "400 Bad Request"
@@ -400,7 +402,7 @@ FAQ
4.7. How do I keep usernames and passwords secret in Curl command lines?
I see this problem as two parts:
This problem has two sides:
The first part is to avoid having clear-text passwords in the command line
so that they don't appear in 'ps' outputs and similar. That is easily
@@ -447,9 +449,8 @@ FAQ
programs. libcurl will use thread-safe functions instead of non-safe ones if
your system has such.
I am very interested in once and for all getting some kind of report or
README file from those who have used libcurl in a threaded environment,
since I haven't and I get this question more and more frequently!
We would appriciate some kind of report or README file from those who have
used libcurl in a threaded environment.
5.2 How can I receive all data into a large memory chunk?
@@ -486,9 +487,16 @@ FAQ
5.3 How do I fetch multiple files with libcurl?
The easy interface of libcurl does not support multiple requests using the
same connection. The only available way to do multiple requests is to
init/perform/cleanup for each request.
Starting with version 7.7, curl and libcurl will have excellent support for
transferring multiple files. You should just repeatedly set new URLs with
curl_easy_setopt() and then transfer it with curl_easy_perform(). The handle
you get from curl_easy_init() is not only reusable starting with libcurl
7.7, but also you're encouraged to reuse it if you can, as that will enable
libcurl to use persistant connections.
For libcurl prior to 7.7, there was no multiple file support. The only
available way to do multiple requests was to init/perform/cleanup for each
transfer.
5.4 Does libcurl do Winsock initing on win32 systems?
@@ -512,17 +520,16 @@ FAQ
5.6 What about Keep-Alive or persistant connections?
This is closely related to issue 5.3. Since libcurl has no real support
for doing multiple file transfers, there's no support for Keep-Alive or
persistant connections either.
Starting with version 7.7, curl and libcurl will have excellent support for
persistant connections when transferring several files from the same server.
Curl will attempt to reuse connections for all URLs specified on the same
command line/config file, and libcurl will reuse connections for all
transfers that are made using the same libcurl handle.
This is of course subject to change as soon as libcurl gets support for
multiple files. Feel free to join in and make this change happen sooner!
Previous versions had no persistant connection support.
6. License Issues
NOTE: This section concerns curl 7.5.2 or later!
Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
the Mozilla Public License. To get a really good answer to your license
conflict questions, you should study the MPL and MIT/X licenses and the
@@ -567,9 +574,10 @@ FAQ
No.
We carefully picked this license years ago and a large amount of people have
contributed with source code knowing that this is the license we use. This
license puts the restrictions we want on curl/libcurl and it does not spread
to other programs or libraries that use it. The recent dual license
modification should make it possible for everyone to use libcurl or curl in
their projects, no matter what license they already have in use.
We have carefully picked this license after years of development and
discussions and a large amount of people have contributed with source code
knowing that this is the license we use. This license puts the restrictions
we want on curl/libcurl and it does not spread to other programs or
libraries that use it. The recent dual license modification should make it
possible for everyone to use libcurl or curl in their projects, no matter
what license they already have in use.

View File

@@ -17,12 +17,14 @@ Misc
- progress bar/time specs while downloading
- "standard" proxy environment variables support
- config file support
- compiles on win32
- compiles on win32 (reported built on 29 operating systems)
- redirectable stderr
- use selected network interface for outgoing traffic
- IPv6 support
- persistant connections
HTTP
- HTTP/1.1 compliant
- GET
- PUT
- HEAD
@@ -72,6 +74,7 @@ FTP
TELNET
- connection negotiation
- custom telnet options
- stdin/stdout I/O
LDAP (*2)

View File

@@ -1,4 +1,4 @@
Updated for curl 7.6 on January 26, 2001
Updated for curl 7.7 on March 13, 2001
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -7,11 +7,11 @@
INTERNALS
The project is kind of split in two. The library and the client. The client
part uses the library, but the library is meant to be designed to allow other
applications to use it.
The project is split in two. The library and the client. The client part uses
the library, but the library is designed to allow other applications to use
it.
Thus, the largest amount of code and complexity is in the library part.
The largest amount of code and complexity is in the library part.
CVS
===
@@ -35,13 +35,13 @@ Windows vs Unix
the same at all places except for the header file that defines them. The
macros in use are sclose(), sread() and swrite().
2. Windows requires a couple of init calls for the socket stuff
2. Windows requires a couple of init calls for the socket stuff.
Those must be made by the application that uses libcurl, in curl that means
src/main.c has some code #ifdef'ed to do just that.
3. The file descriptors for network communication and file operations are
not easily interchangable as in unix
not easily interchangable as in unix.
We avoid this by not trying any funny tricks on file descriptors.
@@ -51,10 +51,10 @@ Windows vs Unix
We set stdout to binary under windows
Inside the source code, I do make an effort to avoid '#ifdef WIN32'. All
Inside the source code, We make an effort to avoid '#ifdef [Your OS]'. All
conditionals that deal with features *should* instead be in the format
'#ifdef HAVE_THAT_WEIRD_FUNCTION'. Since Windows can't run configure scripts,
I maintain two config-win32.h files (one in / and one in src/) that are
we maintain two config-win32.h files (one in / and one in src/) that are
supposed to look exactly as a config.h file would have looked like on a
Windows machine!
@@ -64,12 +64,6 @@ Windows vs Unix
Library
=======
As described elsewhere, libcurl is meant to get two different "layers" of
interfaces. At the present point only the high-level, the "easy", interface
has been fully implemented and documented. We assume the easy-interface in
this description, the low-level interface will be documented when fully
implemented.
There are plenty of entry points to the library, namely each publicly defined
function that libcurl offers to applications. All of those functions are
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
@@ -103,8 +97,9 @@ Library
lib/sendf.c) function to send printf-style formatted data to the remote host
and when they're ready to make the actual file transfer they call the
Curl_Transfer() function (in lib/transfer.c) to setup the transfer and
returns. curl_transfer() then calls _Tranfer() in lib/transfer.c that
performs the entire file transfer.
returns. Curl_perform() then calls Transfer() in lib/transfer.c that performs
the entire file transfer. Curl_perform() is what does the main "connect - do
- transfer - done" loop. It loops if there's a Location: to follow.
During transfer, the progress functions in lib/progress.c are called at a
frequent interval (or at the user's choice, a specified callback might get
@@ -114,6 +109,22 @@ Library
When completed, the curl_easy_cleanup() should be called to free up used
resources.
A quick roundup on internal function sequences (many of these call
protocol-specific function-pointers):
curl_connect - connects to a remote site and does initial connect fluff
This also checks for an existing connection to the requested site and uses
that one if it is possible.
curl_do - starts a transfer
curl_transfer() - transfers data
curl_done - ends a transfer
curl_disconnect - disconnects from a remote site. This is called when the
disconnect is really requested, which doesn't necessarily have to be
exactly after curl_done in case we want to keep the connection open for
a while.
HTTP(S)
HTTP offers a lot and is the protocol in curl that uses the most lines of
@@ -129,6 +140,14 @@ Library
the source by the use of curl_read() for reading and curl_write() for writing
data to the remote server.
http_chunks.c contains functions that understands HTTP 1.1 chunked transfer
encoding.
An interesting detail with the HTTP(S) request, is the add_buffer() series of
functions we use. They append data to one single buffer, and when the
building is done the entire request is sent off in one single write. This is
done this way to overcome problems with flawed firewalls and lame servers.
FTP
The Curl_if2ip() function can be used for getting the IP number of a
@@ -160,7 +179,7 @@ Library
URL encoding and decoding, called escaping and unescaping in the source code,
is found in lib/escape.c.
While transfering data in _Transfer() a few functions might get
While transfering data in Transfer() a few functions might get
used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
more).
@@ -182,6 +201,34 @@ Library
exists in lib/getpass.c. libcurl offers a custom callback that can be used
instead of this, but it doesn't change much to us.
Persistant Connections
======================
With curl 7.7, we added persistant connection support to libcurl which has
introduced a somewhat different treatmeant of things inside of libcurl.
o The 'UrlData' struct returned in the curl_easy_init() call must never
hold connection-oriented data. It is meant to hold the root data as well
as all the options etc that the library-user may choose.
o The 'UrlData' struct holds the cache array of pointers to 'connectdata'
structs. There's one connectdata struct for each connection that libcurl
knows about.
o This also enables the 'curl handle' to be reused on subsequent transfers,
something that was illegal in pre-7.7 versions.
o When we are about to perform a transfer with curl_easy_perform(), we first
check for an already existing connection in the cache that we can use,
otherwise we create a new one and add to the cache. If the cache is full
already when we add a new connection, we close one of the present ones. We
select which one to close dependent on the close policy that may have been
previously set.
o When the tranfer operation is complete, we try to leave the connection open.
Particular options may tell us not to, and protocols may signal closure on
connections and then we don't keep it open of course.
o When curl_easy_cleanup() is called, we close all still opened connections.
You do realize that the curl handle must be re-used in order for the
persistant connections to work.
Library Symbols
===============
@@ -236,12 +283,12 @@ Memory Debugging
deal with resources that might give us problems if we "leak" them. The
functions in the memdebug system do nothing fancy, they do their normal
function and then log information about what they just did. The logged data
is then analyzed after a complete session,
can then be analyzed after a complete session,
memanalyze.pl is a perl script present only in CVS (not part of the release
archives) that analyzes a log file generated by the memdebug system. It
detects if resources are allocated but never freed and other kinds of errors
related to resource management.
memanalyze.pl is a perl script present only present in CVS (not part of the
release archives) that analyzes a log file generated by the memdebug
system. It detects if resources are allocated but never freed and other kinds
of errors related to resource management.
Use -DMALLOCDEBUG when compiling to enable memory debugging.
@@ -256,8 +303,8 @@ Test Suite
httpserver.pl and ftpserver.pl before all the test cases are performed. The
test suite currently only runs on unix-like platforms.
You'll find a complete description of the test case data files in the README
file in the test directory.
You'll find a complete description of the test case data files in the
tests/README file.
The test suite automatically detects if curl was built with the memory
debugging enabled, and if it was it will detect memory leaks too.
@@ -269,6 +316,7 @@ Building Releases
released, run the 'maketgz' script (using 'make distcheck' will give you a
pretty good view on the status of the current sources). maketgz prompts for
version number of the client and the library before it creates a release
archive.
archive. maketgz uses 'make dist' for the actual archive building, why you
need to fill in the Makefile.am files properly for which files that should
be included in the release archives.
You must have autoconf installed to build release archives.

View File

@@ -4,58 +4,91 @@
| | | |_) | (__| |_| | | | |
|_|_|_.__/ \___|\__,_|_| |_|
How To Use Libcurl In Your C/C++ Program
How To Use Libcurl In Your Program
[ libcurl can be used directly from within your PHP or Perl programs as well,
look elsewhere for documentation on this ]
Interfaces
libcurl currently offers two different interfaces to the URL transfer
engine. They can be seen as one low-level and one high-level, in the sense
that the low-level one will allow you to deal with a lot more details but on
the other hand not offer as many fancy features (such as Location:
following). The high-level interface is supposed to be a built-in
implementation of the low-level interface. You will not be able to mix
function calls from the different layers.
As we currently ONLY support the high-level interface, the so called easy
interface, I will not attempt to describe any low-level functions at this
point.
Function descriptions
The interface is meant to be very simple for very simple
implementations. Thus, we have minimized the number of entries.
The interface is meant to be very simple for applictions/programmers, hence
the name "easy". We have therefore minimized the number of entries.
The Easy Interface
When using the easy interface, you init your easy-session and get a handle,
which you use as input to the following interface functions you use.
When using the easy interface, you init your session and get a handle, which
you use as input to the following interface functions you use. Use
curl_easy_init() to get the handle.
You continue by setting all the options you want in the upcoming transfer,
most important among them is the URL itself. You might want to set some
callbacks as well that will be called from the library when data is available
etc.
most important among them is the URL itself (you can't transfer anything
without a specified URL as you may have figured out yourself). You might want
to set some callbacks as well that will be called from the library when data
is available etc. curl_easy_setopt() is there for this.
When all is setup, you tell libcurl to perform the transfer. It will then do
the entire operation and won't return until it is done or failed.
When all is setup, you tell libcurl to perform the transfer using
curl_easy_perform(). It will then do the entire operation and won't return
until it is done or failed.
After the transfer has been made, you cleanup the easy-session's handle and
libcurl is entirely off the hook!
After the transfer has been made, you cleanup the session with
curl_easy_cleanup() and libcurl is entirely off the hook! If you want
persistant connections, you don't cleanup immediately, but instead run ahead
and perform other transfers. See the chapter below for Persistant
Connections.
curl_easy_init()
curl_easy_setopt()
curl_easy_perform()
curl_easy_cleanup()
While the above four functions are the main functions to use in the easy
interface, there is a series of helpful functions to use. They are:
While the above mentioned four functions are the main functions to use in the
easy interface, there is a series of other helpful functions to use. They
are:
curl_version() - displays the libcurl version
curl_getdate() - converts a date string to time_t
curl_getenv() - portable environment variable reader
curl_easy_getinfo() - get information about a performed transfer
curl_formparse() - helps building a HTTP form POST
curl_formfree() - free a list built with curl_formparse()
curl_slist_append() - builds a linked list
curl_slist_free_all() - frees a whole curl_slist
Read the separate man pages for these functions for details!
For details on these, read the separate man pages.
Portability
libcurl works *exactly* the same, on any of the platforms it compiles and
builds on.
There's only one caution, and that is the win32 platform that may(*) require
you to init the winsock stuff before you use the libcurl functions. Details
on this are noted on the curl_easy_init() man page.
(*) = it appears as if users of the cygwin environment get this done
automatically.
Threads
Never *ever* call curl-functions simultaneously using the same handle from
several threads. libcurl is thread-safe and can be used in any number of
threads, but you must use separate curl handles if you want to use libcurl in
more than one thread simultaneously.
Persistant Connections
With libcurl 7.7, persistant connections were added. Persistant connections
means that libcurl can re-use the same connection for several transfers, if
the conditions are right.
libcurl will *always* attempt to use persistant connections. Whenever you use
curl_easy_perform(), libcurl will attempt to use an existing connection to do
the transfer, and if none exists it'll open a new one that will be subject
for re-use on a possible following call to curl_easy_perform().
To allow libcurl to take full advantage of persistant connections, you should
do as many of your file transfers as possible using the same curl
handle. When you call curl_easy_cleanup(), all the possibly open connections
held by libcurl will be closed and forgotten.
Note that the options set with curl_easy_setopt() will be used in on every
repeat curl_easy_perform() call
Compatibility with older libcurls
Repeated curl_easy_perform() calls on the same handle were not supported in
pre-7.7 versions, and caused confusion and defined behaviour.

View File

@@ -25,12 +25,16 @@ SIMPLE USAGE
Get a list of the root directory of an FTP site:
curl ftp://ftp.fts.frontec.se/
curl ftp://cool.haxx.se/
Get the definition of curl from a dictionary:
curl dict://dict.org/m:curl
Fetch two documents at once:
curl ftp://cool.haxx.se/ http://www.weirdserver.com:8000/
DOWNLOAD TO A FILE
Get a web page and store in a local file:
@@ -43,6 +47,10 @@ DOWNLOAD TO A FILE
curl -O http://www.netscape.com/index.html
Fetch two files and store them with their remote names:
curl -O www.haxx.se/index.html -O curl.haxx.se/download.html
USING PASSWORDS
FTP
@@ -455,9 +463,13 @@ EXTRA HEADERS
curl -H "X-you-and-me: yes" www.love.com
This can also be useful in case you want curl to send a different text in
a header than it normally does. The -H header you specify then replaces the
header curl would normally send.
This can also be useful in case you want curl to send a different text in a
header than it normally does. The -H header you specify then replaces the
header curl would normally send. If you replace an internal header with an
empty one, you prevent that header from being sent. To prevent the Host:
header from being used:
curl -H "Host:" www.server.com
FTP and PATH NAMES
@@ -745,6 +757,25 @@ TELNET
to track when the login prompt is received and send the username and
password accordingly.
PERSISTANT CONNECTIONS
Specifying multiple files on a single command line will make curl transfer
all of them, one after the other in the specified order.
libcurl will attempt to use persistant connections for the transfers so that
the second transfer to the same host can use the same connection that was
already initiated and was left open in the previous transfer. This greatly
decreases connection time for all but the first transfer and it makes a far
better use of the network.
Note that curl cannot use persistant connections for transfers that are used
in subsequence curl invokes. Try to stuff as many URLs as possible on the
same command line if they are using the same host, as that'll make the
transfers faster. If you use a http proxy for file transfers, practicly
all transfers will be persistant.
Persistant connections were introduced in curl 7.7.
MAILING LISTS
For your convenience, we have several open mailing lists to discuss curl,
@@ -753,10 +784,10 @@ MAILING LISTS
To subscribe to the main curl list, mail curl-request@contactor.se with
"subscribe <fill in your email address>" in the body.
To subscribe to the libcurl users list, follow the instructions at
http://curl.haxx.se/mail/
To subscribe to the curl-library users/deverlopers list, follow the
instructions at http://curl.haxx.se/mail/
To subscribe to the curl announce list, to only get information about new
To subscribe to the curl-announce list, to only get information about new
releases, follow the instructions at http://curl.haxx.se/mail/
To subscribe to the curl-and-PHP list in which curl using with PHP is

View File

@@ -6,22 +6,32 @@
TODO
For the future
Things to do in project cURL. Please tell me what you think, contribute and
send me patches that improve things!
Ok, this is what I wanna do with Curl. Please tell me what you think, and
please don't hesitate to contribute and send me patches that improve this
product! (Yes, you may add things not mentioned here, these are just a
few teasers...)
To do for the 7.7 release:
* Fix the random seeding. Add --egd-socket and --random-file options to the
curl client and libcurl curl_easy_setopt() interface.
* Support persistant connections (fully detailed elsewhere)
* Add a special connection-timeout that only goes for the connection phase.
To do for the 7.8 release:
* Make SSL session ids get used if multiple HTTPS documents from the same
host is requested.
* Make the curl tool support URLs that start with @ that would then mean that
the following is a plain list with URLs to download. Thus @filename.txt
reads a list of URLs from a local file. A fancy option would then be to
support @http://whatever.com that would first load a list and then get the
URLs mentioned in the list. I figure -O or something would have to be
implied by such an action.
To do in a future release:
* Add configure options that disables certain protocols in libcurl to
decrease footprint. '--disable-[protocol]' where protocol is http, ftp,
telnet, ldap, dict or file.
* Extend the test suite to include telnet and https. The telnet could just do
ftp or http operations (for which we have test servers) and the https would
probably work against/with some of the openssl tools.
* Add a command line option that allows the output file to get the same time
stamp as the remote file. libcurl already is capable of fetching the remote
@@ -31,16 +41,11 @@ For the future
an alternative to OpenSSL:
http://www.mozilla.org/projects/security/pki/nss/
* Make sure the low-level interface works. highlevel.c should basically be
possible to write using that interface. Document the low-level interface
* Make the easy-interface support multiple file transfers. If they're done
to the same host, they should use persistant connections or similar.
Figure out a nice design for this.
* Add asynchronous name resolving, as this enables full timeout support for
fork() systems.
* Non-blocking connect(), also to make timeouts work on windows.
* Move non-URL related functions that are used by both the lib and the curl
application to a separate "portability lib".
@@ -48,14 +53,13 @@ For the future
something being worked on in this area) and perl (we have seen the first
versions of this!) comes to mind. Python anyone?
* "Content-Encoding: compress/gzip/zlib"
* "Content-Encoding: compress/gzip/zlib" HTTP 1.1 clearly defines how to get
and decode compressed documents. There is the zlib that is pretty good at
decompressing stuff. This work was started in October 1999 but halted again
since it proved more work than we thought. It is still a good idea to
implement though.
HTTP 1.1 clearly defines how to get and decode compressed documents. There
is the zlib that is pretty good at decompressing stuff. This work was
started in October 1999 but halted again since it proved more work than we
thought. It is still a good idea to implement though.
* Authentication: NTLM. It would be to support that MS crap called NTLM
* Authentication: NTLM. Support for that MS crap called NTLM
authentication. MS proxies and servers sometime require that. Since that
protocol is a proprietary one, it involves reverse engineering and network
sniffing. This should however be a library-based functionality. There are a
@@ -70,30 +74,19 @@ For the future
http://hopf.math.nwu.edu/testpage/digest/
And some friendly person's server source code is available at
http://hopf.math.nwu.edu/digestauth/index.html
Then there's the Apache mod_digest source code too of course. It seems as
if Netscape doesn't support this, and not many servers do. Although this is
a lot better authentication method than the more common "Basic". Basic
sends the password in cleartext over the network, this "Digest" method uses
a challange-response protocol which increases security quite a lot.
* Multiple Proxies?
Is there anyone that actually uses serial-proxies? I mean, send CONNECT to
the first proxy to connect to the second proxy to which you send CONNECT to
connect to the remote host (or even more iterations). Is there anyone
wanting curl to support it? (Not that it would be hard, just confusing...)
* Other proxies
Ftp-kind proxy, Socks5, whatever kind of proxies are there?
* IPv6 Awareness and support
Where ever it would fit. configure search for v6-versions of a few
functions and then use them instead is of course the first thing to do...
RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT
should be replaced with EPRT for IPv6, and EPSV instead of PASV.
* IPv6 Awareness and support. (This is partly done.) RFC 2428 "FTP
Extensions for IPv6 and NATs" is interesting. PORT should be replaced with
EPRT for IPv6 (done), and EPSV instead of PASV. HTTP proxies are left to
add support for.
* SSL for more protocols, like SSL-FTP...
(http://search.ietf.org/internet-drafts/draft-murray-auth-ftp-ssl-05.txt)
* HTTP POST resume using Range:

View File

@@ -2,7 +2,7 @@
.\" nroff -man curl.1
.\" Written by Daniel Stenberg
.\"
.TH curl 1 "19 January 2001" "Curl 7.6" "Curl Manual"
.TH curl 1 "12 March 2001" "Curl 7.7" "Curl Manual"
.SH NAME
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
HTTPS syntax.
@@ -41,6 +41,12 @@ supported at the moment:
Starting with curl 7.6, you can specify any amount of URLs on the command
line. They will be fetched in a sequential manner in the specified order.
Starting with curl 7.7, curl will attempt to re-use connections for multiple
file transfers, so that getting many files from the same server will not do
multiple connects/handshakes. This improves speed. Of course this is only done
on files specified on a single command line and cannot be used between
separate curl invokes.
.SH OPTIONS
.IP "-a/--append"
(FTP)

View File

@@ -2,13 +2,13 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_cleanup 3 "22 May 2000" "Curl 7.0" "libcurl Manual"
.TH curl_easy_cleanup 3 "5 March 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_easy_cleanup - End a libcurl "easy" session
curl_easy_cleanup - End a libcurl session
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "curl_easy_cleanup(CURL *" handle ");
.BI "curl_easy_cleanup(CURL *" handle ");"
.ad
.SH DESCRIPTION
This function must be the last function to call for a curl session. It is the
@@ -17,6 +17,10 @@ opposite of the
function and must be called with the same
.I handle
as input as the curl_easy_init call returned.
This will effectively close all connections libcurl has been used and possibly
has kept open until now. Don't call this function if you intend to transfer
more files (libcurl 7.7 or later).
.SH RETURN VALUE
None
.SH "SEE ALSO"

View File

@@ -2,11 +2,11 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_init 3 "4 February 2001" "Curl 7.6.1" "libcurl Manual"
.TH curl_easy_init 3 "5 March 2001" "libcurl 7.6.1" "libcurl Manual"
.SH NAME
curl_easy_getinfo - Extract information from a curl session (added in 7.4)
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ... );"
.ad
@@ -83,8 +83,8 @@ verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to
curl_easy_setopt). (Added in 7.4.2)
.TP
.B CURLINFO_CONTENT_LENGTH_DOWNLOAD
Pass a pointer to a double to receive the content-length of the download.
(Added in 7.6.1)
Pass a pointer to a double to receive the content-length of the download. This
is the value read from the Content-Length: field. (Added in 7.6.1)
.TP
.B CURLINFO_CONTENT_LENGTH_UPLOAD
Pass a pointer to a double to receive the specified size of the upload.

View File

@@ -2,11 +2,11 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_init 3 "26 September 2000" "Curl 7.0" "libcurl Manual"
.TH curl_easy_init 3 "5 March 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_easy_init - Start a libcurl "easy" session
curl_easy_init - Start a libcurl session
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "CURL *curl_easy_init( );"
.ad
@@ -19,6 +19,10 @@ when the operation is complete.
On win32 systems, you need to init the winsock stuff manually, libcurl will
not do that for you. WSAStartup() and WSACleanup() should be used accordingly.
Using libcurl 7.7 and later, you should perform all your sequential file
transfers using the same curl handle. This enables libcurl to use persistant
connections where possible.
.SH RETURN VALUE
If this function returns NULL, something went wrong and you cannot use the
other curl functions.

View File

@@ -2,11 +2,11 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_perform 3 "1 Mar 2001" "Curl 7.0" "libcurl Manual"
.TH curl_easy_perform 3 "5 Mar 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_easy_perform - Do the actual transfer in a "easy" session
curl_easy_perform - Perform a file transfer
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "CURLcode curl_easy_perform(CURL *" handle ");
.ad
@@ -17,9 +17,22 @@ It must be called with the same
.I handle
as input as the curl_easy_init call returned.
You are only allowed to call this function once using the same handle. If you
want to do repeated calls, you must call curl_easy_cleanup and curl_easy_init
again first.
libcurl version 7.7 or later (for older versions see below): You can do any
amount of calls to curl_easy_perform() while using the same handle. If you
intend to transfer more than one file, you are even encouraged to do
so. libcurl will then attempt to re-use the same connection for the following
transfers, thus making the operations faster, less CPU intense and using less
network resources. Just note that you will have to use
.I curl_easy_setopt
between the invokes to set options for the following curl_easy_perform.
You must never call this function simultaneously from two places using the
same handle. Let the function return first before invoking it another time. If
you want parallel transfers, you must use several curl handles.
Before libcurl version 7.7: You are only allowed to call this function once
using the same handle. If you want to do repeated calls, you must call
curl_easy_cleanup and curl_easy_init again first.
.SH RETURN VALUE
0 means everything was ok, non-zero means an error occurred as
.I <curl/curl.h>

View File

@@ -2,11 +2,11 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_setopt 3 "2 February 2001" "Curl 7.5" "libcurl Manual"
.TH curl_easy_setopt 3 "13 March 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_easy_setopt - Set curl easy-session options
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "CURLcode curl_easy_setopt(CURL *" handle ", CURLoption "option ", ...);
.ad
@@ -20,7 +20,18 @@ followed by a parameter. That parameter can be a long, a function pointer or
an object pointer, all depending on what the option in question expects. Read
this manual carefully as bad input values may cause libcurl to behave badly!
You can only set one option in each function call. A typical application uses
many calls in the setup phase.
many curl_easy_setopt() calls in the setup phase.
NOTE: strings passed to libcurl as 'char *' arguments, will not be copied by
the library. Instead you should keep them available until libcurl no longer
needs them. Failing to do so will cause very odd behaviour or even crashes.
More note: the options set with this function call are valid for the
forthcoming data transfers that are performed when you invoke
.I curl_easy_perform .
The options are not in any way reset between transfers, so if you want
subsequent transfers with different options, you must change them between the
transfers.
The
.I "handle"
@@ -86,14 +97,16 @@ libcurl what the expected size of the infile is.
.TP
.B CURLOPT_URL
The actual URL to deal with. The parameter should be a char * to a zero
terminated string. NOTE: this option is currently required!
terminated string. The string must remain present until curl no longer needs
it, as it doesn't copy the string. NOTE: this option is required to be set
before curl_easy_perform() is called.
.TP
.B CURLOPT_PROXY
If you need libcurl to use a http proxy to access the outside world, set the
proxy string with this option. The parameter should be a char * to a zero
terminated string. To specify port number in this string, append":[port]" to
terminated string. To specify port number in this string, append :[port] to
the end of the host name. The proxy string may be prefixed with
"[protocol]://" since any such prefix will be ignored.
[protocol]:// since any such prefix will be ignored.
.TP
.B CURLOPT_PROXYPORT
Set this long with this option to set the proxy port to use unless it is
@@ -189,9 +202,11 @@ prompted for it.
.TP
.B CURLOPT_RANGE
Pass a char * as parameter, which should contain the specified range you
want. It should be in the format "X-Y", where X or Y may be left out. The HTTP
want. It should be in the format "X-Y", where X or Y may be left out. HTTP
transfers also support several intervals, separated with commas as in
.I "X-Y,N-M".
.I "X-Y,N-M"
. Using this kind of multiple intervals will cause the HTTP server to send the
response document in pieces.
.TP
.B CURLOPT_ERRORBUFFER
Pass a char * to a buffer that the libcurl may store human readable error
@@ -202,7 +217,8 @@ library. The buffer must be at least CURL_ERROR_SIZE big.
Pass a long as parameter containing the maximum time in seconds that you allow
the libcurl transfer operation to take. Do note that normally, name lookups
maky take a considerable time and that limiting the operation to less than a
few minutes risk aborting perfectly normal operations.
few minutes risk aborting perfectly normal operations. This option will cause
curl to use the SIGALRM to enable timeouting system calls.
.TP
.B CURLOPT_POSTFIELDS
Pass a char * as parameter, which should be the full data to post in a HTTP
@@ -410,6 +426,50 @@ Pass a long. The set number will be the redirection limit. If that many
redirections have been followed, the next redirect will cause an error. This
option only makes sense if the CURLOPT_FOLLOWLOCATION is used at the same
time. (Added in 7.5)
.TP
.B CURLOPT_MAXCONNECTS
Pass a long. The set number will be the persistant connection cache size. The
set amount will be the maximum amount of simultaneous connections that libcurl
may cache between file transfers. Default is 5, and there isn't much point in
changing this value unless you are perfectly aware of how this work and
changes libcurl's behaviour. Note: if you have already performed transfers
with this curl handle, setting a smaller MAXCONNECTS than before may cause
open connections to unnecessarily get closed. (Added in 7.7)
.TP
.B CURLOPT_CLOSEPOLICY
Pass a long. This option sets what policy libcurl should use when the
connection cache is filled and one of the open connections has to be closed to
make room for a new connection. This must be one of the CURLCLOSEPOLICY_*
defines. Use CURLCLOSEPOLICY_LEAST_RECENTLY_USED to make libcurl close the
connection that was least recently used, that connection is also least likely
to be capable of re-use. Use CURLCLOSEPOLICY_OLDEST to make libcurl close the
oldest connection, the one that was created first among the ones in the
connection cache. The other close policies are not support yet. (Added in 7.7)
.TP
.B CURLOPT_FRESH_CONNECT
Pass a long. Set to non-zero to make the next transfer use a new connection by
force. If the connection cache is full before this connection, one of the
existinf connections will be closed as according to the set policy. This
option should be used with caution and only if you understand what it
does. Set to 0 to have libcurl attempt re-use of an existing connection.
(Added in 7.7)
.TP
.B CURLOPT_FORBID_REUSE
Pass a long. Set to non-zero to make the next transfer explicitly close the
connection when done. Normally, libcurl keep all connections alive when done
with one transfer in case there comes a succeeding one that can re-use them.
This option should be used with caution and only if you understand what it
does. Set to 0 to have libcurl keep the connection open for possibly later
re-use. (Added in 7.7)
.TP
.B CURLOPT_RANDOM_FILE
Pass a char * to a zero terminated file name. The file will be used to read
from to seed the random engine for SSL. The more random the specified file is,
the more secure will the SSL connection become.
.TP
.B CURLOPT_FORBID_REUSE
Pass a char * to the zero terminated path name to the Entropy Gathering Daemon
socket. It will be used to seed the random engine for SSL.
.PP
.SH RETURN VALUE
0 means the option was set properly, non-zero means an error as

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_formfree 3 "17 November 2000" "Curl 7.5" "libcurl Manual"
.TH curl_formfree 3 "5 March 2001" "libcurl 7.5" "libcurl Manual"
.SH NAME
curl_formfree - free a previously build multipart/formdata HTTP POST chain
.SH SYNOPSIS

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_formparse 3 "22 February 2001" "Curl 7.0" "libcurl Manual"
.TH curl_formparse 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_formparse - add a section to a multipart/formdata HTTP POST
.SH SYNOPSIS

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_getdate 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.TH curl_getdate 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_getdate - Convert an date in a ASCII string to number of seconds since
January 1, 1970

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_getenv 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.TH curl_getenv 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_getenv - return value for environment name
.SH SYNOPSIS

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_slist_append 3 "1 Mar 2001" "Curl 7.7" "libcurl Manual"
.TH curl_slist_append 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_slist_append - add a string to an slist
.SH SYNOPSIS

View File

@@ -2,13 +2,13 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_slist_free_all 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.TH curl_slist_free_all 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_slist_free_all - free an entire curl_slist list
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "void curl_slist_free_all(struct curl_slit *" list);
.BI "void curl_slist_free_all(struct curl_slist *" list);
.ad
.SH DESCRIPTION
curl_slist_free_all() removes all traces of a previously built curl_slist

View File

@@ -2,11 +2,11 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_version 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.TH curl_version 3 "5 March 2001" "libcurl 7.0" "libcurl Manual"
.SH NAME
curl_version - returns the libcurl version string
.SH SYNOPSIS
.B #include <curl/easy.h>
.B #include <curl/curl.h>
.sp
.BI "char *curl_version( );"
.ad
@@ -14,9 +14,9 @@ curl_version - returns the libcurl version string
Returns a human readable string with the version number of libcurl and some of
its important components (like OpenSSL version).
Do note that this returns the actual running lib's version, you might have
installed a newer lib's include files in your system which may turn your
LIBCURL_VERSION #define value to differ from this result.
Note: this returns the actual running lib's version, you might have installed
a newer lib's include files in your system which may turn your LIBCURL_VERSION
#define value to differ from this result.
.SH RETURN VALUE
A pointer to a zero terminated string.
.SH "SEE ALSO"

View File

@@ -6,7 +6,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies
EXTRA_DIST =
README curlgtk.c sepheaders.c simple.c postit.c \
win32sockets.c \
win32sockets.c persistant.c \
getpageinvar.php simpleget.php simplepost.php
all:

View File

@@ -0,0 +1,53 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*/
#include <stdio.h>
#include <unistd.h>
#include <curl/curl.h>
/* to make this work under windows, use the win32-functions from the
docs/examples/win32socket.c file as well */
/* This example REQUIRES libcurl 7.7 or later */
#if (LIBCURL_VERSION_NUM < 0x070700)
#error Too old libcurl version, upgrade or stay away.
#endif
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
#ifdef MALLOCDEBUG
/* this sends all memory debug messages to a specified logfile */
curl_memdebug("memdump");
#endif
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_HEADER, 1);
/* get the first document */
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/");
res = curl_easy_perform(curl);
/* get another document from the same server using the same
connection */
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/docs/");
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}

View File

@@ -97,71 +97,57 @@ typedef int (*curl_passwd_callback)(void *clientp,
typedef enum {
CURLE_OK = 0,
CURLE_UNSUPPORTED_PROTOCOL,
CURLE_FAILED_INIT,
CURLE_URL_MALFORMAT,
CURLE_URL_MALFORMAT_USER,
CURLE_COULDNT_RESOLVE_PROXY,
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
CURLE_FTP_WEIRD_SERVER_REPLY,
CURLE_FTP_ACCESS_DENIED,
CURLE_FTP_USER_PASSWORD_INCORRECT,
CURLE_FTP_WEIRD_PASS_REPLY,
CURLE_FTP_WEIRD_USER_REPLY,
CURLE_FTP_WEIRD_PASV_REPLY,
CURLE_FTP_WEIRD_227_FORMAT,
CURLE_FTP_CANT_GET_HOST,
CURLE_FTP_CANT_RECONNECT,
CURLE_FTP_COULDNT_SET_BINARY,
CURLE_PARTIAL_FILE,
CURLE_FTP_COULDNT_RETR_FILE,
CURLE_FTP_WRITE_ERROR,
CURLE_FTP_QUOTE_ERROR,
CURLE_HTTP_NOT_FOUND,
CURLE_WRITE_ERROR,
CURLE_UNSUPPORTED_PROTOCOL, /* 1 */
CURLE_FAILED_INIT, /* 2 */
CURLE_URL_MALFORMAT, /* 3 */
CURLE_URL_MALFORMAT_USER, /* 4 */
CURLE_COULDNT_RESOLVE_PROXY, /* 5 */
CURLE_COULDNT_RESOLVE_HOST, /* 6 */
CURLE_COULDNT_CONNECT, /* 7 */
CURLE_FTP_WEIRD_SERVER_REPLY, /* 8 */
CURLE_FTP_ACCESS_DENIED, /* 9 */
CURLE_FTP_USER_PASSWORD_INCORRECT, /* 10 */
CURLE_FTP_WEIRD_PASS_REPLY, /* 11 */
CURLE_FTP_WEIRD_USER_REPLY, /* 12 */
CURLE_FTP_WEIRD_PASV_REPLY, /* 13 */
CURLE_FTP_WEIRD_227_FORMAT, /* 14 */
CURLE_FTP_CANT_GET_HOST, /* 15 */
CURLE_FTP_CANT_RECONNECT, /* 16 */
CURLE_FTP_COULDNT_SET_BINARY, /* 17 */
CURLE_PARTIAL_FILE, /* 18 */
CURLE_FTP_COULDNT_RETR_FILE, /* 19 */
CURLE_FTP_WRITE_ERROR, /* 20 */
CURLE_FTP_QUOTE_ERROR, /* 21 */
CURLE_HTTP_NOT_FOUND, /* 22 */
CURLE_WRITE_ERROR, /* 23 */
CURLE_MALFORMAT_USER, /* 24 - user name is illegally specified */
CURLE_FTP_COULDNT_STOR_FILE, /* 25 - failed FTP upload */
CURLE_READ_ERROR, /* 26 - could open/read from file */
CURLE_OUT_OF_MEMORY, /* 27 */
CURLE_OPERATION_TIMEOUTED, /* 28 - the timeout time was reached */
CURLE_FTP_COULDNT_SET_ASCII, /* 29 - TYPE A failed */
CURLE_FTP_PORT_FAILED, /* 30 - FTP PORT operation failed */
CURLE_FTP_COULDNT_USE_REST, /* 31 - the REST command failed */
CURLE_FTP_COULDNT_GET_SIZE, /* 32 - the SIZE command failed */
CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
CURLE_HTTP_POST_ERROR, /* 34 */
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
CURLE_FTP_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
CURLE_FILE_COULDNT_READ_FILE, /* 37 */
CURLE_LDAP_CANNOT_BIND, /* 38 */
CURLE_LDAP_SEARCH_FAILED, /* 39 */
CURLE_LIBRARY_NOT_FOUND, /* 40 */
CURLE_FUNCTION_NOT_FOUND, /* 41 */
CURLE_ABORTED_BY_CALLBACK, /* 42 */
CURLE_BAD_FUNCTION_ARGUMENT, /* 43 */
CURLE_BAD_CALLING_ORDER, /* 44 */
CURLE_HTTP_PORT_FAILED, /* 45 - HTTP Interface operation failed */
CURLE_BAD_PASSWORD_ENTERED, /* 46 - my_getpass() returns fail */
CURLE_TOO_MANY_REDIRECTS , /* 47 - catch endless re-direct loops */
CURLE_UNKNOWN_TELNET_OPTION, /* 48 - User specified an unknown option */
CURLE_TELNET_OPTION_SYNTAX , /* 49 - Malformed telnet option */
CURLE_MALFORMAT_USER, /* the user name is illegally specified */
CURLE_FTP_COULDNT_STOR_FILE, /* failed FTP upload */
CURLE_READ_ERROR, /* could open/read from file */
CURLE_OUT_OF_MEMORY,
CURLE_OPERATION_TIMEOUTED, /* the timeout time was reached */
CURLE_FTP_COULDNT_SET_ASCII, /* TYPE A failed */
CURLE_FTP_PORT_FAILED, /* FTP PORT operation failed */
CURLE_FTP_COULDNT_USE_REST, /* the REST command failed */
CURLE_FTP_COULDNT_GET_SIZE, /* the SIZE command failed */
CURLE_HTTP_RANGE_ERROR, /* The RANGE "command" didn't seem to work */
CURLE_HTTP_POST_ERROR,
CURLE_SSL_CONNECT_ERROR, /* something was wrong when connecting with SSL */
CURLE_FTP_BAD_DOWNLOAD_RESUME, /* couldn't resume download */
CURLE_FILE_COULDNT_READ_FILE,
CURLE_LDAP_CANNOT_BIND,
CURLE_LDAP_SEARCH_FAILED,
CURLE_LIBRARY_NOT_FOUND,
CURLE_FUNCTION_NOT_FOUND,
CURLE_ABORTED_BY_CALLBACK,
CURLE_BAD_FUNCTION_ARGUMENT,
CURLE_BAD_CALLING_ORDER,
CURLE_HTTP_PORT_FAILED, /* HTTP Interface operation failed */
CURLE_BAD_PASSWORD_ENTERED, /* when the my_getpass() returns fail */
CURLE_TOO_MANY_REDIRECTS , /* catch endless re-direct loops */
CURLE_UNKNOWN_TELNET_OPTION , /* User specified an unknown option */
CURLE_TELNET_OPTION_SYNTAX , /* Malformed telnet option */
CURL_LAST
CURL_LAST /* never use! */
} CURLcode;
/* This is just to make older programs not break: */
@@ -412,6 +398,33 @@ typedef enum {
/* This points to a linked list of telnet options */
CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
/* Max amount of cached alive connections */
CINIT(MAXCONNECTS, LONG, 71),
/* What policy to use when closing connections when the cache is filled
up */
CINIT(CLOSEPOLICY, LONG, 72),
/* Callback to use when CURLCLOSEPOLICY_CALLBACK is set */
CINIT(CLOSEFUNCTION, FUNCTIONPOINT, 73),
/* Set to explicitly use a new connection for the upcoming transfer.
Do not use this unless you're absolutely sure of this, as it makes the
operation slower and is less friendly for the network. */
CINIT(FRESH_CONNECT, LONG, 74),
/* Set to explicitly forbid the upcoming transfer's connection to be re-used
when done. Do not use this unless you're absolutely sure of this, as it
makes the operation slower and is less friendly for the network. */
CINIT(FORBID_REUSE, LONG, 75),
/* Set to a file name that contains random data for libcurl to use to
seed the random engine when doing SSL connects. */
CINIT(RANDOM_FILE, OBJECTPOINT, 76),
/* Set to the Entropy Gathering Daemon socket pathname */
CINIT(EGDSOCKET, OBJECTPOINT, 77),
CURLOPT_LASTENTRY /* the last unusued */
} CURLoption;
@@ -458,8 +471,8 @@ char *curl_getenv(char *variable);
char *curl_version(void);
/* This is the version number */
#define LIBCURL_VERSION "7.7-alpha2"
#define LIBCURL_VERSION_NUM 0x070000
#define LIBCURL_VERSION "7.7-beta2"
#define LIBCURL_VERSION_NUM 0x070700
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
struct curl_slist {
@@ -516,21 +529,6 @@ typedef enum {
before it can be included! */
#include <curl/easy.h> /* nothing in curl is fun without the easy stuff */
/*
* NAME curl_getinfo()
*
* DESCRIPTION
*
* Request internal information from the curl session with this function.
* The third argument MUST be a pointer to a long or a pointer to a char *.
* The data pointed to will be filled in accordingly and can be relied upon
* only if the function returns CURLE_OK.
* This function is intended to get used *AFTER* a performed transfer, all
* results are undefined before the transfer is completed.
*/
CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...);
typedef enum {
CURLCLOSEPOLICY_NONE, /* first, never use this */

View File

@@ -58,7 +58,8 @@ getenv.c ldap.h ssluse.h \
escape.c mprintf.c telnet.c \
escape.h getpass.c netrc.c telnet.h \
getinfo.c transfer.c strequal.c strequal.h easy.c \
security.h security.c krb4.c krb4.h memdebug.c memdebug.h inet_ntoa_r.h
security.h security.c krb4.c krb4.h memdebug.c memdebug.h inet_ntoa_r.h \
http_chunks.c http_chunks.h
noinst_HEADERS = setup.h transfer.h

View File

@@ -83,15 +83,11 @@ CURL *curl_easy_init(void)
CURLcode res;
struct UrlData *data;
if(curl_init())
return NULL;
/* We use curl_open() with undefined URL so far */
res = curl_open((CURL **)&data, NULL);
res = Curl_open((CURL **)&data, NULL);
if(res != CURLE_OK)
return NULL;
data->interf = CURLI_EASY; /* mark it as an easy one */
/* SAC */
data->device = NULL;
@@ -119,16 +115,16 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
if(tag < CURLOPTTYPE_OBJECTPOINT) {
/* This is a LONG type */
param_long = va_arg(arg, long);
curl_setopt(data, tag, param_long);
Curl_setopt(data, tag, param_long);
}
else if(tag < CURLOPTTYPE_FUNCTIONPOINT) {
/* This is a object pointer type */
param_obj = va_arg(arg, void *);
curl_setopt(data, tag, param_obj);
Curl_setopt(data, tag, param_obj);
}
else {
param_func = va_arg(arg, func_T );
curl_setopt(data, tag, param_func);
Curl_setopt(data, tag, param_func);
}
va_end(arg);
@@ -137,13 +133,12 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
CURLcode curl_easy_perform(CURL *curl)
{
return curl_transfer(curl);
return Curl_perform(curl);
}
void curl_easy_cleanup(CURL *curl)
{
curl_close(curl);
curl_free();
Curl_close(curl);
}
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
@@ -153,5 +148,5 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
va_start(arg, info);
paramp = va_arg(arg, void *);
return curl_getinfo(curl, info, paramp);
return Curl_getinfo(curl, info, paramp);
}

View File

@@ -78,7 +78,7 @@ char *curl_unescape(char *string, int length)
char *ns = malloc(alloc);
unsigned char in;
int index=0;
int hex;
unsigned int hex;
char querypart=FALSE; /* everything to the right of a '?' letter is
the "query part" where '+' should become ' '.
RFC 2316, section 3.10 */

View File

@@ -91,25 +91,19 @@
#include "memdebug.h"
#endif
CURLcode file(struct connectdata *conn)
/* Emulate a connect-then-transfer protocol. We connect to the file here */
CURLcode Curl_file_connect(struct connectdata *conn)
{
/* This implementation ignores the host name in conformance with
RFC 1738. Only local files (reachable via the standard file system)
are supported. This means that files on remotely mounted directories
(via NFS, Samba, NT sharing) can be accessed through a file:// URL
*/
CURLcode res = CURLE_OK;
char *path = conn->path;
struct stat statbuf;
size_t expected_size=-1;
size_t nread;
struct UrlData *data = conn->data;
char *buf = data->buffer;
int bytecount = 0;
struct timeval start = Curl_tvnow();
struct timeval now = start;
char *actual_path = curl_unescape(conn->path, 0);
struct FILE *file;
int fd;
char *actual_path = curl_unescape(path, 0);
file = (struct FILE *)malloc(sizeof(struct FILE));
if(!file)
return CURLE_OUT_OF_MEMORY;
memset(file, 0, sizeof(struct FILE));
conn->proto.file = file;
#if defined(WIN32) || defined(__EMX__)
int i;
@@ -126,9 +120,37 @@ CURLcode file(struct connectdata *conn)
free(actual_path);
if(fd == -1) {
failf(data, "Couldn't open file %s", path);
failf(conn->data, "Couldn't open file %s", conn->path);
return CURLE_FILE_COULDNT_READ_FILE;
}
file->fd = fd;
return CURLE_OK;
}
/* This is the do-phase, separated from the connect-phase above */
CURLcode Curl_file(struct connectdata *conn)
{
/* This implementation ignores the host name in conformance with
RFC 1738. Only local files (reachable via the standard file system)
are supported. This means that files on remotely mounted directories
(via NFS, Samba, NT sharing) can be accessed through a file:// URL
*/
CURLcode res = CURLE_OK;
struct stat statbuf;
size_t expected_size=-1;
size_t nread;
struct UrlData *data = conn->data;
char *buf = data->buffer;
int bytecount = 0;
struct timeval start = Curl_tvnow();
struct timeval now = start;
int fd;
/* get the fd from the connection phase */
fd = conn->proto.file->fd;
if( -1 != fstat(fd, &statbuf)) {
/* we could stat it, then read out the size */
expected_size = statbuf.st_size;

View File

@@ -23,6 +23,6 @@
*
* $Id$
*****************************************************************************/
CURLcode file(struct connectdata *conn);
CURLcode Curl_file(struct connectdata *conn);
CURLcode Curl_file_connect(struct connectdata *conn);
#endif

View File

@@ -119,8 +119,8 @@ static CURLcode AllowServerConnect(struct UrlData *data,
size_t size = sizeof(struct sockaddr_in);
struct sockaddr_in add;
getsockname(sock, (struct sockaddr *) &add, (int *)&size);
s=accept(sock, (struct sockaddr *) &add, (int *)&size);
getsockname(sock, (struct sockaddr *) &add, (socklen_t *)&size);
s=accept(sock, (struct sockaddr *) &add, (socklen_t *)&size);
sclose(sock); /* close the first socket */
@@ -296,6 +296,9 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
memset(ftp, 0, sizeof(struct FTP));
conn->proto.ftp = ftp;
/* We always support persistant connections on ftp */
conn->bits.close = FALSE;
/* get some initial data into the ftp struct */
ftp->bytecountp = &conn->bytecount;
@@ -929,7 +932,7 @@ again:;
size = sizeof(add);
if(getsockname(portsock, (struct sockaddr *) &add,
(int *)&size)<0) {
(socklen_t *)&size)<0) {
failf(data, "getsockname() failed");
return CURLE_FTP_PORT_FAILED;
}

View File

@@ -31,7 +31,7 @@
#include <string.h>
#include <stdarg.h>
CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
CURLcode Curl_getinfo(CURL *curl, CURLINFO info, ...)
{
va_list arg;
long *param_longp;

View File

@@ -104,6 +104,7 @@
#include "memdebug.h"
#endif
/* ------------------------------------------------------------------------- */
/*
* The add_buffer series of functions are used to build one large memory chunk
* from repeated function invokes. Used so that the entire HTTP request can
@@ -205,7 +206,7 @@ CURLcode add_buffer(send_buffer *in, void *inptr, size_t size)
}
/* end of the add_buffer functions */
/*****************************************************************************/
/* ------------------------------------------------------------------------- */
/*
* Read everything until a newline.
@@ -309,6 +310,9 @@ CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
return CURLE_OK;
}
/*
* HTTP stuff to do at connect-time.
*/
CURLcode Curl_http_connect(struct connectdata *conn)
{
struct UrlData *data;
@@ -402,6 +406,9 @@ CURLcode Curl_http(struct connectdata *conn)
else
http = conn->proto.http;
/* We default to persistant connections */
conn->bits.close = FALSE;
if ( (conn->protocol&(PROT_HTTP|PROT_FTP)) &&
data->bits.upload) {
data->bits.http_put=1;
@@ -462,10 +469,14 @@ CURLcode Curl_http(struct connectdata *conn)
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
}
if(!checkheaders(data, "Host:") &&
!conn->allocptr.host) {
/* if ptr_host is already set, it is OK since we only re-use connections
to the very same host and port */
if(!checkheaders(data, "Host:")) {
/* if ptr_host is already set, it is almost OK since we only re-use
connections to the very same host and port, but when we use a HTTP
proxy we have a persistant connect and yet we must change the Host:
header! */
if(conn->allocptr.host)
free(conn->allocptr.host);
if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) ||
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )

View File

@@ -35,4 +35,9 @@ CURLcode Curl_http_done(struct connectdata *conn);
CURLcode Curl_http_connect(struct connectdata *conn);
CURLcode Curl_http_close(struct connectdata *conn);
/* The following functions are defined in http_chunks.c */
void Curl_httpchunk_init(struct connectdata *conn);
CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
ssize_t length, ssize_t *wrote);
#endif

198
lib/http_chunks.c Normal file
View File

@@ -0,0 +1,198 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
*
* 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 MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
*****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ctype.h>
#include "urldata.h" /* it includes http_chunks.h */
#include "sendf.h" /* for the client write stuff */
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
/* The last #include file should be: */
#ifdef MALLOCDEBUG
#include "memdebug.h"
#endif
/*
* Chunk format (simplified):
*
* <HEX SIZE>[ chunk extension ] CRLF
* <DATA>
*
* Highlights from RFC2616 section 3.6 say:
The chunked encoding modifies the body of a message in order to
transfer it as a series of chunks, each with its own size indicator,
followed by an OPTIONAL trailer containing entity-header fields. This
allows dynamically produced content to be transferred along with the
information necessary for the recipient to verify that it has
received the full message.
Chunked-Body = *chunk
last-chunk
trailer
CRLF
chunk = chunk-size [ chunk-extension ] CRLF
chunk-data CRLF
chunk-size = 1*HEX
last-chunk = 1*("0") [ chunk-extension ] CRLF
chunk-extension= *( ";" chunk-ext-name [ "=" chunk-ext-val ] )
chunk-ext-name = token
chunk-ext-val = token | quoted-string
chunk-data = chunk-size(OCTET)
trailer = *(entity-header CRLF)
The chunk-size field is a string of hex digits indicating the size of
the chunk. The chunked encoding is ended by any chunk whose size is
zero, followed by the trailer, which is terminated by an empty line.
*/
void Curl_httpchunk_init(struct connectdata *conn)
{
struct Curl_chunker *chunk = &conn->proto.http->chunk;
chunk->hexindex=0; /* start at 0 */
chunk->dataleft=0; /* no data left yet! */
chunk->state = CHUNK_HEX; /* we get hex first! */
}
/*
* chunk_read() returns a OK for normal operations, or a positive return code
* for errors. STOP means this sequence of chunks is complete. The 'wrote'
* argument is set to tell the caller how many bytes we actually passed to the
* client (for byte-counting and whatever).
*
* The states and the state-machine is further explained in the header file.
*/
CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
char *datap,
ssize_t length,
ssize_t *wrote)
{
CURLcode result;
struct Curl_chunker *ch = &conn->proto.http->chunk;
int piece;
*wrote = 0; /* nothing yet */
while(length) {
switch(ch->state) {
case CHUNK_HEX:
if(isxdigit((int)*datap)) {
if(ch->hexindex < MAXNUM_SIZE) {
ch->hexbuffer[ch->hexindex] = *datap;
datap++;
length--;
ch->hexindex++;
}
else {
return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */
}
}
else {
if(0 == ch->hexindex) {
/* This is illegal data, we received junk where we expected
a hexadecimal digit. */
return CHUNKE_ILLEGAL_HEX;
}
/* length and datap are unmodified */
ch->hexbuffer[ch->hexindex]=0;
ch->datasize=strtoul(ch->hexbuffer, NULL, 16);
ch->state = CHUNK_POSTHEX;
}
break;
case CHUNK_POSTHEX:
/* In this state, we're waiting for CRLF to arrive. We support
this to allow so called chunk-extensions to show up here
before the CRLF comes. */
if(*datap == '\r')
ch->state = CHUNK_CR;
length--;
datap++;
break;
case CHUNK_CR:
/* waiting for the LF */
if(*datap == '\n') {
/* we're now expecting data to come, unless size was zero! */
if(0 == ch->datasize) {
ch->state = CHUNK_STOP; /* stop reading! */
if(1 == length) {
/* This was the final byte, return right now */
return CHUNKE_STOP;
}
}
else
ch->state = CHUNK_DATA;
}
else
/* previously we got a fake CR, go back to CR waiting! */
ch->state = CHUNK_CR;
datap++;
length--;
break;
case CHUNK_DATA:
/* we get pure and fine data
We expect another 'datasize' of data. We have 'length' right now,
it can be more or less than 'datasize'. Get the smallest piece.
*/
piece = (ch->datasize >= length)?length:ch->datasize;
/* Write the data portion available */
result = Curl_client_write(conn->data, CLIENTWRITE_BODY, datap, piece);
if(result)
return CHUNKE_WRITE_ERROR;
*wrote += piece;
ch->datasize -= piece; /* decrease amount left to expect */
datap += piece; /* move read pointer forward */
length -= piece; /* decrease space left in this round */
if(0 == ch->datasize)
/* end of data this round, go back to get a new size */
Curl_httpchunk_init(conn);
break;
case CHUNK_STOP:
/* If we arrive here, there is data left in the end of the buffer
even if there's no more chunks to read */
ch->dataleft = length;
return CHUNKE_STOP; /* return stop */
default:
return CHUNKE_STATE_ERROR;
}
}
return CHUNKE_OK;
}

79
lib/http_chunks.h Normal file
View File

@@ -0,0 +1,79 @@
#ifndef __HTTP_CHUNKS_H
#define __HTTP_CHUNKS_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2001, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
*
* 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 MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
*****************************************************************************/
/*
* The longest possible hexadecimal number we support in a chunked transfer.
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
* to convert it, we "only" support 2^32 bytes chunk data.
*/
#define MAXNUM_SIZE 16
typedef enum {
CHUNK_LOST, /* never use */
/* In this we await and buffer all hexadecimal digits until we get one
that isn't a hexadecimal digit. When done, we go POSTHEX */
CHUNK_HEX,
/* We have received the hexadecimal digit and we eat all characters until
we get a CRLF pair. When we see a CR we go to the CR state. */
CHUNK_POSTHEX,
/* A single CR has been found and we should get a LF right away in this
state or we go back to POSTHEX. When LF is received, we go to DATA.
If the size given was zero, we set state to STOP and return. */
CHUNK_CR,
/* We eat the amount of data specified. When done, we move back to the
HEX state. */
CHUNK_DATA,
/* This is mainly used to really mark that we're out of the game.
NOTE: that there's a 'dataleft' field in the struct that will tell how
many bytes that were not passed to the client in the end of the last
buffer! */
CHUNK_STOP,
CHUNK_LAST /* never use */
} ChunkyState;
typedef enum {
CHUNKE_STOP = -1,
CHUNKE_OK = 0,
CHUNKE_TOO_LONG_HEX = 1,
CHUNKE_ILLEGAL_HEX,
CHUNKE_WRITE_ERROR,
CHUNKE_STATE_ERROR,
CHUNKE_LAST
} CHUNKcode;
struct Curl_chunker {
char hexbuffer[ MAXNUM_SIZE + 1];
int hexindex;
ChunkyState state;
size_t datasize;
size_t dataleft; /* untouched data amount at the end of the last buffer */
};
#endif

View File

@@ -120,7 +120,7 @@ int curl_socket(int domain, int type, int protocol, int line, char *source)
return sockfd;
}
int curl_accept(int s, struct sockaddr *addr, int *addrlen,
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
int line, char *source)
{
int sockfd=(accept)(s, addr, addrlen);

View File

@@ -13,7 +13,7 @@ void curl_memdebug(char *logname);
/* file descriptor manipulators */
int curl_socket(int domain, int type, int protocol, int, char *);
int curl_sclose(int sockfd, int, char *);
int curl_accept(int s, struct sockaddr *addr, int *addrlen,
int curl_accept(int s, struct sockaddr *addr, socklen_t *addrlen,
int line, char *source);
/* FILE functions */

View File

@@ -120,7 +120,7 @@ void curl_slist_free_all(struct curl_slist *list)
}
/* infof() is for info message along the way */
/* Curl_infof() is for info message along the way */
void Curl_infof(struct UrlData *data, char *fmt, ...)
{
@@ -133,7 +133,7 @@ void Curl_infof(struct UrlData *data, char *fmt, ...)
}
}
/* failf() is for messages stating why we failed, the LAST one will be
/* Curl_failf() is for messages stating why we failed, the LAST one will be
returned for the user (if requested) */
void Curl_failf(struct UrlData *data, char *fmt, ...)
@@ -142,7 +142,7 @@ void Curl_failf(struct UrlData *data, char *fmt, ...)
va_start(ap, fmt);
if(data->errorbuffer)
vsnprintf(data->errorbuffer, CURL_ERROR_SIZE, fmt, ap);
else {
else if(!data->bits.mute) {
/* no errorbuffer receives this, write to data->err instead */
vfprintf(data->err, fmt, ap);
fprintf(data->err, "\n");
@@ -213,23 +213,6 @@ CURLcode Curl_write(struct connectdata *conn, int sockfd,
return CURLE_OK;
}
/*
* External write-function, writes to the data-socket.
* Takes care of plain sockets, SSL or kerberos transparently.
*/
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
size_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
return Curl_write(conn, conn->sockfd, buf, amount, n);
}
/* client_write() sends data to the write callback(s)
The bit pattern defines to what "streams" to write to. Body and/or header.
@@ -299,19 +282,3 @@ CURLcode Curl_read(struct connectdata *conn, int sockfd,
return CURLE_OK;
}
/*
* The public read function reads from the 'sockfd' file descriptor only.
* Use the Curl_read() internally when you want to specify fd.
*/
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
ssize_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
return Curl_read(conn, conn->sockfd, buf, buffersize, n);
}

View File

@@ -24,6 +24,7 @@
#include "setup.h"
#include <stdio.h>
#include <string.h>
#if defined(__MINGW32__)
#include <winsock.h>
#endif

View File

@@ -35,6 +35,7 @@
#include "formdata.h" /* for the boundary function */
#ifdef USE_SSLEAY
#include <openssl/rand.h>
static char global_passwd[64];
@@ -58,16 +59,108 @@ static int passwd_callback(char *buf, int num, int verify
return 0;
}
/* This function is *highly* inspired by (and parts are directly stolen
* from) source from the SSLeay package written by Eric Young
* (eay@cryptsoft.com). */
static
bool seed_enough(struct connectdata *conn, /* unused for now */
int nread)
{
#ifdef HAVE_RAND_STATUS
/* only available in OpenSSL 0.9.5a and later */
if(RAND_status())
return TRUE;
#else
if(nread > 500)
/* this is a very silly decision to make */
return TRUE;
#endif
return FALSE; /* not enough */
}
static
int cert_stuff(struct UrlData *data,
struct connectdata *conn,
int random_the_seed(struct connectdata *conn)
{
char *buf = conn->data->buffer; /* point to the big buffer */
int nread=0;
struct UrlData *data=conn->data;
/* Q: should we add support for a random file name as a libcurl option?
A: Yes, it is here */
#ifndef RANDOM_FILE
/* if RANDOM_FILE isn't defined, we only perform this if an option tells
us to! */
if(data->ssl.random_file)
#define RANDOM_FILE "" /* doesn't matter won't be used */
#endif
{
/* let the option override the define */
nread += RAND_load_file((data->ssl.random_file?
data->ssl.random_file:RANDOM_FILE),
16384);
if(seed_enough(conn, nread))
return nread;
}
#if defined(HAVE_RAND_EGD)
/* only available in OpenSSL 0.9.5 and later */
/* EGD_SOCKET is set at configure time or not at all */
#ifndef EGD_SOCKET
/* If we don't have the define set, we only do this if the egd-option
is set */
if(data->ssl.egdsocket)
#define EGD_SOCKET "" /* doesn't matter won't be used */
#endif
{
/* If there's an option and a define, the option overrides the
define */
int ret = RAND_egd(data->ssl.egdsocket?data->ssl.egdsocket:EGD_SOCKET);
if(-1 != ret) {
nread += ret;
if(seed_enough(conn, nread))
return nread;
}
}
#endif
/* If we get here, it means we need to seed the PRNG using a "silly"
approach! */
#ifdef HAVE_RAND_SCREEN
/* This one gets a random value by reading the currently shown screen */
RAND_screen();
nread = 100; /* just a value */
#else
{
int len;
char *area = Curl_FormBoundary();
if(!area)
return 3; /* out of memory */
len = strlen(area);
RAND_seed(area, len);
free(area); /* now remove the random junk */
#endif
}
/* generates a default path for the random seed file */
buf[0]=0; /* blank it first */
RAND_file_name(buf, BUFSIZE);
if ( buf[0] ) {
/* we got a file name to try */
nread += RAND_load_file(buf, 16384);
if(seed_enough(conn, nread))
return nread;
}
infof(conn->data, "Your connection is using a weak random seed!\n");
return nread;
}
static
int cert_stuff(struct connectdata *conn,
char *cert_file,
char *key_file)
{
struct UrlData *data = conn->data;
if (cert_file != NULL) {
SSL *ssl;
X509 *x509;
@@ -123,9 +216,6 @@ int cert_stuff(struct UrlData *data,
return(1);
}
#endif
#ifdef USE_SSLEAY
static
int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
{
@@ -156,28 +246,8 @@ Curl_SSLConnect(struct connectdata *conn)
/* Lets get nice error messages */
SSL_load_error_strings();
#ifdef HAVE_RAND_STATUS
/* RAND_status() was introduced in OpenSSL 0.9.5 */
if(0 == RAND_status())
#endif
{
/* We need to seed the PRNG properly! */
#ifdef HAVE_RAND_SCREEN
/* This one gets a random value by reading the currently shown screen */
RAND_screen();
#else
int len;
char *area = Curl_FormBoundary();
if(!area)
return 3; /* out of memory */
len = strlen(area);
RAND_seed(area, len);
free(area); /* now remove the random junk */
#endif
}
/* Make funny stuff to get random input */
random_the_seed(conn);
/* Setup all the global SSL stuff */
SSLeay_add_ssl_algorithms();
@@ -202,7 +272,7 @@ Curl_SSLConnect(struct connectdata *conn)
}
if(data->cert) {
if (!cert_stuff(data, conn, data->cert, data->cert)) {
if (!cert_stuff(conn, data->cert, data->cert)) {
failf(data, "couldn't use certificate!\n");
return 2;
}

View File

@@ -84,16 +84,16 @@
#define SUBBUFSIZE 512
#define SB_CLEAR() subpointer = subbuffer;
#define SB_TERM() { subend = subpointer; SB_CLEAR(); }
#define SB_ACCUM(c) if (subpointer < (subbuffer+sizeof subbuffer)) { \
*subpointer++ = (c); \
#define SB_CLEAR(x) x->subpointer = x->subbuffer;
#define SB_TERM(x) { x->subend = x->subpointer; SB_CLEAR(x); }
#define SB_ACCUM(x,c) if (x->subpointer < (x->subbuffer+sizeof x->subbuffer)) { \
*x->subpointer++ = (c); \
}
#define SB_GET() ((*subpointer++)&0xff)
#define SB_PEEK() ((*subpointer)&0xff)
#define SB_EOF() (subpointer >= subend)
#define SB_LEN() (subend - subpointer)
#define SB_GET(x) ((*x->subpointer++)&0xff)
#define SB_PEEK(x) ((*x->subpointer)&0xff)
#define SB_EOF(x) (x->subpointer >= x->subend)
#define SB_LEN(x) (x->subend - x->subpointer)
static
void telrcv(struct connectdata *,
@@ -113,14 +113,19 @@ static void printsub(struct UrlData *data,
int direction, unsigned char *pointer, int length);
static void suboption(struct connectdata *);
/* suboptions */
static char subbuffer[SUBBUFSIZE];
static char *subpointer, *subend; /* buffer for sub-options */
/* For negotiation compliant to RFC 1143 */
#define NO 0
#define YES 1
#define WANTYES 2
#define WANTNO 3
#define EMPTY 0
#define OPPOSITE 1
/*
* Telnet receiver states for fsm
*/
static enum
typedef enum
{
TS_DATA = 0,
TS_IAC,
@@ -131,63 +136,76 @@ static enum
TS_CR,
TS_SB, /* sub-option collection */
TS_SE /* looking for sub-option end */
} telrcv_state;
} TelnetReceive;
/* For negotiation compliant to RFC 1143 */
#define NO 0
#define YES 1
#define WANTYES 2
#define WANTNO 3
struct TELNET {
int please_negotiate;
int already_negotiated;
int us[256];
int usq[256];
int us_preferred[256];
int him[256];
int himq[256];
int him_preferred[256];
char *subopt_ttype; /* Set with suboption TTYPE */
char *subopt_xdisploc; /* Set with suboption XDISPLOC */
struct curl_slist *telnet_vars; /* Environment variables */
#define EMPTY 0
#define OPPOSITE 1
/* suboptions */
char subbuffer[SUBBUFSIZE];
char *subpointer, *subend; /* buffer for sub-options */
static int please_negotiate = 0;
static int already_negotiated = 0;
static int us[256];
static int usq[256];
static int us_preferred[256];
static int him[256];
static int himq[256];
static int him_preferred[256];
static char *subopt_ttype = NULL; /* Set with suboption TTYPE */
static char *subopt_xdisploc = NULL; /* Set with suboption XDISPLOC */
static struct curl_slist *telnet_vars = NULL; /* Environment variables */
TelnetReceive telrcv_state;
};
static
void init_telnet(struct connectdata *conn)
CURLcode init_telnet(struct connectdata *conn)
{
telrcv_state = TS_DATA;
struct TELNET *tn;
tn = (struct TELNET *)malloc(sizeof(struct TELNET));
if(!tn)
return CURLE_OUT_OF_MEMORY;
conn->proto.telnet = (void *)tn; /* make us known */
memset(tn, 0, sizeof(struct TELNET));
tn->telrcv_state = TS_DATA;
/* Init suboptions */
SB_CLEAR();
SB_CLEAR(tn);
/* Set all options to NO */
memset(us, NO, 256);
memset(usq, NO, 256);
memset(us_preferred, NO, 256);
memset(him, NO, 256);
memset(himq, NO, 256);
memset(him_preferred, NO, 256);
#if 0
/* NO is zero => default fill pattern */
memset(tn->us, NO, 256);
memset(tn->usq, NO, 256);
memset(tn->us_preferred, NO, 256);
memset(tn->him, NO, 256);
memset(tn->himq, NO, 256);
memset(tn->him_preferred, NO, 256);
#endif
/* Set the options we want by default */
us_preferred[TELOPT_BINARY] = YES;
us_preferred[TELOPT_SGA] = YES;
him_preferred[TELOPT_BINARY] = YES;
him_preferred[TELOPT_SGA] = YES;
tn->us_preferred[TELOPT_BINARY] = YES;
tn->us_preferred[TELOPT_SGA] = YES;
tn->him_preferred[TELOPT_BINARY] = YES;
tn->him_preferred[TELOPT_SGA] = YES;
return CURLE_OK;
}
static void negotiate(struct connectdata *conn)
{
int i;
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
for(i = 0;i < NTELOPTS;i++)
{
if(us_preferred[i] == YES)
if(tn->us_preferred[i] == YES)
set_local_option(conn, i, YES);
if(him_preferred[i] == YES)
if(tn->him_preferred[i] == YES)
set_remote_option(conn, i, YES);
}
}
@@ -247,12 +265,13 @@ static void send_negotiation(struct connectdata *conn, int cmd, int option)
static
void set_remote_option(struct connectdata *conn, int option, int newstate)
{
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
if(newstate == YES)
{
switch(him[option])
switch(tn->him[option])
{
case NO:
him[option] = WANTYES;
tn->him[option] = WANTYES;
send_negotiation(conn, DO, option);
break;
@@ -261,11 +280,11 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case WANTNO:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
/* Already negotiating for YES, queue the request */
himq[option] = OPPOSITE;
tn->himq[option] = OPPOSITE;
break;
case OPPOSITE:
/* Error: already queued an enable request */
@@ -274,13 +293,13 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
break;
case WANTYES:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
/* Error: already negotiating for enable */
break;
case OPPOSITE:
himq[option] = EMPTY;
tn->himq[option] = EMPTY;
break;
}
break;
@@ -288,34 +307,34 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
}
else /* NO */
{
switch(him[option])
switch(tn->him[option])
{
case NO:
/* Already disabled */
break;
case YES:
him[option] = WANTNO;
tn->him[option] = WANTNO;
send_negotiation(conn, DONT, option);
break;
case WANTNO:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
/* Already negotiating for NO */
break;
case OPPOSITE:
himq[option] = EMPTY;
tn->himq[option] = EMPTY;
break;
}
break;
case WANTYES:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
himq[option] = OPPOSITE;
tn->himq[option] = OPPOSITE;
break;
case OPPOSITE:
break;
@@ -328,12 +347,13 @@ void set_remote_option(struct connectdata *conn, int option, int newstate)
static
void rec_will(struct connectdata *conn, int option)
{
switch(him[option])
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
switch(tn->him[option])
{
case NO:
if(him_preferred[option] == YES)
if(tn->him_preferred[option] == YES)
{
him[option] = YES;
tn->him[option] = YES;
send_negotiation(conn, DO, option);
}
else
@@ -347,29 +367,29 @@ void rec_will(struct connectdata *conn, int option)
break;
case WANTNO:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
/* Error: DONT answered by WILL */
him[option] = NO;
tn->him[option] = NO;
break;
case OPPOSITE:
/* Error: DONT answered by WILL */
him[option] = YES;
himq[option] = EMPTY;
tn->him[option] = YES;
tn->himq[option] = EMPTY;
break;
}
break;
case WANTYES:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
him[option] = YES;
tn->him[option] = YES;
break;
case OPPOSITE:
him[option] = WANTNO;
himq[option] = EMPTY;
tn->him[option] = WANTNO;
tn->himq[option] = EMPTY;
send_negotiation(conn, DONT, option);
break;
}
@@ -380,41 +400,42 @@ void rec_will(struct connectdata *conn, int option)
static
void rec_wont(struct connectdata *conn, int option)
{
switch(him[option])
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
switch(tn->him[option])
{
case NO:
/* Already disabled */
break;
case YES:
him[option] = NO;
tn->him[option] = NO;
send_negotiation(conn, DONT, option);
break;
case WANTNO:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
him[option] = NO;
tn->him[option] = NO;
break;
case OPPOSITE:
him[option] = WANTYES;
himq[option] = EMPTY;
tn->him[option] = WANTYES;
tn->himq[option] = EMPTY;
send_negotiation(conn, DO, option);
break;
}
break;
case WANTYES:
switch(himq[option])
switch(tn->himq[option])
{
case EMPTY:
him[option] = NO;
tn->him[option] = NO;
break;
case OPPOSITE:
him[option] = NO;
himq[option] = EMPTY;
tn->him[option] = NO;
tn->himq[option] = EMPTY;
break;
}
break;
@@ -423,12 +444,13 @@ void rec_wont(struct connectdata *conn, int option)
void set_local_option(struct connectdata *conn, int option, int newstate)
{
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
if(newstate == YES)
{
switch(us[option])
switch(tn->us[option])
{
case NO:
us[option] = WANTYES;
tn->us[option] = WANTYES;
send_negotiation(conn, WILL, option);
break;
@@ -437,11 +459,11 @@ void set_local_option(struct connectdata *conn, int option, int newstate)
break;
case WANTNO:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
/* Already negotiating for YES, queue the request */
usq[option] = OPPOSITE;
tn->usq[option] = OPPOSITE;
break;
case OPPOSITE:
/* Error: already queued an enable request */
@@ -450,13 +472,13 @@ void set_local_option(struct connectdata *conn, int option, int newstate)
break;
case WANTYES:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
/* Error: already negotiating for enable */
break;
case OPPOSITE:
usq[option] = EMPTY;
tn->usq[option] = EMPTY;
break;
}
break;
@@ -464,34 +486,34 @@ void set_local_option(struct connectdata *conn, int option, int newstate)
}
else /* NO */
{
switch(us[option])
switch(tn->us[option])
{
case NO:
/* Already disabled */
break;
case YES:
us[option] = WANTNO;
tn->us[option] = WANTNO;
send_negotiation(conn, WONT, option);
break;
case WANTNO:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
/* Already negotiating for NO */
break;
case OPPOSITE:
usq[option] = EMPTY;
tn->usq[option] = EMPTY;
break;
}
break;
case WANTYES:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
usq[option] = OPPOSITE;
tn->usq[option] = OPPOSITE;
break;
case OPPOSITE:
break;
@@ -504,12 +526,13 @@ void set_local_option(struct connectdata *conn, int option, int newstate)
static
void rec_do(struct connectdata *conn, int option)
{
switch(us[option])
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
switch(tn->us[option])
{
case NO:
if(us_preferred[option] == YES)
if(tn->us_preferred[option] == YES)
{
us[option] = YES;
tn->us[option] = YES;
send_negotiation(conn, WILL, option);
}
else
@@ -523,29 +546,29 @@ void rec_do(struct connectdata *conn, int option)
break;
case WANTNO:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
/* Error: DONT answered by WILL */
us[option] = NO;
tn->us[option] = NO;
break;
case OPPOSITE:
/* Error: DONT answered by WILL */
us[option] = YES;
usq[option] = EMPTY;
tn->us[option] = YES;
tn->usq[option] = EMPTY;
break;
}
break;
case WANTYES:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
us[option] = YES;
tn->us[option] = YES;
break;
case OPPOSITE:
us[option] = WANTNO;
himq[option] = EMPTY;
tn->us[option] = WANTNO;
tn->himq[option] = EMPTY;
send_negotiation(conn, WONT, option);
break;
}
@@ -556,41 +579,42 @@ void rec_do(struct connectdata *conn, int option)
static
void rec_dont(struct connectdata *conn, int option)
{
switch(us[option])
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
switch(tn->us[option])
{
case NO:
/* Already disabled */
break;
case YES:
us[option] = NO;
tn->us[option] = NO;
send_negotiation(conn, WONT, option);
break;
case WANTNO:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
us[option] = NO;
tn->us[option] = NO;
break;
case OPPOSITE:
us[option] = WANTYES;
usq[option] = EMPTY;
tn->us[option] = WANTYES;
tn->usq[option] = EMPTY;
send_negotiation(conn, WILL, option);
break;
}
break;
case WANTYES:
switch(usq[option])
switch(tn->usq[option])
{
case EMPTY:
us[option] = NO;
tn->us[option] = NO;
break;
case OPPOSITE:
us[option] = NO;
usq[option] = EMPTY;
tn->us[option] = NO;
tn->usq[option] = EMPTY;
break;
}
break;
@@ -717,6 +741,7 @@ static int check_telnet_options(struct connectdata *conn)
char option_arg[256];
char *buf;
struct UrlData *data = conn->data;
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
/* Add the user name as an environment variable if it
was given on the command line */
@@ -724,9 +749,9 @@ static int check_telnet_options(struct connectdata *conn)
{
char *buf = malloc(256);
sprintf(buf, "USER,%s", data->user);
telnet_vars = curl_slist_append(telnet_vars, buf);
tn->telnet_vars = curl_slist_append(tn->telnet_vars, buf);
us_preferred[TELOPT_NEW_ENVIRON] = YES;
tn->us_preferred[TELOPT_NEW_ENVIRON] = YES;
}
for(head = data->telnet_options; head; head=head->next) {
@@ -735,15 +760,15 @@ static int check_telnet_options(struct connectdata *conn)
/* Terminal type */
if(strequal(option_keyword, "TTYPE")) {
subopt_ttype = option_arg;
us_preferred[TELOPT_TTYPE] = YES;
tn->subopt_ttype = option_arg;
tn->us_preferred[TELOPT_TTYPE] = YES;
continue;
}
/* Display variable */
if(strequal(option_keyword, "XDISPLOC")) {
subopt_xdisploc = option_arg;
us_preferred[TELOPT_XDISPLOC] = YES;
tn->subopt_xdisploc = option_arg;
tn->us_preferred[TELOPT_XDISPLOC] = YES;
continue;
}
@@ -752,8 +777,8 @@ static int check_telnet_options(struct connectdata *conn)
buf = strdup(option_arg);
if(!buf)
return CURLE_OUT_OF_MEMORY;
telnet_vars = curl_slist_append(telnet_vars, buf);
us_preferred[TELOPT_NEW_ENVIRON] = YES;
tn->telnet_vars = curl_slist_append(tn->telnet_vars, buf);
tn->us_preferred[TELOPT_NEW_ENVIRON] = YES;
continue;
}
@@ -773,7 +798,6 @@ static int check_telnet_options(struct connectdata *conn)
*
* Look at the sub-option buffer, and try to be helpful to the other
* side.
* No suboptions are supported yet.
*/
static void suboption(struct connectdata *conn)
@@ -786,22 +810,23 @@ static void suboption(struct connectdata *conn)
char varname[128];
char varval[128];
struct UrlData *data = conn->data;
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
printsub(data, '<', (unsigned char *)subbuffer, SB_LEN()+2);
switch (subchar = SB_GET()) {
printsub(data, '<', (unsigned char *)tn->subbuffer, SB_LEN(tn)+2);
switch (subchar = SB_GET(tn)) {
case TELOPT_TTYPE:
len = strlen(subopt_ttype) + 4 + 2;
len = strlen(tn->subopt_ttype) + 4 + 2;
snprintf((char *)temp, sizeof(temp),
"%c%c%c%c%s%c%c", IAC, SB, TELOPT_TTYPE,
TELQUAL_IS, subopt_ttype, IAC, SE);
TELQUAL_IS, tn->subopt_ttype, IAC, SE);
swrite(conn->firstsocket, temp, len);
printsub(data, '>', &temp[2], len-2);
break;
case TELOPT_XDISPLOC:
len = strlen(subopt_xdisploc) + 4 + 2;
len = strlen(tn->subopt_xdisploc) + 4 + 2;
snprintf((char *)temp, sizeof(temp),
"%c%c%c%c%s%c%c", IAC, SB, TELOPT_XDISPLOC,
TELQUAL_IS, subopt_xdisploc, IAC, SE);
TELQUAL_IS, tn->subopt_xdisploc, IAC, SE);
swrite(conn->firstsocket, temp, len);
printsub(data, '>', &temp[2], len-2);
break;
@@ -810,7 +835,7 @@ static void suboption(struct connectdata *conn)
"%c%c%c%c", IAC, SB, TELOPT_NEW_ENVIRON, TELQUAL_IS);
len = 4;
for(v = telnet_vars;v;v = v->next) {
for(v = tn->telnet_vars;v;v = v->next) {
tmplen = (strlen(v->data) + 1);
/* Add the variable only if it fits */
if(len + tmplen < sizeof(temp)-6) {
@@ -839,15 +864,16 @@ void telrcv(struct connectdata *conn,
unsigned char c;
int index = 0;
struct UrlData *data = conn->data;
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
while(count--)
{
c = inbuf[index++];
switch (telrcv_state)
switch (tn->telrcv_state)
{
case TS_CR:
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
if (c == '\0')
{
break; /* Ignore \0 after CR */
@@ -859,12 +885,12 @@ void telrcv(struct connectdata *conn,
case TS_DATA:
if (c == IAC)
{
telrcv_state = TS_IAC;
tn->telrcv_state = TS_IAC;
break;
}
else if(c == '\r')
{
telrcv_state = TS_CR;
tn->telrcv_state = TS_CR;
}
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
@@ -875,20 +901,20 @@ void telrcv(struct connectdata *conn,
switch (c)
{
case WILL:
telrcv_state = TS_WILL;
tn->telrcv_state = TS_WILL;
continue;
case WONT:
telrcv_state = TS_WONT;
tn->telrcv_state = TS_WONT;
continue;
case DO:
telrcv_state = TS_DO;
tn->telrcv_state = TS_DO;
continue;
case DONT:
telrcv_state = TS_DONT;
tn->telrcv_state = TS_DONT;
continue;
case SB:
SB_CLEAR();
telrcv_state = TS_SB;
SB_CLEAR(tn);
tn->telrcv_state = TS_SB;
continue;
case IAC:
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
@@ -900,45 +926,45 @@ void telrcv(struct connectdata *conn,
printoption(data, "RCVD", IAC, c);
break;
}
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
continue;
case TS_WILL:
printoption(data, "RCVD", WILL, c);
please_negotiate = 1;
tn->please_negotiate = 1;
rec_will(conn, c);
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
continue;
case TS_WONT:
printoption(data, "RCVD", WONT, c);
please_negotiate = 1;
tn->please_negotiate = 1;
rec_wont(conn, c);
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
continue;
case TS_DO:
printoption(data, "RCVD", DO, c);
please_negotiate = 1;
tn->please_negotiate = 1;
rec_do(conn, c);
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
continue;
case TS_DONT:
printoption(data, "RCVD", DONT, c);
please_negotiate = 1;
tn->please_negotiate = 1;
rec_dont(conn, c);
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
continue;
case TS_SB:
if (c == IAC)
{
telrcv_state = TS_SE;
tn->telrcv_state = TS_SE;
}
else
{
SB_ACCUM(c);
SB_ACCUM(tn,c);
}
continue;
@@ -959,27 +985,27 @@ void telrcv(struct connectdata *conn,
* we terminate the suboption, and process the
* partial suboption if we can.
*/
SB_ACCUM((unsigned char)IAC);
SB_ACCUM(c);
subpointer -= 2;
SB_TERM();
SB_ACCUM(tn, (unsigned char)IAC);
SB_ACCUM(tn, c);
tn->subpointer -= 2;
SB_TERM(tn);
printoption(data, "In SUBOPTION processing, RCVD", IAC, c);
suboption(conn); /* handle sub-option */
telrcv_state = TS_IAC;
tn->telrcv_state = TS_IAC;
goto process_iac;
}
SB_ACCUM(c);
telrcv_state = TS_SB;
SB_ACCUM(tn,c);
tn->telrcv_state = TS_SB;
}
else
{
SB_ACCUM((unsigned char)IAC);
SB_ACCUM((unsigned char)SE);
subpointer -= 2;
SB_TERM();
SB_ACCUM(tn, (unsigned char)IAC);
SB_ACCUM(tn, (unsigned char)SE);
tn->subpointer -= 2;
SB_TERM(tn);
suboption(conn); /* handle sub-option */
telrcv_state = TS_DATA;
tn->telrcv_state = TS_DATA;
}
break;
}
@@ -988,7 +1014,12 @@ void telrcv(struct connectdata *conn,
CURLcode Curl_telnet_done(struct connectdata *conn)
{
curl_slist_free_all(telnet_vars);
struct TELNET *tn = (struct TELNET *)conn->proto.telnet;
curl_slist_free_all(tn->telnet_vars);
free(conn->proto.telnet);
conn->proto.telnet = NULL;
return CURLE_OK;
}
@@ -1003,8 +1034,13 @@ CURLcode Curl_telnet(struct connectdata *conn)
bool keepon = TRUE;
char *buf = data->buffer;
ssize_t nread;
struct TELNET *tn;
init_telnet(conn);
code = init_telnet(conn);
if(code)
return code;
tn = (struct TELNET *)conn->proto.telnet;
code = check_telnet_options(conn);
if(code)
@@ -1060,9 +1096,9 @@ CURLcode Curl_telnet(struct connectdata *conn)
/* Negotiate if the peer has started negotiating,
otherwise don't. We don't want to speak telnet with
non-telnet servers, like POP or SMTP. */
if(please_negotiate && !already_negotiated) {
if(tn->please_negotiate && !tn->already_negotiated) {
negotiate(conn);
already_negotiated = 1;
tn->already_negotiated = 1;
}
}
}

View File

@@ -53,7 +53,7 @@ gettimeofday (struct timeval *tp, void *nothing)
#endif
#endif
struct timeval Curl_tvnow ()
struct timeval Curl_tvnow (void)
{
struct timeval now;
#ifdef HAVE_GETTIMEOFDAY

View File

@@ -89,6 +89,7 @@
#include "getpass.h"
#include "progress.h"
#include "getdate.h"
#include "http.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
@@ -106,7 +107,7 @@
<butlerm@xmission.com>. */
CURLcode static
_Transfer(struct connectdata *c_conn)
Transfer(struct connectdata *c_conn)
{
ssize_t nread; /* number of bytes read */
int bytecount = 0; /* total number of bytes read */
@@ -141,9 +142,6 @@ _Transfer(struct connectdata *c_conn)
char *buf;
int maxfd;
if(!conn || (conn->handle != STRUCT_CONNECT))
return CURLE_BAD_FUNCTION_ARGUMENT;
data = conn->data; /* there's the root struct */
buf = data->buffer;
maxfd = (conn->sockfd>conn->writesockfd?conn->sockfd:conn->writesockfd)+1;
@@ -337,6 +335,18 @@ _Transfer(struct connectdata *c_conn)
return urg;
data->header_size += p - data->headerbuff;
/*
* end-of-headers.
*
* If we requested a "no body" and this isn't a "close"
* connection, this is a good time to get out and return
* home.
*/
if(!conn->bits.close && data->bits.no_body)
return CURLE_OK;
break; /* exit header line loop */
}
@@ -357,6 +367,12 @@ _Transfer(struct connectdata *c_conn)
return CURLE_HTTP_NOT_FOUND;
}
data->progress.httpcode = code;
data->progress.httpversion = httpversion;
if(httpversion == 0)
/* Default action for HTTP/1.0 must be to close, unless
we get one of those fancy headers that tell us the
server keeps it open for us! */
conn->bits.close = TRUE;
}
else {
header = FALSE; /* this is not a header line */
@@ -365,8 +381,23 @@ _Transfer(struct connectdata *c_conn)
}
/* check for Content-Length: header lines to get size */
if (strnequal("Content-Length", p, 14) &&
sscanf (p+14, ": %ld", &contentlength))
sscanf (p+14, ": %ld", &contentlength)) {
conn->size = contentlength;
Curl_pgrsSetDownloadSize(data, contentlength);
}
else if((httpversion == 0) &&
conn->bits.httpproxy &&
strnequal("Proxy-Connection: keep-alive", p,
strlen("Proxy-Connection: keep-alive"))) {
/*
* When a HTTP/1.0 reply comes when using a proxy, the
* 'Proxy-Connection: keep-alive' line tells us the
* connection will be kept alive for our pleasure.
* Default action for 1.0 is to close.
*/
conn->bits.close = FALSE; /* don't close when done */
infof(data, "HTTP/1.0 proxy connection set to keep alive!\n");
}
else if (strnequal("Connection: close", p,
strlen("Connection: close"))) {
/*
@@ -377,10 +408,25 @@ _Transfer(struct connectdata *c_conn)
*/
conn->bits.close = TRUE; /* close when done */
}
else if (strnequal("Transfer-Encoding: chunked", p,
strlen("Transfer-Encoding: chunked"))) {
/*
* [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
* means that the server will send a series of "chunks". Each
* chunk starts with line with info (including size of the
* coming block) (terminated with CRLF), then a block of data
* with the previously mentioned size. There can be any amount
* of chunks, and a chunk-data set to zero signals the
* end-of-chunks. */
conn->bits.chunk = TRUE; /* chunks coming our way */
/* init our chunky engine */
Curl_httpchunk_init(conn);
}
else if (strnequal("Content-Range", p, 13)) {
if (sscanf (p+13, ": bytes %d-", &offset) ||
sscanf (p+13, ": bytes: %d-", &offset)) {
/* This second format was added August 1st by Igor
/* This second format was added August 1st 2000 by Igor
Khristophorov since Sun's webserver JavaWebServer/1.1.1
obviously sends the header this way! :-( */
if (data->resume_from == offset) {
@@ -416,7 +462,7 @@ _Transfer(struct connectdata *c_conn)
ptr++;
backup = *ptr; /* store the ending letter */
*ptr = '\0'; /* zero terminate */
data->newurl = strdup(start); /* clone string */
conn->newurl = strdup(start); /* clone string */
*ptr = backup; /* restore ending letter */
}
@@ -457,12 +503,12 @@ _Transfer(struct connectdata *c_conn)
if(0 == bodywrites) {
/* These checks are only made the first time we are about to
write a chunk of the body */
write a piece of the body */
if(conn->protocol&PROT_HTTP) {
/* HTTP-only checks */
if (data->newurl) {
if (conn->newurl) {
/* abort after the headers if "follow Location" is set */
infof (data, "Follow to new URL: %s\n", data->newurl);
infof (data, "Follow to new URL: %s\n", conn->newurl);
return CURLE_OK;
}
else if (data->resume_from &&
@@ -500,7 +546,8 @@ _Transfer(struct connectdata *c_conn)
} /* switch */
} /* two valid time strings */
} /* we have a time condition */
if(!conn->bits.close && (httpversion == 1)) {
if(!conn->bits.close) {
/* If this is not the last request before a close, we must
set the maximum download size to the size of the expected
document or else, we won't know when to stop reading! */
@@ -514,6 +561,29 @@ _Transfer(struct connectdata *c_conn)
} /* this is the first time we write a body part */
bodywrites++;
if(conn->bits.chunk) {
/*
* Bless me father for I have sinned. Here comes a chunked
* transfer flying and we need to decode this properly. While
* the name says read, this function both reads and writes away
* the data. The returned 'nread' holds the number of actual
* data it wrote to the client. */
CHUNKcode res =
Curl_httpchunk_read(conn, str, nread, &nread);
if(CHUNKE_OK < res)
return CURLE_READ_ERROR;
else if(CHUNKE_STOP == res) {
/* we're done reading chunks! */
keepon &= ~KEEP_READ; /* read no more */
/* There are now possibly N number of bytes at the end of the
str buffer that weren't written to the client, but we don't
care about them right now. */
}
/* If it returned OK, we just keep going */
}
if(conn->maxdownload &&
(bytecount + nread >= conn->maxdownload)) {
nread = conn->maxdownload - bytecount;
@@ -526,9 +596,12 @@ _Transfer(struct connectdata *c_conn)
Curl_pgrsSetDownloadCounter(data, (double)bytecount);
if(! conn->bits.chunk) {
/* If this is chunky transfer, it was already written */
urg = Curl_client_write(data, CLIENTWRITE_BODY, str, nread);
if(urg)
return urg;
}
} /* if (! header and data to read ) */
} /* if( read from socket ) */
@@ -625,29 +698,27 @@ _Transfer(struct connectdata *c_conn)
return CURLE_OK;
}
typedef int (*func_T)(void);
CURLcode curl_transfer(CURL *curl)
CURLcode Curl_perform(CURL *curl)
{
CURLcode res;
struct UrlData *data = curl;
struct connectdata *c_connect=NULL;
struct UrlData *data = (struct UrlData *)curl;
struct connectdata *conn=NULL;
bool port=TRUE; /* allow data->use_port to set port to use */
Curl_pgrsStartNow(data);
do {
Curl_pgrsTime(data, TIMER_STARTSINGLE);
res = curl_connect(curl, (CURLconnect **)&c_connect, port);
res = Curl_connect(data, &conn, port);
if(res == CURLE_OK) {
res = curl_do(c_connect);
res = Curl_do(conn);
if(res == CURLE_OK) {
res = _Transfer(c_connect); /* now fetch that URL please */
res = Transfer(conn); /* now fetch that URL please */
if(res == CURLE_OK)
res = curl_done(c_connect);
res = Curl_done(conn);
}
if((res == CURLE_OK) && data->newurl) {
if((res == CURLE_OK) && conn->newurl) {
/* Location: redirect
This is assumed to happen for HTTP(S) only!
@@ -687,7 +758,7 @@ CURLcode curl_transfer(CURL *curl)
data->bits.http_set_referer = TRUE; /* might have been false */
}
if(2 != sscanf(data->newurl, "%15[^:]://%c", prot, &letter)) {
if(2 != sscanf(conn->newurl, "%15[^:]://%c", prot, &letter)) {
/***
*DANG* this is an RFC 2068 violation. The URL is supposed
to be absolute and this doesn't seem to be that!
@@ -712,7 +783,7 @@ CURLcode curl_transfer(CURL *curl)
protsep+=2; /* pass the slashes */
}
if('/' != data->newurl[0]) {
if('/' != conn->newurl[0]) {
/* First we need to find out if there's a ?-letter in the URL,
and cut it and the right-side of that off */
pathsep = strrchr(protsep, '?');
@@ -735,14 +806,14 @@ CURLcode curl_transfer(CURL *curl)
newest=(char *)malloc( strlen(data->url) +
1 + /* possible slash */
strlen(data->newurl) + 1/* zero byte */);
strlen(conn->newurl) + 1/* zero byte */);
if(!newest)
return CURLE_OUT_OF_MEMORY;
sprintf(newest, "%s%s%s", data->url, ('/' == data->newurl[0])?"":"/",
data->newurl);
free(data->newurl);
data->newurl = newest;
sprintf(newest, "%s%s%s", data->url, ('/' == conn->newurl[0])?"":"/",
conn->newurl);
free(conn->newurl);
conn->newurl = newest;
}
else {
/* This is an absolute URL, don't use the custom port number */
@@ -753,8 +824,8 @@ CURLcode curl_transfer(CURL *curl)
free(data->url);
/* TBD: set the URL with curl_setopt() */
data->url = data->newurl;
data->newurl = NULL; /* don't show! */
data->url = conn->newurl;
conn->newurl = NULL; /* don't show! */
data->bits.urlstringalloc = TRUE; /* the URL is allocated */
infof(data, "Follows Location: to new URL: '%s'\n", data->url);
@@ -813,8 +884,10 @@ CURLcode curl_transfer(CURL *curl)
} while(1); /* loop if Location: */
if(data->newurl)
free(data->newurl);
if(conn->newurl) {
free(conn->newurl);
conn->newurl = NULL;
}
return res;
}

View File

@@ -22,8 +22,9 @@
*
* $Id$
*****************************************************************************/
CURLcode curl_transfer(CURL *curl);
CURLcode Curl_perform(CURL *curl);
/* This sets up a forthcoming transfer */
CURLcode
Curl_Transfer (struct connectdata *data,
int sockfd, /* socket to read from or -1 */

657
lib/url.c

File diff suppressed because it is too large Load Diff

View File

@@ -79,6 +79,8 @@
#include <curl/curl.h>
#include "http_chunks.h" /* for the structs and enum stuff */
/* Download buffer size, keep it fairly big for speed reasons */
#define BUFSIZE (1024*50)
@@ -96,27 +98,6 @@
#define MAX(x,y) ((x)>(y)?(x):(y))
#endif
/* Type of handle. All publicly returned 'handles' in the curl interface
have a handle first in the struct that describes what kind of handle it
is. Used to detect bad handle usage. */
typedef enum {
STRUCT_NONE,
STRUCT_OPEN,
STRUCT_CONNECT,
STRUCT_LAST
} Handle;
/* Connecting to a remote server using the curl interface is moving through
a state machine, this type is used to store the current state */
typedef enum {
CONN_NONE, /* illegal state */
CONN_INIT, /* curl_connect() has been called */
CONN_DO, /* curl_do() has been called successfully */
CONN_DONE, /* curl_done() has been called successfully */
CONN_ERROR, /* and error has occurred */
CONN_LAST /* illegal state */
} ConnState;
#ifdef KRB4
/* Types needed for krb4-ftp connections */
struct krb4buffer {
@@ -150,6 +131,8 @@ struct ssl_config_data {
long verifypeer; /* set TRUE if this is desired */
char *CApath; /* DOES NOT WORK ON WINDOWS */
char *CAfile; /* cerficate to verify peer against */
char *random_file; /* path to file containing "random" data */
char *egdsocket; /* path to file containing the EGD daemon socket */
};
/****************************************************************************
@@ -167,6 +150,8 @@ struct HTTP {
struct Form form;
size_t (*storefread)(char *, size_t , size_t , FILE *);
FILE *in;
struct Curl_chunker chunk;
};
/****************************************************************************
@@ -183,12 +168,21 @@ struct FTP {
char *entrypath; /* the PWD reply when we logged on */
};
/****************************************************************************
* FILE unique setup
***************************************************************************/
struct FILE {
int fd; /* open file descriptor to read from! */
};
/*
* Boolean values that concerns this connection.
*/
struct ConnectBits {
bool close; /* if set, we close the connection after this request */
bool reuse; /* if set, this is a re-used connection */
bool chunk; /* if set, this is a chunked transfer-encoding */
bool httpproxy; /* if set, this transfer is done through a http proxy */
};
/*
@@ -197,18 +191,10 @@ struct ConnectBits {
*/
struct connectdata {
/**** Fields set when inited and not modified again */
/* To better see what kind of struct that is passed as input, *ALL* publicly
returned handles MUST have this initial 'Handle'. */
Handle handle; /* struct identifier */
struct UrlData *data; /* link to the root CURL struct */
int connectindex; /* what index in the connects index this particular
struct has */
/**** curl_connect() phase fields */
ConnState state; /* for state dependent actions */
long protocol; /* PROT_* flags concerning the protocol set */
#define PROT_MISSING (1<<0)
#define PROT_GOPHER (1<<1)
@@ -238,7 +224,11 @@ struct connectdata {
not the proxy port! */
char *ppath;
long bytecount;
struct timeval now; /* current time */
char *proxyhost; /* name of the http proxy host */
struct timeval now; /* "current" time */
struct timeval created; /* creation time */
int firstsocket; /* the main socket to use */
int secondarysocket; /* for i.e ftp transfers */
@@ -297,6 +287,9 @@ struct connectdata {
char *host; /* free later if not NULL */
} allocptr;
char *newurl; /* This can only be set if a Location: was in the
document headers */
#ifdef KRB4
enum protection_level command_prot;
@@ -318,9 +311,9 @@ struct connectdata {
struct HTTP *gopher; /* alias, just for the sake of being more readable */
struct HTTP *https; /* alias, just for the sake of being more readable */
struct FTP *ftp;
#if 0 /* no need for special ones for these: */
struct TELNET *telnet;
struct FILE *file;
void *telnet; /* private for telnet.c-eyes only */
#if 0 /* no need for special ones for these: */
struct LDAP *ldap;
struct DICT *dict;
#endif
@@ -354,6 +347,7 @@ struct Progress {
double t_connect;
double t_pretransfer;
int httpcode;
int httpversion;
time_t filetime; /* If requested, this is might get set. It may be 0 if
the time was unretrievable */
@@ -409,16 +403,12 @@ struct Configbits {
bool proxystringalloc; /* the http proxy string is malloc()'ed */
bool rangestringalloc; /* the range string is malloc()'ed */
bool urlstringalloc; /* the URL string is malloc()'ed */
bool reuse_forbid; /* if this is forbidden to be reused, close
after use */
bool reuse_fresh; /* do not re-use an existing connection for this
transfer */
};
/* What type of interface that intiated this struct */
typedef enum {
CURLI_NONE,
CURLI_EASY,
CURLI_NORMAL,
CURLI_LAST
} CurlInterface;
/*
* As of April 11, 2000 we're now trying to split up the urldata struct in
* three different parts:
@@ -445,9 +435,6 @@ typedef enum {
*/
struct UrlData {
Handle handle; /* struct identifier */
CurlInterface interf; /* created by WHAT interface? */
/*************** Global - specific items ************/
FILE *err; /* the stderr writes goes here */
char *errorbuffer; /* store failure messages in here */
@@ -523,9 +510,6 @@ struct UrlData {
char *cookie; /* HTTP cookie string to send */
char *newurl; /* This can only be set if a Location: was in the
document headers */
struct curl_slist *headers; /* linked list of extra headers */
struct HttpPost *httppost; /* linked list of POST data */
@@ -585,191 +569,26 @@ struct UrlData {
#define LIBCURL_NAME "libcurl"
#define LIBCURL_ID LIBCURL_NAME " " LIBCURL_VERSION " " SSL_ID
CURLcode Curl_getinfo(CURL *curl, CURLINFO info, ...);
/*
* Here follows function prototypes from what we used to plan to call
* the "low level" interface. It is no longer prioritized and it is not likely
* to ever be supported to external users.
*
* I removed all the comments to them as well, as they were no longer accurate
* and they're not meant for "public use" anymore.
*/
/*
* NAME curl_init()
*
* DESCRIPTION
*
* Inits libcurl globally. This must be used before any libcurl calls can
* be used. This may install global plug-ins or whatever. (This does not
* do winsock inits in Windows.)
*
* EXAMPLE
*
* curl_init();
*
*/
CURLcode curl_init(void);
/*
* NAME curl_init()
*
* DESCRIPTION
*
* Frees libcurl globally. This must be used after all libcurl calls have
* been used. This may remove global plug-ins or whatever. (This does not
* do winsock cleanups in Windows.)
*
* EXAMPLE
*
* curl_free(curl);
*
*/
void curl_free(void);
/*
* NAME curl_open()
*
* DESCRIPTION
*
* Opens a general curl session. It does not try to connect or do anything
* on the network because of this call. The specified URL is only required
* to enable curl to figure out what protocol to "activate".
*
* A session should be looked upon as a series of requests to a single host. A
* session interacts with one host only, using one single protocol.
*
* The URL is not required. If set to "" or NULL, it can still be set later
* using the curl_setopt() function. If the curl_connect() function is called
* without the URL being known, it will return error.
*
* EXAMPLE
*
* CURLcode result;
* CURL *curl;
* result = curl_open(&curl, "http://curl.haxx.nu/libcurl/");
* if(result != CURL_OK) {
* return result;
* }
* */
CURLcode curl_open(CURL **curl, char *url);
/*
* NAME curl_setopt()
*
* DESCRIPTION
*
* Sets a particular option to the specified value.
*
* EXAMPLE
*
* CURL curl;
* curl_setopt(curl, CURL_HTTP_FOLLOW_LOCATION, TRUE);
*/
CURLcode curl_setopt(CURL *handle, CURLoption option, ...);
/*
* NAME curl_close()
*
* DESCRIPTION
*
* Closes a session previously opened with curl_open()
*
* EXAMPLE
*
* CURL *curl;
* CURLcode result;
*
* result = curl_close(curl);
*/
CURLcode curl_close(CURL *curl); /* the opposite of curl_open() */
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
ssize_t *n);
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
size_t *n);
/*
* NAME curl_connect()
*
* DESCRIPTION
*
* Connects to the peer server and performs the initial setup. This function
* writes a connect handle to its second argument that is a unique handle for
* this connect. This allows multiple connects from the same handle returned
* by curl_open().
*
* By setting 'allow_port' to FALSE, the data->use_port will *NOT* be
* respected.
*
* EXAMPLE
*
* CURLCode result;
* CURL curl;
* CURLconnect connect;
* result = curl_connect(curl, &connect); */
CURLcode curl_connect(CURL *curl,
CURLconnect **in_connect,
CURLcode Curl_open(CURL **curl, char *url);
CURLcode Curl_setopt(CURL *handle, CURLoption option, ...);
CURLcode Curl_close(CURL *curl); /* the opposite of curl_open() */
CURLcode Curl_connect(struct UrlData *,
struct connectdata **,
bool allow_port);
/*
* NAME curl_do()
*
* DESCRIPTION
*
* (Note: May 3rd 2000: this function does not currently allow you to
* specify a document, it will use the one set previously)
*
* This function asks for the particular document, file or resource that
* resides on the server we have connected to. You may specify a full URL,
* just an absolute path or even a relative path. That means, if you're just
* getting one file from the remote site, you can use the same URL as input
* for both curl_open() as well as for this function.
*
* In the even there is a host name, port number, user name or password parts
* in the URL, you can use the 'flags' argument to ignore them completely, or
* at your choice, make the function fail if you're trying to get a URL from
* different host than you connected to with curl_connect().
*
* You can only get one document at a time using the same connection. When one
* document has been received you can although request again.
*
* When the transfer is done, curl_done() MUST be called.
*
* EXAMPLE
*
* CURLCode result;
* char *url;
* CURLconnect *connect;
* result = curl_do(connect, url, CURL_DO_NONE); */
CURLcode curl_do(CURLconnect *in_conn);
/*
* NAME curl_done()
*
* DESCRIPTION
*
* When the transfer following a curl_do() call is done, this function should
* get called.
*
* EXAMPLE
*
* CURLCode result;
* char *url;
* CURLconnect *connect;
* result = curl_done(connect); */
CURLcode curl_done(CURLconnect *connect);
/*
* NAME curl_disconnect()
*
* DESCRIPTION
*
* Disconnects from the peer server and performs connection cleanup.
*
* EXAMPLE
*
* CURLcode result;
* CURLconnect *connect;
* result = curl_disconnect(connect); */
CURLcode curl_disconnect(CURLconnect *connect);
CURLcode Curl_do(struct connectdata *);
CURLcode Curl_done(struct connectdata *);
CURLcode Curl_disconnect(struct connectdata *);
#endif

View File

@@ -11,7 +11,7 @@ libversion="$version"
# Now we have a section to get the major, minor and patch number from the
# full version string. We create a single hexadecimal number from it '0xMMmmpp'
#
perl='$a=<STDIN>;@p=split("\\.",$a);for(0..2){printf STDOUT ("%02x",$p[0+$_]);}';
perl='$a=<STDIN>;@p=split("[\\.-]",$a);for(0..2){printf STDOUT ("%02x",$p[0+$_]);}';
numeric=`echo $libversion | perl -e "$perl"`

View File

@@ -242,61 +242,62 @@ static void help(void)
" -a/--append Append to target file when uploading (F)\n"
" -A/--user-agent <string> User-Agent to send to server (H)\n"
" -b/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
" -B/--use-ascii Use ASCII/text transfer\n"
" -C/--continue-at <offset> Specify absolute resume offset\n"
" -B/--use-ascii Use ASCII/text transfer\n",
curl_version());
puts(" -C/--continue-at <offset> Specify absolute resume offset\n"
" -d/--data <data> HTTP POST data (H)\n"
" --data-ascii <data> HTTP POST ASCII data (H)\n"
" --data-binary <data> HTTP POST binary data (H)\n"
" -D/--dump-header <file> Write the headers to this file\n"
" -e/--referer Referer page (H)\n"
" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n"
" -e/--referer Referer page (H)");
puts(" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n"
" --cacert <file> CA certifciate to verify peer against (HTTPS)\n"
" -f/--fail Fail silently (no output at all) on errors (H)\n"
" -F/--form <name=content> Specify HTTP POST data (H)\n"
" -g/--globoff Disable URL sequences and ranges using {} and []\n"
" -h/--help This help text\n"
" -H/--header <line> Custom header to pass to server. (H)\n"
" -i/--include Include the HTTP-header in the output (H)\n"
" -H/--header <line> Custom header to pass to server. (H)");
puts(" -i/--include Include the HTTP-header in the output (H)\n"
" -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n"
" --interface <interface> Specify the interface to be used\n"
" --krb4 <level> Enable krb4 with specified security level (F)\n"
" -K/--config Specify which config file to read\n"
" -l/--list-only List only names of an FTP directory (F)\n"
" -L/--location Follow Location: hints (H)\n"
" -l/--list-only List only names of an FTP directory (F)");
puts(" -L/--location Follow Location: hints (H)\n"
" -m/--max-time <seconds> Maximum time allowed for the transfer\n"
" -M/--manual Display huge help text\n"
" -n/--netrc Read .netrc for user name and password\n"
" -N/--no-buffer Disables the buffering of the output stream\n"
" -o/--output <file> Write output to <file> instead of stdout\n"
" -N/--no-buffer Disables the buffering of the output stream");
puts(" -o/--output <file> Write output to <file> instead of stdout\n"
" -O/--remote-name Write output to a file named as the remote file\n"
" -p/--proxytunnel Perform non-HTTP services through a HTTP proxy\n"
" -P/--ftpport <address> Use PORT with address instead of PASV when ftping (F)\n"
" -q When used as the first parameter disables .curlrc\n"
" -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)\n"
" -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n"
" -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)");
puts(" -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n"
" -s/--silent Silent mode. Don't output anything\n"
" -S/--show-error Show error. With -s, make curl show errors when they occur\n"
" -t/--telnet-option <OPT=val> Set telnet option\n"
" -T/--upload-file <file> Transfer/upload <file> to remote site\n"
" --url <URL> Another way to specify URL to work with\n"
" -u/--user <user[:password]> Specify user and password to use\n"
" --url <URL> Another way to specify URL to work with");
puts(" -u/--user <user[:password]> Specify user and password to use\n"
" -U/--proxy-user <user[:password]> Specify Proxy authentication\n"
" -v/--verbose Makes the operation more talkative\n"
" -V/--version Outputs version number then quits\n"
" -w/--write-out [format] What to output after completion\n"
" -x/--proxy <host[:port]> Use proxy. (Default port is 1080)\n"
" -X/--request <command> Specific request command to use\n"
" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
" -X/--request <command> Specific request command to use");
puts(" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
" -Y/--speed-limit Stop transfer if below speed-limit for 'speed-time' secs\n"
" -z/--time-cond <time> Includes a time condition to the server (H)\n"
" -Z/--max-redirs <num> Set maximum number of redirections allowed (H)\n"
" -2/--sslv2 Force usage of SSLv2 (H)\n"
" -3/--sslv3 Force usage of SSLv3 (H)\n"
" -#/--progress-bar Display transfer progress as a progress bar\n"
" -3/--sslv3 Force usage of SSLv3 (H)");
puts(" -#/--progress-bar Display transfer progress as a progress bar\n"
" --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)\n"
" --stderr <file> Where to redirect stderr. - means stdout.\n",
curl_version()
);
" --stderr <file> Where to redirect stderr. - means stdout.\n"
" --random-file <file> File to use for reading random data from (SSL)\n"
" --egd-file <file> EGD socket path for random data (SSL)");
}
struct LongShort {
@@ -306,6 +307,8 @@ struct LongShort {
};
struct Configurable {
char *random_file;
char *egd_file;
char *useragent;
char *cookie;
bool use_resume;
@@ -525,6 +528,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"7", "interface", TRUE},
{"6", "krb4", TRUE},
{"5", "url", TRUE},
{"5a", "random-file", TRUE},
{"5b", "egd-file", TRUE},
{"2", "sslv2", FALSE},
{"3", "sslv3", FALSE},
@@ -674,7 +679,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->krb4level, nextarg);
break;
case '5':
/* the URL! */
switch(subletter) {
case 'a': /* random-file */
GetStr(&config->random_file, nextarg);
break;
case 'b': /* egd-file */
GetStr(&config->egd_file, nextarg);
break;
default: /* the URL! */
{
struct getout *url;
if(config->url_get || (config->url_get=config->url_list)) {
@@ -699,6 +711,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
url->flags |= GETOUT_URL;
}
}
}
break;
case '#': /* added 19990617 larsa */
config->progressmode ^= CURL_PROGRESS_BAR;
@@ -1368,6 +1381,10 @@ void progressbarinit(struct ProgressData *bar)
void free_config_fields(struct Configurable *config)
{
if(config->random_file)
free(config->random_file);
if(config->egd_file)
free(config->egd_file);
if(config->userpwd)
free(config->userpwd);
if(config->postfields)
@@ -1441,12 +1458,10 @@ operate(struct Configurable *config, int argc, char *argv[])
curl_memdebug("memdump");
#endif
main_init(); /* inits winsock crap for windows */
config->showerror=TRUE;
config->conf=CONF_DEFAULT;
#if 0
config->crlf=FALSE;
config->quote=NULL;
#endif
if(argc>1 &&
(!strnequal("--", argv[1], 2) && (argv[1][0] == '-')) &&
@@ -1455,9 +1470,6 @@ operate(struct Configurable *config, int argc, char *argv[])
* The first flag, that is not a verbose name, but a shortname
* and it includes the 'q' flag!
*/
#if 0
fprintf(stderr, "I TURNED OFF THE CRAP\n");
#endif
;
}
else {
@@ -1537,6 +1549,15 @@ operate(struct Configurable *config, int argc, char *argv[])
else
allocuseragent = TRUE;
/*
* Get a curl handle to use for all forthcoming curl transfers. Cleanup
* when all transfers are done. This is supported with libcurl 7.7 and
* should not be attempted on previous versions.
*/
curl = curl_easy_init();
if(!curl)
return CURLE_FAILED_INIT;
urlnode = config->url_list;
/* loop through the list of given URLs */
@@ -1722,10 +1743,6 @@ operate(struct Configurable *config, int argc, char *argv[])
#endif
main_init();
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_FILE, (FILE *)&outs); /* where to store */
/* what call to write: */
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
@@ -1821,22 +1838,18 @@ operate(struct Configurable *config, int argc, char *argv[])
/* new in libcurl 7.6.2: */
curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, config->telnet_options);
/* new in libcurl 7.7: */
curl_easy_setopt(curl, CURLOPT_RANDOM_FILE, config->random_file);
curl_easy_setopt(curl, CURLOPT_EGDSOCKET, config->egd_file);
res = curl_easy_perform(curl);
if(config->writeout) {
ourWriteOut(curl, config->writeout);
}
/* always cleanup */
curl_easy_cleanup(curl);
if((res!=CURLE_OK) && config->showerror)
fprintf(config->errors, "curl: (%d) %s\n", res, errorbuffer);
}
else
fprintf(config->errors, "curl: failed to init libcurl!\n");
main_free();
if((config->errors != stderr) &&
(config->errors != stdout))
@@ -1884,6 +1897,11 @@ operate(struct Configurable *config, int argc, char *argv[])
if(allocuseragent)
free(config->useragent);
/* cleanup the curl handle! */
curl_easy_cleanup(curl);
main_free(); /* cleanup the winsock stuff for windows */
return res;
}

View File

@@ -75,18 +75,18 @@ for(@out) {
$new = $_;
$outsize += length($new);
$outsize += length($new)+1; # one for the newline
$new =~ s/\\/\\\\/g;
$new =~ s/\"/\\\"/g;
printf("\"%s\\n\"\n", $new);
if($outsize > 10000) {
# gcc 2.96 claims ISO C89 only is required to support 509 letter strings
if($outsize > 500) {
# terminate and make another puts() call here
print ");\n puts(\n";
$outsize=0;
$outsize=length($new)+1;
}
printf("\"%s\\n\"\n", $new);
}

View File

@@ -1,3 +1,3 @@
#define CURL_NAME "curl"
#define CURL_VERSION "7.7-alpha2"
#define CURL_VERSION "7.7-beta2"
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "

View File

@@ -7,7 +7,7 @@
The cURL Test Suite
Requires:
perl
perl (and a unix-style shell)
Run:
'make test'. This invokes the 'runtests.pl' perl script. Edit the top
@@ -15,10 +15,13 @@ Run:
The script breaks on the first test that doesn't do OK. Use -a to prevent
the script to abort on the first error. Run the script with -v for more
verbose output.
verbose output. Use -d to run the test servers with debug output enabled as
well.
Use -s fort shorter output, or pass a string with test numbers to run
specific tests only (like ./runtests.pl "3 4" to test 3 and 4 only)
Use -s for shorter output, or pass test numbers to run specific tests only
(like "./runtests.pl 3 4" to test 3 and 4 only). It also supports test case
ranges with 'to'. As in "./runtests 3 to 9" which runs the seven tests from
3 to 9.
Memory:
The test script will check that all allocated memory is freed properly IF
@@ -26,9 +29,24 @@ Memory:
automatically detect if that is the case, and it will use the ../memanalyze
script to analyze the memory debugging output.
Debug:
If a test case fails, you can conveniently get the script to invoke the
debugger (gdb) for you with the server running and the exact same command
line parameters that failed. Just invoke 'runtests.pl <test number> -g' and
then just type 'run' in the debugger to perform the command through the
debugger.
If a test case causes a core dump, analyze it by running gdb like:
# gdb ../curl/src core
... and get a stack trace with the gdb command:
(gdb) where
Logs:
All logs are generated in the logs/ subdirctory (it is emtpied first
in the runtests.sh script)
in the runtests.pl script)
Data:
All test-data are put in the data/ subdirctory.
@@ -45,8 +63,10 @@ Data:
replyN.txt: the full dump the server should reply to curl for this test.
If the final result that curl should've got is not in this
file, you can instead name the file replyN0001.txt. This enables
you to fiddle more. ;-)
file, you can instead name the file replyN0001.txt. This
enables you to fiddle more. ;-) Alas, the server sends the
replyN.txt file but checks the result after the test against
the *0001.txt file.
stdoutN.txt: if this file is present, curl's stdout is compared against
this file to see that they're identical. If this is present,
@@ -63,7 +83,7 @@ Data:
of the ftp server. It uses a simple syntax that is left to
describe here!
FIX:
TODO:
* Make httpserver.pl work when we PUT without Content-Length:
* Add persistant connection support and test cases

View File

@@ -62,4 +62,8 @@ command30.txt name29.txt prot29.txt reply29.txt \
command31.txt name32.txt reply31.txt reply32.txt \
command32.txt prot31.txt reply310001.txt reply320001.txt \
name31.txt prot32.txt reply310002.txt reply320002.txt \
command33.txt extra33.txt name33.txt prot33.txt reply33.txt
command33.txt extra33.txt name33.txt prot33.txt reply33.txt \
command34.txt prot34.txt reply340001.txt name34.txt reply34.txt \
command35.txt name35.txt prot35.txt reply35.txt \
command36.txt error36.txt name36.txt reply36.txt \
command37.txt name37.txt prot37.txt reply37.txt

View File

@@ -1,4 +1,4 @@
http://%HOSTIP:%HOSTPORT/want/25 -o - -o -
http://%HOSTIP:%HOSTPORT/want/26 -o - -o -

1
tests/data/command34.txt Normal file
View File

@@ -0,0 +1 @@
http://%HOSTIP:%HOSTPORT/34

1
tests/data/command35.txt Normal file
View File

@@ -0,0 +1 @@
http://%HOSTIP:%HOSTPORT/want/35 --include --head

1
tests/data/command36.txt Normal file
View File

@@ -0,0 +1 @@
http://%HOSTIP:%HOSTPORT/36

1
tests/data/command37.txt Normal file
View File

@@ -0,0 +1 @@
http://uUsSeErrr:pppasswrd@%HOSTIP:%HOSTPORT/37

1
tests/data/error36.txt Normal file
View File

@@ -0,0 +1 @@
26

View File

@@ -1 +1 @@
HTTP HEAD
HTTP HEAD with Connection: close

View File

@@ -1 +1 @@
looping HTTP Location: following with --max-redirs
looping HTTP Location: following with --max-redirs, no persistance

1
tests/data/name34.txt Normal file
View File

@@ -0,0 +1 @@
HTTP GET with chunked Transfer-Encoding

1
tests/data/name35.txt Normal file
View File

@@ -0,0 +1 @@
HTTP HEAD without Connection: close

1
tests/data/name36.txt Normal file
View File

@@ -0,0 +1 @@
HTTP GET with badly formatted chunked Transfer-Encoding

1
tests/data/name37.txt Normal file
View File

@@ -0,0 +1 @@
HTTP GET with name+password in the URL

View File

@@ -1,4 +1,4 @@
GET /1 HTTP/1.0
GET /1 HTTP/1.1
User-Agent: curl/7.4.2-pre3 (sparc-sun-solaris2.7) libcurl 7.4.2-pre3 (SSL 0.9.6)
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
PUT /we/want/10 HTTP/1.0
PUT /we/want/10 HTTP/1.1
Host: 127.0.0.1:8999
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE A
LIST

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PORT 127,0,0,1,243,212
TYPE A
LIST

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
RETR 102

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD a/path
PORT 127,0,0,1,246,33
TYPE I

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD a/path
MDTM 103
TYPE I

View File

@@ -1,5 +1,6 @@
USER userdude
PASS passfellow
PWD
PASV
TYPE A
RETR 103

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD /path with spaces/and things2
PASV
TYPE A

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
STOR 107

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
CWD CWD/STOR/RETR
PORT 127,0,0,1,5,109
TYPE I

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
APPE 109

View File

@@ -1,4 +1,4 @@
GET /want/data/110002.txt?coolsite=yes HTTP/1.0
GET /want/data/110002.txt?coolsite=yes HTTP/1.1
Host: 127.0.0.1:8999
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
SIZE 110

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
APPE 112

View File

@@ -1,4 +1,4 @@
GET /want/12 HTTP/1.0
GET /want/12 HTTP/1.1
Range: bytes=100-200
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
PASV
TYPE I
RETR 106

View File

@@ -1,5 +1,6 @@
USER anonymous
PASS curl_by_daniel@haxx.se
PWD
DELE before_transfer
PASV
TYPE I

View File

@@ -1,4 +1,4 @@
DELETE /want/13 HTTP/1.0
DELETE /want/13 HTTP/1.1
Host: 127.0.0.1:8999
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

View File

@@ -1,4 +1,4 @@
HEAD /want/14 HTTP/1.0
HEAD /want/14 HTTP/1.1
User-Agent: curl/7.4.2-pre4 (sparc-sun-solaris2.7) libcurl 7.4.2-pre4
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /want/15 HTTP/1.0
GET /want/15 HTTP/1.1
Host: 127.0.0.1:8999
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

View File

@@ -1,4 +1,4 @@
GET http://we.want.that.site.com/2 HTTP/1.0
GET http://we.want.that.site.com/2 HTTP/1.1
Proxy-authorization: Basic ZmFrZUB1c2VyOqenp2xvb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb29vb28=
Host: we.want.that.site.com
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
MOOO /that.site.com/17 HTTP/1.0
MOOO /that.site.com/17 HTTP/1.1
User-Agent: agent007 license to drill
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /11 HTTP/1.0
GET /11 HTTP/1.1
User-Agent: curl/7.4.2 (sparc-sun-solaris2.7) libcurl 7.4.2
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /2 HTTP/1.0
GET /2 HTTP/1.1
Authorization: Basic ZmFrZTp1c2Vy
Host: 127.0.0.1:8999
Pragma: no-cache

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
GET /want/25 HTTP/1.0
GET /want/26 HTTP/1.1
User-Agent: curl/7.6-pre1 (sparc-sun-solaris2.7) libcurl 7.5.2 (SSL 0.9.6) (krb4 enabled)
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /want/22 HTTP/1.0
GET /want/22 HTTP/1.1
User-Agent: curl/7.6-pre1 (sparc-sun-solaris2.7) libcurl 7.6-pre1 (SSL 0.9.6) (krb4 enabled)
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /wantit/{}[]/28 HTTP/1.0
GET /wantit/{}[]/28 HTTP/1.1
Host: 127.0.0.1:8999
Pragma: no-cache
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

View File

@@ -1,4 +1,4 @@
GET /29 HTTP/1.0
GET /29 HTTP/1.1
Range: bytes=200-
User-Agent: curl/7.6 (i686-pc-linux-gnu) libcurl 7.6 (SSL 0.9.5) (ipv6 enabled)
Host: 127.0.0.1:8999

View File

@@ -1,4 +1,4 @@
POST /3 HTTP/1.0
POST /3 HTTP/1.1
Authorization: Basic ZmFrZTotdXNlcg==
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
GET /30 HTTP/1.0
GET /30 HTTP/1.1
User-Agent: curl/7.6 (i686-pc-linux-gnu) libcurl 7.6 (SSL 0.9.5) (ipv6 enabled)
Host: 127.0.0.1:8999
Pragma: no-cache

View File

@@ -1,4 +1,4 @@
POST /moo/moo/moo/310002 HTTP/1.0
POST /moo/moo/moo/310002 HTTP/1.1
User-Agent: curl/7.6 (i686-pc-linux-gnu) libcurl 7.6 (SSL 0.9.5) (ipv6 enabled)
Host: 127.0.0.1:8999
Pragma: no-cache

Some files were not shown because too many files have changed in this diff Show More