Compare commits

..

48 Commits

Author SHA1 Message Date
Daniel Stenberg
50a53d4eec 7.7.1 commit 2001-04-04 06:23:43 +00:00
Daniel Stenberg
6bd1ed034a bugfixed the Location: following that must've been bad since the persistant
connections were introduced
2001-04-03 13:37:53 +00:00
Daniel Stenberg
fa491ed910 - disabling port on absolute redirects is wrong
- removed #ifdefed code
2001-04-03 13:18:41 +00:00
Daniel Stenberg
66a1e3df69 two crashes removed 2001-04-03 12:37:48 +00:00
Daniel Stenberg
28497e7ee4 better error checks for failure conditions (based on Puneet Pawaia's reports) 2001-04-03 10:20:23 +00:00
Daniel Stenberg
87c7f403a9 Puneet Pawaia pointed out the lack of http_chunks in several places. 2001-04-03 08:57:06 +00:00
Daniel Stenberg
1a2c3acb3b elaborated more in CURLOPT_HTTPHEADER section 2001-03-30 08:43:52 +00:00
Daniel Stenberg
b54d752783 ftps:// added and the perl interfaces changed 2001-03-29 11:25:29 +00:00
Daniel Stenberg
b1328430c9 ftps:// support added 2001-03-29 08:16:55 +00:00
Daniel Stenberg
34efa74a59 Georg Horn's and my fixes to make it compile with 7.7 2001-03-29 06:45:04 +00:00
Daniel Stenberg
794d08a728 Georg Horn set -Wall 2001-03-29 06:44:34 +00:00
Daniel Stenberg
0abc999c4d Georg Horn's updates 2001-03-29 06:43:46 +00:00
Daniel Stenberg
3e65062be2 make sure the alarm is off when returning from curl_easy_perform() 2001-03-27 21:24:46 +00:00
Daniel Stenberg
45ffb16c2a Added a line about the new makefile example 2001-03-27 09:10:53 +00:00
Daniel Stenberg
0b8b0b7c86 Added Makefile.example as an example makefile that can build the example
source files (if edited slightly)
2001-03-27 09:09:09 +00:00
Daniel Stenberg
053bf49bd2 Added ftpget.c just to show that it is exactly as easy to get FTP files 2001-03-27 09:00:18 +00:00
Daniel Stenberg
8b08dfed38 no more ' as first letter of a row, and made the quotes match in the top
.BI line
2001-03-27 08:45:50 +00:00
Daniel Stenberg
ba3a3553dc Added some text to WRITEHEADER about the fact that libcurl will always write
complete header lines one-by-one to that file handle
2001-03-27 08:41:37 +00:00
Daniel Stenberg
6a26104724 7.7.1-beta1 2001-03-26 13:49:50 +00:00
Daniel Stenberg
8b35b89f4d persistant fix for http/1.0 2001-03-26 09:07:44 +00:00
Daniel Stenberg
31f9d4016d 'Connection: keep-alive' is now understood when sent by a HTTP/1.0 server
as an indication of a persistant connection
2001-03-26 06:19:11 +00:00
Daniel Stenberg
bb601731ea numerous corrections since the 7.7 release 2001-03-24 18:50:55 +00:00
Daniel Stenberg
9a85172896 Colin Watson's man patch as posted to debian bug tracker numer #90281 2001-03-24 18:28:43 +00:00
Daniel Stenberg
a0eb52bee1 two Qs added:
1.5 Who makes cURL?
 1.6 What do you get for making cURL?
2001-03-23 15:28:13 +00:00
Daniel Stenberg
6235a8d969 make should be $(MAKE) 2001-03-23 14:29:10 +00:00
Daniel Stenberg
0d6a87ed7a match the new never-read-body when doing HEAD 2001-03-23 14:26:23 +00:00
Daniel Stenberg
b6241b3c89 curl_setopt() should be curl_easy_setopt() 2001-03-23 09:07:04 +00:00
Daniel Stenberg
1e14f8d4c7 DONT TOUCH the data->url as it may point to read-only memory!!! 2001-03-23 08:24:47 +00:00
Daniel Stenberg
bc5954fe2d updates by SM nttp at iname.com 2001-03-23 08:16:24 +00:00
Daniel Stenberg
02f6894af5 now always stops reading a HEAD reply after all the headers have been returned
RFC 2616, section 9.4 says: "The HEAD method is identical to GET except that
the server MUST NOT return a message-body in the response."
2001-03-23 07:52:45 +00:00
Daniel Stenberg
76576cd1e2 ConnectionExists() wrongly returned TRUE for too many connections if proxy
was not used...
2001-03-23 07:46:14 +00:00
Daniel Stenberg
997672ba9a updated with the new don't-encode-already-encoded-data concept 2001-03-22 20:06:31 +00:00
Daniel Stenberg
ec1f42a154 Treat 302-redirects the same way we treat 303-redirects 2001-03-22 20:02:52 +00:00
Daniel Stenberg
aa1c3bb46d reset the follow location counter in Curl_perform() so that we can follow
new locations on the same connection that was previously followed on
2001-03-22 19:14:35 +00:00
Daniel Stenberg
95f0714ff8 brand new Curl_ prefixes on global symbols 2001-03-22 19:07:38 +00:00
Daniel Stenberg
c050619b36 made it use Curl_ prefixes on global symbols 2001-03-22 18:44:43 +00:00
Daniel Stenberg
58085dbbf6 Jim Drash suggested and I made it not encode what looks like an already
encoded letter (in curl_escape)
2001-03-22 18:06:08 +00:00
Daniel Stenberg
546572da04 7.7 commit 2001-03-22 17:21:07 +00:00
Daniel Stenberg
005536cc28 removed the duplicates! 2001-03-22 15:42:10 +00:00
Daniel Stenberg
3d5b6aa3b0 added escape and unescape 2001-03-22 11:53:12 +00:00
Daniel Stenberg
f8d883355d the new escape/unescape function setup 2001-03-22 11:40:58 +00:00
Daniel Stenberg
c23df41d83 (un)escape, configure hack, betas run fine 2001-03-22 11:24:21 +00:00
Daniel Stenberg
8e7b261984 added how to pronounce curl! ;-) 2001-03-22 11:23:48 +00:00
Daniel Stenberg
08e3d034ef don't mention explicit version 7.8
removed escape/unescape as they're now documented
2001-03-22 11:22:47 +00:00
Daniel Stenberg
2f869f89ff added escape and unescape man pages 2001-03-22 11:22:09 +00:00
Daniel Stenberg
0f310a5001 not exactly new, but documented for 7.7 2001-03-22 10:32:56 +00:00
Daniel Stenberg
ad1abee441 Andrs Garca's problems on the mailing list made me realize that we can't
allow this script to simply detect a gethostbyname_r() if it can't figure
out how to use it. From now on, this script will fail when that happens.
2001-03-22 08:51:24 +00:00
Daniel Stenberg
669709f80e GNUTLS is another new SSL library we can add support for. Anyone? 2001-03-20 10:13:47 +00:00
32 changed files with 658 additions and 277 deletions

90
CHANGES
View File

@@ -6,6 +6,96 @@
History of Changes History of Changes
Version 7.7.1
Daniel (3 April 2001)
- Puneet Pawaia pointed out two serious problems. Libcurl would attempt to
read bad memory during situations when an (ftp) connection attempt failed.
Also, the lib/Makefile.vc6 was corrected.
- More investigations in the Location: following code made me realize that
it was not clean enough to work transparantly with persistant and non-
persistant connections. I think I've fixed it now.
Daniel (29 March 2001)
- Georg Horn mailed me some corrections for the Curl::easy perl interface.
- Experimental ftps:// support added. It is basically FTP over SSL for the
control connection. It still makes all data transfers going over unencrypted
connections. Rainer Weikusat's ftpd-ssl server hack supports this and I used
that to verify the functionality.
Daniel (27 March 2001)
- Guenole Bescon discovered that if you set a CURLOPT_TIMEOUT and then tried
to get a file from a site and it fails, the SIGALRM would still be sent
after the timeout-time, quite inexpectedly!
- I added an ftp transfer example to docs/examples/ and I also wrote a tiny
example makefile that can be used as a start when building one of the
examples.
Version 7.7.1-beta1
Daniel (26 March 2001)
- Mohamed Lrhazi reported problems with 7.6.1 and persistant HTTP/1.0
connections (when the server replied a Connection: Keep-Alive) and this
problem was not properly dealt with in 7.7 either. A patch was posted to the
curl-and-php mailing list.
Daniel (24 March 2001)
- Colin Watson reported about a problem and brought a patch that corrected it,
which was about the man page and lines starting with a single quote (') in a
way that gnroff doesn't like.
Daniel (23 March 2001)
- Peter Bray reported correctly that the root makefile used make instead of
$(MAKE) for the test target.
- Corrected the Curl::easy perl interface to use curl_easy_setopt() and not
curl_setopt() which was removed in 7.7!
- SM provided updates on three documents (MANUAL, INSTALL and FAQ).
- When following a Location:, libcurl would sometimes write to the URL string
in a way it shouldn't. As the pointer is passed-in to libcurl from an
application, we can't be allowed to write to it. The particular bug report
from 'nk' that brought this up was because he had a read-only URL that then
caused a libcurl crash!
- No longer reads HEAD responses longer than to the last header. Previously,
curl would read the full reply if the connection was a "close" one.
- libcurl did re-use connections way too much. Doing "curl
http://www.{microsoft,ibm}.com" would make it re-use the connection which
made the second request return very odd results.
Daniel (22 March 2001)
- Edin Kadribasic made me aware that curl should not re-send POST requests
when following 302-redirects. I made 302 work like 303 which means curl uses
GET in the following request(s).
- libcurl now reset the "followed-location" counter on each invoke of
curl_easy_perform() as it otherwise would sum up all redirects on the same
connection and thus could reach the maxredirs counter wrongly.
- Jim Drash suggested curl_escape() should not re-encode what already looks
like an encoded sequence and I think that's a fair suggestion.
Version 7.7
Daniel (22 March 2001)
- The configure script now fails with an error message if gethostbyname_r() is
detected but it couldn't figure out how to invoke it (what amount of
arguments it is supposed to get). Reports from Andr<64>s Garc<72>a made me aware
of this need.
- Talking with Jim Drash made me finally put the curl_escape and curl_unescape
functions in the curl.h include file and write man pages for them. The
escape function was modified to use the same interface as the unescape one
had.
- No bug reports at all on the latest betas. Release time coming up.
Version 7.7-beta5 Version 7.7-beta5
Daniel (19 March 2001) Daniel (19 March 2001)

View File

@@ -17,7 +17,7 @@ dist-hook:
check: test check: test
test: test:
@(cd tests; make quiet-test) @(cd tests; $(MAKE) quiet-test)
# #
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros

View File

@@ -295,6 +295,14 @@ exit (rc != 0 ? 1 : 0); }],[
[ac_cv_gethostbyname_args=0])], [ac_cv_gethostbyname_args=0])],
[ac_cv_gethostbyname_args=0])]) [ac_cv_gethostbyname_args=0])])
if test "$ac_cv_func_gethostbyname_r" = "yes"; then
if test "$ac_cv_gethostbyname_args" = "0"; then
dnl there's a gethostbyname_r() function, but we don't know how
dnl many arguments it wants!
AC_MSG_ERROR([couldn't figure out how to use gethostbyname_r()])
fi
fi
]) ])
dnl ********************************************************************** dnl **********************************************************************

View File

@@ -1,4 +1,4 @@
Updated: March 13, 2001 (http://curl.haxx.se/docs/faq.shtml) Updated: March 23, 2001 (http://curl.haxx.se/docs/faq.shtml)
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
@@ -12,6 +12,8 @@ FAQ
1.2 What is libcurl? 1.2 What is libcurl?
1.3 What is cURL not? 1.3 What is cURL not?
1.4 When will you make curl do XXXX ? 1.4 When will you make curl do XXXX ?
1.5 Who makes cURL?
1.6 What do you get for making cURL?
2. Install Related Problems 2. Install Related Problems
2.1 configure doesn't find OpenSSL even when it is installed 2.1 configure doesn't find OpenSSL even when it is installed
@@ -79,14 +81,16 @@ FAQ
Curl supports a range of common internet protocols, currently including Curl supports a range of common internet protocols, currently including
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE. HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE.
We spell it cURL or just curl. We spell it cURL or just curl. We pronounce it with an initial k sound:
[kurl].
1.2 What is libcurl? 1.2 What is libcurl?
libcurl is a reliable, higly portable multiprotocol file transfer library. libcurl is a reliable and portable library which provides you with an easy
interface to a range of common internet protocols.
Any application is free to use libcurl, even commercial or closed-source You can use libcurl for free in your application even if it is commercial
ones. or closed-source.
1.3 What is cURL not? 1.3 What is cURL not?
@@ -140,6 +144,31 @@ FAQ
* 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.
1.5 Who makes cURL?
cURL and libcurl are not made by any single individual. Sure, Daniel
Stenberg writes the major parts, but various people's submissions are
important and crucial. Anyone can post their changes and improvements and
have them inserted in the main sources (of course on the condition that
developers agree on that the fixes are good).
The list of contributors in the bottom of the man page is only a small part
of all the people that every day provide us with bug reports, suggestions,
ideas and source code.
curl is developed by a community, with Daniel at the wheel.
1.6 What do you get for making cURL?
Project cURL is entirely free and open, without any commercial interests or
money involved. No person gets paid in any way for developing curl. We all
do this volountarily on our spare time.
We get some help from companies. Contactor Data hosts the curl web site and
the main mailing list, Haxx owns the curl web site's domain and
sourceforge.net hosts several project tools we take advantage from like the
bug tracker, mailing lists and more.
2. Install Related Problems 2. Install Related Problems
2.1. configure doesn't find OpenSSL even when it is installed 2.1. configure doesn't find OpenSSL even when it is installed
@@ -498,7 +527,7 @@ FAQ
available way to do multiple requests was to init/perform/cleanup for each available way to do multiple requests was to init/perform/cleanup for each
transfer. transfer.
5.4 Does libcurl do Winsock initing on win32 systems? 5.4 Does libcurl do Winsock initialization on win32 systems?
No. No.

View File

@@ -183,9 +183,9 @@ Win32
For VC++ 6, there's an included Makefile.vc6 that should be possible For VC++ 6, there's an included Makefile.vc6 that should be possible
to use out-of-the-box. to use out-of-the-box.
Microsoft note: add /Zm200 to the compiler options, as the hugehelp.c Microsoft note: add /Zm200 to the compiler options to increase the
won't compile otherwise due to "too long puts string" or something compiler's memory allocation limit, as the hugehelp.c won't compile
like that! due to "too long puts string".
With SSL: With SSL:
@@ -251,7 +251,7 @@ IBM OS/2
PORTS PORTS
===== =====
Just to show off, this is a probably incomplete list of known hardware and This is a probably incomplete list of known hardware and
operating systems that curl has been compiled for: operating systems that curl has been compiled for:
- Ultrix - Ultrix

View File

@@ -15,10 +15,6 @@ SIMPLE USAGE
curl ftp://ftp.funet.fi/README curl ftp://ftp.funet.fi/README
Get a gopher document from funet's gopher server:
curl gopher://gopher.funet.fi
Get a web page from a server using port 8000: Get a web page from a server using port 8000:
curl http://www.weirdserver.com:8000/ curl http://www.weirdserver.com:8000/
@@ -27,6 +23,10 @@ SIMPLE USAGE
curl ftp://cool.haxx.se/ curl ftp://cool.haxx.se/
Get a gopher document from funet's gopher server:
curl gopher://gopher.funet.fi
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
@@ -186,7 +186,7 @@ DETAILED INFORMATION
-D/--dump-header option when getting files from both FTP and HTTP, and it -D/--dump-header option when getting files from both FTP and HTTP, and it
will then store the headers in the specified file. will then store the headers in the specified file.
Store the HTTP headers in a separate file: Store the HTTP headers in a separate file (headers.txt in the example):
curl --dump-header headers.txt curl.haxx.se curl --dump-header headers.txt curl.haxx.se
@@ -245,32 +245,32 @@ POST (HTTP)
-F accepts parameters like -F "name=contents". If you want the contents to -F accepts parameters like -F "name=contents". If you want the contents to
be read from a file, use <@filename> as contents. When specifying a file, be read from a file, use <@filename> as contents. When specifying a file,
you can also specify which content type the file is, by appending you can also specify the file content type by appending ';type=<mime type>'
';type=<mime type>' to the file name. You can also post contents of several to the file name. You can also post the contents of several files in one field.
files in one field. So that the field name 'coolfiles' can be sent three For example, the field name 'coolfiles' is used to send three files, with
files with different content types in a manner similar to: different content types using the following syntax:
curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \ curl -F "coolfiles=@fil1.gif;type=image/gif,fil2.txt,fil3.html" \
http://www.post.com/postit.cgi http://www.post.com/postit.cgi
If content-type is not specified, curl will try to guess from the extension If the content-type is not specified, curl will try to guess from the file
(it only knows a few), or use the previously specified type (from an earlier extension (it only knows a few), or use the previously specified type
file if several files are specified in a list) or finally using the default (from an earlier file if several files are specified in a list) or else it
type 'text/plain'. will using the default type 'text/plain'.
Emulate a fill-in form with -F. Let's say you fill in three fields in a Emulate a fill-in form with -F. Let's say you fill in three fields in a
form. One field is a file name which to post, one field is your name and one form. One field is a file name which to post, one field is your name and one
field is a file description. We want to post the file we have written named field is a file description. We want to post the file we have written named
"cooltext.txt". To let curl do the posting of this data instead of your "cooltext.txt". To let curl do the posting of this data instead of your
favourite browser, you have to check out the HTML of the form page to get to favourite browser, you have to read the HTML source of the form page and find
know the names of the input fields. In our example, the input field names are the names of the input fields. In our example, the input field names are
'file', 'yourname' and 'filedescription'. 'file', 'yourname' and 'filedescription'.
curl -F "file=@cooltext.txt" -F "yourname=Daniel" \ curl -F "file=@cooltext.txt" -F "yourname=Daniel" \
-F "filedescription=Cool text file with cool text inside" \ -F "filedescription=Cool text file with cool text inside" \
http://www.post.com/postit.cgi http://www.post.com/postit.cgi
So, to send two files in one post you can do it in two ways: To send two files in one post you can do it in two ways:
1. Send multiple files in a single "field" with a single field name: 1. Send multiple files in a single "field" with a single field name:
@@ -280,11 +280,11 @@ POST (HTTP)
curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif"
REFERER REFERRER
A HTTP request has the option to include information about which address A HTTP request has the option to include information about which address
that referred to actual page, and curl allows the user to specify that that referred to actual page. Curl allows you to specify the
referrer to get specified on the command line. It is especially useful to referrer to be used on the command line. It is especially useful to
fool or trick stupid servers or CGI scripts that rely on that information fool or trick stupid servers or CGI scripts that rely on that information
being available or contain certain data. being available or contain certain data.
@@ -353,13 +353,17 @@ COOKIES
Note that by specifying -b you enable the "cookie awareness" and with -L Note that by specifying -b you enable the "cookie awareness" and with -L
you can make curl follow a location: (which often is used in combination you can make curl follow a location: (which often is used in combination
with cookies). So that if a site sends cookies and a location, you can with cookies). So that if a site sends cookies and a location, you can
use a non-existing file to trig the cookie awareness like: use a non-existing file to trigger the cookie awareness like:
curl -L -b empty-file www.example.com curl -L -b empty.txt www.example.com
The file to read cookies from must be formatted using plain HTTP headers OR The file to read cookies from must be formatted using plain HTTP headers OR
as netscape's cookie file. Curl will determine what kind it is based on the as netscape's cookie file. Curl will determine what kind it is based on the
file contents. file contents. In the above command, curl will parse the header and store
the cookies received from www.example.com. curl will send to the server the
stored cookies which match the request as it follows the location. The
file "empty.txt" may be a non-existant file.
PROGRESS METER PROGRESS METER
@@ -392,12 +396,12 @@ PROGRESS METER
SPEED LIMIT SPEED LIMIT
Curl offers the user to set conditions regarding transfer speed that must Curl allows the user to set the transfer speed conditions that must be met
be met to let the transfer keep going. By using the switch -y and -Y you to let the transfer keep going. By using the switch -y and -Y you
can make curl abort transfers if the transfer speed doesn't exceed your can make curl abort transfers if the transfer speed is below the specified
given lowest limit for a specified time. lowest limit for a specified time.
To let curl abandon downloading this page if its slower than 3000 bytes per To have curl abort the download if the speed is slower than 3000 bytes per
second for 1 minute, run: second for 1 minute, run:
curl -y 3000 -Y 60 www.far-away-site.com curl -y 3000 -Y 60 www.far-away-site.com
@@ -610,7 +614,7 @@ RESUMING FILE TRANSFERS
(*1) = This requires that the ftp server supports the non-standard command (*1) = This requires that the ftp server supports the non-standard command
SIZE. If it doesn't, curl will say so. SIZE. If it doesn't, curl will say so.
(*2) = This requires that the wb server supports at least HTTP/1.1. If it (*2) = This requires that the web server supports at least HTTP/1.1. If it
doesn't, curl will say so. doesn't, curl will say so.
TIME CONDITIONS TIME CONDITIONS

View File

@@ -17,7 +17,9 @@ man_MANS = \
curl_getenv.3 \ curl_getenv.3 \
curl_slist_append.3 \ curl_slist_append.3 \
curl_slist_free_all.3 \ curl_slist_free_all.3 \
curl_version.3 curl_version.3 \
curl_escape.3 \
curl_unescape.3
EXTRA_DIST = $(man_MANS) \ EXTRA_DIST = $(man_MANS) \
MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \ MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \

View File

@@ -9,18 +9,24 @@ TODO
Things to do in project cURL. Please tell me what you think, contribute and Things to do in project cURL. Please tell me what you think, contribute and
send me patches that improve things! send me patches that improve things!
To do for the 7.8 release: To do for the next release:
* Make SSL session ids get used if multiple HTTPS documents from the same * Make SSL session ids get used if multiple HTTPS documents from the same
host is requested. host is requested.
* Document the undocumented libcurl functions: the printf clones (like * Document the undocumented libcurl functions: the printf clones (like
curl_msprintf, curl_mfprintf, curl_msnprintf, curl_maprintf and curl_msprintf, curl_mfprintf, curl_msnprintf, curl_maprintf and
curl_mvfprintf), the string compare functions (curl_strequal curl_mvfprintf) and the string compare functions (curl_strequal
and curl_strnequal) and the URL escape/unescape functions. and curl_strnequal).
To do in a future release (random order): To do in a future release (random order):
* Rewrite parts of the test suite. Make a (XML?) format to store all
test-data in a single for a single test case. The current system makes far
too many separate files. We also need to have the test suite support
different behaviors, like when libcurl is compiled for IPv6 support and
thus performs a different set of FTP commands.
* Add configure options that disables certain protocols in libcurl to * Add configure options that disables certain protocols in libcurl to
decrease footprint. '--disable-[protocol]' where protocol is http, ftp, decrease footprint. '--disable-[protocol]' where protocol is http, ftp,
telnet, ldap, dict or file. telnet, ldap, dict or file.
@@ -33,9 +39,10 @@ To do in a future release (random order):
stamp as the remote file. libcurl already is capable of fetching the remote stamp as the remote file. libcurl already is capable of fetching the remote
file's date. file's date.
* Make the SSL layer option capable of using the Mozilla Security Services as * Make curl's SSL layer option capable of using other free SSL libraries.
an alternative to OpenSSL: Such as the Mozilla Security Services
http://www.mozilla.org/projects/security/pki/nss/ (http://www.mozilla.org/projects/security/pki/nss/) and GNUTLS
(http://gnutls.hellug.gr/)
* Add asynchronous name resolving, as this enables full timeout support for * Add asynchronous name resolving, as this enables full timeout support for
fork() systems. fork() systems.

View File

@@ -2,7 +2,7 @@
.\" nroff -man curl.1 .\" nroff -man curl.1
.\" Written by Daniel Stenberg .\" Written by Daniel Stenberg
.\" .\"
.TH curl 1 "15 March 2001" "Curl 7.7" "Curl Manual" .TH curl 1 "24 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.
@@ -128,7 +128,7 @@ content-type application/x-www-form-urlencoded. Compare to -F. If more than
one -d/--data option is used on the same command line, the data pieces one -d/--data option is used on the same command line, the data pieces
specified will be merged together with a separating &-letter. Thus, using '-d specified will be merged together with a separating &-letter. Thus, using '-d
name=daniel -d skill=lousy' would generate a post chunk that looks like name=daniel -d skill=lousy' would generate a post chunk that looks like
'name=daniel&skill=lousy'. \&'name=daniel&skill=lousy'.
If you start the data with the letter @, the rest should be a file name to If you start the data with the letter @, the rest should be a file name to
read the data from, or - if you want curl to read the data from stdin. The read the data from, or - if you want curl to read the data from stdin. The
@@ -215,7 +215,7 @@ get attached in the post as a file upload, while the < makes a text field and
just get the contents for that text field from a file. just get the contents for that text field from a file.
Example, to send your password file to the server, where Example, to send your password file to the server, where
'password' is the name of the form-field to which /etc/passwd will be the \&'password' is the name of the form-field to which /etc/passwd will be the
input: input:
.B curl .B curl
@@ -325,7 +325,7 @@ directory.
A quick and very simple example of how to setup a A quick and very simple example of how to setup a
.I .netrc .I .netrc
to allow curl to ftp to the machine host.domain.com with user name to allow curl to ftp to the machine host.domain.com with user name
'myself' and password 'secret' should look similar to: \&'myself' and password 'secret' should look similar to:
.B "machine host.domain.com login myself password secret" .B "machine host.domain.com login myself password secret"

View File

@@ -2,13 +2,13 @@
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by daniel@haxx.se .\" Written by daniel@haxx.se
.\" .\"
.TH curl_easy_setopt 3 "13 March 2001" "libcurl 7.7" "libcurl Manual" .TH curl_easy_setopt 3 "30 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
.B #include <curl/curl.h> .B #include <curl/curl.h>
.sp .sp
.BI "CURLcode curl_easy_setopt(CURL *" handle ", CURLoption "option ", ...); .BI "CURLcode curl_easy_setopt(CURL *" handle ", CURLoption "option ", ...);"
.ad .ad
.SH DESCRIPTION .SH DESCRIPTION
curl_easy_setopt() is called to tell libcurl how to behave in a number of curl_easy_setopt() is called to tell libcurl how to behave in a number of
@@ -274,7 +274,11 @@ curl_slist' structs properly filled in. Use
.I curl_slist_append(3) .I curl_slist_append(3)
to create the list and to create the list and
.I curl_slist_free_all(3) .I curl_slist_free_all(3)
to clean up an entire list. to clean up an entire list. If you add a header that is otherwise generated
and used by libcurl internally, your added one will be used instead. If you
add a header with no contents as in 'Accept:', the internally used header will
just get disabled. Thus, using this option you can add new headers, replace
internal headers and remove internal headers.
.TP .TP
.B CURLOPT_HTTPPOST .B CURLOPT_HTTPPOST
Tells libcurl you want a multipart/formdata HTTP POST to be made and you Tells libcurl you want a multipart/formdata HTTP POST to be made and you
@@ -313,7 +317,9 @@ struct curl_slist structs properly filled in as described for
.I "CURLOPT_QUOTE" .I "CURLOPT_QUOTE"
.TP .TP
.B CURLOPT_WRITEHEADER .B CURLOPT_WRITEHEADER
Pass a FILE * to be used to write the header part of the received data to. Pass a FILE * to be used to write the header part of the received data to. The
headers are guaranteed to be written one-by-one to this file handle and only
complete lines are written. Parsing headers should be easy enough using this.
.TP .TP
.B CURLOPT_COOKIEFILE .B CURLOPT_COOKIEFILE
Pass a pointer to a zero terminated string as parameter. It should contain the Pass a pointer to a zero terminated string as parameter. It should contain the
@@ -353,7 +359,7 @@ name. (Added in libcurl 7.3)
.B CURLOPT_KRB4LEVEL .B CURLOPT_KRB4LEVEL
Pass a char * as parameter. Set the krb4 security level, this also enables Pass a char * as parameter. Set the krb4 security level, this also enables
krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or krb4 awareness. This is a string, 'clear', 'safe', 'confidential' or
'private'. If the string is set but doesn't match one of these, 'private' \&'private'. If the string is set but doesn't match one of these, 'private'
will be used. Set the string to NULL to disable kerberos4. The kerberos will be used. Set the string to NULL to disable kerberos4. The kerberos
support only works for FTP. (Added in libcurl 7.3) support only works for FTP. (Added in libcurl 7.3)
.TP .TP

28
docs/curl_escape.3 Normal file
View File

@@ -0,0 +1,28 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_escape 3 "22 March 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_escape - URL encodes the given string
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "char *curl_escape( char *" url ", int "length " );"
.ad
.SH DESCRIPTION
This function will convert the given input string to an URL encoded string and
return that as a new allocated string. All input characters that are not a-z,
A-Z or 0-9 will be converted to their "URL escaped" version. If a sequence of
%NN (where NN is a two-digit hexadecimal number) is found in the string to
encode, that 3-letter combination will be copied to the output unmodifed,
assuming that it is an already encoded piece of data.
If the 'length' argument is set to 0, curl_escape() will use strlen() on the
input 'url' string to find out the size.
You must free() the returned string when you're done with it.
.SH RETURN VALUE
A pointer to a zero terminated string or NULL if it failed.
.SH "SEE ALSO"
.I curl_unescape(), RFC 2396

27
docs/curl_unescape.3 Normal file
View File

@@ -0,0 +1,27 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_unescape 3 "22 March 2001" "libcurl 7.7" "libcurl Manual"
.SH NAME
curl_unescape - URL decodes the given string
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "char *curl_unescape( char *" url ", int "length " );"
.ad
.SH DESCRIPTION
This function will convert the given URL encoded input string to a "plain
string" and return that as a new allocated string. All input characters that
are URL encoded (%XX where XX is a two-digit hexadecimal number, or +) will be
converted to their plain text versions (up to a ? letter, no letters to the
right of a ? letter will be converted).
If the 'length' argument is set to 0, curl_unescape() will use strlen() on the
input 'url' string to find out the size.
You must free() the returned string when you're done with it.
.SH RETURN VALUE
A pointer to a zero terminated string or NULL if it failed.
.SH "SEE ALSO"
.I curl_escape(), RFC 2396

View File

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

View File

@@ -0,0 +1,41 @@
#############################################################################
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# $Id$
#
# What to call the final executable
TARGET = example
# Which object files that the executable consists of
OBJS= ftpget.o
# What compiler to use
CC = gcc
# Compiler flags, -g for debug, -c to make an object file
CFLAGS = -c -g
# This should point to a directory that holds libcurl, if it isn't
# in the system's standard lib dir
# We also set a -L to include the directory where we have the openssl
# libraries
LDFLAGS = -L/home/dast/lib -L/usr/local/ssl/lib
# We need -lcurl for the curl stuff
# We need -lsocket and -lnsl when on Solaris
# We need -lssl and -lcrypto when using libcurl with SSL support
# We need -ldl for dlopen() if that is in libdl
LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto -dl
# Link the target with all objects and libraries
$(TARGET) : $(OBJS)
$(CC) $(LDFLAGS) $(LIBS) -o $(TARGET) $(OBJS)
# Compile the source files into object files
ftpget.o : ftpget.c
$(CC) $(CFLAGS) $<

View File

@@ -7,4 +7,8 @@ advantage of libcurl.
If you end up with other small but still useful example sources, please mail If you end up with other small but still useful example sources, please mail
them for submission in future packages and on the web site. them for submission in future packages and on the web site.
The Makefile.example is an example makefile that could be used to build these
examples. Just edit the file according to your system and requirements first.
Try the php/examples/ directory for PHP programming snippets! Try the php/examples/ directory for PHP programming snippets!

44
docs/examples/ftpget.c Normal file
View File

@@ -0,0 +1,44 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*/
#include <stdio.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
/* to make this work under windows, use the win32-functions from the
win32socket.c file as well */
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
FILE *ftpfile;
/* local file name to store the file as */
ftpfile = fopen("curl.tar.gz", "wb"); /* b is binary for win */
curl = curl_easy_init();
if(curl) {
/* Get curl 7.7 from sunet.se's FTP site: */
curl_easy_setopt(curl, CURLOPT_URL,
"ftp://ftp.sunet.se/pub/www/utilities/curl/curl-7.7.tar.gz");
curl_easy_setopt(curl, CURLOPT_FILE, ftpfile);
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
fclose(ftpfile); /* close the local file */
return 0;
}

View File

@@ -475,9 +475,14 @@ char *curl_getenv(char *variable);
/* Returns a static ascii string of the libcurl version. */ /* Returns a static ascii string of the libcurl version. */
char *curl_version(void); char *curl_version(void);
/* Escape and unescape URL encoding in strings. The functions return a new
* allocated string or NULL if an error occurred. */
char *curl_escape(char *string, int length);
char *curl_unescape(char *string, int length);
/* This is the version number */ /* This is the version number */
#define LIBCURL_VERSION "7.7-beta5" #define LIBCURL_VERSION "7.7.1"
#define LIBCURL_VERSION_NUM 0x070700 #define LIBCURL_VERSION_NUM 0x070701
/* linked-list structure for the CURLOPT_QUOTE option (and other) */ /* linked-list structure for the CURLOPT_QUOTE option (and other) */
struct curl_slist { struct curl_slist {

View File

@@ -38,6 +38,7 @@ RELEASE_OBJS= \
formdatar.obj \ formdatar.obj \
ftpr.obj \ ftpr.obj \
httpr.obj \ httpr.obj \
http_chunksr.obj \
ldapr.obj \ ldapr.obj \
dictr.obj \ dictr.obj \
telnetr.obj \ telnetr.obj \
@@ -68,6 +69,7 @@ DEBUG_OBJS= \
formdatad.obj \ formdatad.obj \
ftpd.obj \ ftpd.obj \
httpd.obj \ httpd.obj \
http_chunksd.obj \
ldapd.obj \ ldapd.obj \
dictd.obj \ dictd.obj \
telnetd.obj \ telnetd.obj \
@@ -98,6 +100,7 @@ RELEASE_SSL_OBJS= \
formdatars.obj \ formdatars.obj \
ftprs.obj \ ftprs.obj \
httprs.obj \ httprs.obj \
http_chunksrs.obj \
ldaprs.obj \ ldaprs.obj \
dictrs.obj \ dictrs.obj \
telnetrs.obj \ telnetrs.obj \
@@ -128,6 +131,7 @@ LINK_OBJS= \
formdata.obj \ formdata.obj \
ftp.obj \ ftp.obj \
http.obj \ http.obj \
http_chunks.obj \
ldap.obj \ ldap.obj \
dict.obj \ dict.obj \
telnet.obj \ telnet.obj \
@@ -176,6 +180,8 @@ ftpr.obj: ftp.c
$(CCR) $(CFLAGS) ftp.c $(CCR) $(CFLAGS) ftp.c
httpr.obj: http.c httpr.obj: http.c
$(CCR) $(CFLAGS) http.c $(CCR) $(CFLAGS) http.c
http_chunksr.obj: http_chunks.c
$(CCR) $(CFLAGS) http_chunks.c
ldapr.obj: ldap.c ldapr.obj: ldap.c
$(CCR) $(CFLAGS) ldap.c $(CCR) $(CFLAGS) ldap.c
dictr.obj: dict.c dictr.obj: dict.c
@@ -234,6 +240,8 @@ ftpd.obj: ftp.c
$(CCD) $(CFLAGS) ftp.c $(CCD) $(CFLAGS) ftp.c
httpd.obj: http.c httpd.obj: http.c
$(CCD) $(CFLAGS) http.c $(CCD) $(CFLAGS) http.c
http_chunksd.obj: http_chunks.c
$(CCD) $(CFLAGS) http_chunks.c
ldapd.obj: ldap.c ldapd.obj: ldap.c
$(CCD) $(CFLAGS) ldap.c $(CCD) $(CFLAGS) ldap.c
dictd.obj: dict.c dictd.obj: dict.c
@@ -291,8 +299,8 @@ formdatars.obj: formdata.c
$(CCRS) $(CFLAGS) formdata.c $(CCRS) $(CFLAGS) formdata.c
ftprs.obj: ftp.c ftprs.obj: ftp.c
$(CCRS) $(CFLAGS) ftp.c $(CCRS) $(CFLAGS) ftp.c
httprs.obj: http.c http_chunksrs.obj: http_chunks.c
$(CCRS) $(CFLAGS) http.c $(CCRS) $(CFLAGS) http_chunks.c
ldaprs.obj: ldap.c ldaprs.obj: ldap.c
$(CCRS) $(CFLAGS) ldap.c $(CCRS) $(CFLAGS) ldap.c
dictrs.obj: dict.c dictrs.obj: dict.c

View File

@@ -25,6 +25,7 @@
* allocated string or NULL if an error occurred. */ * allocated string or NULL if an error occurred. */
#include "setup.h" #include "setup.h"
#include <ctype.h>
#include <curl/curl.h> #include <curl/curl.h>
#include <stdio.h> #include <stdio.h>
@@ -36,15 +37,15 @@
#include "memdebug.h" #include "memdebug.h"
#endif #endif
char *curl_escape(char *string) char *curl_escape(char *string, int length)
{ {
int alloc=strlen(string)+1; int alloc = (length?length:strlen(string))+1;
char *ns = malloc(alloc); char *ns = malloc(alloc);
unsigned char in; unsigned char in;
int newlen = alloc; int newlen = alloc;
int index=0; int index=0;
while(*string) { while(length--) {
in = *string; in = *string;
if(' ' == in) if(' ' == in)
ns[index++] = '+'; ns[index++] = '+';
@@ -52,6 +53,19 @@ char *curl_escape(char *string)
!(in >= 'A' && in <= 'Z') && !(in >= 'A' && in <= 'Z') &&
!(in >= '0' && in <= '9')) { !(in >= '0' && in <= '9')) {
/* encode it */ /* encode it */
if(('%' == in) &&
(length>=2) &&
isxdigit((int)string[1]) &&
isxdigit((int)string[2]) ) {
/*
* This is an already encoded letter, leave it!
*/
memcpy(&ns[index], string, 3);
string+=2;
}
else {
/* encode this now */
newlen += 2; /* the size grows with two, since this'll become a %XX */ newlen += 2; /* the size grows with two, since this'll become a %XX */
if(newlen > alloc) { if(newlen > alloc) {
alloc *= 2; alloc *= 2;
@@ -60,6 +74,7 @@ char *curl_escape(char *string)
return NULL; return NULL;
} }
sprintf(&ns[index], "%%%02X", in); sprintf(&ns[index], "%%%02X", in);
}
index+=3; index+=3;
} }
else { else {

View File

@@ -26,7 +26,7 @@
/* Escape and unescape URL encoding in strings. The functions return a new /* Escape and unescape URL encoding in strings. The functions return a new
* allocated string or NULL if an error occurred. */ * allocated string or NULL if an error occurred. */
char *curl_escape(char *string); char *curl_escape(char *string, int length);
char *curl_unescape(char *string, int length); char *curl_unescape(char *string, int length);
#endif #endif

View File

@@ -78,6 +78,7 @@
#endif #endif
#include "strequal.h" #include "strequal.h"
#include "ssluse.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -316,6 +317,14 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
return result; return result;
} }
if(conn->protocol & PROT_FTPS) {
/* FTPS is simply ftp with SSL for the control channel */
/* now, perform the SSL initialization for this socket */
if(Curl_SSLConnect(conn))
return CURLE_SSL_CONNECT_ERROR;
}
/* The first thing we do is wait for the "220*" line: */ /* The first thing we do is wait for the "220*" line: */
nread = Curl_GetFTPResponse(conn->firstsocket, buf, conn, &ftpcode); nread = Curl_GetFTPResponse(conn->firstsocket, buf, conn, &ftpcode);
if(nread < 0) if(nread < 0)
@@ -337,8 +346,6 @@ CURLcode Curl_ftp_connect(struct connectdata *conn)
set a valid level */ set a valid level */
sec_request_prot(conn, data->krb4_level); sec_request_prot(conn, data->krb4_level);
data->cmdchannel = fdopen(conn->firstsocket, "w");
if(sec_login(conn) != 0) if(sec_login(conn) != 0)
infof(data, "Logging in with password in cleartext!\n"); infof(data, "Logging in with password in cleartext!\n");
else else
@@ -1702,16 +1709,9 @@ size_t Curl_ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
strcat(s, "\r\n"); /* append a trailing CRLF */ strcat(s, "\r\n"); /* append a trailing CRLF */
#ifdef KRB4 bytes_written=0;
if(conn->sec_complete && conn->data->cmdchannel) { Curl_write(conn, fd, s, strlen(s), &bytes_written);
bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
fflush(conn->data->cmdchannel);
}
else
#endif /* KRB4 */
{
bytes_written = swrite(fd, s, strlen(s));
}
return(bytes_written); return(bytes_written);
} }
@@ -1720,12 +1720,14 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
{ {
struct FTP *ftp= conn->proto.ftp; struct FTP *ftp= conn->proto.ftp;
/* The FTP session may or may not have been allocated/setup at this point! */
if(ftp) {
if(ftp->user) if(ftp->user)
free(ftp->user); free(ftp->user);
if(ftp->passwd) if(ftp->passwd)
free(ftp->passwd); free(ftp->passwd);
if(ftp->entrypath) if(ftp->entrypath)
free(ftp->entrypath); free(ftp->entrypath);
}
return CURLE_OK; return CURLE_OK;
} }

View File

@@ -132,44 +132,44 @@
then those parser generators need to be fixed instead of adding those then those parser generators need to be fixed instead of adding those
names to this list. */ names to this list. */
#define yymaxdepth gd_maxdepth #define yymaxdepth Curl_gd_maxdepth
#define yyparse gd_parse #define yyparse Curl_gd_parse
#define yylex gd_lex #define yylex Curl_gd_lex
#define yyerror gd_error #define yyerror Curl_gd_error
#define yylval gd_lval #define yylval Curl_gd_lval
#define yychar gd_char #define yychar Curl_gd_char
#define yydebug gd_debug #define yydebug Curl_gd_debug
#define yypact gd_pact #define yypact Curl_gd_pact
#define yyr1 gd_r1 #define yyr1 Curl_gd_r1
#define yyr2 gd_r2 #define yyr2 Curl_gd_r2
#define yydef gd_def #define yydef Curl_gd_def
#define yychk gd_chk #define yychk Curl_gd_chk
#define yypgo gd_pgo #define yypgo Curl_gd_pgo
#define yyact gd_act #define yyact Curl_gd_act
#define yyexca gd_exca #define yyexca Curl_gd_exca
#define yyerrflag gd_errflag #define yyerrflag Curl_gd_errflag
#define yynerrs gd_nerrs #define yynerrs Curl_gd_nerrs
#define yyps gd_ps #define yyps Curl_gd_ps
#define yypv gd_pv #define yypv Curl_gd_pv
#define yys gd_s #define yys Curl_gd_s
#define yy_yys gd_yys #define yy_yys Curl_gd_yys
#define yystate gd_state #define yystate Curl_gd_state
#define yytmp gd_tmp #define yytmp Curl_gd_tmp
#define yyv gd_v #define yyv Curl_gd_v
#define yy_yyv gd_yyv #define yy_yyv Curl_gd_yyv
#define yyval gd_val #define yyval Curl_gd_val
#define yylloc gd_lloc #define yylloc Curl_gd_lloc
#define yyreds gd_reds /* With YYDEBUG defined */ #define yyreds Curl_gd_reds /* With YYDEBUG defined */
#define yytoks gd_toks /* With YYDEBUG defined */ #define yytoks Curl_gd_toks /* With YYDEBUG defined */
#define yylhs gd_yylhs #define yylhs Curl_gd_yylhs
#define yylen gd_yylen #define yylen Curl_gd_yylen
#define yydefred gd_yydefred #define yydefred Curl_gd_yydefred
#define yydgoto gd_yydgoto #define yydgoto Curl_gd_yydgoto
#define yysindex gd_yysindex #define yysindex Curl_gd_yysindex
#define yyrindex gd_yyrindex #define yyrindex Curl_gd_yyrindex
#define yygindex gd_yygindex #define yygindex Curl_gd_yygindex
#define yytable gd_yytable #define yytable Curl_gd_yytable
#define yycheck gd_yycheck #define yycheck Curl_gd_yycheck
static int yylex (); static int yylex ();
static int yyerror (); static int yyerror ();

View File

@@ -108,44 +108,44 @@
then those parser generators need to be fixed instead of adding those then those parser generators need to be fixed instead of adding those
names to this list. */ names to this list. */
#define yymaxdepth gd_maxdepth #define yymaxdepth Curl_gd_maxdepth
#define yyparse gd_parse #define yyparse Curl_gd_parse
#define yylex gd_lex #define yylex Curl_gd_lex
#define yyerror gd_error #define yyerror Curl_gd_error
#define yylval gd_lval #define yylval Curl_gd_lval
#define yychar gd_char #define yychar Curl_gd_char
#define yydebug gd_debug #define yydebug Curl_gd_debug
#define yypact gd_pact #define yypact Curl_gd_pact
#define yyr1 gd_r1 #define yyr1 Curl_gd_r1
#define yyr2 gd_r2 #define yyr2 Curl_gd_r2
#define yydef gd_def #define yydef Curl_gd_def
#define yychk gd_chk #define yychk Curl_gd_chk
#define yypgo gd_pgo #define yypgo Curl_gd_pgo
#define yyact gd_act #define yyact Curl_gd_act
#define yyexca gd_exca #define yyexca Curl_gd_exca
#define yyerrflag gd_errflag #define yyerrflag Curl_gd_errflag
#define yynerrs gd_nerrs #define yynerrs Curl_gd_nerrs
#define yyps gd_ps #define yyps Curl_gd_ps
#define yypv gd_pv #define yypv Curl_gd_pv
#define yys gd_s #define yys Curl_gd_s
#define yy_yys gd_yys #define yy_yys Curl_gd_yys
#define yystate gd_state #define yystate Curl_gd_state
#define yytmp gd_tmp #define yytmp Curl_gd_tmp
#define yyv gd_v #define yyv Curl_gd_v
#define yy_yyv gd_yyv #define yy_yyv Curl_gd_yyv
#define yyval gd_val #define yyval Curl_gd_val
#define yylloc gd_lloc #define yylloc Curl_gd_lloc
#define yyreds gd_reds /* With YYDEBUG defined */ #define yyreds Curl_gd_reds /* With YYDEBUG defined */
#define yytoks gd_toks /* With YYDEBUG defined */ #define yytoks Curl_gd_toks /* With YYDEBUG defined */
#define yylhs gd_yylhs #define yylhs Curl_gd_yylhs
#define yylen gd_yylen #define yylen Curl_gd_yylen
#define yydefred gd_yydefred #define yydefred Curl_gd_yydefred
#define yydgoto gd_yydgoto #define yydgoto Curl_gd_yydgoto
#define yysindex gd_yysindex #define yysindex Curl_gd_yysindex
#define yyrindex gd_yyrindex #define yyrindex Curl_gd_yyrindex
#define yygindex gd_yygindex #define yygindex Curl_gd_yygindex
#define yytable gd_yytable #define yytable Curl_gd_yytable
#define yycheck gd_yycheck #define yycheck Curl_gd_yycheck
static int yylex (); static int yylex ();
static int yyerror (); static int yyerror ();

View File

@@ -29,3 +29,4 @@ EXPORTS
curl_mvfprintf @ 20 ; curl_mvfprintf @ 20 ;
curl_strequal @ 21 ; curl_strequal @ 21 ;
curl_strnequal @ 22 ; curl_strnequal @ 22 ;

View File

@@ -356,11 +356,10 @@ Transfer(struct connectdata *c_conn)
/* /*
* end-of-headers. * end-of-headers.
* *
* If we requested a "no body" and this isn't a "close" * If we requested a "no body", this is a good time to get
* connection, this is a good time to get out and return * out and return home.
* home.
*/ */
if(!conn->bits.close && data->bits.no_body) if(data->bits.no_body)
return CURLE_OK; return CURLE_OK;
break; /* exit header line loop */ break; /* exit header line loop */
} }
@@ -423,6 +422,18 @@ Transfer(struct connectdata *c_conn)
conn->bits.close = FALSE; /* don't close when done */ conn->bits.close = FALSE; /* don't close when done */
infof(data, "HTTP/1.0 proxy connection set to keep alive!\n"); infof(data, "HTTP/1.0 proxy connection set to keep alive!\n");
} }
else if((httpversion == 0) &&
strnequal("Connection: keep-alive", p,
strlen("Connection: keep-alive"))) {
/*
* A HTTP/1.0 reply with the 'Connection: keep-alive' line
* tells us the connection will be kept alive for our
* pleasure. Default action for 1.0 is to close.
*
* [RFC2068, section 19.7.1] */
conn->bits.close = FALSE; /* don't close when done */
infof(data, "HTTP/1.0 connection set to keep alive!\n");
}
else if (strnequal("Connection: close", p, else if (strnequal("Connection: close", p,
strlen("Connection: close"))) { strlen("Connection: close"))) {
/* /*
@@ -736,6 +747,10 @@ CURLcode Curl_perform(CURL *curl)
struct UrlData *data = (struct UrlData *)curl; struct UrlData *data = (struct UrlData *)curl;
struct connectdata *conn=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 */
char *newurl = NULL; /* possibly a new URL to follow to! */
data->followlocation=0; /* reset the location-follow counter */
data->bits.this_is_a_follow = FALSE; /* reset this */
Curl_pgrsStartNow(data); Curl_pgrsStartNow(data);
@@ -746,11 +761,23 @@ CURLcode Curl_perform(CURL *curl)
res = Curl_do(conn); res = Curl_do(conn);
if(res == CURLE_OK) { if(res == CURLE_OK) {
res = Transfer(conn); /* now fetch that URL please */ res = Transfer(conn); /* now fetch that URL please */
if(res == CURLE_OK) if(res == CURLE_OK) {
/*
* We must duplicate the new URL here as the connection data
* may be free()ed in the Curl_done() function.
*/
newurl = conn->newurl?strdup(conn->newurl):NULL;
res = Curl_done(conn); res = Curl_done(conn);
} }
}
if((res == CURLE_OK) && conn->newurl) { /*
* Important: 'conn' cannot be used here, since it may have been closed
* in 'Curl_done' or other functions.
*/
if((res == CURLE_OK) && newurl) {
/* Location: redirect /* Location: redirect
This is assumed to happen for HTTP(S) only! This is assumed to happen for HTTP(S) only!
@@ -763,9 +790,6 @@ CURLcode Curl_perform(CURL *curl)
if (data->maxredirs && (data->followlocation >= data->maxredirs)) { if (data->maxredirs && (data->followlocation >= data->maxredirs)) {
failf(data,"Maximum (%d) redirects followed", data->maxredirs); failf(data,"Maximum (%d) redirects followed", data->maxredirs);
#ifdef USE_OLD_DISCONNECT
curl_disconnect(c_connect);
#endif
res=CURLE_TOO_MANY_REDIRECTS; res=CURLE_TOO_MANY_REDIRECTS;
break; break;
} }
@@ -790,7 +814,7 @@ CURLcode Curl_perform(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(conn->newurl, "%15[^:]://%c", prot, &letter)) { if(2 != sscanf(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!
@@ -803,19 +827,21 @@ CURLcode Curl_perform(CURL *curl)
char *pathsep; char *pathsep;
char *newest; char *newest;
/* we must make our own copy of the URL to play with, as it may
point to read-only data */
char *url_clone=strdup(data->url);
if(!url_clone)
return CURLE_OUT_OF_MEMORY;
/* protsep points to the start of the host name */ /* protsep points to the start of the host name */
protsep=strstr(data->url, "//"); protsep=strstr(url_clone, "//");
if(!protsep) if(!protsep)
protsep=data->url; protsep=url_clone;
else { else
port=FALSE; /* we got a full URL and thus we should not obey the
port number that might have been set by the user
in data->use_port */
protsep+=2; /* pass the slashes */ protsep+=2; /* pass the slashes */
}
if('/' != conn->newurl[0]) { if('/' != 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, '?');
@@ -836,16 +862,17 @@ CURLcode Curl_perform(CURL *curl)
*pathsep=0; *pathsep=0;
} }
newest=(char *)malloc( strlen(data->url) + newest=(char *)malloc( strlen(url_clone) +
1 + /* possible slash */ 1 + /* possible slash */
strlen(conn->newurl) + 1/* zero byte */); strlen(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, ('/' == conn->newurl[0])?"":"/", sprintf(newest, "%s%s%s", url_clone, ('/' == newurl[0])?"":"/",
conn->newurl); newurl);
free(conn->newurl); free(newurl);
conn->newurl = newest; free(url_clone);
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 */
@@ -856,8 +883,8 @@ CURLcode Curl_perform(CURL *curl)
free(data->url); free(data->url);
/* TBD: set the URL with curl_setopt() */ /* TBD: set the URL with curl_setopt() */
data->url = conn->newurl; data->url = newurl;
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);
@@ -871,7 +898,6 @@ CURLcode Curl_perform(CURL *curl)
switch(data->progress.httpcode) { switch(data->progress.httpcode) {
case 300: /* Multiple Choices */ case 300: /* Multiple Choices */
case 301: /* Moved Permanently */ case 301: /* Moved Permanently */
case 302: /* Found */
case 306: /* Not used */ case 306: /* Not used */
case 307: /* Temporary Redirect */ case 307: /* Temporary Redirect */
default: /* for all unknown ones */ default: /* for all unknown ones */
@@ -879,6 +905,24 @@ CURLcode Curl_perform(CURL *curl)
* seem to be OK to POST to. * seem to be OK to POST to.
*/ */
break; break;
case 302: /* Found */
/* (From 10.3.3)
Note: RFC 1945 and RFC 2068 specify that the client is not allowed
to change the method on the redirected request. However, most
existing user agent implementations treat 302 as if it were a 303
response, performing a GET on the Location field-value regardless
of the original request method. The status codes 303 and 307 have
been added for servers that wish to make unambiguously clear which
kind of reaction is expected of the client.
(From 10.3.4)
Note: Many pre-HTTP/1.1 user agents do not understand the 303
status. When interoperability with such clients is a concern, the
302 status code may be used instead, since most user agents react
to a 302 response as described here for 303.
*/
case 303: /* See Other */ case 303: /* See Other */
/* Disable both types of POSTs, since doing a second POST when /* Disable both types of POSTs, since doing a second POST when
* following isn't what anyone would want! */ * following isn't what anyone would want! */
@@ -902,24 +946,19 @@ CURLcode Curl_perform(CURL *curl)
*/ */
break; break;
} }
#ifdef USE_OLD_DISCONNECT
curl_disconnect(c_connect);
#endif
continue; continue;
} }
#ifdef USE_OLD_DISCONNECT
curl_disconnect(c_connect);
#endif
} }
break; /* it only reaches here when this shouldn't loop */ break; /* it only reaches here when this shouldn't loop */
} while(1); /* loop if Location: */ } while(1); /* loop if Location: */
if(conn->newurl) { if(newurl)
free(conn->newurl); free(newurl);
conn->newurl = NULL;
} /* make sure the alarm is switched off! */
if(data->timeout || data->connecttimeout)
myalarm(0);
return res; return res;
} }

View File

@@ -816,6 +816,9 @@ CURLcode Curl_disconnect(struct connectdata *conn)
free(conn->hostent_buf); free(conn->hostent_buf);
#endif #endif
if(conn->newurl)
free(conn->newurl);
if(conn->path) /* the URL path part */ if(conn->path) /* the URL path part */
free(conn->path); free(conn->path);
@@ -936,9 +939,11 @@ ConnectionExists(struct UrlData *data,
data->connects[i]=NULL; /* nothing here */ data->connects[i]=NULL; /* nothing here */
continue; /* try another one now */ continue; /* try another one now */
} }
}
*usethis = check; *usethis = check;
return TRUE; /* yes, we found one to use! */ return TRUE; /* yes, we found one to use! */
}
} }
else { /* The requested needle connection is using a proxy, else { /* The requested needle connection is using a proxy,
is the checked one using the same? */ is the checked one using the same? */
@@ -1397,6 +1402,8 @@ static CURLcode Connect(struct UrlData *data,
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
else if(strnequal(conn->gname, "HTTPS", 5)) else if(strnequal(conn->gname, "HTTPS", 5))
strcpy(conn->protostr, "https"); strcpy(conn->protostr, "https");
else if(strnequal(conn->gname, "FTPS", 4))
strcpy(conn->protostr, "ftps");
#endif /* USE_SSLEAY */ #endif /* USE_SSLEAY */
else if(strnequal(conn->gname, "TELNET", 6)) else if(strnequal(conn->gname, "TELNET", 6))
strcpy(conn->protostr, "telnet"); strcpy(conn->protostr, "telnet");
@@ -1666,8 +1673,19 @@ static CURLcode Connect(struct UrlData *data,
conn->curl_done = Curl_http_done; conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close; conn->curl_close = Curl_http_close;
} }
else if(strequal(conn->protostr, "FTP")) { else if(strequal(conn->protostr, "FTP") ||
strequal(conn->protostr, "FTPS")) {
char *type; char *type;
if(strequal(conn->protostr, "FTPS")) {
#ifdef USE_SSLEAY
conn->protocol |= PROT_FTPS;
#else
failf(data, "libcurl was built with SSL disabled, ftps: not supported!");
return CURLE_UNSUPPORTED_PROTOCOL;
#endif /* !USE_SSLEAY */
}
conn->port = (data->use_port && allow_port)?data->use_port:PORT_FTP; conn->port = (data->use_port && allow_port)?data->use_port:PORT_FTP;
conn->remote_port = PORT_FTP; conn->remote_port = PORT_FTP;
conn->protocol |= PROT_FTP; conn->protocol |= PROT_FTP;
@@ -1676,6 +1694,12 @@ static CURLcode Connect(struct UrlData *data,
!data->bits.tunnel_thru_httpproxy) { !data->bits.tunnel_thru_httpproxy) {
/* Unless we have asked to tunnel ftp operations through the proxy, we /* Unless we have asked to tunnel ftp operations through the proxy, we
switch and use HTTP operations only */ switch and use HTTP operations only */
if(conn->protocol & PROT_FTPS) {
/* FTPS is a hacked protocol and does not work through your
ordinary http proxy! */
failf(data, "ftps does not work through http proxy!");
return CURLE_UNSUPPORTED_PROTOCOL;
}
conn->curl_do = Curl_http; conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done; conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close; conn->curl_close = Curl_http_close;
@@ -2126,8 +2150,10 @@ CURLcode Curl_connect(struct UrlData *data,
/* We're not allowed to return failure with memory left allocated /* We're not allowed to return failure with memory left allocated
in the connectdata struct, free those here */ in the connectdata struct, free those here */
conn = (struct connectdata *)*in_connect; conn = (struct connectdata *)*in_connect;
if(conn) if(conn) {
Curl_disconnect(conn); /* close the connection */ Curl_disconnect(conn); /* close the connection */
*in_connect = NULL; /* return a NULL */
}
} }
return code; return code;
} }

View File

@@ -207,6 +207,7 @@ struct connectdata {
#define PROT_DICT (1<<6) #define PROT_DICT (1<<6)
#define PROT_LDAP (1<<7) #define PROT_LDAP (1<<7)
#define PROT_FILE (1<<8) #define PROT_FILE (1<<8)
#define PROT_FTPS (1<<9)
#ifdef ENABLE_IPV6 #ifdef ENABLE_IPV6
struct addrinfo *hp; /* host info pointer list */ struct addrinfo *hp; /* host info pointer list */
@@ -293,7 +294,6 @@ struct connectdata {
document headers */ document headers */
#ifdef KRB4 #ifdef KRB4
enum protection_level command_prot; enum protection_level command_prot;
enum protection_level data_prot; enum protection_level data_prot;
enum protection_level request_data_prot; enum protection_level request_data_prot;
@@ -553,10 +553,6 @@ struct UrlData {
char proxypasswd[MAX_CURL_PASSWORD_LENGTH]; char proxypasswd[MAX_CURL_PASSWORD_LENGTH];
char *krb4_level; /* what security level */ char *krb4_level; /* what security level */
#ifdef KRB4
FILE *cmdchannel;
#endif
struct timeval keeps_speed; /* this should be request-specific */ struct timeval keeps_speed; /* this should be request-specific */
/* 'connects' will be an allocated array with pointers. If the pointer is /* 'connects' will be an allocated array with pointers. If the pointer is

View File

@@ -8,7 +8,7 @@ WriteMakefile(
'NAME' => 'Curl::easy', 'NAME' => 'Curl::easy',
'VERSION_FROM' => 'easy.pm', # finds $VERSION 'VERSION_FROM' => 'easy.pm', # finds $VERSION
'LIBS' => ['-lcurl '], # e.g., '-lm' 'LIBS' => ['-lcurl '], # e.g., '-lm'
'DEFINE' => '', # e.g., '-DHAVE_SOMETHING' 'DEFINE' => '-Wall', # e.g., '-DHAVE_SOMETHING'
'INC' => '', # e.g., '-I/usr/include/other' 'INC' => '', # e.g., '-I/usr/include/other'
'clean' => {FILES => "head.out body.out"} 'clean' => {FILES => "head.out body.out"}
); );

View File

@@ -205,15 +205,15 @@ CODE:
if (option < CURLOPTTYPE_OBJECTPOINT) { if (option < CURLOPTTYPE_OBJECTPOINT) {
/* This is an option specifying an integer value: */ /* This is an option specifying an integer value: */
long value = (long)SvIV(ST(2)); long value = (long)SvIV(ST(2));
RETVAL = curl_setopt(curl, option, value); RETVAL = curl_easy_setopt(curl, option, value);
} else if (option == CURLOPT_FILE || option == CURLOPT_INFILE || } else if (option == CURLOPT_FILE || option == CURLOPT_INFILE ||
option == CURLOPT_WRITEHEADER) { option == CURLOPT_WRITEHEADER) {
/* This is an option specifying a FILE * value: */ /* This is an option specifying a FILE * value: */
FILE * value = IoIFP(sv_2io(ST(2))); FILE * value = IoIFP(sv_2io(ST(2)));
RETVAL = curl_setopt(curl, option, value); RETVAL = curl_easy_setopt(curl, option, value);
} else if (option == CURLOPT_ERRORBUFFER) { } else if (option == CURLOPT_ERRORBUFFER) {
SV *sv; SV *sv;
RETVAL = curl_setopt(curl, option, errbuf); RETVAL = curl_easy_setopt(curl, option, errbuf);
if (errbufvarname) free(errbufvarname); if (errbufvarname) free(errbufvarname);
errbufvarname = strdup(value); errbufvarname = strdup(value);
sv = perl_get_sv(errbufvarname, TRUE | GV_ADDMULTI); sv = perl_get_sv(errbufvarname, TRUE | GV_ADDMULTI);
@@ -224,7 +224,7 @@ CODE:
RETVAL = -1; RETVAL = -1;
} else { } else {
/* default, option specifying a char * value: */ /* default, option specifying a char * value: */
RETVAL = curl_setopt(curl, option, value); RETVAL = curl_easy_setopt(curl, option, value);
} }
OUTPUT: OUTPUT:
RETVAL RETVAL
@@ -252,19 +252,19 @@ CODE:
switch (option & CURLINFO_TYPEMASK) { switch (option & CURLINFO_TYPEMASK) {
case CURLINFO_STRING: { case CURLINFO_STRING: {
char * value = (char *)SvPV(ST(2), PL_na); char * value = (char *)SvPV(ST(2), PL_na);
RETVAL = curl_getinfo(curl, option, &value); RETVAL = curl_easy_getinfo(curl, option, &value);
sv_setpv(ST(2), value); sv_setpv(ST(2), value);
break; break;
} }
case CURLINFO_LONG: { case CURLINFO_LONG: {
long value = (long)SvIV(ST(2)); long value = (long)SvIV(ST(2));
RETVAL = curl_getinfo(curl, option, &value); RETVAL = curl_easy_getinfo(curl, option, &value);
sv_setiv(ST(2), value); sv_setiv(ST(2), value);
break; break;
} }
case CURLINFO_DOUBLE: { case CURLINFO_DOUBLE: {
double value = (double)SvNV(ST(2)); double value = (double)SvNV(ST(2));
RETVAL = curl_getinfo(curl, option, &value); RETVAL = curl_easy_getinfo(curl, option, &value);
sv_setnv(ST(2), value); sv_setnv(ST(2), value);
break; break;
} }

View File

@@ -11,7 +11,8 @@ elegantly used from within it. You can either invoke external curl command
line or use the curl interface. line or use the curl interface.
Georg Horn's Perl interface to curl is available in the Curl_easy/ Georg Horn's Perl interface to curl is available in the Curl_easy/
subdirectory. subdirectory. Using the Curl::easy module is just straightforward and
works much like using libcurl in a C programm, so please refer to the
documentation of libcurl. Have a look at test.pl to get an idea of how
to start.
Unfortunately, we don't have any examples nor any documentation for it at
this point.

View File

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

View File

@@ -2,4 +2,3 @@ HTTP/1.1 200 OK
Server: thebest/1.0 Server: thebest/1.0
Connection: close Connection: close
no?