Compare commits
64 Commits
curl-7_7-b
...
curl-7_7-b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ff681f7bfd | ||
![]() |
60bbb64a81 | ||
![]() |
c622f2bb4e | ||
![]() |
cd59f13da6 | ||
![]() |
11d718bf52 | ||
![]() |
8e8846d876 | ||
![]() |
7d562bb685 | ||
![]() |
20ddd35669 | ||
![]() |
063f88cd14 | ||
![]() |
87b0b7cab9 | ||
![]() |
70d0d9d4da | ||
![]() |
4ae3bd71ea | ||
![]() |
a9390665b8 | ||
![]() |
fb7a6e3423 | ||
![]() |
cc99e3f7de | ||
![]() |
e6b40bb6ac | ||
![]() |
f2fd1b8856 | ||
![]() |
cb4efcf275 | ||
![]() |
56a27d608a | ||
![]() |
46c9075eab | ||
![]() |
d95fa648e9 | ||
![]() |
563ad213dc | ||
![]() |
0121d7d731 | ||
![]() |
8495fac1c5 | ||
![]() |
38c349f751 | ||
![]() |
542df800ab | ||
![]() |
3e88b1cac5 | ||
![]() |
d774b10afb | ||
![]() |
b449b94393 | ||
![]() |
a6cb9b08b2 | ||
![]() |
440a3101d0 | ||
![]() |
9778a5356b | ||
![]() |
de7dcdbc54 | ||
![]() |
070968abbc | ||
![]() |
e97fc2aab5 | ||
![]() |
a23ac24192 | ||
![]() |
9ee14644a7 | ||
![]() |
c576e114b9 | ||
![]() |
639a7982ba | ||
![]() |
5bbe189420 | ||
![]() |
93ff159e32 | ||
![]() |
8eb8a0a8e4 | ||
![]() |
a4af638867 | ||
![]() |
75a9a87ec2 | ||
![]() |
b5ba011110 | ||
![]() |
e9b763ff05 | ||
![]() |
ac0bad2433 | ||
![]() |
67d5c0a970 | ||
![]() |
580896d615 | ||
![]() |
11693c0faa | ||
![]() |
26cd8eda4a | ||
![]() |
8cd3f44040 | ||
![]() |
2b30bfc349 | ||
![]() |
8ec4dba599 | ||
![]() |
1efec6572e | ||
![]() |
781dd7a9bf | ||
![]() |
beb8761b22 | ||
![]() |
071c7de9fe | ||
![]() |
3e7ebcd051 | ||
![]() |
c67952fc5c | ||
![]() |
7d7c24f915 | ||
![]() |
0dc8c4d451 | ||
![]() |
9cf4434ae2 | ||
![]() |
8ccd8b6dbc |
62
CHANGES
62
CHANGES
@@ -7,10 +7,72 @@
|
|||||||
History of Changes
|
History of Changes
|
||||||
|
|
||||||
|
|
||||||
|
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)
|
Daniel (8 March 2001)
|
||||||
- "Transfer-Encoding: chunked" is no longer any trouble for libcurl. I've
|
- "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.
|
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)
|
Daniel (5 March 2001)
|
||||||
- The current 57 test cases now pass OK. It would suggest that libcurl works
|
- 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
|
using the old-style with one connection per handle. The test suite doesn't
|
||||||
|
@@ -43,6 +43,9 @@
|
|||||||
/* Define this to 'int' if ssize_t is not an available typedefed type */
|
/* Define this to 'int' if ssize_t is not an available typedefed type */
|
||||||
#undef ssize_t
|
#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 */
|
/* Define this as a suitable file to read random data from */
|
||||||
#undef RANDOM_FILE
|
#undef RANDOM_FILE
|
||||||
|
|
||||||
|
25
configure.in
25
configure.in
@@ -693,6 +693,28 @@ AC_CHECK_SIZEOF(long long, 4)
|
|||||||
# check for ssize_t
|
# check for ssize_t
|
||||||
AC_CHECK_TYPE(ssize_t, int)
|
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
|
dnl Get system canonical name
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
AC_DEFINE_UNQUOTED(OS, "${host}")
|
AC_DEFINE_UNQUOTED(OS, "${host}")
|
||||||
@@ -764,6 +786,5 @@ AC_OUTPUT( Makefile \
|
|||||||
packages/Linux/Makefile \
|
packages/Linux/Makefile \
|
||||||
packages/Linux/RPM/Makefile \
|
packages/Linux/RPM/Makefile \
|
||||||
packages/Linux/RPM/curl.spec \
|
packages/Linux/RPM/curl.spec \
|
||||||
packages/Linux/RPM/curl-ssl.spec \
|
packages/Linux/RPM/curl-ssl.spec )
|
||||||
tiny/Makefile )
|
|
||||||
|
|
||||||
|
17
docs/BUGS
17
docs/BUGS
@@ -6,9 +6,9 @@
|
|||||||
|
|
||||||
BUGS
|
BUGS
|
||||||
|
|
||||||
Curl has grown substantially from that day, several years ago, when I
|
Curl and libcurl have grown substantially since the beginning. At the time
|
||||||
started fiddling with it. When I write this, there are 16500 lines of source
|
of writing (mid March 2001), there are 23000 lines of source code, and by
|
||||||
code, and by the time you read this it has probably grown even more.
|
the time you read this it has probably grown even more.
|
||||||
|
|
||||||
Of course there are lots of bugs left. And lots of misfeatures.
|
Of course there are lots of bugs left. And lots of misfeatures.
|
||||||
|
|
||||||
@@ -21,10 +21,11 @@ BUGS
|
|||||||
http://sourceforge.net/bugs/?group_id=976
|
http://sourceforge.net/bugs/?group_id=976
|
||||||
|
|
||||||
When reporting a bug, you should include information that will help us
|
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
|
understand what's wrong, what you expected to happen and how to repeat the
|
||||||
need to supply your operating system's name and version number (uname -a
|
bad behaviour. You therefore need to supply your operating system's name and
|
||||||
under a unix is fine), what version of curl you're using (curl -v is fine),
|
version number (uname -a under a unix is fine), what version of curl you're
|
||||||
what URL you were working with and anything else you think matters.
|
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
|
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
|
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!
|
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
|
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
|
HOW TO GET A STACK TRACE with a common unix debugger
|
||||||
====================================================
|
====================================================
|
||||||
|
@@ -13,7 +13,7 @@ To Think About When Contributing Source Code
|
|||||||
The License Issue
|
The License Issue
|
||||||
|
|
||||||
When contributing with code, you agree to put your changes and new code under
|
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
|
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
|
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
|
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
|
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,
|
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
|
Indenting
|
||||||
|
|
||||||
Please try using the same indenting levels and bracing method as all the
|
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
|
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
|
all of it is written using the same style. We don't ask you to like it, we
|
||||||
ask you to follow the tradition! ;-)
|
just ask you to follow the tradition! ;-)
|
||||||
|
|
||||||
Commenting
|
Commenting
|
||||||
|
|
||||||
Comment your source code extensively. I don't see myself as a very good
|
Comment your source code extensively. Commented code is quality code and
|
||||||
source commenter, but I try to become one. Commented code is quality code and
|
|
||||||
enables future modifications much more. Uncommented code much more risk being
|
enables future modifications much more. Uncommented code much more risk being
|
||||||
completely replaced when someone wants to extend things, since other persons'
|
completely replaced when someone wants to extend things, since other persons'
|
||||||
source code can get quite hard to read.
|
source code can get quite hard to read.
|
||||||
@@ -71,9 +71,9 @@ Separate Patches Doing Different Things
|
|||||||
Patch Against Recent Sources
|
Patch Against Recent Sources
|
||||||
|
|
||||||
Please try to get the latest available sources to make your patches
|
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
|
against. It makes the life of the developers so much easier. The very best is
|
||||||
most up-to-date sources from the CVS repository, but the latest release
|
if you get the most up-to-date sources from the CVS repository, but the
|
||||||
archive is quite OK as well!
|
latest release archive is quite OK as well!
|
||||||
|
|
||||||
Document
|
Document
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ Write Access to CVS Repository
|
|||||||
|
|
||||||
Test Cases
|
Test Cases
|
||||||
|
|
||||||
Since the introduction of the test suite, we will get the possibility to
|
Since the introduction of the test suite, we can quickly verify that the main
|
||||||
quickly verify that the main features are working as supposed to. To maintain
|
features are working as they're supposed to. To maintain this situation and
|
||||||
this situation and improve it, all new features and functions that are added
|
improve it, all new features and functions that are added need to be tested
|
||||||
need tro be tested. Every feature that is added should get at least one valid
|
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
|
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!
|
post a few test cases, it won't end up as a heavy burden on a single person!
|
||||||
|
108
docs/FAQ
108
docs/FAQ
@@ -1,4 +1,4 @@
|
|||||||
Updated: March 6, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
Updated: March 13, 2001 (http://curl.haxx.se/docs/faq.shtml)
|
||||||
_ _ ____ _
|
_ _ ____ _
|
||||||
___| | | | _ \| |
|
___| | | | _ \| |
|
||||||
/ __| | | | |_) | |
|
/ __| | | | |_) | |
|
||||||
@@ -112,29 +112,30 @@ FAQ
|
|||||||
|
|
||||||
1.4 When will you make curl do XXXX ?
|
1.4 When will you make curl do XXXX ?
|
||||||
|
|
||||||
I love suggestions of what to change in order to make curl and libcurl
|
We 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
|
better. We do however believe in a few rules when it comes to the future of
|
||||||
curl:
|
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
|
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
|
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
|
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.
|
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
|
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
|
big I will agree. If you wanna add more protocols, I may very well
|
||||||
agree.
|
agree.
|
||||||
|
|
||||||
* If you want me to make all the work while you wait for me to implement it
|
* If you want someone else to make all the work while you wait for us to
|
||||||
for you, that is not a very friendly attitude. I spend a considerable time
|
implement it for you, that is not a very friendly attitude. We spend a
|
||||||
already on maintaining and developing curl. In order to get more out of
|
considerable time already on maintaining and developing curl. In order to
|
||||||
me, I trust you will offer some of your time and efforts in return.
|
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
|
* If you write the code, chances are bigger that it will get into curl
|
||||||
faster.
|
faster.
|
||||||
@@ -182,23 +183,24 @@ FAQ
|
|||||||
|
|
||||||
2.2. Does curl work/build with other SSL libraries?
|
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
|
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?
|
2.3. Where can I find a copy of LIBEAY32.DLL?
|
||||||
|
|
||||||
That is an OpenSSL binary built for Windows.
|
That is an OpenSSL binary built for Windows.
|
||||||
|
|
||||||
Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
|
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
|
accurate and up-to-date pointers to recent OpenSSL DDLs and other binary
|
||||||
packages.
|
packages.
|
||||||
|
|
||||||
2.4. Does cURL support Socks (RFC 1928) ?
|
2.4. Does cURL support Socks (RFC 1928) ?
|
||||||
|
|
||||||
No. Nobody has wanted it that badly yet. I would appriciate patches that
|
No. Nobody has wanted it that badly yet. We appriciate patches that bring
|
||||||
brings this functionality.
|
this functionality.
|
||||||
|
|
||||||
|
|
||||||
3. Usage problems
|
3. Usage problems
|
||||||
@@ -220,7 +222,7 @@ FAQ
|
|||||||
|
|
||||||
3.2. How do I tell curl to resume a transfer?
|
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.
|
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
|
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'.
|
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
|
This is described in some detail in the README.curl file, and if you don't
|
||||||
don't understand it the first time, read it again before you post questions
|
understand it the first time, read it again before you post questions about
|
||||||
about this to the mailing list. I would also suggest that you read through
|
this to the mailing list. Also, try reading through the mailing list
|
||||||
the mailing list archives for old postings and questions regarding this.
|
archives for old postings and questions regarding this.
|
||||||
|
|
||||||
3.4. How do I tell curl to run custom FTP commands?
|
3.4. How do I tell curl to run custom FTP commands?
|
||||||
|
|
||||||
@@ -306,9 +308,9 @@ FAQ
|
|||||||
|
|
||||||
4.1. Problems connecting to SSL servers.
|
4.1. Problems connecting to SSL servers.
|
||||||
|
|
||||||
It took a very long time before I could sort out why curl had problems
|
It took a very long time before we could sort out why curl had problems to
|
||||||
to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+.
|
connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The
|
||||||
The error sometimes showed up similar to:
|
error sometimes showed up similar to:
|
||||||
|
|
||||||
16570:error:1407D071:SSL routines:SSL2_READ:bad mac decode:s2_pkt.c:233:
|
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
|
requests properly. To correct this problem, tell curl to select SSLv2 from
|
||||||
the command line (-2/--sslv2).
|
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.
|
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?
|
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
|
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 (")
|
of a URL, you should qoute the entire URL by using single (') or double (")
|
||||||
quotes around it.
|
quotes around it.
|
||||||
@@ -346,8 +348,8 @@ FAQ
|
|||||||
curl '{curl,www}.haxx.se'
|
curl '{curl,www}.haxx.se'
|
||||||
|
|
||||||
To be able to use those letters as actual parts of the URL (without using
|
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
|
them for the curl URL "globbing" system), use the -g/--globoff option (curl
|
||||||
(included in curl 7.6 and later):
|
7.6 and later):
|
||||||
|
|
||||||
curl -g 'www.site.com/weirdname[].html'
|
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?
|
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
|
RFC2616 clearly explains the return codes. This is a short transcript. Go
|
||||||
here. Go read the RFC for exact details:
|
read the RFC for exact details:
|
||||||
|
|
||||||
4.5.1 "400 Bad Request"
|
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?
|
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
|
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
|
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
|
programs. libcurl will use thread-safe functions instead of non-safe ones if
|
||||||
your system has such.
|
your system has such.
|
||||||
|
|
||||||
I am very interested in once and for all getting some kind of report or
|
We would appriciate some kind of report or README file from those who have
|
||||||
README file from those who have used libcurl in a threaded environment,
|
used libcurl in a threaded environment.
|
||||||
since I haven't and I get this question more and more frequently!
|
|
||||||
|
|
||||||
5.2 How can I receive all data into a large memory chunk?
|
5.2 How can I receive all data into a large memory chunk?
|
||||||
|
|
||||||
@@ -487,11 +488,15 @@ FAQ
|
|||||||
5.3 How do I fetch multiple files with libcurl?
|
5.3 How do I fetch multiple files with libcurl?
|
||||||
|
|
||||||
Starting with version 7.7, curl and libcurl will have excellent support for
|
Starting with version 7.7, curl and libcurl will have excellent support for
|
||||||
transferring multiple files.
|
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.
|
||||||
|
|
||||||
The easy interface of libcurl does not support multiple requests using the
|
For libcurl prior to 7.7, there was no multiple file support. The only
|
||||||
same connection. The only available way to do multiple requests is to
|
available way to do multiple requests was to init/perform/cleanup for each
|
||||||
init/perform/cleanup for each request.
|
transfer.
|
||||||
|
|
||||||
5.4 Does libcurl do Winsock initing on win32 systems?
|
5.4 Does libcurl do Winsock initing on win32 systems?
|
||||||
|
|
||||||
@@ -517,18 +522,14 @@ FAQ
|
|||||||
|
|
||||||
Starting with version 7.7, curl and libcurl will have excellent support for
|
Starting with version 7.7, curl and libcurl will have excellent support for
|
||||||
persistant connections when transferring several files from the same server.
|
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 closely related to issue 5.3. Since libcurl has no real support
|
Previous versions had no persistant connection support.
|
||||||
for doing multiple file transfers, there's no support for Keep-Alive or
|
|
||||||
persistant connections either.
|
|
||||||
|
|
||||||
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!
|
|
||||||
|
|
||||||
6. License Issues
|
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,
|
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
|
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
|
conflict questions, you should study the MPL and MIT/X licenses and the
|
||||||
@@ -573,9 +574,10 @@ FAQ
|
|||||||
|
|
||||||
No.
|
No.
|
||||||
|
|
||||||
We carefully picked this license years ago and a large amount of people have
|
We have carefully picked this license after years of development and
|
||||||
contributed with source code knowing that this is the license we use. This
|
discussions and a large amount of people have contributed with source code
|
||||||
license puts the restrictions we want on curl/libcurl and it does not spread
|
knowing that this is the license we use. This license puts the restrictions
|
||||||
to other programs or libraries that use it. The recent dual license
|
we want on curl/libcurl and it does not spread to other programs or
|
||||||
modification should make it possible for everyone to use libcurl or curl in
|
libraries that use it. The recent dual license modification should make it
|
||||||
their projects, no matter what license they already have in use.
|
possible for everyone to use libcurl or curl in their projects, no matter
|
||||||
|
what license they already have in use.
|
||||||
|
@@ -17,12 +17,14 @@ Misc
|
|||||||
- progress bar/time specs while downloading
|
- progress bar/time specs while downloading
|
||||||
- "standard" proxy environment variables support
|
- "standard" proxy environment variables support
|
||||||
- config file support
|
- config file support
|
||||||
- compiles on win32
|
- compiles on win32 (reported built on 29 operating systems)
|
||||||
- redirectable stderr
|
- redirectable stderr
|
||||||
- use selected network interface for outgoing traffic
|
- use selected network interface for outgoing traffic
|
||||||
- IPv6 support
|
- IPv6 support
|
||||||
|
- persistant connections
|
||||||
|
|
||||||
HTTP
|
HTTP
|
||||||
|
- HTTP/1.1 compliant
|
||||||
- GET
|
- GET
|
||||||
- PUT
|
- PUT
|
||||||
- HEAD
|
- HEAD
|
||||||
@@ -72,6 +74,7 @@ FTP
|
|||||||
|
|
||||||
TELNET
|
TELNET
|
||||||
- connection negotiation
|
- connection negotiation
|
||||||
|
- custom telnet options
|
||||||
- stdin/stdout I/O
|
- stdin/stdout I/O
|
||||||
|
|
||||||
LDAP (*2)
|
LDAP (*2)
|
||||||
|
102
docs/INTERNALS
102
docs/INTERNALS
@@ -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
|
INTERNALS
|
||||||
|
|
||||||
The project is kind of split in two. The library and the client. The client
|
The project is split in two. The library and the client. The client part uses
|
||||||
part uses the library, but the library is meant to be designed to allow other
|
the library, but the library is designed to allow other applications to use
|
||||||
applications to use it.
|
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
|
CVS
|
||||||
===
|
===
|
||||||
@@ -35,13 +35,13 @@ Windows vs Unix
|
|||||||
the same at all places except for the header file that defines them. The
|
the same at all places except for the header file that defines them. The
|
||||||
macros in use are sclose(), sread() and swrite().
|
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
|
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.
|
src/main.c has some code #ifdef'ed to do just that.
|
||||||
|
|
||||||
3. The file descriptors for network communication and file operations are
|
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.
|
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
|
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
|
conditionals that deal with features *should* instead be in the format
|
||||||
'#ifdef HAVE_THAT_WEIRD_FUNCTION'. Since Windows can't run configure scripts,
|
'#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
|
supposed to look exactly as a config.h file would have looked like on a
|
||||||
Windows machine!
|
Windows machine!
|
||||||
|
|
||||||
@@ -64,12 +64,6 @@ Windows vs Unix
|
|||||||
Library
|
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
|
There are plenty of entry points to the library, namely each publicly defined
|
||||||
function that libcurl offers to applications. All of those functions are
|
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
|
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
|
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
|
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
|
Curl_Transfer() function (in lib/transfer.c) to setup the transfer and
|
||||||
returns. curl_transfer() then calls _Tranfer() in lib/transfer.c that
|
returns. Curl_perform() then calls Transfer() in lib/transfer.c that performs
|
||||||
performs the entire file transfer.
|
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
|
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
|
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
|
When completed, the curl_easy_cleanup() should be called to free up used
|
||||||
resources.
|
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(S)
|
||||||
|
|
||||||
HTTP offers a lot and is the protocol in curl that uses the most lines of
|
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
|
the source by the use of curl_read() for reading and curl_write() for writing
|
||||||
data to the remote server.
|
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
|
FTP
|
||||||
|
|
||||||
The Curl_if2ip() function can be used for getting the IP number of a
|
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,
|
URL encoding and decoding, called escaping and unescaping in the source code,
|
||||||
is found in lib/escape.c.
|
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
|
used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
|
||||||
more).
|
more).
|
||||||
|
|
||||||
@@ -182,6 +201,34 @@ Library
|
|||||||
exists in lib/getpass.c. libcurl offers a custom callback that can be used
|
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.
|
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
|
Library Symbols
|
||||||
===============
|
===============
|
||||||
|
|
||||||
@@ -236,12 +283,12 @@ Memory Debugging
|
|||||||
deal with resources that might give us problems if we "leak" them. The
|
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
|
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
|
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
|
memanalyze.pl is a perl script present only present in CVS (not part of the
|
||||||
archives) that analyzes a log file generated by the memdebug system. It
|
release archives) that analyzes a log file generated by the memdebug
|
||||||
detects if resources are allocated but never freed and other kinds of errors
|
system. It detects if resources are allocated but never freed and other kinds
|
||||||
related to resource management.
|
of errors related to resource management.
|
||||||
|
|
||||||
Use -DMALLOCDEBUG when compiling to enable memory debugging.
|
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
|
httpserver.pl and ftpserver.pl before all the test cases are performed. The
|
||||||
test suite currently only runs on unix-like platforms.
|
test suite currently only runs on unix-like platforms.
|
||||||
|
|
||||||
You'll find a complete description of the test case data files in the README
|
You'll find a complete description of the test case data files in the
|
||||||
file in the test directory.
|
tests/README file.
|
||||||
|
|
||||||
The test suite automatically detects if curl was built with the memory
|
The test suite automatically detects if curl was built with the memory
|
||||||
debugging enabled, and if it was it will detect memory leaks too.
|
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
|
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
|
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
|
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.
|
|
||||||
|
@@ -58,9 +58,16 @@ Portability
|
|||||||
you to init the winsock stuff before you use the libcurl functions. Details
|
you to init the winsock stuff before you use the libcurl functions. Details
|
||||||
on this are noted on the curl_easy_init() man page.
|
on this are noted on the curl_easy_init() man page.
|
||||||
|
|
||||||
(*) = it appears users of the cygwin environment gets this done
|
(*) = it appears as if users of the cygwin environment get this done
|
||||||
automatically.
|
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
|
Persistant Connections
|
||||||
|
|
||||||
With libcurl 7.7, persistant connections were added. Persistant connections
|
With libcurl 7.7, persistant connections were added. Persistant connections
|
||||||
|
45
docs/MANUAL
45
docs/MANUAL
@@ -25,12 +25,16 @@ SIMPLE USAGE
|
|||||||
|
|
||||||
Get a list of the root directory of an FTP site:
|
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:
|
Get the definition of curl from a dictionary:
|
||||||
|
|
||||||
curl dict://dict.org/m:curl
|
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
|
DOWNLOAD TO A FILE
|
||||||
|
|
||||||
Get a web page and store in a local 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
|
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
|
USING PASSWORDS
|
||||||
|
|
||||||
FTP
|
FTP
|
||||||
@@ -455,9 +463,13 @@ EXTRA HEADERS
|
|||||||
|
|
||||||
curl -H "X-you-and-me: yes" www.love.com
|
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
|
This can also be useful in case you want curl to send a different text in a
|
||||||
a header than it normally does. The -H header you specify then replaces the
|
header than it normally does. The -H header you specify then replaces the
|
||||||
header curl would normally send.
|
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
|
FTP and PATH NAMES
|
||||||
|
|
||||||
@@ -745,6 +757,25 @@ TELNET
|
|||||||
to track when the login prompt is received and send the username and
|
to track when the login prompt is received and send the username and
|
||||||
password accordingly.
|
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
|
MAILING LISTS
|
||||||
|
|
||||||
For your convenience, we have several open mailing lists to discuss curl,
|
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
|
To subscribe to the main curl list, mail curl-request@contactor.se with
|
||||||
"subscribe <fill in your email address>" in the body.
|
"subscribe <fill in your email address>" in the body.
|
||||||
|
|
||||||
To subscribe to the libcurl users list, follow the instructions at
|
To subscribe to the curl-library users/deverlopers list, follow the
|
||||||
http://curl.haxx.se/mail/
|
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/
|
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
|
To subscribe to the curl-and-PHP list in which curl using with PHP is
|
||||||
|
@@ -25,6 +25,10 @@ To do for the 7.8 release:
|
|||||||
|
|
||||||
To do in a future release:
|
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
|
* 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
|
ftp or http operations (for which we have test servers) and the https would
|
||||||
probably work against/with some of the openssl tools.
|
probably work against/with some of the openssl tools.
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man curl.1
|
.\" nroff -man curl.1
|
||||||
.\" Written by Daniel Stenberg
|
.\" 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
|
.SH NAME
|
||||||
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
|
||||||
HTTPS syntax.
|
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
|
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.
|
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
|
.SH OPTIONS
|
||||||
.IP "-a/--append"
|
.IP "-a/--append"
|
||||||
(FTP)
|
(FTP)
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
.\" nroff -man [file]
|
.\" nroff -man [file]
|
||||||
.\" Written by daniel@haxx.se
|
.\" Written by daniel@haxx.se
|
||||||
.\"
|
.\"
|
||||||
.TH curl_easy_setopt 3 "6 March 2001" "libcurl 7.5" "libcurl Manual"
|
.TH curl_easy_setopt 3 "13 March 2001" "libcurl 7.7" "libcurl Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
curl_easy_setopt - Set curl easy-session options
|
curl_easy_setopt - Set curl easy-session options
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -26,6 +26,13 @@ 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
|
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.
|
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
|
The
|
||||||
.I "handle"
|
.I "handle"
|
||||||
is the return code from the
|
is the return code from the
|
||||||
@@ -419,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
|
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
|
option only makes sense if the CURLOPT_FOLLOWLOCATION is used at the same
|
||||||
time. (Added in 7.5)
|
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
|
.PP
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
0 means the option was set properly, non-zero means an error as
|
0 means the option was set properly, non-zero means an error as
|
||||||
|
@@ -398,6 +398,33 @@ typedef enum {
|
|||||||
/* This points to a linked list of telnet options */
|
/* This points to a linked list of telnet options */
|
||||||
CINIT(TELNETOPTIONS, OBJECTPOINT, 70),
|
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 */
|
CURLOPT_LASTENTRY /* the last unusued */
|
||||||
} CURLoption;
|
} CURLoption;
|
||||||
|
|
||||||
@@ -444,7 +471,7 @@ char *curl_getenv(char *variable);
|
|||||||
char *curl_version(void);
|
char *curl_version(void);
|
||||||
|
|
||||||
/* This is the version number */
|
/* This is the version number */
|
||||||
#define LIBCURL_VERSION "7.7-beta1"
|
#define LIBCURL_VERSION "7.7-beta2"
|
||||||
#define LIBCURL_VERSION_NUM 0x070700
|
#define LIBCURL_VERSION_NUM 0x070700
|
||||||
|
|
||||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||||
@@ -502,21 +529,6 @@ typedef enum {
|
|||||||
before it can be included! */
|
before it can be included! */
|
||||||
#include <curl/easy.h> /* nothing in curl is fun without the easy stuff */
|
#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 {
|
typedef enum {
|
||||||
CURLCLOSEPOLICY_NONE, /* first, never use this */
|
CURLCLOSEPOLICY_NONE, /* first, never use this */
|
||||||
|
|
||||||
|
19
lib/easy.c
19
lib/easy.c
@@ -83,15 +83,11 @@ CURL *curl_easy_init(void)
|
|||||||
CURLcode res;
|
CURLcode res;
|
||||||
struct UrlData *data;
|
struct UrlData *data;
|
||||||
|
|
||||||
if(curl_init())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* We use curl_open() with undefined URL so far */
|
/* 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)
|
if(res != CURLE_OK)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data->interf = CURLI_EASY; /* mark it as an easy one */
|
|
||||||
/* SAC */
|
/* SAC */
|
||||||
data->device = NULL;
|
data->device = NULL;
|
||||||
|
|
||||||
@@ -119,16 +115,16 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
|
|||||||
if(tag < CURLOPTTYPE_OBJECTPOINT) {
|
if(tag < CURLOPTTYPE_OBJECTPOINT) {
|
||||||
/* This is a LONG type */
|
/* This is a LONG type */
|
||||||
param_long = va_arg(arg, long);
|
param_long = va_arg(arg, long);
|
||||||
curl_setopt(data, tag, param_long);
|
Curl_setopt(data, tag, param_long);
|
||||||
}
|
}
|
||||||
else if(tag < CURLOPTTYPE_FUNCTIONPOINT) {
|
else if(tag < CURLOPTTYPE_FUNCTIONPOINT) {
|
||||||
/* This is a object pointer type */
|
/* This is a object pointer type */
|
||||||
param_obj = va_arg(arg, void *);
|
param_obj = va_arg(arg, void *);
|
||||||
curl_setopt(data, tag, param_obj);
|
Curl_setopt(data, tag, param_obj);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
param_func = va_arg(arg, func_T );
|
param_func = va_arg(arg, func_T );
|
||||||
curl_setopt(data, tag, param_func);
|
Curl_setopt(data, tag, param_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
va_end(arg);
|
va_end(arg);
|
||||||
@@ -137,13 +133,12 @@ CURLcode curl_easy_setopt(CURL *curl, CURLoption tag, ...)
|
|||||||
|
|
||||||
CURLcode curl_easy_perform(CURL *curl)
|
CURLcode curl_easy_perform(CURL *curl)
|
||||||
{
|
{
|
||||||
return curl_transfer(curl);
|
return Curl_perform(curl);
|
||||||
}
|
}
|
||||||
|
|
||||||
void curl_easy_cleanup(CURL *curl)
|
void curl_easy_cleanup(CURL *curl)
|
||||||
{
|
{
|
||||||
curl_close(curl);
|
Curl_close(curl);
|
||||||
curl_free();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
||||||
@@ -153,5 +148,5 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
|||||||
va_start(arg, info);
|
va_start(arg, info);
|
||||||
paramp = va_arg(arg, void *);
|
paramp = va_arg(arg, void *);
|
||||||
|
|
||||||
return curl_getinfo(curl, info, paramp);
|
return Curl_getinfo(curl, info, paramp);
|
||||||
}
|
}
|
||||||
|
@@ -78,7 +78,7 @@ char *curl_unescape(char *string, int length)
|
|||||||
char *ns = malloc(alloc);
|
char *ns = malloc(alloc);
|
||||||
unsigned char in;
|
unsigned char in;
|
||||||
int index=0;
|
int index=0;
|
||||||
int hex;
|
unsigned int hex;
|
||||||
char querypart=FALSE; /* everything to the right of a '?' letter is
|
char querypart=FALSE; /* everything to the right of a '?' letter is
|
||||||
the "query part" where '+' should become ' '.
|
the "query part" where '+' should become ' '.
|
||||||
RFC 2316, section 3.10 */
|
RFC 2316, section 3.10 */
|
||||||
|
@@ -119,8 +119,8 @@ static CURLcode AllowServerConnect(struct UrlData *data,
|
|||||||
size_t size = sizeof(struct sockaddr_in);
|
size_t size = sizeof(struct sockaddr_in);
|
||||||
struct sockaddr_in add;
|
struct sockaddr_in add;
|
||||||
|
|
||||||
getsockname(sock, (struct sockaddr *) &add, (int *)&size);
|
getsockname(sock, (struct sockaddr *) &add, (socklen_t *)&size);
|
||||||
s=accept(sock, (struct sockaddr *) &add, (int *)&size);
|
s=accept(sock, (struct sockaddr *) &add, (socklen_t *)&size);
|
||||||
|
|
||||||
sclose(sock); /* close the first socket */
|
sclose(sock); /* close the first socket */
|
||||||
|
|
||||||
@@ -932,7 +932,7 @@ again:;
|
|||||||
size = sizeof(add);
|
size = sizeof(add);
|
||||||
|
|
||||||
if(getsockname(portsock, (struct sockaddr *) &add,
|
if(getsockname(portsock, (struct sockaddr *) &add,
|
||||||
(int *)&size)<0) {
|
(socklen_t *)&size)<0) {
|
||||||
failf(data, "getsockname() failed");
|
failf(data, "getsockname() failed");
|
||||||
return CURLE_FTP_PORT_FAILED;
|
return CURLE_FTP_PORT_FAILED;
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
|
CURLcode Curl_getinfo(CURL *curl, CURLINFO info, ...)
|
||||||
{
|
{
|
||||||
va_list arg;
|
va_list arg;
|
||||||
long *param_longp;
|
long *param_longp;
|
||||||
|
12
lib/http.c
12
lib/http.c
@@ -469,10 +469,14 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
|
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!checkheaders(data, "Host:") &&
|
if(!checkheaders(data, "Host:")) {
|
||||||
!conn->allocptr.host) {
|
/* if ptr_host is already set, it is almost OK since we only re-use
|
||||||
/* if ptr_host is already set, it is OK since we only re-use connections
|
connections to the very same host and port, but when we use a HTTP
|
||||||
to the very same host and port */
|
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)) ||
|
if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) ||
|
||||||
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )
|
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )
|
||||||
|
@@ -115,10 +115,15 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||||||
ch->hexindex++;
|
ch->hexindex++;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return 1; /* longer hex than we support */
|
return CHUNKE_TOO_LONG_HEX; /* longer hex than we support */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
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 */
|
/* length and datap are unmodified */
|
||||||
ch->hexbuffer[ch->hexindex]=0;
|
ch->hexbuffer[ch->hexindex]=0;
|
||||||
ch->datasize=strtoul(ch->hexbuffer, NULL, 16);
|
ch->datasize=strtoul(ch->hexbuffer, NULL, 16);
|
||||||
@@ -127,7 +132,9 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CHUNK_POSTHEX:
|
case CHUNK_POSTHEX:
|
||||||
/* just a lame state waiting for CRLF to arrive */
|
/* 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')
|
if(*datap == '\r')
|
||||||
ch->state = CHUNK_CR;
|
ch->state = CHUNK_CR;
|
||||||
length--;
|
length--;
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*
|
/*
|
||||||
* The longest possible hexadecimal number we support in a chunked transfer.
|
* The longest possible hexadecimal number we support in a chunked transfer.
|
||||||
* Weird enoug, RFC2616 doesn't set a maximum size! Since we use strtoul()
|
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
|
||||||
* to convert it, we "only" support 2^32 bytes chunk data.
|
* to convert it, we "only" support 2^32 bytes chunk data.
|
||||||
*/
|
*/
|
||||||
#define MAXNUM_SIZE 16
|
#define MAXNUM_SIZE 16
|
||||||
@@ -62,6 +62,7 @@ typedef enum {
|
|||||||
CHUNKE_STOP = -1,
|
CHUNKE_STOP = -1,
|
||||||
CHUNKE_OK = 0,
|
CHUNKE_OK = 0,
|
||||||
CHUNKE_TOO_LONG_HEX = 1,
|
CHUNKE_TOO_LONG_HEX = 1,
|
||||||
|
CHUNKE_ILLEGAL_HEX,
|
||||||
CHUNKE_WRITE_ERROR,
|
CHUNKE_WRITE_ERROR,
|
||||||
CHUNKE_STATE_ERROR,
|
CHUNKE_STATE_ERROR,
|
||||||
CHUNKE_LAST
|
CHUNKE_LAST
|
||||||
|
@@ -120,7 +120,7 @@ int curl_socket(int domain, int type, int protocol, int line, char *source)
|
|||||||
return sockfd;
|
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 line, char *source)
|
||||||
{
|
{
|
||||||
int sockfd=(accept)(s, addr, addrlen);
|
int sockfd=(accept)(s, addr, addrlen);
|
||||||
|
@@ -13,7 +13,7 @@ void curl_memdebug(char *logname);
|
|||||||
/* file descriptor manipulators */
|
/* file descriptor manipulators */
|
||||||
int curl_socket(int domain, int type, int protocol, int, char *);
|
int curl_socket(int domain, int type, int protocol, int, char *);
|
||||||
int curl_sclose(int sockfd, 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);
|
int line, char *source);
|
||||||
|
|
||||||
/* FILE functions */
|
/* FILE functions */
|
||||||
|
39
lib/sendf.c
39
lib/sendf.c
@@ -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, ...)
|
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) */
|
returned for the user (if requested) */
|
||||||
|
|
||||||
void Curl_failf(struct UrlData *data, char *fmt, ...)
|
void Curl_failf(struct UrlData *data, char *fmt, ...)
|
||||||
@@ -142,7 +142,7 @@ void Curl_failf(struct UrlData *data, char *fmt, ...)
|
|||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
if(data->errorbuffer)
|
if(data->errorbuffer)
|
||||||
vsnprintf(data->errorbuffer, CURL_ERROR_SIZE, fmt, ap);
|
vsnprintf(data->errorbuffer, CURL_ERROR_SIZE, fmt, ap);
|
||||||
else {
|
else if(!data->bits.mute) {
|
||||||
/* no errorbuffer receives this, write to data->err instead */
|
/* no errorbuffer receives this, write to data->err instead */
|
||||||
vfprintf(data->err, fmt, ap);
|
vfprintf(data->err, fmt, ap);
|
||||||
fprintf(data->err, "\n");
|
fprintf(data->err, "\n");
|
||||||
@@ -213,23 +213,6 @@ CURLcode Curl_write(struct connectdata *conn, int sockfd,
|
|||||||
return CURLE_OK;
|
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)
|
/* client_write() sends data to the write callback(s)
|
||||||
|
|
||||||
The bit pattern defines to what "streams" to write to. Body and/or header.
|
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;
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
#include "setup.h"
|
#include "setup.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#endif
|
#endif
|
||||||
|
53
lib/ssluse.c
53
lib/ssluse.c
@@ -80,34 +80,39 @@ int random_the_seed(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
char *buf = conn->data->buffer; /* point to the big buffer */
|
char *buf = conn->data->buffer; /* point to the big buffer */
|
||||||
int nread=0;
|
int nread=0;
|
||||||
|
struct UrlData *data=conn->data;
|
||||||
|
|
||||||
/* Q: should we add support for a random file name as a libcurl option?
|
/* Q: should we add support for a random file name as a libcurl option?
|
||||||
A: Yes */
|
A: Yes, it is here */
|
||||||
#if 0
|
|
||||||
/* something like this */
|
#ifndef RANDOM_FILE
|
||||||
nread += RAND_load_file(filename, number_of_bytes);
|
/* 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
|
#endif
|
||||||
/* generates a default path for the random seed file */
|
{
|
||||||
buf[0]=0; /* blank it first */
|
/* let the option override the define */
|
||||||
RAND_file_name(buf, BUFSIZE);
|
nread += RAND_load_file((data->ssl.random_file?
|
||||||
if ( buf[0] ) {
|
data->ssl.random_file:RANDOM_FILE),
|
||||||
/* we got a file name to try */
|
16384);
|
||||||
nread += RAND_load_file(buf, 16384);
|
|
||||||
if(seed_enough(conn, nread))
|
if(seed_enough(conn, nread))
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef RANDOM_FILE
|
#if defined(HAVE_RAND_EGD)
|
||||||
nread += RAND_load_file(RANDOM_FILE, 16384);
|
|
||||||
if(seed_enough(conn, nread))
|
|
||||||
return nread;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_RAND_EGD) && defined(EGD_SOCKET)
|
|
||||||
/* only available in OpenSSL 0.9.5 and later */
|
/* only available in OpenSSL 0.9.5 and later */
|
||||||
/* EGD_SOCKET is set at configure time */
|
/* 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
|
||||||
{
|
{
|
||||||
int ret = RAND_egd(EGD_SOCKET);
|
/* 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) {
|
if(-1 != ret) {
|
||||||
nread += ret;
|
nread += ret;
|
||||||
if(seed_enough(conn, nread))
|
if(seed_enough(conn, nread))
|
||||||
@@ -136,6 +141,16 @@ int random_the_seed(struct connectdata *conn)
|
|||||||
#endif
|
#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");
|
infof(conn->data, "Your connection is using a weak random seed!\n");
|
||||||
return nread;
|
return nread;
|
||||||
}
|
}
|
||||||
|
@@ -53,7 +53,7 @@ gettimeofday (struct timeval *tp, void *nothing)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct timeval Curl_tvnow ()
|
struct timeval Curl_tvnow (void)
|
||||||
{
|
{
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
#ifdef HAVE_GETTIMEOFDAY
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
|
@@ -107,7 +107,7 @@
|
|||||||
<butlerm@xmission.com>. */
|
<butlerm@xmission.com>. */
|
||||||
|
|
||||||
CURLcode static
|
CURLcode static
|
||||||
_Transfer(struct connectdata *c_conn)
|
Transfer(struct connectdata *c_conn)
|
||||||
{
|
{
|
||||||
ssize_t nread; /* number of bytes read */
|
ssize_t nread; /* number of bytes read */
|
||||||
int bytecount = 0; /* total number of bytes read */
|
int bytecount = 0; /* total number of bytes read */
|
||||||
@@ -142,9 +142,6 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
char *buf;
|
char *buf;
|
||||||
int maxfd;
|
int maxfd;
|
||||||
|
|
||||||
if(!conn || (conn->handle != STRUCT_CONNECT))
|
|
||||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
|
||||||
|
|
||||||
data = conn->data; /* there's the root struct */
|
data = conn->data; /* there's the root struct */
|
||||||
buf = data->buffer;
|
buf = data->buffer;
|
||||||
maxfd = (conn->sockfd>conn->writesockfd?conn->sockfd:conn->writesockfd)+1;
|
maxfd = (conn->sockfd>conn->writesockfd?conn->sockfd:conn->writesockfd)+1;
|
||||||
@@ -370,6 +367,12 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
return CURLE_HTTP_NOT_FOUND;
|
return CURLE_HTTP_NOT_FOUND;
|
||||||
}
|
}
|
||||||
data->progress.httpcode = code;
|
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 {
|
else {
|
||||||
header = FALSE; /* this is not a header line */
|
header = FALSE; /* this is not a header line */
|
||||||
@@ -382,6 +385,19 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
conn->size = contentlength;
|
conn->size = contentlength;
|
||||||
Curl_pgrsSetDownloadSize(data, 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,
|
else if (strnequal("Connection: close", p,
|
||||||
strlen("Connection: close"))) {
|
strlen("Connection: close"))) {
|
||||||
/*
|
/*
|
||||||
@@ -446,7 +462,7 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
ptr++;
|
ptr++;
|
||||||
backup = *ptr; /* store the ending letter */
|
backup = *ptr; /* store the ending letter */
|
||||||
*ptr = '\0'; /* zero terminate */
|
*ptr = '\0'; /* zero terminate */
|
||||||
data->newurl = strdup(start); /* clone string */
|
conn->newurl = strdup(start); /* clone string */
|
||||||
*ptr = backup; /* restore ending letter */
|
*ptr = backup; /* restore ending letter */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -490,9 +506,9 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
write a piece of the body */
|
write a piece of the body */
|
||||||
if(conn->protocol&PROT_HTTP) {
|
if(conn->protocol&PROT_HTTP) {
|
||||||
/* HTTP-only checks */
|
/* HTTP-only checks */
|
||||||
if (data->newurl) {
|
if (conn->newurl) {
|
||||||
/* abort after the headers if "follow Location" is set */
|
/* 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;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
else if (data->resume_from &&
|
else if (data->resume_from &&
|
||||||
@@ -530,7 +546,8 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
} /* two valid time strings */
|
} /* two valid time strings */
|
||||||
} /* we have a time condition */
|
} /* 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
|
/* If this is not the last request before a close, we must
|
||||||
set the maximum download size to the size of the expected
|
set the maximum download size to the size of the expected
|
||||||
document or else, we won't know when to stop reading! */
|
document or else, we won't know when to stop reading! */
|
||||||
@@ -560,9 +577,9 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
/* we're done reading chunks! */
|
/* we're done reading chunks! */
|
||||||
keepon &= ~KEEP_READ; /* read no more */
|
keepon &= ~KEEP_READ; /* read no more */
|
||||||
|
|
||||||
/* There are now possibly bytes at the end of the str buffer
|
/* There are now possibly N number of bytes at the end of the
|
||||||
that weren't written to the client, but we don't care
|
str buffer that weren't written to the client, but we don't
|
||||||
about them right now. */
|
care about them right now. */
|
||||||
}
|
}
|
||||||
/* If it returned OK, we just keep going */
|
/* If it returned OK, we just keep going */
|
||||||
}
|
}
|
||||||
@@ -681,27 +698,27 @@ _Transfer(struct connectdata *c_conn)
|
|||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
CURLcode curl_transfer(CURL *curl)
|
CURLcode Curl_perform(CURL *curl)
|
||||||
{
|
{
|
||||||
CURLcode res;
|
CURLcode res;
|
||||||
struct UrlData *data = curl;
|
struct UrlData *data = (struct UrlData *)curl;
|
||||||
struct connectdata *c_connect=NULL;
|
struct connectdata *conn=NULL;
|
||||||
bool port=TRUE; /* allow data->use_port to set port to use */
|
bool port=TRUE; /* allow data->use_port to set port to use */
|
||||||
|
|
||||||
Curl_pgrsStartNow(data);
|
Curl_pgrsStartNow(data);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Curl_pgrsTime(data, TIMER_STARTSINGLE);
|
Curl_pgrsTime(data, TIMER_STARTSINGLE);
|
||||||
res = curl_connect(curl, (CURLconnect **)&c_connect, port);
|
res = Curl_connect(data, &conn, port);
|
||||||
if(res == CURLE_OK) {
|
if(res == CURLE_OK) {
|
||||||
res = curl_do(c_connect);
|
res = Curl_do(conn);
|
||||||
if(res == CURLE_OK) {
|
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)
|
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
|
/* Location: redirect
|
||||||
|
|
||||||
This is assumed to happen for HTTP(S) only!
|
This is assumed to happen for HTTP(S) only!
|
||||||
@@ -741,7 +758,7 @@ CURLcode curl_transfer(CURL *curl)
|
|||||||
data->bits.http_set_referer = TRUE; /* might have been false */
|
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
|
*DANG* this is an RFC 2068 violation. The URL is supposed
|
||||||
to be absolute and this doesn't seem to be that!
|
to be absolute and this doesn't seem to be that!
|
||||||
@@ -766,7 +783,7 @@ CURLcode curl_transfer(CURL *curl)
|
|||||||
protsep+=2; /* pass the slashes */
|
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,
|
/* First we need to find out if there's a ?-letter in the URL,
|
||||||
and cut it and the right-side of that off */
|
and cut it and the right-side of that off */
|
||||||
pathsep = strrchr(protsep, '?');
|
pathsep = strrchr(protsep, '?');
|
||||||
@@ -789,14 +806,14 @@ CURLcode curl_transfer(CURL *curl)
|
|||||||
|
|
||||||
newest=(char *)malloc( strlen(data->url) +
|
newest=(char *)malloc( strlen(data->url) +
|
||||||
1 + /* possible slash */
|
1 + /* possible slash */
|
||||||
strlen(data->newurl) + 1/* zero byte */);
|
strlen(conn->newurl) + 1/* zero byte */);
|
||||||
|
|
||||||
if(!newest)
|
if(!newest)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
sprintf(newest, "%s%s%s", data->url, ('/' == data->newurl[0])?"":"/",
|
sprintf(newest, "%s%s%s", data->url, ('/' == conn->newurl[0])?"":"/",
|
||||||
data->newurl);
|
conn->newurl);
|
||||||
free(data->newurl);
|
free(conn->newurl);
|
||||||
data->newurl = newest;
|
conn->newurl = newest;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* This is an absolute URL, don't use the custom port number */
|
/* This is an absolute URL, don't use the custom port number */
|
||||||
@@ -807,8 +824,8 @@ CURLcode curl_transfer(CURL *curl)
|
|||||||
free(data->url);
|
free(data->url);
|
||||||
|
|
||||||
/* TBD: set the URL with curl_setopt() */
|
/* TBD: set the URL with curl_setopt() */
|
||||||
data->url = data->newurl;
|
data->url = conn->newurl;
|
||||||
data->newurl = NULL; /* don't show! */
|
conn->newurl = NULL; /* don't show! */
|
||||||
data->bits.urlstringalloc = TRUE; /* the URL is allocated */
|
data->bits.urlstringalloc = TRUE; /* the URL is allocated */
|
||||||
|
|
||||||
infof(data, "Follows Location: to new URL: '%s'\n", data->url);
|
infof(data, "Follows Location: to new URL: '%s'\n", data->url);
|
||||||
@@ -867,8 +884,10 @@ CURLcode curl_transfer(CURL *curl)
|
|||||||
|
|
||||||
} while(1); /* loop if Location: */
|
} while(1); /* loop if Location: */
|
||||||
|
|
||||||
if(data->newurl)
|
if(conn->newurl) {
|
||||||
free(data->newurl);
|
free(conn->newurl);
|
||||||
|
conn->newurl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@@ -22,8 +22,9 @@
|
|||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
CURLcode curl_transfer(CURL *curl);
|
CURLcode Curl_perform(CURL *curl);
|
||||||
|
|
||||||
|
/* This sets up a forthcoming transfer */
|
||||||
CURLcode
|
CURLcode
|
||||||
Curl_Transfer (struct connectdata *data,
|
Curl_Transfer (struct connectdata *data,
|
||||||
int sockfd, /* socket to read from or -1 */
|
int sockfd, /* socket to read from or -1 */
|
||||||
|
251
lib/urldata.h
251
lib/urldata.h
@@ -98,27 +98,6 @@
|
|||||||
#define MAX(x,y) ((x)>(y)?(x):(y))
|
#define MAX(x,y) ((x)>(y)?(x):(y))
|
||||||
#endif
|
#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
|
#ifdef KRB4
|
||||||
/* Types needed for krb4-ftp connections */
|
/* Types needed for krb4-ftp connections */
|
||||||
struct krb4buffer {
|
struct krb4buffer {
|
||||||
@@ -152,6 +131,8 @@ struct ssl_config_data {
|
|||||||
long verifypeer; /* set TRUE if this is desired */
|
long verifypeer; /* set TRUE if this is desired */
|
||||||
char *CApath; /* DOES NOT WORK ON WINDOWS */
|
char *CApath; /* DOES NOT WORK ON WINDOWS */
|
||||||
char *CAfile; /* cerficate to verify peer against */
|
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 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -201,6 +182,7 @@ struct ConnectBits {
|
|||||||
bool close; /* if set, we close the connection after this request */
|
bool close; /* if set, we close the connection after this request */
|
||||||
bool reuse; /* if set, this is a re-used connection */
|
bool reuse; /* if set, this is a re-used connection */
|
||||||
bool chunk; /* if set, this is a chunked transfer-encoding */
|
bool chunk; /* if set, this is a chunked transfer-encoding */
|
||||||
|
bool httpproxy; /* if set, this transfer is done through a http proxy */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -209,18 +191,10 @@ struct ConnectBits {
|
|||||||
*/
|
*/
|
||||||
struct connectdata {
|
struct connectdata {
|
||||||
/**** Fields set when inited and not modified again */
|
/**** 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 */
|
struct UrlData *data; /* link to the root CURL struct */
|
||||||
|
|
||||||
int connectindex; /* what index in the connects index this particular
|
int connectindex; /* what index in the connects index this particular
|
||||||
struct has */
|
struct has */
|
||||||
|
|
||||||
/**** curl_connect() phase fields */
|
|
||||||
ConnState state; /* for state dependent actions */
|
|
||||||
|
|
||||||
long protocol; /* PROT_* flags concerning the protocol set */
|
long protocol; /* PROT_* flags concerning the protocol set */
|
||||||
#define PROT_MISSING (1<<0)
|
#define PROT_MISSING (1<<0)
|
||||||
#define PROT_GOPHER (1<<1)
|
#define PROT_GOPHER (1<<1)
|
||||||
@@ -250,7 +224,11 @@ struct connectdata {
|
|||||||
not the proxy port! */
|
not the proxy port! */
|
||||||
char *ppath;
|
char *ppath;
|
||||||
long bytecount;
|
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 firstsocket; /* the main socket to use */
|
||||||
int secondarysocket; /* for i.e ftp transfers */
|
int secondarysocket; /* for i.e ftp transfers */
|
||||||
|
|
||||||
@@ -309,6 +287,9 @@ struct connectdata {
|
|||||||
char *host; /* free later if not NULL */
|
char *host; /* free later if not NULL */
|
||||||
} allocptr;
|
} allocptr;
|
||||||
|
|
||||||
|
char *newurl; /* This can only be set if a Location: was in the
|
||||||
|
document headers */
|
||||||
|
|
||||||
#ifdef KRB4
|
#ifdef KRB4
|
||||||
|
|
||||||
enum protection_level command_prot;
|
enum protection_level command_prot;
|
||||||
@@ -366,6 +347,7 @@ struct Progress {
|
|||||||
double t_connect;
|
double t_connect;
|
||||||
double t_pretransfer;
|
double t_pretransfer;
|
||||||
int httpcode;
|
int httpcode;
|
||||||
|
int httpversion;
|
||||||
time_t filetime; /* If requested, this is might get set. It may be 0 if
|
time_t filetime; /* If requested, this is might get set. It may be 0 if
|
||||||
the time was unretrievable */
|
the time was unretrievable */
|
||||||
|
|
||||||
@@ -421,16 +403,12 @@ struct Configbits {
|
|||||||
bool proxystringalloc; /* the http proxy string is malloc()'ed */
|
bool proxystringalloc; /* the http proxy string is malloc()'ed */
|
||||||
bool rangestringalloc; /* the range string is malloc()'ed */
|
bool rangestringalloc; /* the range string is malloc()'ed */
|
||||||
bool urlstringalloc; /* the URL 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
|
* As of April 11, 2000 we're now trying to split up the urldata struct in
|
||||||
* three different parts:
|
* three different parts:
|
||||||
@@ -457,9 +435,6 @@ typedef enum {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
struct UrlData {
|
struct UrlData {
|
||||||
Handle handle; /* struct identifier */
|
|
||||||
CurlInterface interf; /* created by WHAT interface? */
|
|
||||||
|
|
||||||
/*************** Global - specific items ************/
|
/*************** Global - specific items ************/
|
||||||
FILE *err; /* the stderr writes goes here */
|
FILE *err; /* the stderr writes goes here */
|
||||||
char *errorbuffer; /* store failure messages in here */
|
char *errorbuffer; /* store failure messages in here */
|
||||||
@@ -535,9 +510,6 @@ struct UrlData {
|
|||||||
|
|
||||||
char *cookie; /* HTTP cookie string to send */
|
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 curl_slist *headers; /* linked list of extra headers */
|
||||||
struct HttpPost *httppost; /* linked list of POST data */
|
struct HttpPost *httppost; /* linked list of POST data */
|
||||||
|
|
||||||
@@ -597,191 +569,26 @@ struct UrlData {
|
|||||||
#define LIBCURL_NAME "libcurl"
|
#define LIBCURL_NAME "libcurl"
|
||||||
#define LIBCURL_ID LIBCURL_NAME " " LIBCURL_VERSION " " SSL_ID
|
#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
|
* 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
|
* the "low level" interface. It is no longer prioritized and it is not likely
|
||||||
* to ever be supported to external users.
|
* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
CURLcode Curl_open(CURL **curl, char *url);
|
||||||
* NAME curl_init()
|
CURLcode Curl_setopt(CURL *handle, CURLoption option, ...);
|
||||||
*
|
CURLcode Curl_close(CURL *curl); /* the opposite of curl_open() */
|
||||||
* DESCRIPTION
|
CURLcode Curl_connect(struct UrlData *,
|
||||||
*
|
struct connectdata **,
|
||||||
* 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,
|
|
||||||
bool allow_port);
|
bool allow_port);
|
||||||
|
CURLcode Curl_do(struct connectdata *);
|
||||||
/*
|
CURLcode Curl_done(struct connectdata *);
|
||||||
* NAME curl_do()
|
CURLcode Curl_disconnect(struct connectdata *);
|
||||||
*
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
100
src/main.c
100
src/main.c
@@ -242,61 +242,62 @@ static void help(void)
|
|||||||
" -a/--append Append to target file when uploading (F)\n"
|
" -a/--append Append to target file when uploading (F)\n"
|
||||||
" -A/--user-agent <string> User-Agent to send to server (H)\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/--cookie <name=string/file> Cookie string or file to read cookies from (H)\n"
|
||||||
" -B/--use-ascii Use ASCII/text transfer\n"
|
" -B/--use-ascii Use ASCII/text transfer\n",
|
||||||
" -C/--continue-at <offset> Specify absolute resume offset\n"
|
curl_version());
|
||||||
|
puts(" -C/--continue-at <offset> Specify absolute resume offset\n"
|
||||||
" -d/--data <data> HTTP POST data (H)\n"
|
" -d/--data <data> HTTP POST data (H)\n"
|
||||||
" --data-ascii <data> HTTP POST ASCII data (H)\n"
|
" --data-ascii <data> HTTP POST ASCII data (H)\n"
|
||||||
" --data-binary <data> HTTP POST binary data (H)\n"
|
" --data-binary <data> HTTP POST binary data (H)\n"
|
||||||
" -D/--dump-header <file> Write the headers to this file\n"
|
" -D/--dump-header <file> Write the headers to this file\n"
|
||||||
" -e/--referer Referer page (H)\n"
|
" -e/--referer Referer page (H)");
|
||||||
" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n"
|
puts(" -E/--cert <cert[:passwd]> Specifies your certificate file and password (HTTPS)\n"
|
||||||
" --cacert <file> CA certifciate to verify peer against (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/--fail Fail silently (no output at all) on errors (H)\n"
|
||||||
" -F/--form <name=content> Specify HTTP POST data (H)\n"
|
" -F/--form <name=content> Specify HTTP POST data (H)\n"
|
||||||
" -g/--globoff Disable URL sequences and ranges using {} and []\n"
|
" -g/--globoff Disable URL sequences and ranges using {} and []\n"
|
||||||
" -h/--help This help text\n"
|
" -h/--help This help text\n"
|
||||||
" -H/--header <line> Custom header to pass to server. (H)\n"
|
" -H/--header <line> Custom header to pass to server. (H)");
|
||||||
" -i/--include Include the HTTP-header in the output (H)\n"
|
puts(" -i/--include Include the HTTP-header in the output (H)\n"
|
||||||
" -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n"
|
" -I/--head Fetch document info only (HTTP HEAD/FTP SIZE)\n"
|
||||||
" --interface <interface> Specify the interface to be used\n"
|
" --interface <interface> Specify the interface to be used\n"
|
||||||
" --krb4 <level> Enable krb4 with specified security level (F)\n"
|
" --krb4 <level> Enable krb4 with specified security level (F)\n"
|
||||||
" -K/--config Specify which config file to read\n"
|
" -K/--config Specify which config file to read\n"
|
||||||
" -l/--list-only List only names of an FTP directory (F)\n"
|
" -l/--list-only List only names of an FTP directory (F)");
|
||||||
" -L/--location Follow Location: hints (H)\n"
|
puts(" -L/--location Follow Location: hints (H)\n"
|
||||||
" -m/--max-time <seconds> Maximum time allowed for the transfer\n"
|
" -m/--max-time <seconds> Maximum time allowed for the transfer\n"
|
||||||
" -M/--manual Display huge help text\n"
|
" -M/--manual Display huge help text\n"
|
||||||
" -n/--netrc Read .netrc for user name and password\n"
|
" -n/--netrc Read .netrc for user name and password\n"
|
||||||
" -N/--no-buffer Disables the buffering of the output stream\n"
|
" -N/--no-buffer Disables the buffering of the output stream");
|
||||||
" -o/--output <file> Write output to <file> instead of stdout\n"
|
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"
|
" -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/--proxytunnel Perform non-HTTP services through a HTTP proxy\n"
|
||||||
" -P/--ftpport <address> Use PORT with address instead of PASV when ftping (F)\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 When used as the first parameter disables .curlrc\n"
|
||||||
" -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)\n"
|
" -Q/--quote <cmd> Send QUOTE command to FTP before file transfer (F)");
|
||||||
" -r/--range <range> Retrieve a byte range from a HTTP/1.1 or FTP server\n"
|
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/--silent Silent mode. Don't output anything\n"
|
||||||
" -S/--show-error Show error. With -s, make curl show errors when they occur\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/--telnet-option <OPT=val> Set telnet option\n"
|
||||||
" -T/--upload-file <file> Transfer/upload <file> to remote site\n"
|
" -T/--upload-file <file> Transfer/upload <file> to remote site\n"
|
||||||
" --url <URL> Another way to specify URL to work with\n"
|
" --url <URL> Another way to specify URL to work with");
|
||||||
" -u/--user <user[:password]> Specify user and password to use\n"
|
puts(" -u/--user <user[:password]> Specify user and password to use\n"
|
||||||
" -U/--proxy-user <user[:password]> Specify Proxy authentication\n"
|
" -U/--proxy-user <user[:password]> Specify Proxy authentication\n"
|
||||||
" -v/--verbose Makes the operation more talkative\n"
|
" -v/--verbose Makes the operation more talkative\n"
|
||||||
" -V/--version Outputs version number then quits\n"
|
" -V/--version Outputs version number then quits\n"
|
||||||
" -w/--write-out [format] What to output after completion\n"
|
" -w/--write-out [format] What to output after completion\n"
|
||||||
" -x/--proxy <host[:port]> Use proxy. (Default port is 1080)\n"
|
" -x/--proxy <host[:port]> Use proxy. (Default port is 1080)\n"
|
||||||
" -X/--request <command> Specific request command to use\n"
|
" -X/--request <command> Specific request command to use");
|
||||||
" -y/--speed-time Time needed to trig speed-limit abort. Defaults to 30\n"
|
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"
|
" -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/--time-cond <time> Includes a time condition to the server (H)\n"
|
||||||
" -Z/--max-redirs <num> Set maximum number of redirections allowed (H)\n"
|
" -Z/--max-redirs <num> Set maximum number of redirections allowed (H)\n"
|
||||||
" -2/--sslv2 Force usage of SSLv2 (H)\n"
|
" -2/--sslv2 Force usage of SSLv2 (H)\n"
|
||||||
" -3/--sslv3 Force usage of SSLv3 (H)\n"
|
" -3/--sslv3 Force usage of SSLv3 (H)");
|
||||||
" -#/--progress-bar Display transfer progress as a progress bar\n"
|
puts(" -#/--progress-bar Display transfer progress as a progress bar\n"
|
||||||
" --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)\n"
|
" --crlf Convert LF to CRLF in upload. Useful for MVS (OS/390)\n"
|
||||||
" --stderr <file> Where to redirect stderr. - means stdout.\n",
|
" --stderr <file> Where to redirect stderr. - means stdout.\n"
|
||||||
curl_version()
|
" --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 {
|
struct LongShort {
|
||||||
@@ -306,6 +307,8 @@ struct LongShort {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Configurable {
|
struct Configurable {
|
||||||
|
char *random_file;
|
||||||
|
char *egd_file;
|
||||||
char *useragent;
|
char *useragent;
|
||||||
char *cookie;
|
char *cookie;
|
||||||
bool use_resume;
|
bool use_resume;
|
||||||
@@ -525,6 +528,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
{"7", "interface", TRUE},
|
{"7", "interface", TRUE},
|
||||||
{"6", "krb4", TRUE},
|
{"6", "krb4", TRUE},
|
||||||
{"5", "url", TRUE},
|
{"5", "url", TRUE},
|
||||||
|
{"5a", "random-file", TRUE},
|
||||||
|
{"5b", "egd-file", TRUE},
|
||||||
|
|
||||||
{"2", "sslv2", FALSE},
|
{"2", "sslv2", FALSE},
|
||||||
{"3", "sslv3", FALSE},
|
{"3", "sslv3", FALSE},
|
||||||
@@ -674,7 +679,14 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
|||||||
GetStr(&config->krb4level, nextarg);
|
GetStr(&config->krb4level, nextarg);
|
||||||
break;
|
break;
|
||||||
case '5':
|
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;
|
struct getout *url;
|
||||||
if(config->url_get || (config->url_get=config->url_list)) {
|
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;
|
url->flags |= GETOUT_URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case '#': /* added 19990617 larsa */
|
case '#': /* added 19990617 larsa */
|
||||||
config->progressmode ^= CURL_PROGRESS_BAR;
|
config->progressmode ^= CURL_PROGRESS_BAR;
|
||||||
@@ -1368,6 +1381,10 @@ void progressbarinit(struct ProgressData *bar)
|
|||||||
|
|
||||||
void free_config_fields(struct Configurable *config)
|
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)
|
if(config->userpwd)
|
||||||
free(config->userpwd);
|
free(config->userpwd);
|
||||||
if(config->postfields)
|
if(config->postfields)
|
||||||
@@ -1441,12 +1458,10 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
curl_memdebug("memdump");
|
curl_memdebug("memdump");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
main_init(); /* inits winsock crap for windows */
|
||||||
|
|
||||||
config->showerror=TRUE;
|
config->showerror=TRUE;
|
||||||
config->conf=CONF_DEFAULT;
|
config->conf=CONF_DEFAULT;
|
||||||
#if 0
|
|
||||||
config->crlf=FALSE;
|
|
||||||
config->quote=NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(argc>1 &&
|
if(argc>1 &&
|
||||||
(!strnequal("--", argv[1], 2) && (argv[1][0] == '-')) &&
|
(!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
|
* The first flag, that is not a verbose name, but a shortname
|
||||||
* and it includes the 'q' flag!
|
* and it includes the 'q' flag!
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
fprintf(stderr, "I TURNED OFF THE CRAP\n");
|
|
||||||
#endif
|
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1537,6 +1549,15 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
else
|
else
|
||||||
allocuseragent = TRUE;
|
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;
|
urlnode = config->url_list;
|
||||||
|
|
||||||
/* loop through the list of given URLs */
|
/* loop through the list of given URLs */
|
||||||
@@ -1722,10 +1743,6 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
main_init();
|
|
||||||
|
|
||||||
curl = curl_easy_init();
|
|
||||||
if(curl) {
|
|
||||||
curl_easy_setopt(curl, CURLOPT_FILE, (FILE *)&outs); /* where to store */
|
curl_easy_setopt(curl, CURLOPT_FILE, (FILE *)&outs); /* where to store */
|
||||||
/* what call to write: */
|
/* what call to write: */
|
||||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
|
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: */
|
/* new in libcurl 7.6.2: */
|
||||||
curl_easy_setopt(curl, CURLOPT_TELNETOPTIONS, config->telnet_options);
|
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);
|
res = curl_easy_perform(curl);
|
||||||
|
|
||||||
if(config->writeout) {
|
if(config->writeout) {
|
||||||
ourWriteOut(curl, config->writeout);
|
ourWriteOut(curl, config->writeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* always cleanup */
|
|
||||||
curl_easy_cleanup(curl);
|
|
||||||
|
|
||||||
if((res!=CURLE_OK) && config->showerror)
|
if((res!=CURLE_OK) && config->showerror)
|
||||||
fprintf(config->errors, "curl: (%d) %s\n", res, errorbuffer);
|
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) &&
|
if((config->errors != stderr) &&
|
||||||
(config->errors != stdout))
|
(config->errors != stdout))
|
||||||
@@ -1884,6 +1897,11 @@ operate(struct Configurable *config, int argc, char *argv[])
|
|||||||
if(allocuseragent)
|
if(allocuseragent)
|
||||||
free(config->useragent);
|
free(config->useragent);
|
||||||
|
|
||||||
|
/* cleanup the curl handle! */
|
||||||
|
curl_easy_cleanup(curl);
|
||||||
|
|
||||||
|
main_free(); /* cleanup the winsock stuff for windows */
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,18 +75,18 @@ for(@out) {
|
|||||||
|
|
||||||
$new = $_;
|
$new = $_;
|
||||||
|
|
||||||
$outsize += length($new);
|
$outsize += length($new)+1; # one for the newline
|
||||||
|
|
||||||
$new =~ s/\\/\\\\/g;
|
$new =~ s/\\/\\\\/g;
|
||||||
$new =~ s/\"/\\\"/g;
|
$new =~ s/\"/\\\"/g;
|
||||||
|
|
||||||
printf("\"%s\\n\"\n", $new);
|
# gcc 2.96 claims ISO C89 only is required to support 509 letter strings
|
||||||
|
if($outsize > 500) {
|
||||||
if($outsize > 10000) {
|
|
||||||
# terminate and make another puts() call here
|
# terminate and make another puts() call here
|
||||||
print ");\n puts(\n";
|
print ");\n puts(\n";
|
||||||
$outsize=0;
|
$outsize=length($new)+1;
|
||||||
}
|
}
|
||||||
|
printf("\"%s\\n\"\n", $new);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
#define CURL_NAME "curl"
|
#define CURL_NAME "curl"
|
||||||
#define CURL_VERSION "7.7-beta1"
|
#define CURL_VERSION "7.7-beta2"
|
||||||
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
#define CURL_ID CURL_NAME " " CURL_VERSION " (" OS ") "
|
||||||
|
@@ -18,8 +18,10 @@ Run:
|
|||||||
verbose output. Use -d to run the test servers with debug output enabled as
|
verbose output. Use -d to run the test servers with debug output enabled as
|
||||||
well.
|
well.
|
||||||
|
|
||||||
Use -s fort shorter output, or pass a string with test numbers to run
|
Use -s for shorter output, or pass test numbers to run specific tests only
|
||||||
specific tests only (like ./runtests.pl "3 4" to test 3 and 4 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:
|
Memory:
|
||||||
The test script will check that all allocated memory is freed properly IF
|
The test script will check that all allocated memory is freed properly IF
|
||||||
|
@@ -64,4 +64,6 @@ command32.txt prot31.txt reply310001.txt reply320001.txt \
|
|||||||
name31.txt prot32.txt reply310002.txt reply320002.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 \
|
command34.txt prot34.txt reply340001.txt name34.txt reply34.txt \
|
||||||
command35.txt name35.txt prot35.txt reply35.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
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
http://%HOSTIP:%HOSTPORT/want/25 -o - -o -
|
http://%HOSTIP:%HOSTPORT/want/26 -o - -o -
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
1
tests/data/command36.txt
Normal file
1
tests/data/command36.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
http://%HOSTIP:%HOSTPORT/36
|
1
tests/data/command37.txt
Normal file
1
tests/data/command37.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
http://uUsSeErrr:pppasswrd@%HOSTIP:%HOSTPORT/37
|
1
tests/data/error36.txt
Normal file
1
tests/data/error36.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
26
|
@@ -1 +1 @@
|
|||||||
looping HTTP Location: following with --max-redirs
|
looping HTTP Location: following with --max-redirs, no persistance
|
||||||
|
1
tests/data/name36.txt
Normal file
1
tests/data/name36.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
HTTP GET with badly formatted chunked Transfer-Encoding
|
1
tests/data/name37.txt
Normal file
1
tests/data/name37.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
HTTP GET with name+password in the URL
|
@@ -1,4 +1,4 @@
|
|||||||
GET /want/25 HTTP/1.1
|
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)
|
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
|
Host: 127.0.0.1:8999
|
||||||
Pragma: no-cache
|
Pragma: no-cache
|
||||||
|
7
tests/data/prot37.txt
Normal file
7
tests/data/prot37.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
GET /37 HTTP/1.1
|
||||||
|
Authorization: Basic dVVzU2VFcnJyOnBwcGFzc3dyZA==
|
||||||
|
User-Agent: curl/7.7-beta1 (i686-pc-linux-gnu) libcurl 7.7-beta1 (SSL 0.9.5)
|
||||||
|
Host: 127.0.0.1:8999
|
||||||
|
Pragma: no-cache
|
||||||
|
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
|
||||||
|
|
@@ -1,4 +1,4 @@
|
|||||||
HTTP/1.1 200 OK
|
HTTP/1.0 200 OK
|
||||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
HTTP/1.1 404 BAD BOY
|
HTTP/1.0 404 BAD BOY
|
||||||
Content-Type: text/html
|
Content-Type: text/html
|
||||||
|
|
||||||
This silly page doesn't reaaaaaly exist so you should not get it.
|
This silly page doesn't reaaaaaly exist so you should not get it.
|
||||||
|
@@ -1,5 +1,7 @@
|
|||||||
HTTP/1.1 301 This is a weirdo text message
|
HTTP/1.1 301 This is a weirdo text message
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
Location: data/reply/25
|
Location: data/reply/25
|
||||||
|
Content-Length: 32
|
||||||
|
Connection: close
|
||||||
|
|
||||||
Redirect to the same URL again!
|
Redirect to the same URL again!
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
HTTP/1.1 301 This is a weirdo text message
|
HTTP/1.1 301 This is a weirdo text message
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
Location: data/reply/25
|
Location: data/reply/25
|
||||||
|
Connection: close
|
||||||
|
|
||||||
Redirect to the same URL again!
|
Redirect to the same URL again!
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
HTTP/1.1 200 OK
|
HTTP/1.0 200 OK
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
Content-Type: text/html
|
Content-Type: text/html
|
||||||
Content-Length: 0
|
Content-Length: 0
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
HTTP/1.1 301 Moved Permanently
|
HTTP/1.1 301 Moved Permanently
|
||||||
Server: fake
|
Server: fake
|
||||||
Location: /moo/moo/moo/310002
|
Location: /moo/moo/moo/310002
|
||||||
|
Connection: close
|
||||||
|
|
||||||
No contents
|
No contents
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
HTTP/1.1 301 Moved Permanently
|
HTTP/1.1 301 Moved Permanently
|
||||||
Server: fake
|
Server: fake
|
||||||
Location: /moo/moo/moo/310002
|
Location: /moo/moo/moo/310002
|
||||||
|
Connection: close
|
||||||
|
|
||||||
HTTP/1.1 200 Followed here fine
|
HTTP/1.1 200 Followed here fine
|
||||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
HTTP/1.1 303 See Other
|
HTTP/1.1 303 See Other
|
||||||
Server: fake
|
Server: fake
|
||||||
Location: /moo/moo/moo/320002
|
Location: /moo/moo/moo/320002
|
||||||
|
Connection: close
|
||||||
|
|
||||||
This Location should be fetched with a GET!
|
This Location should be fetched with a GET!
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
HTTP/1.1 303 See Other
|
HTTP/1.1 303 See Other
|
||||||
Server: fake
|
Server: fake
|
||||||
Location: /moo/moo/moo/320002
|
Location: /moo/moo/moo/320002
|
||||||
|
Connection: close
|
||||||
|
|
||||||
HTTP/1.1 200 Followed here fine
|
HTTP/1.1 200 Followed here fine
|
||||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
|
8
tests/data/reply36.txt
Normal file
8
tests/data/reply36.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
HTTP/1.1 200 funky chunky!
|
||||||
|
Server: fakeit/1.0
|
||||||
|
Transfer-Encoding: chunked
|
||||||
|
|
||||||
|
40
|
||||||
|
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
|
||||||
|
ILLEGAL
|
||||||
|
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
3
tests/data/reply37.txt
Normal file
3
tests/data/reply37.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
HTTP/1.0 200 OK
|
||||||
|
|
||||||
|
no headers!
|
@@ -1,5 +1,5 @@
|
|||||||
--_curl_--127.0.0.1:8999/3
|
--_curl_--127.0.0.1:8999/3
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.0 200 OK
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
Content-Type: text/html
|
Content-Type: text/html
|
||||||
Content-Length: 0
|
Content-Length: 0
|
||||||
@@ -8,7 +8,7 @@ this is data even though Content-Length is set to zero
|
|||||||
|
|
||||||
|
|
||||||
--_curl_--127.0.0.1:8999/10
|
--_curl_--127.0.0.1:8999/10
|
||||||
HTTP/1.1 200 OK
|
HTTP/1.0 200 OK
|
||||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
|
|
||||||
|
@@ -1,9 +1,11 @@
|
|||||||
HTTP/1.1 301 This is a weirdo text message
|
HTTP/1.1 301 This is a weirdo text message
|
||||||
Server: test-server/fake
|
Server: test-server/fake
|
||||||
Location: data/reply/25
|
Location: data/reply/25
|
||||||
|
Content-Length: 32
|
||||||
|
Connection: close
|
||||||
|
|
||||||
Redirect to the same URL again!
|
Redirect to the same URL again!
|
||||||
HTTP/1.1 404 BAD BOY
|
HTTP/1.0 404 BAD BOY
|
||||||
Content-Type: text/html
|
Content-Type: text/html
|
||||||
|
|
||||||
This silly page doesn't reaaaaaly exist so you should not get it.
|
This silly page doesn't reaaaaaly exist so you should not get it.
|
||||||
|
@@ -63,6 +63,8 @@ for ( $waitedpid = 0;
|
|||||||
my ($request, $path, $ver, $left, $cl);
|
my ($request, $path, $ver, $left, $cl);
|
||||||
|
|
||||||
my @headers;
|
my @headers;
|
||||||
|
|
||||||
|
stdin:
|
||||||
while(<STDIN>) {
|
while(<STDIN>) {
|
||||||
if($_ =~ /([A-Z]*) (.*) HTTP\/1.(\d)/) {
|
if($_ =~ /([A-Z]*) (.*) HTTP\/1.(\d)/) {
|
||||||
$request=$1;
|
$request=$1;
|
||||||
@@ -135,13 +137,16 @@ for ( $waitedpid = 0;
|
|||||||
print "HTTP/1.1 200 OK\r\n",
|
print "HTTP/1.1 200 OK\r\n",
|
||||||
"header: yes\r\n",
|
"header: yes\r\n",
|
||||||
"\r\n",
|
"\r\n",
|
||||||
"You must select a test number to get good data back\r\n";
|
"You must enter a test number to get good data back\r\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# send a custom reply to the client
|
# send a custom reply to the client
|
||||||
open(DATA, "<data/reply$testnum.txt");
|
open(DATA, "<data/reply$testnum.txt");
|
||||||
while(<DATA>) {
|
while(<DATA>) {
|
||||||
print $_;
|
print $_;
|
||||||
|
if($verbose) {
|
||||||
|
print STDERR "OUT: $_";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(DATA);
|
close(DATA);
|
||||||
}
|
}
|
||||||
|
@@ -356,7 +356,7 @@ sub singletest {
|
|||||||
if(! -r $CURLCMD) {
|
if(! -r $CURLCMD) {
|
||||||
# this is not a test
|
# this is not a test
|
||||||
print "$NUMBER doesn't look like a test case!\n";
|
print "$NUMBER doesn't look like a test case!\n";
|
||||||
next;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove previous server output logfile
|
# remove previous server output logfile
|
||||||
@@ -567,6 +567,8 @@ sub singletest {
|
|||||||
# Check options to this test program
|
# Check options to this test program
|
||||||
#
|
#
|
||||||
|
|
||||||
|
my $number=0;
|
||||||
|
my $fromnum=-1;
|
||||||
my @testthis;
|
my @testthis;
|
||||||
do {
|
do {
|
||||||
if ($ARGV[0] eq "-v") {
|
if ($ARGV[0] eq "-v") {
|
||||||
@@ -605,8 +607,20 @@ EOHELP
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
elsif($ARGV[0] =~ /^(\d+)/) {
|
elsif($ARGV[0] =~ /^(\d+)/) {
|
||||||
|
$number = $1;
|
||||||
|
if($fromnum >= 0) {
|
||||||
|
for($fromnum .. $number) {
|
||||||
|
push @testthis, $_;
|
||||||
|
}
|
||||||
|
$fromnum = -1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
push @testthis, $1;
|
push @testthis, $1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
elsif($ARGV[0] =~ /^to$/i) {
|
||||||
|
$fromnum = $number;
|
||||||
|
}
|
||||||
} while(shift @ARGV);
|
} while(shift @ARGV);
|
||||||
|
|
||||||
if($testthis[0] ne "") {
|
if($testthis[0] ne "") {
|
||||||
@@ -665,18 +679,25 @@ open(CMDLOG, ">$CURLLOG") ||
|
|||||||
# The main test-loop
|
# The main test-loop
|
||||||
#
|
#
|
||||||
|
|
||||||
|
my $failed;
|
||||||
my $testnum;
|
my $testnum;
|
||||||
my $ok=0;
|
my $ok=0;
|
||||||
my $total=0;
|
my $total=0;
|
||||||
foreach $testnum (split(" ", $TESTCASES)) {
|
foreach $testnum (split(" ", $TESTCASES)) {
|
||||||
|
|
||||||
$total++;
|
|
||||||
my $error = singletest($testnum);
|
my $error = singletest($testnum);
|
||||||
if($error && !$anyway) {
|
if(-1 != $error) {
|
||||||
|
# valid test case number
|
||||||
|
$total++;
|
||||||
|
}
|
||||||
|
if($error>0) {
|
||||||
|
if(!$anyway) {
|
||||||
# a test failed, abort
|
# a test failed, abort
|
||||||
print "\n - abort tests\n";
|
print "\n - abort tests\n";
|
||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
|
$failed.= "$testnum ";
|
||||||
|
}
|
||||||
elsif(!$error) {
|
elsif(!$error) {
|
||||||
$ok++;
|
$ok++;
|
||||||
}
|
}
|
||||||
@@ -696,4 +717,13 @@ close(CMDLOG);
|
|||||||
stopserver($FTPPIDFILE);
|
stopserver($FTPPIDFILE);
|
||||||
stopserver($PIDFILE);
|
stopserver($PIDFILE);
|
||||||
|
|
||||||
|
if($total) {
|
||||||
print "$ok tests out of $total reported OK\n";
|
print "$ok tests out of $total reported OK\n";
|
||||||
|
|
||||||
|
if($ok != $total) {
|
||||||
|
print "These test cases failed: $failed\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "No tests were performed!\n";
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user