Compare commits
329 Commits
curl-7_9_6
...
curl-7_10
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e2e64798b5 | ||
![]() |
b9b6a6566a | ||
![]() |
dc9e415602 | ||
![]() |
84fa12c885 | ||
![]() |
296b35fe9b | ||
![]() |
0ff89b9c3c | ||
![]() |
3b33540c99 | ||
![]() |
29d0174253 | ||
![]() |
cc7f2a0d08 | ||
![]() |
b1579aed2f | ||
![]() |
9247daf953 | ||
![]() |
9031e33b66 | ||
![]() |
1ee1f5f427 | ||
![]() |
a5874a5393 | ||
![]() |
969217c9d9 | ||
![]() |
e399502c7a | ||
![]() |
6883f0c49f | ||
![]() |
3fc2c813cc | ||
![]() |
9de4b99fc7 | ||
![]() |
24e7036822 | ||
![]() |
ec9acbcda7 | ||
![]() |
c0460660d5 | ||
![]() |
b03f4919fb | ||
![]() |
08620743b9 | ||
![]() |
41362f063a | ||
![]() |
5b3069e265 | ||
![]() |
b466924717 | ||
![]() |
cbc0f65fa3 | ||
![]() |
35089a4289 | ||
![]() |
aef3131e92 | ||
![]() |
342fce97af | ||
![]() |
fb5d267bd0 | ||
![]() |
c19844a0a3 | ||
![]() |
22cf05519a | ||
![]() |
511ce35631 | ||
![]() |
e9b7548dd6 | ||
![]() |
010cde0a4a | ||
![]() |
cac5251a98 | ||
![]() |
3b825bcbfb | ||
![]() |
31959fb24b | ||
![]() |
5e9675ad1e | ||
![]() |
084b7675b2 | ||
![]() |
ed8be5bc55 | ||
![]() |
efca2943a0 | ||
![]() |
371da7132f | ||
![]() |
9a3ff5c46a | ||
![]() |
b36c654a3d | ||
![]() |
ddeb2613ec | ||
![]() |
2d02d20911 | ||
![]() |
b2563b9f9f | ||
![]() |
fccf6925b1 | ||
![]() |
4a7cf65064 | ||
![]() |
56587e2821 | ||
![]() |
33b8e71583 | ||
![]() |
1c96128695 | ||
![]() |
ca516b1b26 | ||
![]() |
ba4e69bebc | ||
![]() |
de5e9f100c | ||
![]() |
955da86a3e | ||
![]() |
8d85be4c5e | ||
![]() |
93eadfb10f | ||
![]() |
f8e0b18439 | ||
![]() |
64bbe9dfaf | ||
![]() |
2e8a9416af | ||
![]() |
5dd40bd0bb | ||
![]() |
1822dd0549 | ||
![]() |
751e49fb0a | ||
![]() |
56c43604d0 | ||
![]() |
7438c378be | ||
![]() |
0e0caf7c06 | ||
![]() |
5644f4a295 | ||
![]() |
98e1605b17 | ||
![]() |
73f0e32d1a | ||
![]() |
713cb56fea | ||
![]() |
bd3bb70ee8 | ||
![]() |
8aa3f14303 | ||
![]() |
ac285b453e | ||
![]() |
daf55705e4 | ||
![]() |
7140baae72 | ||
![]() |
27a2e590cd | ||
![]() |
7172fa058a | ||
![]() |
c0790ccf08 | ||
![]() |
87c43517cd | ||
![]() |
6561ec524b | ||
![]() |
982c5460f0 | ||
![]() |
2a3a8848f3 | ||
![]() |
752520e428 | ||
![]() |
8095b776fe | ||
![]() |
e504103e2c | ||
![]() |
904183262a | ||
![]() |
2a0bc64226 | ||
![]() |
6b975c308c | ||
![]() |
74be55a477 | ||
![]() |
394832c2d6 | ||
![]() |
f636c12255 | ||
![]() |
03e4a8214c | ||
![]() |
6d7785a35b | ||
![]() |
904f579332 | ||
![]() |
a72d789b08 | ||
![]() |
87ad7ace18 | ||
![]() |
35153eb524 | ||
![]() |
c8ee1fa62e | ||
![]() |
5c1a6ed719 | ||
![]() |
9d68fde148 | ||
![]() |
c7d517f6d2 | ||
![]() |
183f1531d3 | ||
![]() |
6dfe0ec31e | ||
![]() |
8b3f1cebda | ||
![]() |
086daf913c | ||
![]() |
6a3e2272e9 | ||
![]() |
d0e0bf53a6 | ||
![]() |
0009e4dfb9 | ||
![]() |
30b7a9f172 | ||
![]() |
c74cb59e08 | ||
![]() |
c1f29a8e08 | ||
![]() |
cb895ec335 | ||
![]() |
2df4866cfa | ||
![]() |
423a1cf486 | ||
![]() |
7aeb63c817 | ||
![]() |
476fa1f4d2 | ||
![]() |
0bea215560 | ||
![]() |
3c20b98d99 | ||
![]() |
8bcdda29d4 | ||
![]() |
c88036405f | ||
![]() |
60cddab4f2 | ||
![]() |
411ca1c050 | ||
![]() |
d1be3a4a1d | ||
![]() |
b5dd257427 | ||
![]() |
4cf953678d | ||
![]() |
ca5678c8c1 | ||
![]() |
9e4594be53 | ||
![]() |
d16c757c28 | ||
![]() |
312bcafd05 | ||
![]() |
be24652d4d | ||
![]() |
6ab44d9439 | ||
![]() |
108cb14d1f | ||
![]() |
b98308b524 | ||
![]() |
215c445583 | ||
![]() |
20d8e32a58 | ||
![]() |
33306b2749 | ||
![]() |
94eeeba79a | ||
![]() |
ecd29a289a | ||
![]() |
e7d0af72e3 | ||
![]() |
fcb1d3521a | ||
![]() |
890bf3bd27 | ||
![]() |
dafd81178f | ||
![]() |
99dfdebc64 | ||
![]() |
c1cfdd6323 | ||
![]() |
264a9bc6ed | ||
![]() |
f79f5cbf82 | ||
![]() |
7313501e30 | ||
![]() |
d8b2c819e7 | ||
![]() |
69f6d14b81 | ||
![]() |
9f3856e646 | ||
![]() |
a46e2e9900 | ||
![]() |
14f0dd2dd0 | ||
![]() |
c051438fa1 | ||
![]() |
52e32ac1d3 | ||
![]() |
7f8ad34ba2 | ||
![]() |
a9c0302454 | ||
![]() |
a33e89b44a | ||
![]() |
e203ecebee | ||
![]() |
2f8e7f56b3 | ||
![]() |
2443e1f38c | ||
![]() |
eb164098b7 | ||
![]() |
62527fa98a | ||
![]() |
b9f8e80b14 | ||
![]() |
b79e250ed2 | ||
![]() |
fc5c9d8f17 | ||
![]() |
72d57a8ee6 | ||
![]() |
23262e30bc | ||
![]() |
8b4ad40ed6 | ||
![]() |
d7e9797365 | ||
![]() |
e54e0c7877 | ||
![]() |
5cb06d8fd6 | ||
![]() |
2b34d4e1f7 | ||
![]() |
c7aa095fac | ||
![]() |
93f1784526 | ||
![]() |
559dc503c2 | ||
![]() |
414afe0935 | ||
![]() |
4ad4f3fc70 | ||
![]() |
67273eed9b | ||
![]() |
3c63e1d8d9 | ||
![]() |
cae555c977 | ||
![]() |
407583e8e2 | ||
![]() |
131645dc31 | ||
![]() |
dafd644fe7 | ||
![]() |
73cc1742af | ||
![]() |
87afd7686f | ||
![]() |
8ce10b5dfa | ||
![]() |
943e31b35c | ||
![]() |
20f85b94df | ||
![]() |
17b784381e | ||
![]() |
e3031fddb9 | ||
![]() |
38c994a7ae | ||
![]() |
85e2e96fb6 | ||
![]() |
be35b3ad03 | ||
![]() |
dbbd871ea1 | ||
![]() |
813911db59 | ||
![]() |
3c49b405de | ||
![]() |
4cfffd6c4a | ||
![]() |
e9f1c12f0f | ||
![]() |
4fe252847c | ||
![]() |
109cbbe9c5 | ||
![]() |
fd3881eaa6 | ||
![]() |
08ef208fb7 | ||
![]() |
8c45e2a641 | ||
![]() |
25dc520163 | ||
![]() |
fc37ef9e4b | ||
![]() |
11ba367fc9 | ||
![]() |
78473f71eb | ||
![]() |
8b77f40f99 | ||
![]() |
d866716565 | ||
![]() |
307d0effe2 | ||
![]() |
b47b053e54 | ||
![]() |
b79f01caf3 | ||
![]() |
0db227f55e | ||
![]() |
ac48b38842 | ||
![]() |
0cbb9365c6 | ||
![]() |
798b8c522b | ||
![]() |
15bc7e19f9 | ||
![]() |
0be3f1a063 | ||
![]() |
c0257c6721 | ||
![]() |
9aec0fc7de | ||
![]() |
bce5e0d82c | ||
![]() |
62032ee248 | ||
![]() |
775645f29b | ||
![]() |
99c0456872 | ||
![]() |
0236bee5de | ||
![]() |
59c11b82d5 | ||
![]() |
98871d1e9e | ||
![]() |
b40dc5d742 | ||
![]() |
17b0723713 | ||
![]() |
ec585e8907 | ||
![]() |
0aeb25ff3b | ||
![]() |
a928f2c4aa | ||
![]() |
51fcee6f81 | ||
![]() |
654be65590 | ||
![]() |
105ec79b2b | ||
![]() |
c759d8427a | ||
![]() |
c7b03d6479 | ||
![]() |
2080738883 | ||
![]() |
48bc73c271 | ||
![]() |
3d0969d1d1 | ||
![]() |
323f195036 | ||
![]() |
c3c392fc98 | ||
![]() |
5d2944c211 | ||
![]() |
fe3ba1dd11 | ||
![]() |
0c00eb93a0 | ||
![]() |
baa77ec13b | ||
![]() |
9263652c6d | ||
![]() |
bc74375543 | ||
![]() |
edb1756050 | ||
![]() |
5215f6f654 | ||
![]() |
1913b4eeed | ||
![]() |
b44a4da5df | ||
![]() |
919878fbb2 | ||
![]() |
06bdf83419 | ||
![]() |
2ff2810a92 | ||
![]() |
20d9c1b30d | ||
![]() |
bbe10cb0cb | ||
![]() |
daba8f3a70 | ||
![]() |
1458c3668d | ||
![]() |
980a47b42b | ||
![]() |
f7ca561b06 | ||
![]() |
cacd756efd | ||
![]() |
8539e76cb9 | ||
![]() |
3bbf694d5a | ||
![]() |
44debdde62 | ||
![]() |
c6cf2b8e93 | ||
![]() |
69c5452b25 | ||
![]() |
d321056e8d | ||
![]() |
d9a1a59f22 | ||
![]() |
0b898b5a8a | ||
![]() |
a9e0885be0 | ||
![]() |
57ff28c9b7 | ||
![]() |
86cc34c0de | ||
![]() |
39028f1bd4 | ||
![]() |
71f4c05665 | ||
![]() |
9ef9797998 | ||
![]() |
ab9374de57 | ||
![]() |
913e997061 | ||
![]() |
8e50d6b6f3 | ||
![]() |
2db0744a7b | ||
![]() |
2de0028349 | ||
![]() |
35d04c5398 | ||
![]() |
b1becd0ed5 | ||
![]() |
bd9650bc81 | ||
![]() |
969a25d1b2 | ||
![]() |
f144f77ba7 | ||
![]() |
abea1f8910 | ||
![]() |
8eaa7fec76 | ||
![]() |
fdace647e8 | ||
![]() |
d7531c18fc | ||
![]() |
ef3f978784 | ||
![]() |
e410860e0e | ||
![]() |
c64fca1b0c | ||
![]() |
15b2a3af91 | ||
![]() |
8358505b6d | ||
![]() |
1c42779845 | ||
![]() |
32823f17e0 | ||
![]() |
e1c2e3f5e9 | ||
![]() |
044755b30f | ||
![]() |
9aa22399a8 | ||
![]() |
f564905ac4 | ||
![]() |
00e4f81446 | ||
![]() |
8927ddec16 | ||
![]() |
f6525ae200 | ||
![]() |
0be7944d66 | ||
![]() |
47819ea86e | ||
![]() |
96ce3461ad | ||
![]() |
8b6d555421 | ||
![]() |
3b9ef8dfc8 | ||
![]() |
db6d4bcf47 | ||
![]() |
471f1d694f | ||
![]() |
495f6f6bd3 | ||
![]() |
36e35b6f60 | ||
![]() |
192606bc4b | ||
![]() |
53a9fdf078 | ||
![]() |
ef436bdbe8 | ||
![]() |
72d722b07b | ||
![]() |
21fc402c01 | ||
![]() |
381f77756d | ||
![]() |
a386562d9a | ||
![]() |
2bc84fb163 | ||
![]() |
08f8917acb | ||
![]() |
62d205a2ec | ||
![]() |
29e873b12d | ||
![]() |
95f78080ab |
11
.cvsignore
Normal file
11
.cvsignore
Normal file
@@ -0,0 +1,11 @@
|
||||
config.log
|
||||
Makefile
|
||||
libtool
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
config.h
|
||||
config.status
|
||||
curl-config
|
||||
autom4te.cache
|
||||
depcomp
|
531
CHANGES
531
CHANGES
@@ -4,7 +4,536 @@
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
History of Changes
|
||||
Changelog
|
||||
|
||||
|
||||
Version 7.10 (1 Oct 2002)
|
||||
|
||||
Daniel (30 Sep 2002)
|
||||
- Modified the curl_version_info() proto and returned struct once again, and
|
||||
updated the man page accordingly.
|
||||
|
||||
- Cris Bailiff found out that the pre-releases crashed on name lookups on
|
||||
names such as "a:" or "baz:" (on Linux versions not being ipv6-enabled) due
|
||||
to some weird return codes from gethostbyname_r(). I'll blame the complete
|
||||
lack of docs in that department. Cris provided a fix, which I modified only
|
||||
slightly.
|
||||
|
||||
Daniel (27 Sep 2002)
|
||||
- After a suggestion from Christian Kurz to Debian curl package maintainer
|
||||
Domenico Andreoli, I made it possible to override the proxy environment
|
||||
variables better. Now, by setting -x "" you can explicitly tell libcurl to
|
||||
not use a proxy, no matter whan the environment variables say.
|
||||
|
||||
Version 7.10-pre4
|
||||
|
||||
Daniel (26 Sep 2002)
|
||||
- Extended curl_version_info() more and wrote a man page for it.
|
||||
|
||||
Daniel (25 Sep 2002)
|
||||
- libcurl could leak memory when downloading multiple files using http ranges.
|
||||
|
||||
- Walter J. Mack provided code and docs for the new curl_free() function that
|
||||
shall be used to free memory that is allocated by libcurl and returned back
|
||||
to the application, as curl_escape() and curl_unescape() do.
|
||||
|
||||
- Yarram Sunil pointed out a flaw in the multi interface where a failed
|
||||
connection didn't close down properly and thus a second transfer using the
|
||||
same handle failed.
|
||||
|
||||
- Andr<64>s Garc<72>a fixed a flaw that made (among other things) dict-fetches
|
||||
return a random value.
|
||||
|
||||
Daniel (24 Sep 2002)
|
||||
- Wez Furlong brought his initial patch that introduced curl_version_info().
|
||||
We might need to tweak it somewhat before release.
|
||||
|
||||
Daniel (20 Sep 2002)
|
||||
- Craig Markwardt fixed another Tru64 IP resolve problem.
|
||||
|
||||
Daniel (19 Sep 2002)
|
||||
- Dolbneff A.V and Spiridonoff A.V made the file:// code work with resumes
|
||||
in the same style other code does.
|
||||
|
||||
- Ilguiz Latypov fixed a flaw in the client code when fetching multiple URLs
|
||||
and -C - was used. The first file's resume position was then accidentally
|
||||
reused on all the other files too.
|
||||
|
||||
Daniel (18 Sep 2002)
|
||||
- The curl_easy_setopt.3 man page was greatly modified and the options have
|
||||
now been grouped in logical groups so that it should be somewhat easier to
|
||||
read it and find things you search for.
|
||||
|
||||
Daniel (13 Sep 2002)
|
||||
- Kevin Roth pinpointed a scary flaw in libcurl, when the HTTP server doesn't
|
||||
send any headers back, only raw content. Right, that is a violation of the
|
||||
standard but still happens at times and we need to deal with it. Test case
|
||||
306 was added to verify that we do right now.
|
||||
|
||||
Version 7.10-pre3
|
||||
|
||||
Daniel (11 Sep 2002)
|
||||
- Lukasz Czekierda found out that curl didn't send a correct HTTP Host: header
|
||||
when you specified the URL with an IPv6 IP-address.
|
||||
|
||||
Daniel (4 Sep 2002)
|
||||
- Sven Neuhaus made --silent being acknowledged even when multiple URLs
|
||||
were used. It used to output "[1/2]: http://host/a.html.de --> a.html.d" etc
|
||||
even when told to shut up.
|
||||
|
||||
Daniel (3 Sep 2002)
|
||||
- Updated all source code headers to use MIT-license references only, and
|
||||
point to the COPYING file and the http://curl.haxx.se/docs/copyright.html
|
||||
URL. I've cut out all references to MPL that I could find.
|
||||
|
||||
- Corected the makefiles to not always use -lz when linking
|
||||
|
||||
Version 7.10-pre2
|
||||
|
||||
Daniel (2 Sep 2002)
|
||||
- James Gallagher added Content-Encoding support to libcurl so now curl and
|
||||
libcurl-using apps can request compressed contents using the 'deflate'
|
||||
method. See the special file lib/README.encoding for details.
|
||||
|
||||
curl --compressed is now used to request compressed contents.
|
||||
|
||||
curl-config --feature will include 'libz' if this feature was around when
|
||||
the library was built.
|
||||
|
||||
Daniel (30 Aug 2002)
|
||||
- Applied an anonymous SOCKS5-proxy patch. Not properly working in all
|
||||
situations though, as all getaddrinfo()-using libcurls will fail on this.
|
||||
This is because of the somewhat naive way the current code tries to extract
|
||||
the IP address of the proxy.
|
||||
|
||||
- Fixed up the SSL cert fixes from the other day even more after more inputs
|
||||
from Cris. Added three new SSL error codes to make the
|
||||
CURLE_SSL_CONNECT_ERROR slightly less overloaded.
|
||||
|
||||
Daniel (27 Aug 2002)
|
||||
- After lots of talk with Tom Zerucha, Nick Gimbrone and Cris Bailiff I
|
||||
decided to talk the bold path and I now made libcurl do CA certificate
|
||||
verification by default. Thus library users need to explicitly turn this off
|
||||
if you want to connect to sites without proper checking. We also install a
|
||||
CA cert bundle on 'make install' now.
|
||||
|
||||
The curl tool now requires the -k/--insecure option in order to allow
|
||||
connections and operations on SSL sites that aren't properly verified with
|
||||
-cafile or --capath.
|
||||
|
||||
curl-config --ca displays the built-in path to the CA cert bundle.
|
||||
|
||||
Daniel (26 Aug 2002)
|
||||
- Andrew Francis cleaned up some code that now compiles fine without the need
|
||||
for ugly MSVC pragmas.
|
||||
|
||||
- Keith MacDonald found a minor bug in src/main.c that made it close stdin
|
||||
instead of the actual file handle. It shouldn't have resulted in much
|
||||
trouble as most operating systems close all file handles on process exit
|
||||
anyway.
|
||||
|
||||
Daniel (22 Aug 2002)
|
||||
- Markus Oberhumer provided some documentation for his previously provided
|
||||
CURLOPT_NOSIGNAL fix.
|
||||
|
||||
- Patched the lib/Makefile.am to hopefully no longer complain on undefined
|
||||
symbols that seemed to occur on builds with shared OpenSSL libraries on
|
||||
Solaris lately...
|
||||
|
||||
Daniel (20 Aug 2002)
|
||||
- Fixed compiler warnings on MSCV++ compiles. We're looking for help here:
|
||||
remove the pragmas from lib/config-win32.h and adjust the sources where
|
||||
the warnings occur. Hiding them with pragmas like this is not the correct
|
||||
way of dealing with compiler warnings.
|
||||
|
||||
Daniel (13 Aug 2002)
|
||||
- Ulrich Zadow made the global include files in curl/* include themselves
|
||||
using "curl.h" instead of <curl/curl.h> which thus allows people to more
|
||||
freely decide how to include curl and how to setup their include paths.
|
||||
|
||||
- Sterling Hughes added the curl_share* interface, somewhat as discussed
|
||||
previously.
|
||||
|
||||
- J<>rn Hartroth pointed out that poll() was used in the pre1 source code and
|
||||
it isn't very portable, so now I check for it in the configure script and
|
||||
work around it.
|
||||
|
||||
Version 7.9.9-pre1
|
||||
|
||||
Daniel (12 Aug 2002)
|
||||
- Applied my initial take on making the multi stuff more asynchronous. Connects
|
||||
should now return back without "hanging" until it has connected for real.
|
||||
This should also be the case for FTP-PASV connects.
|
||||
|
||||
Daniel (9 Aug 2002)
|
||||
- Applied Markus F.X.J. Oberhumer's patch that introduces CURLOPT_NOSIGNAL,
|
||||
which effectively prevents libcurl from doing anything that may cause
|
||||
signals to get sent. This is basicly for multi-threaded applications that
|
||||
now can use timeouts properly, without risking any signals to burst in and
|
||||
ruin the party.
|
||||
|
||||
Daniel (5 Aug 2002)
|
||||
- Lukasz Czekierda reported that RFC2732-style literal IPv6 addresses didn't
|
||||
work. When did that code vanish? Anyway, it's back again now and seems to
|
||||
work!
|
||||
|
||||
- Jonatan Lander found out that POSTing an empty string didn't work with the
|
||||
command line tool.
|
||||
|
||||
Daniel (3 Aug 2002)
|
||||
- J<>rn Hartroth fixed the libcurl.def file to build the windows DLL with
|
||||
the multi interface enabled.
|
||||
|
||||
Daniel (1 Aug 2002)
|
||||
- The ftp PORT command now uses a better default IP address, as it will
|
||||
extract and use the local IP address used by the control connection.
|
||||
|
||||
- Modified the #include lines in curl/multi.h to work better on more
|
||||
platforms.
|
||||
|
||||
Daniel (31 Jul 2002)
|
||||
- Attempted a fix for Ray DeGennaro's reported HP-UX host name resolve
|
||||
problems.
|
||||
|
||||
Daniel (30 Jul 2002)
|
||||
- Priya Ramakrishnan and Ryan Jones compiles curl/curl.h with a C++ compiler
|
||||
and don't get __STDC__ defined, which required us to extend the preprocessor
|
||||
check for the ## operator usage.
|
||||
|
||||
- Correct the description for CURLOPT_PASSWDFUNCTION, if set to NULL the
|
||||
internal default function will be put back.
|
||||
|
||||
- danfuzz at milk.com found out that libcurl badly assumed a space after
|
||||
'Set-Cookie:' so if it wasn't present, it caused the first letter of the
|
||||
cookie name to fall off!
|
||||
|
||||
Daniel (29 Jul 2002)
|
||||
- The password prompt asking for user password used stdout and now uses
|
||||
stderr instead to better allow redirecting. It also leaked a fopen() file
|
||||
handle that is now fixed.
|
||||
|
||||
Daniel (28 Jul 2002)
|
||||
- HAVE_SETVBUF was left out from src/main.c which made -N not work. Found out
|
||||
by M T.
|
||||
|
||||
Daniel (26 Jun 2002)
|
||||
- Glen Nakamura solved a crash in the name resolving function for IP-only
|
||||
addresses on Alpha Linux (at least).
|
||||
|
||||
- T. Bharath corrected the high resolution timer introduced in 7.9.8.
|
||||
|
||||
Daniel (22 Jun 2002)
|
||||
- Andr<64>s Garc<72>a pointed out man page errors in curl_formadd.3. I fixed.
|
||||
|
||||
Daniel (19 Jun 2002)
|
||||
- Chris Combes pointed out a flaw in curl_escape(). I fixed. We no longer
|
||||
tries to generate nor parse '+' in URLs. Spaces become %20, and only %-codes
|
||||
are translated by curl_unescape().
|
||||
|
||||
Daniel (15 Jun 2002)
|
||||
- Added --limit-rate to the curl tool. Allows the user to set a maxmimum
|
||||
upper limit to how much bandwidth to use for transfers.
|
||||
|
||||
- CURLOPT_BUFFERSIZE was added to libcurl. This sets a prefered size for the
|
||||
receive buffer in libcurl. The main point of this would be that the write
|
||||
callback gets called more often and with smaller chunks.
|
||||
|
||||
Daniel (14 Jun 2002)
|
||||
- Yarram Sunil found out that the SocketIsDead() function performed a lot
|
||||
faster on Windows when removing the 1 microsecond timeout.
|
||||
|
||||
- Hanno L. Kranzhoff fixed the VC++ project files.
|
||||
|
||||
- Tom Mattison found out that ftp transfers closed the connection a little
|
||||
too often.
|
||||
|
||||
- Miklos Nemeth posted a VC++ makefile fix and some INSTALL comments on how
|
||||
to disable specific protocols when building for Windows.
|
||||
|
||||
Version 7.9.8
|
||||
|
||||
Daniel (13 Jun 2002)
|
||||
- Time to let this baby go.
|
||||
|
||||
Daniel (12 Jun 2002)
|
||||
- Chris Combes added three new options for curl_formadd(): CURLFORM_BUFFER,
|
||||
CURLFORM_BUFFERPTR, CURLFORM_BUFFERLENGTH. They are used to create a
|
||||
multipart that appears as a regular file upload, but the data is provided
|
||||
with a pointer and length.
|
||||
|
||||
- Nico Baggus made the VMS version use sigsetjmp() too.
|
||||
|
||||
- J<>rn Hartroth fixed the mingw32 build using the mm lib.
|
||||
|
||||
- Applied patches by Kris Kennaway that correct format string problems in
|
||||
lib/ftp.c and lib/ldap.c.
|
||||
|
||||
Version 7.9.8-pre3
|
||||
|
||||
Daniel (11 Jun 2002)
|
||||
- James Cone brought the idea of using sigsetjmp() in the signal handler to
|
||||
make the time-out of name lookups to work, even when the underlying name
|
||||
resolver library traps EINTR. The use of sigsetjmp() and siglongjmp() for
|
||||
this may be a bit drastic, and also not likely to exist on all platforms. I
|
||||
added careful checking for this in the configure script, even checks for it
|
||||
being a macro (which seems to be the case in for example Linux).
|
||||
|
||||
sigsetjmp() seems to be mentioned in the Single Unix specification.
|
||||
|
||||
- Miklos Nemeth brought a patch that allows libcurl to get built with specific
|
||||
protocols disabled. This is done by running ./configure
|
||||
--disable-[protocol].
|
||||
|
||||
- FTP range downloads could make CURLE_FTP_WRITE_ERROR get returned. We now
|
||||
make precautions to not return this for range downloads.
|
||||
|
||||
Added test case 135 that makes an ftp range download. Had to tweak the
|
||||
runtests.pl script a bit too.
|
||||
|
||||
- Bug report #566835 identified a strlen() on a NULL pointer. Added additional
|
||||
check to prevent this.
|
||||
|
||||
Daniel (10 Jun 2002)
|
||||
- Found and corrected a connect failure problem that didn't create a human
|
||||
error text.
|
||||
|
||||
- Added code to compile with OpenSSL 0.9.7. Based on patch from Jacob Meuser
|
||||
and comments from G<>tz Babin-Ebell.
|
||||
|
||||
- Gautam Mani found a socket descriptor leak that happened when FTP transfers
|
||||
failed and you reinvoked curl_easy_perform().
|
||||
|
||||
Daniel (5 Jun 2002)
|
||||
- Gustaf Hui corrected curl_multi_remove_handle() so that it won't crash no
|
||||
matter when you decide to remove the CURL handle.
|
||||
|
||||
- HAVE_RAND_STATUS was added to lib/config-win32.h by Andreas Olsson, as it
|
||||
makes windows builds stop complaining about "weak seeding" when it in fact
|
||||
isn't.
|
||||
|
||||
- Another 64bit architecture crash that was introduced in 7.9.7 was now
|
||||
removed, as bug report #564585 clarified. This happened due to our attempts
|
||||
to only allocate only as much memory as is actually needed for name
|
||||
resolving (using realloc) which called for a function that could 'move' a
|
||||
hostent struct in memory.
|
||||
|
||||
Version 7.9.8-pre2
|
||||
|
||||
Daniel (3 Jun 2002)
|
||||
- T. Bharath fixed the CURLINFO_REDIRECT_TIME to return a correct time and
|
||||
made the CURLINFO_REQUEST_SIZE return the correct total request size. He
|
||||
also made the win32 timers use higher resolution than before.
|
||||
|
||||
Daniel (29 May 2002)
|
||||
- Renaud Chaillat made me aware of the fact that libcurl returned an error if
|
||||
you tried to get an empty FTP file. This seemed like a wrong thing to do, so
|
||||
now it no longer does that! I just hope that no one built anything fancy
|
||||
upon this unexpected behavior...
|
||||
|
||||
Daniel (28 May 2002)
|
||||
- Cris Bailiff brought CURLOPT_CAPATH that works like CURLOPT_CAINFO but
|
||||
specifies a path to a directory with certificates rather than a single file
|
||||
with them all concatenated. --capath was added to the command line tool
|
||||
for the same function.
|
||||
|
||||
Windows users need to pay attention that the directory should be setup with
|
||||
the c_rehash tool of the OpenSSL package, and that creates symlinks by
|
||||
default that need to be replaced with actual copies to work on Windows.
|
||||
|
||||
- Gustaf Hui provided new code that changes how curl_multi_info_read()
|
||||
messages are stored, so that they don't have to be kept around for the multi
|
||||
handle's entire life time. He also made it return failure codes properly
|
||||
which it didn't do before.
|
||||
|
||||
Daniel (27 May 2002)
|
||||
- Gustaf Hui pointed out that running curl_multi_perform() without doing
|
||||
curl_multi_fdset() first was not really a working combo. I added an internal
|
||||
check for this and have some extra select() code without timeout to make the
|
||||
library internals work identically nevertheless. We might need to somehow
|
||||
either document that once you've used the *_fdset() you should remain using
|
||||
them in select() or you should blank them somehow so that libcurl won't go
|
||||
crazy.
|
||||
|
||||
Version 7.9.8-pre1
|
||||
|
||||
Daniel (22 May 2002)
|
||||
- James Cone brought an excellent patch, including several tests and docs!
|
||||
CURLOPT_NETRC now takes an enum as argument instead of the previous boolean.
|
||||
--netrc-optional was introduced as an addition to --netrc to allow the
|
||||
command line client to take use of all that new netrc stuff.
|
||||
|
||||
- Bug report #558888 showed a case where libcurl re-used the previous host
|
||||
name when a connection over a proxy was re-used but to a different target
|
||||
host.
|
||||
|
||||
Daniel (21 May 2002)
|
||||
- Edin Kadribasic helped me sort out a problem to made libcurl crash when
|
||||
trying to HTTP POST an empty string.
|
||||
|
||||
- Clarified that Juergen Wilke donated the original tests/server/sws.c code.
|
||||
|
||||
- Jean-Philippe Barrette-LaPierre made curl_formadd() return a typedef named
|
||||
CURLFORMcode instead of the previous 'int', and the various return codes are
|
||||
now globally exported. It allows applications to better figure out what goes
|
||||
wrong when curl_formadd() returns errors.
|
||||
|
||||
Daniel (20 May 2002)
|
||||
- Roland Zimmermann pointed out that SSL_CTX_use_certificate_chain_file()
|
||||
is prefered to SSL_CTX_use_certificate_file().
|
||||
|
||||
Daniel (17 May 2002)
|
||||
- Bug report #556869 pointed out that src/writeout.c didn't compile on freebsd
|
||||
after my AIX fixes the other week.
|
||||
|
||||
- Bug report #556930 pointed out a FreeBSD core dump introduced in 7.9.7 in
|
||||
the DNS struct realloc stuff. Actually, this crash could happen on all
|
||||
systems that made the pack_hostent() function get invoked.
|
||||
|
||||
- I removed several compiler warnings in the test suite's HTTP server.
|
||||
|
||||
Version 7.9.7
|
||||
|
||||
Daniel (10 May 2002)
|
||||
- Kevin Roth adjusted the --trace-ascii output slightly.
|
||||
|
||||
- Paul Harrington found out that src/writeout.c needed an additional header
|
||||
file included for AIX builds
|
||||
|
||||
Version 7.9.7-pre2
|
||||
|
||||
Daniel (7 May 2002)
|
||||
- Updated the man page with --trace-ascii and -j/--junk-session-cookies.
|
||||
|
||||
- Made --trace-ascii do pretty much the same as --trace but without the hex
|
||||
part in the output.
|
||||
|
||||
- Added CURLOPT_COOKIESESSION that when enabled makes libcurl ignore session
|
||||
cookies read from a file. This option is enforced by the curl command line
|
||||
tool using the new -j/--junk-session-cookies option. After discussions with
|
||||
Kevin Roth. This makes it easier to use curl to fully emulate a browser's
|
||||
behavior, even when it comes to "session cookies". Session cookies are
|
||||
cookies that a normal browser discards when the browser is shut
|
||||
down. They're identified by not having any expire date/time.
|
||||
|
||||
- When CURLOPT_DEBUGDATA was set, it ruined the CURLOPT_STDERR setting and
|
||||
this was discovered when --trace was made to crash.
|
||||
|
||||
- Using -v and --trace at the same time confused matters. -v is now pretty
|
||||
much ignored when --trace or --trace-ascii is used.
|
||||
|
||||
- Made --trace (and --trace-ascii) support - as file name to pass output to
|
||||
stdout instead. It makes it consistent with how other options work.
|
||||
|
||||
Version 7.9.7-pre1
|
||||
|
||||
Daniel (6 May 2002)
|
||||
- Added multi-post.c to the examples directory. I got the basic source for
|
||||
this from Gustaf Hui.
|
||||
|
||||
Daniel (3 May 2002)
|
||||
- CURL_MAX_WRITE_SIZE is now an exported #define in the curl/curl.h header and
|
||||
can be used to figure out the maximum buffer size your write callback can
|
||||
get.
|
||||
|
||||
- CURLOPT_READDATA is now an alias for CURLOPT_INFILE and CURLOPT_WRITEDATE is
|
||||
an alias for CURLOPT_FILE. These two were added for conformity. Most other
|
||||
callback function's userdata are provided with options using a similar name-
|
||||
scheme.
|
||||
|
||||
- Added "--trace [file]" to the command line tool. It makes a very detailed
|
||||
trace dump get stored, with a full protocol dump that includes all received
|
||||
and transmitted data. This could be a very effective tool for debugging what
|
||||
goes wrong. This dump includes every byte the way it is sent to/received
|
||||
from the server. The dump is the plain-text version, so SSL transfers will
|
||||
still be readable.
|
||||
|
||||
- I found out that the DEBUGFUNCTION was not called properly everywhere as we
|
||||
wanted it to. I fixed it.
|
||||
|
||||
- -D now stores all headers to the same file if multiple URLs are given on the
|
||||
command line! Kevin Roth made me aware of that it didn't already do this!
|
||||
|
||||
- Gustaf Hui wrote an excellent formpost example that used the multi
|
||||
interface. Unfortunately, it didn't work due to several bugs in how
|
||||
transfers were made when the multi interface was used.
|
||||
|
||||
Daniel (2 May 2002)
|
||||
- Hanno Kranzhoff found out that when doing multiple transfers on the same
|
||||
easy handle, the progress meter would show a bad "currently downloaded
|
||||
value" when the transfer starts.
|
||||
|
||||
Daniel (1 May 2002)
|
||||
- Applied another patch by Jacky Lam to make the name resolve info realloc()
|
||||
stuff work properly.
|
||||
|
||||
Daniel (28 April 2002)
|
||||
- curl_multi_info_read() is now implemented!
|
||||
|
||||
Daniel (27 April 2002)
|
||||
- Updated BUGS, TODO, FAQ, INSTALL and added BINDINGS.
|
||||
|
||||
- I think I fixed the DNS cache prune crach Jacky Lam found and reported.
|
||||
|
||||
- I cleaned up the name prefix stuff in the hash and llist modules.
|
||||
|
||||
- FTP responses should now be better on timing out properly. The timeout value
|
||||
is maximum timeout for the entire request operation, but before this, the
|
||||
timeout was used as a maximum allowed time between two reads...
|
||||
|
||||
Daniel (26 April 2002)
|
||||
- Fixed the test suite http server to not use snprintf() anymore due to better
|
||||
portability.
|
||||
|
||||
Daniel (25 April 2002)
|
||||
- With Sterling Hughes' new DNS pruning, Jacky Lam asked if this wouldn't
|
||||
cause problems since the pruning is only checking the entry time, and it
|
||||
sure could cause problems. Therefor, I've now added and changed code so that
|
||||
this should not be a problem. Nowhere in the code will be store name
|
||||
resolved information around so that a sunsequent DNS cache prune should
|
||||
cause a problem. This of course called for some mild internal changes.
|
||||
|
||||
Daniel (23 April 2002)
|
||||
- Improved the 'no_proxy' check, as using port numbers in the URL confused it
|
||||
previously. Reported by Erwan Legrand in bug report #547484.
|
||||
|
||||
- The --interface option now works even on IPv6 enabled builds. Reported by
|
||||
'thor'.
|
||||
|
||||
Daniel (22 April 2002)
|
||||
- The #defines names starting with TIMECOND now has CURL_ prefixes. (The old
|
||||
names are still #defined too.) Pointed out by Robert Olson.
|
||||
|
||||
- Jacky Lam brought code that lets the name resolve function only use as much
|
||||
memory as it actually needs. This only works on certain operating systems,
|
||||
but is totally transparant to all users.
|
||||
|
||||
Daniel (19 April 2002)
|
||||
- Bjorn Reese fixed pack_hostent to work properly with 64 bit pointers.
|
||||
|
||||
Daniel (18 April 2002)
|
||||
- Sterling Hughes added code to prune old DNS cache entries, since Jacky Lam
|
||||
experienced very big caches.
|
||||
|
||||
Daniel (17 April 2002)
|
||||
- Dirk Manske patched the 301 response to work against the RFC but more like
|
||||
common browsers do. If a POST get a 301 back, it'll switch to GET in the
|
||||
next request (if location-following is enabled).
|
||||
|
||||
Daniel (16 April 2002)
|
||||
- Dirk Manske posted a patch originally written by Ingo Wilken that introduced
|
||||
two new CURLINFO_* values: CURLINFO_REDIRECT_TIME and
|
||||
CURLINFO_REDIRECT_COUNT.
|
||||
|
||||
Daniel (15 April 2002)
|
||||
- Jonatan Lander patched the verbose text 'Disables POST, goes with GET' to
|
||||
reflect reality better, like when the first request isn't POST and when
|
||||
the second isn't GET... :-)
|
||||
|
||||
- Craig Davison pointed out that when curl_formadd()ing a file that doesn't
|
||||
exist, libcurl doesn't return error. Now, curl_easy_perform() will return
|
||||
CURLE_READ_ERROR if that is the case. Test 41 was added to verify this.
|
||||
|
||||
Version 7.9.6
|
||||
|
||||
Daniel (14 April 2002)
|
||||
- Dirk Manske brought a fix that makes libcurl strip off white spaces from the
|
||||
|
21
COPYING
Normal file
21
COPYING
Normal file
@@ -0,0 +1,21 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1996 - 2002, Daniel Stenberg, <daniel@haxx.se>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright
|
||||
notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization of the copyright holder.
|
2
LEGAL
2
LEGAL
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 1998-2001, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
Copyright (C) 1998-2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license
|
||||
document, but changing it is not allowed.
|
||||
|
22
MITX.txt
22
MITX.txt
@@ -1,27 +1,21 @@
|
||||
COPYRIGHT AND PERMISSION NOTICE
|
||||
|
||||
Copyright (c) 1996 - 2001, Daniel Stenberg, <daniel@haxx.se>.
|
||||
Copyright (c) 1996 - 2002, Daniel Stenberg, <daniel@haxx.se>.
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, and/or sell copies of the
|
||||
Software, and to permit persons to whom the Software is furnished to do so,
|
||||
provided that the above copyright notice(s) and this permission notice appear
|
||||
in all copies of the Software.
|
||||
Permission to use, copy, modify, and distribute this software for any purpose
|
||||
with or without fee is hereby granted, provided that the above copyright
|
||||
notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN
|
||||
NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE
|
||||
LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY
|
||||
DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of a copyright holder shall not
|
||||
be used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization of the copyright holder.
|
||||
|
||||
|
@@ -4,9 +4,8 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = \
|
||||
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
|
||||
reconf Makefile.dist curl-config.in build_vms.com curl-mode.el
|
||||
EXTRA_DIST = CHANGES COPYING maketgz UPGRADE reconf Makefile.dist \
|
||||
curl-config.in build_vms.com curl-mode.el
|
||||
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
@@ -63,7 +62,7 @@ rpm:
|
||||
pkgadd:
|
||||
umask 022 ; \
|
||||
make install DESTDIR=`/bin/pwd`/packages/Solaris/root ; \
|
||||
cat LEGAL MITX.txt MPL-1.1.txt > $(srcdir)/packages/Solaris/copyright ; \
|
||||
cat COPYING > $(srcdir)/packages/Solaris/copyright ; \
|
||||
cd $(srcdir)/packages/Solaris && $(MAKE) package
|
||||
|
||||
#
|
||||
|
@@ -34,12 +34,12 @@ borland:
|
||||
cd src & make -f Makefile.b32
|
||||
|
||||
mingw32:
|
||||
cd lib & make -f Makefile.m32
|
||||
cd src & make -f Makefile.m32
|
||||
cd lib & make -f Makefile.m32 ZLIB=1
|
||||
cd src & make -f Makefile.m32 ZLIB=1
|
||||
|
||||
mingw32-ssl:
|
||||
cd lib & make -f Makefile.m32 SSL=1
|
||||
cd src & make -f Makefile.m32 SSL=1
|
||||
cd lib & make -f Makefile.m32 SSL=1 ZLIB=1
|
||||
cd src & make -f Makefile.m32 SSL=1 ZLIB=1
|
||||
|
||||
vc:
|
||||
cd lib
|
||||
|
34
UPGRADE
Normal file
34
UPGRADE
Normal file
@@ -0,0 +1,34 @@
|
||||
Upgrading to curl/libcurl 7.10 from any previous version
|
||||
========================================================
|
||||
|
||||
libcurl 7.10 performs peer SSL certificate verification by default. This is
|
||||
done by installing a default CA cert bundle on 'make install' (or similar),
|
||||
that CA bundle package is used by default on operations against SSL servers.
|
||||
|
||||
Alas, if you communicate with HTTPS servers using certifcates that are signed
|
||||
by CAs present in the bundle, you will not notice any changed behavior and you
|
||||
will seeminglessly get a higher security level on your SSL connections since
|
||||
can be sure that the remote server really is the one it claims to be.
|
||||
|
||||
If the remote server uses a self-signed certificate, or if you don't install
|
||||
curl's CA cert bundle or if it uses a certificate signed by a CA that isn't
|
||||
included in the bundle, then you need to do one of the following:
|
||||
|
||||
1. Tell libcurl to *not* verify the peer. With libcurl you disable with with
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
|
||||
With the curl command tool, you disable this with -k/--insecure.
|
||||
|
||||
2. Get a CA certificate that can verify the remote server and use the proper
|
||||
option to point out this CA cert for verification when connecting. For
|
||||
libcurl hackers: curl_easy_setopt(curl, CURLOPT_CAPATH, capath);
|
||||
|
||||
With the curl command tool: --cacert [file]
|
||||
|
||||
This upgrade procedure has been deemed The Right Thing even though it adds
|
||||
this extra trouble for some users, since it adds security to a majority of the
|
||||
SSL connections that previously weren't really secure.
|
||||
|
||||
It turned out many people were using previous versions of curl/libcurl without
|
||||
realizing the need for the CA cert options to get truly secure SSL
|
||||
connections.
|
24
acconfig.h
24
acconfig.h
@@ -64,3 +64,27 @@
|
||||
|
||||
/* Define this to 'int' if in_addr_t is not an available typedefed type */
|
||||
#undef in_addr_t
|
||||
|
||||
/* Define to disable DICT */
|
||||
#undef CURL_DISABLE_DICT
|
||||
|
||||
/* Define to disable FILE */
|
||||
#undef CURL_DISABLE_FILE
|
||||
|
||||
/* Define to disable FTP */
|
||||
#undef CURL_DISABLE_FTP
|
||||
|
||||
/* Define to disable GOPHER */
|
||||
#undef CURL_DISABLE_GOPHER
|
||||
|
||||
/* Define to disable HTTP */
|
||||
#undef CURL_DISABLE_HTTP
|
||||
|
||||
/* Define to disable LDAP */
|
||||
#undef CURL_DISABLE_LDAP
|
||||
|
||||
/* Define to disable TELNET */
|
||||
#undef CURL_DISABLE_TELNET
|
||||
|
||||
/* Define if you have zlib present */
|
||||
#undef HAVE_LIBZ
|
||||
|
213
configure.in
213
configure.in
@@ -8,7 +8,7 @@ AC_PREREQ(2.50)
|
||||
dnl First some basic init macros
|
||||
AC_INIT
|
||||
AC_CONFIG_SRCDIR([lib/urldata.h])
|
||||
AM_CONFIG_HEADER(lib/config.h src/config.h tests/server/config.h)
|
||||
AM_CONFIG_HEADER(lib/config.h src/config.h tests/server/config.h lib/ca-bundle.h)
|
||||
|
||||
dnl figure out the libcurl version
|
||||
VERSION=`sed -ne 's/^#define LIBCURL_VERSION "\(.*\)"/\1/p' ${srcdir}/include/curl/curl.h`
|
||||
@@ -56,24 +56,117 @@ dnl AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
dnl ************************************************************
|
||||
dnl lame option to switch on debug options
|
||||
dnl switch off particular protocols
|
||||
dnl
|
||||
AC_MSG_CHECKING([whether to enable debug options])
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable pedantic debug options
|
||||
--disable-debug Disable debug options],
|
||||
AC_MSG_CHECKING([whether to support http])
|
||||
AC_ARG_ENABLE(http,
|
||||
[ --enable-http Enable HTTP support
|
||||
--disable-http Disable HTTP support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_HTTP)
|
||||
AC_MSG_WARN([disable HTTP disables FTP over proxy and GOPHER too])
|
||||
AC_DEFINE(CURL_DISABLE_GOPHER)
|
||||
AC_SUBST(CURL_DISABLE_HTTP)
|
||||
AC_SUBST(CURL_DISABLE_GOPHER)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
|
||||
CFLAGS="-W -Wall -Wwrite-strings -pedantic -Wundef -Wpointer-arith -Wcast-align -Wnested-externs -g"
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support ftp])
|
||||
AC_ARG_ENABLE(ftp,
|
||||
[ --enable-ftp Enable FTP support
|
||||
--disable-ftp Disable FTP support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_FTP)
|
||||
AC_SUBST(CURL_DISABLE_FTP)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support gopher])
|
||||
AC_ARG_ENABLE(gopher,
|
||||
[ --enable-gopher Enable GOPHER support
|
||||
--disable-gopher Disable GOPHER support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_GOPHER)
|
||||
AC_SUBST(CURL_DISABLE_GOPHER)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support file])
|
||||
AC_ARG_ENABLE(file,
|
||||
[ --enable-file Enable FILE support
|
||||
--disable-file Disable FILE support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_FILE)
|
||||
AC_SUBST(CURL_DISABLE_FILE)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support ldap])
|
||||
AC_ARG_ENABLE(ldap,
|
||||
[ --enable-ldap Enable LDAP support
|
||||
--disable-ldap Disable LDAP support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_LDAP)
|
||||
AC_SUBST(CURL_DISABLE_LDAP)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support dict])
|
||||
AC_ARG_ENABLE(dict,
|
||||
[ --enable-dict Enable DICT support
|
||||
--disable-dict Disable DICT support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_DICT)
|
||||
AC_SUBST(CURL_DISABLE_DICT)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
AC_MSG_CHECKING([whether to support telnet])
|
||||
AC_ARG_ENABLE(telnet,
|
||||
[ --enable-telnet Enable TELNET support
|
||||
--disable-telnet Disable TELNET support],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
AC_DEFINE(CURL_DISABLE_TELNET)
|
||||
AC_SUBST(CURL_DISABLE_TELNET)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(yes)
|
||||
)
|
||||
|
||||
|
||||
dnl **********************************************************************
|
||||
dnl Checks for IPv6
|
||||
@@ -163,9 +256,6 @@ fi
|
||||
dnl socket lib?
|
||||
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
|
||||
|
||||
dnl ucb lib?
|
||||
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(ucb, gethostname))
|
||||
|
||||
dnl dl lib?
|
||||
AC_CHECK_FUNC(dlclose, , AC_CHECK_LIB(dl, dlopen))
|
||||
|
||||
@@ -432,20 +522,23 @@ dnl NOTE: We *always* look for ZLIB headers & libraries, all this option
|
||||
dnl does is change where we look (by adjusting LIBS and CPPFLAGS.)
|
||||
dnl
|
||||
|
||||
dnl AC_MSG_CHECKING(where to look for ZLIB)
|
||||
dnl if test X"$OPT_ZLIB" = Xno
|
||||
dnl then
|
||||
dnl AC_MSG_RESULT([defaults (or given in environment)])
|
||||
dnl else
|
||||
dnl test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
|
||||
dnl LIBS="$LIBS -L$OPT_ZLIB/lib"
|
||||
dnl CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
|
||||
dnl AC_MSG_RESULT([$OPT_ZLIB])
|
||||
dnl fi
|
||||
AC_MSG_CHECKING(where to look for ZLIB)
|
||||
if test X"$OPT_ZLIB" = Xno
|
||||
then
|
||||
AC_MSG_RESULT([defaults (or given in environment)])
|
||||
else
|
||||
test X"$OPT_ZLIB" = Xyes && OPT_ZLIB=/usr/local
|
||||
LIBS="$LIBS -L$OPT_ZLIB/lib"
|
||||
CPPFLAGS="$CPPFLAGS -I$OPT_ZLIB/include"
|
||||
AC_MSG_RESULT([$OPT_ZLIB])
|
||||
fi
|
||||
|
||||
dnl z lib?
|
||||
dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
|
||||
|
||||
AC_CHECK_LIB(z, gzread, [AM_CONDITIONAL(CONTENT_ENCODING, true)
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
LIBS="$LIBS -lz"
|
||||
HAVE_LIBZ="1"
|
||||
AC_SUBST(HAVE_LIBZ)])
|
||||
|
||||
dnl Default is to try the thread-safe versions of a few functions
|
||||
OPT_THREAD=on
|
||||
@@ -510,11 +603,13 @@ AC_CHECK_HEADERS( \
|
||||
io.h \
|
||||
pwd.h \
|
||||
utime.h \
|
||||
sys/utime.h
|
||||
sys/utime.h \
|
||||
sys/poll.h \
|
||||
setjmp.h
|
||||
)
|
||||
|
||||
dnl Check for libz header
|
||||
dnl AC_CHECK_HEADERS(zlib.h)
|
||||
AC_CHECK_HEADERS(zlib.h)
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
@@ -548,7 +643,6 @@ AC_CHECK_FUNCS( socket \
|
||||
strcasecmp \
|
||||
stricmp \
|
||||
strcmpi \
|
||||
gethostname \
|
||||
gethostbyaddr \
|
||||
gettimeofday \
|
||||
inet_addr \
|
||||
@@ -565,9 +659,24 @@ AC_CHECK_FUNCS( socket \
|
||||
getpwuid \
|
||||
geteuid \
|
||||
dlopen \
|
||||
utime
|
||||
utime \
|
||||
sigsetjmp \
|
||||
poll
|
||||
)
|
||||
|
||||
dnl sigsetjmp() might be a macro and no function so if it isn't found already
|
||||
dnl we make an extra check here!
|
||||
if test "$ac_cv_func_sigsetjmp" != "yes"; then
|
||||
AC_MSG_CHECKING([for sigsetjmp defined as macro])
|
||||
AC_TRY_LINK( [#include <setjmp.h>],
|
||||
[sigjmp_buf jmpenv;
|
||||
sigsetjmp(jmpenv, 1);],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_SIGSETJMP),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
fi
|
||||
|
||||
dnl removed 'getpass' check on October 26, 2000
|
||||
|
||||
if test "$ac_cv_func_select" != "yes"; then
|
||||
@@ -585,12 +694,58 @@ AC_PATH_PROGS( NROFF, gnroff nroff, ,
|
||||
$PATH:/usr/bin/:/usr/local/bin )
|
||||
AC_SUBST(NROFF)
|
||||
|
||||
|
||||
AC_MSG_CHECKING([CA cert bundle install path])
|
||||
|
||||
AC_ARG_WITH(ca-bundle,
|
||||
AC_HELP_STRING([--with-ca-bundle=FILE], [File name to install the CA bundle as])
|
||||
AC_HELP_STRING([--without-ca-bundle], [Don't install the CA bundle]),
|
||||
[ ca="$withval" ],
|
||||
[
|
||||
if test "x$prefix" != xNONE; then
|
||||
ca="$prefix/share/curl/curl-ca-bundle.crt"
|
||||
else
|
||||
ca="$ac_default_prefix/share/curl/curl-ca-bundle.crt"
|
||||
fi
|
||||
] )
|
||||
|
||||
if test "x$ca" = "xno"; then
|
||||
dnl let's not keep "no" as path name, blank it instead
|
||||
ca=""
|
||||
else
|
||||
AC_DEFINE_UNQUOTED(CURL_CA_BUNDLE, "$ca", [CA bundle full path name])
|
||||
fi
|
||||
|
||||
CURL_CA_BUNDLE="$ca"
|
||||
AC_SUBST(CURL_CA_BUNDLE)
|
||||
AC_MSG_RESULT([$ca])
|
||||
|
||||
AC_PROG_YACC
|
||||
|
||||
dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
|
||||
dnl $PATH:/usr/bin/:/usr/local/bin )
|
||||
dnl AC_SUBST(RANLIB)
|
||||
|
||||
dnl ************************************************************
|
||||
dnl lame option to switch on debug options
|
||||
dnl
|
||||
AC_MSG_CHECKING([whether to enable debug options])
|
||||
AC_ARG_ENABLE(debug,
|
||||
[ --enable-debug Enable pedantic debug options
|
||||
--disable-debug Disable debug options],
|
||||
[ case "$enableval" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -DMALLOCDEBUG"
|
||||
CFLAGS="-W -Wall -Wwrite-strings -pedantic -Wundef -Wpointer-arith -Wcast-align -Wnested-externs -g"
|
||||
;;
|
||||
esac ],
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_CONFIG_FILES([Makefile \
|
||||
docs/Makefile \
|
||||
docs/examples/Makefile \
|
||||
|
@@ -16,6 +16,7 @@ Usage: curl-config [OPTION]
|
||||
|
||||
Available values for OPTION include:
|
||||
|
||||
--ca ca bundle install path
|
||||
--cc compiler
|
||||
--cflags pre-processor and compiler flags
|
||||
--feature newline separated list of enabled features
|
||||
@@ -43,6 +44,10 @@ while test $# -gt 0; do
|
||||
esac
|
||||
|
||||
case "$1" in
|
||||
--ca)
|
||||
echo @CURL_CA_BUNDLE@
|
||||
;;
|
||||
|
||||
--cc)
|
||||
echo @CC@
|
||||
;;
|
||||
@@ -61,6 +66,30 @@ while test $# -gt 0; do
|
||||
if test "@IPV6_ENABLED@" = "1"; then
|
||||
echo "IPv6"
|
||||
fi
|
||||
if test "@HAVE_LIBZ@" = "1"; then
|
||||
echo "libz"
|
||||
fi
|
||||
if test "@CURL_DISABLE_HTTP@" = "1"; then
|
||||
echo "HTTP-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_FTP@" = "1"; then
|
||||
echo "FTP-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_GOPHER@" = "1"; then
|
||||
echo "GOPHER-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_FILE@" = "1"; then
|
||||
echo "FILE-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_TELNET@" = "1"; then
|
||||
echo "TELNET-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_LDAP@" = "1"; then
|
||||
echo "LDAP-disabled"
|
||||
fi
|
||||
if test "@CURL_DISABLE_DICT@" = "1"; then
|
||||
echo "DICT-disabled"
|
||||
fi
|
||||
;;
|
||||
|
||||
--version)
|
||||
|
3
docs/.cvsignore
Normal file
3
docs/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*html
|
96
docs/BINDINGS
Normal file
96
docs/BINDINGS
Normal file
@@ -0,0 +1,96 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
libcurl bindings
|
||||
|
||||
Creative people have written particular bindings or interfaces for various
|
||||
environments and programming languages. Using one of these allows you to take
|
||||
advantage of curl powers from within your favourite language or system.
|
||||
|
||||
This is a list of all known interfaces as of this writing.
|
||||
|
||||
The bindings listed below are not part of the curl/libcurl distribution
|
||||
archives, but must be downloaded and installed separately.
|
||||
|
||||
Basic
|
||||
|
||||
ScriptBasic bindings to libcurl. Writtten by Peter Verhas.
|
||||
http://scriptbasic.com/
|
||||
|
||||
C++
|
||||
|
||||
Maintained by Jean-Philippe Barrette-LaPierre.
|
||||
http://curl.haxx.se/libcurl/cplusplus/
|
||||
|
||||
Cocoa
|
||||
|
||||
Written by Dan Wood.
|
||||
http://curlhandle.sourceforge.net/
|
||||
|
||||
Dylan
|
||||
|
||||
Written by Chris Double.
|
||||
http://dylanlibs.sourceforge.net/
|
||||
|
||||
Java
|
||||
|
||||
Written by Daniel Stenberg.
|
||||
http://curl.haxx.se/libcurl/java/
|
||||
|
||||
Lua
|
||||
|
||||
Written by Steve Dekorte.
|
||||
http://curl.haxx.se/libcurl/lua/
|
||||
|
||||
Object-Pascal
|
||||
|
||||
Free Pascal, Delphi and Kylix binding written by Christophe Espern.
|
||||
http://www.tekool.com/opcurl
|
||||
|
||||
Pascal
|
||||
|
||||
Free Pascal, Delphi and Kylix binding written by Jeffrey Pohlmeyer.
|
||||
http://houston.quik.com/jkp/curlpas/
|
||||
|
||||
Perl
|
||||
|
||||
Maintained by Cris Bailiff.
|
||||
http://curl.haxx.se/libcurl/perl/
|
||||
|
||||
PHP
|
||||
|
||||
Written by Sterling Hughes.
|
||||
http://curl.haxx.se/libcurl/php/
|
||||
|
||||
PostgreSQL
|
||||
|
||||
Written by Gian Paolo Ciceri.
|
||||
http://gborg.postgresql.org/project/pgcurl/projdisplay.php
|
||||
|
||||
Python
|
||||
|
||||
Written by Kjetil Jacobsen.
|
||||
http://pycurl.sourceforge.net/
|
||||
|
||||
Rexx
|
||||
|
||||
Written Mark Hessling.
|
||||
http://rexxcurl.sourceforge.net/
|
||||
|
||||
Ruby
|
||||
|
||||
Written by Hirotaka Matsuyuki.
|
||||
http://www.d1.dion.ne.jp/~matuyuki/ruby.html
|
||||
|
||||
Scheme
|
||||
|
||||
Bigloo binding written by Kirill Lisovsky.
|
||||
http://curl.haxx.se/libcurl/scheme/
|
||||
|
||||
Tcl
|
||||
|
||||
Written by Andr<64>s Garc<72>a.
|
||||
http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html
|
42
docs/BUGS
42
docs/BUGS
@@ -8,28 +8,44 @@ $Id$
|
||||
BUGS
|
||||
|
||||
Curl and libcurl have grown substantially since the beginning. At the time
|
||||
of writing (mid March 2001), there are 23000 lines of source code, and by
|
||||
of writing (end of April 2002), there are 32000 lines of source code, and by
|
||||
the time you read this it has probably grown even more.
|
||||
|
||||
Of course there are lots of bugs left. And lots of misfeatures.
|
||||
|
||||
To help us make curl the stable and solid product we want it to be, we need
|
||||
bug reports and bug fixes. If you can't fix a bug yourself and submit a fix
|
||||
for it, try to report an as detailed report as possible to the curl mailing
|
||||
list to allow one of us to have a go at a solution. You should also post
|
||||
your bug/problem at curl's bug tracking system over at
|
||||
bug reports and bug fixes.
|
||||
|
||||
WHERE TO REPORT
|
||||
|
||||
If you can't fix a bug yourself and submit a fix for it, try to report an as
|
||||
detailed report as possible to the curl mailing list to allow one of us to
|
||||
have a go at a solution. You should also post your bug/problem at curl's bug
|
||||
tracking system over at
|
||||
|
||||
http://sourceforge.net/bugs/?group_id=976
|
||||
|
||||
When reporting a bug, you should include information that will help us
|
||||
understand what's wrong, what you expected to happen and how to repeat the
|
||||
bad behavior. You therefore need to supply your operating system's name and
|
||||
version number (uname -a under a unix is fine), what version of curl you're
|
||||
using (curl -V is fine), what URL you were working with and anything else
|
||||
you think matters.
|
||||
(but please read the section below first before doing that)
|
||||
|
||||
Since curl deals with networks, it often helps us a lot if you include a
|
||||
protocol debug dump with your bug report. The output you get by using the -v
|
||||
WHAT TO REPORT
|
||||
|
||||
When reporting a bug, you should include information that will help us
|
||||
understand what's wrong what you expected to happen and how to repeat the
|
||||
bad behavior. You therefore need to tell us:
|
||||
|
||||
- your operating system's name and version number (uname -a under a unix
|
||||
is fine)
|
||||
- what version of curl you're using (curl -V is fine)
|
||||
- what URL you were working with (if possible), at least which protocol
|
||||
|
||||
and anything and everything else you think matters. Tell us what you
|
||||
expected to happen, tell use what did happen, tell us how you could make it
|
||||
work another way. Dig around, try out, test. Then include all the tiny bits
|
||||
and pieces in your report. You will benefit from this yourself, as it will
|
||||
enable us to help you quicker and more accurately.
|
||||
|
||||
Since curl deals with networks, it often helps us if you include a protocol
|
||||
debug dump with your bug report. The output you get by using the -v
|
||||
flag. Usually, you also get more info by using -i so that is likely to be
|
||||
useful when reporting bugs as well.
|
||||
|
||||
|
121
docs/FAQ
121
docs/FAQ
@@ -1,4 +1,4 @@
|
||||
Updated: March 11, 2002 (http://curl.haxx.se/docs/faq.shtml)
|
||||
Updated: September 3, 2002 (http://curl.haxx.se/docs/faq.html)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -15,6 +15,7 @@ FAQ
|
||||
1.5 Who makes cURL?
|
||||
1.6 What do you get for making cURL?
|
||||
1.7 What about CURL from curl.com?
|
||||
1.8 I have a problem who do I mail?
|
||||
|
||||
2. Install Related Problems
|
||||
2.1 configure doesn't find OpenSSL even when it is installed
|
||||
@@ -30,14 +31,15 @@ FAQ
|
||||
3.3 Why doesn't my posting using -F work?
|
||||
3.4 How do I tell curl to run custom FTP commands?
|
||||
3.5 How can I disable the Pragma: nocache header?
|
||||
3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
|
||||
3.6 Does curl support ASP, XML, XHTML or HTML version Y?
|
||||
3.7 Can I use curl to delete/rename a file through FTP?
|
||||
3.8 How do I tell curl to follow HTTP redirects?
|
||||
3.9 How do I use curl in my favourite programming language?
|
||||
3.9 How do I use curl in my favorite programming language?
|
||||
3.10 What about SOAP, WebDAV, XML-RPC or similar protocols over HTTP?
|
||||
3.11 How do I POST with a different Content-Type?
|
||||
3.12 Why do FTP specific features over HTTP proxy fail?
|
||||
3.13 Why does my single/double quotes fail?
|
||||
3.14 Does curl support javascript or pac (automated proxy config)?
|
||||
|
||||
4. Running Problems
|
||||
4.1 Problems connecting to SSL servers.
|
||||
@@ -55,6 +57,7 @@ FAQ
|
||||
4.7 How do I keep user names and passwords secret in Curl command lines?
|
||||
4.8 I found a bug!
|
||||
4.9 Curl can't authenticate to the server that requires NTLM?
|
||||
4.10 My HTTP request using HEAD, PUT or DELETE doesn't work!
|
||||
|
||||
5. libcurl Issues
|
||||
5.1 Is libcurl thread-safe?
|
||||
@@ -81,7 +84,9 @@ FAQ
|
||||
cURL (or simply just 'curl') is a command line tool for getting or sending
|
||||
files using URL syntax. The name is a play on 'Client for URLs', originally
|
||||
with URL spelled in uppercase to make it obvious it deals with URLs. The
|
||||
fact it can also be pronounced 'see URL' also helped.
|
||||
fact it can also be pronounced 'see URL' also helped, it works as an
|
||||
abbrivation for "Client URL Request Library" or why not the recursive
|
||||
version: "Curl is a URL Request Library".
|
||||
|
||||
Curl supports a range of common Internet protocols, currently including
|
||||
HTTP, HTTPS, FTP, FTPS, GOPHER, LDAP, DICT, TELNET and FILE.
|
||||
@@ -151,10 +156,10 @@ FAQ
|
||||
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).
|
||||
Stenberg writes the major parts, but other persons' submissions are
|
||||
important and crucial. Anyone can contribute and 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 docs/THANKS file is only a small part of all
|
||||
the people that every day provide us with bug reports, suggestions, ideas
|
||||
@@ -164,8 +169,8 @@ FAQ
|
||||
|
||||
1.6 What do you get for making cURL?
|
||||
|
||||
Project cURL is entirely free and open. No person gets paid in any way for
|
||||
developing curl. We all do this voluntarily on our spare time.
|
||||
Project cURL is entirely free and open. No person gets paid for developing
|
||||
curl. We do this voluntarily 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
|
||||
@@ -175,8 +180,8 @@ FAQ
|
||||
If you want to support our project with a donation or similar, one way of
|
||||
doing that would be to buy "gift certificates" at useful online shopping
|
||||
sites, such as amazon.com or thinkgeek.com. Another way would be to sponsor
|
||||
us through a banner-program or by simply helping us coding, documenting,
|
||||
testing etc.
|
||||
us through a banner-program or even better: by helping us coding,
|
||||
documenting, testing etc.
|
||||
|
||||
1.7 What about CURL from curl.com?
|
||||
|
||||
@@ -193,6 +198,21 @@ FAQ
|
||||
We recognize that we will be living in parallel with curl.com and wish them
|
||||
every success.
|
||||
|
||||
1.8 I have a problem who do I mail?
|
||||
|
||||
Please do not attempt to mail any single individual unless you really need
|
||||
to. Keep curl-related questions on a suitable mailing list. All available
|
||||
mailing lists are listed in the MANUAL document and online at
|
||||
http://curl.haxx.se/mail/
|
||||
|
||||
Keeping curl-related questions and discussions on mailing lists allows others
|
||||
to join in and help, to share their ideas, contribute their suggestions and
|
||||
spread their wisdom. Keeping discussions on public mailing lists also allows
|
||||
for others to learn from this (both current and future users thanks to the
|
||||
web based archives of the mailing lists), thus saving us from having to
|
||||
repeat ourselves even more. Thanks for respecting this.
|
||||
|
||||
|
||||
2. Install Related Problems
|
||||
|
||||
2.1. configure doesn't find OpenSSL even when it is installed
|
||||
@@ -308,16 +328,14 @@ FAQ
|
||||
the -H/--header option. By adding a header with empty contents you safely
|
||||
disable that one. Use -H "Pragma:" to disable that specific header.
|
||||
|
||||
3.6. Does curl support javascript, ASP, XML, XHTML or HTML version Y?
|
||||
3.6. Does curl support ASP, XML, XHTML or HTML version Y?
|
||||
|
||||
To curl, all contents are alike. It doesn't matter how the page was
|
||||
generated. It may be ASP, PHP, Perl, shell-script, SSI or plain
|
||||
HTML-files. There's no difference to curl and it doesn't even know what kind
|
||||
of language that generated the page.
|
||||
|
||||
Javascript is slightly different since that is code embedded in the HTML
|
||||
that is sent for the client to interpret and curl has no javascript
|
||||
interpreter.
|
||||
See also item 3.14 regarding javascript.
|
||||
|
||||
3.7. Can I use curl to delete/rename a file through FTP?
|
||||
|
||||
@@ -335,7 +353,7 @@ FAQ
|
||||
|
||||
curl -L http://redirector.com
|
||||
|
||||
3.9 How do I use curl in my favourite programming language?
|
||||
3.9 How do I use curl in my favorite programming language?
|
||||
|
||||
There exist many language interfaces/bindings for curl that integrates it
|
||||
better with various languages. If you are fluid in a script language, you
|
||||
@@ -372,7 +390,7 @@ FAQ
|
||||
|
||||
Because when you use a HTTP proxy, the protocol spoken on the network will
|
||||
be HTTP, even if you specify a FTP URL. This effectively means that you
|
||||
normally can't use FTP specific features such as ftp upload and ftp quote
|
||||
normally can't use FTP specific features such as FTP upload and FTP quote
|
||||
etc.
|
||||
|
||||
There is one exception to this rule, and that is if you can "tunnel through"
|
||||
@@ -392,17 +410,41 @@ FAQ
|
||||
curl -d ' with spaces ' url.com
|
||||
|
||||
Exactly what kind of quotes and how to do this is entirely up to the shell
|
||||
or command line interepreter that you are using. For most unix shells, you
|
||||
or command line interpreter that you are using. For most unix shells, you
|
||||
can more or less pick either single (') or double (") quotes. For
|
||||
Windows/DOS prompts I believe you're forced to use double (") quotes.
|
||||
|
||||
Please study the documentaion for your particular environment. Examples in
|
||||
Please study the documentation for your particular environment. Examples in
|
||||
the curl docs will use a mix of both these ones as shown above. You must
|
||||
adjust them to work in your environment.
|
||||
|
||||
Remember that curl works and runs on more operating systems than most single
|
||||
individuals have ever tried.
|
||||
|
||||
3.14 Does curl support javascript or pac (automated proxy config)?
|
||||
|
||||
Many web pages do magic stuff using embedded javascript. Curl and libcurl
|
||||
have no built-in support for that, so it will be treated just like any other
|
||||
contents.
|
||||
|
||||
.pac files are a netscape invention and are sometimes used by organizations
|
||||
to allow them to differentiate which proxies to use. The .pac contents is
|
||||
just a javascript program that gets invoked by the browser and that returns
|
||||
the name of the proxy to connect to. Since curl doesn't support javascript,
|
||||
it can't support .pac proxy configuration either.
|
||||
|
||||
Some work-arounds usually suggested to overcome this javascript dependency:
|
||||
|
||||
- Depending on the javascript complexity, write up a script that
|
||||
translates it to another language and execute that.
|
||||
|
||||
- Read the javascript code and rewrite the same logic in another language.
|
||||
|
||||
- Implement a javascript interpreted, people have successfully used the
|
||||
Mozilla javascript engine in the past.
|
||||
|
||||
- Ask your admins to stop this, for a static proxy setup or similar.
|
||||
|
||||
|
||||
4. Running Problems
|
||||
|
||||
@@ -432,11 +474,12 @@ FAQ
|
||||
|
||||
curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
|
||||
|
||||
In win32, the standard DOS shell treats the %-letter specially and you may
|
||||
need to quote the string properly when % is used in it.
|
||||
In Windows, the standard DOS shell treats the %-letter specially and you
|
||||
need to use TWO %-letters for each single one you want to use in the URL.
|
||||
|
||||
Also note that if you want the literal %-letter to be part of the data you
|
||||
pass in a POST using -d/--data you must encode it as '%25'.
|
||||
pass in a POST using -d/--data you must encode it as '%25' (which then also
|
||||
needs the %-letter doubled on Windows machines).
|
||||
|
||||
4.3. How can I use {, }, [ or ] to specify multiple URLs?
|
||||
|
||||
@@ -495,7 +538,7 @@ FAQ
|
||||
|
||||
4.5.6 "301 Moved Permanently"
|
||||
|
||||
If you get this return code and an HTML outpt similar to this:
|
||||
If you get this return code and an HTML output similar to this:
|
||||
|
||||
<H1>Moved Permanently</H1> The document has moved <A
|
||||
HREF="http://same_url_now_with_a_trailing_slash/">here</A>.
|
||||
@@ -537,12 +580,8 @@ FAQ
|
||||
particular platform, try contacting the person who built the package/archive
|
||||
you have.
|
||||
|
||||
If there is a bug, post a bug report in the Curl Bug Track System over at
|
||||
http://sourceforge.net/bugs/?group_id=976
|
||||
|
||||
Always include as many details you can think of, including curl version,
|
||||
operating system name and version and complete instructions how to repeat
|
||||
the bug.
|
||||
If there is a bug, read the BUGS document first. Then report it as described
|
||||
in there.
|
||||
|
||||
4.9. Curl can't authenticate to the server that requires NTLM?
|
||||
|
||||
@@ -550,6 +589,18 @@ FAQ
|
||||
currently support that. Proprietary formats are evil. You should not use
|
||||
such ones.
|
||||
|
||||
4.10 My HTTP request using HEAD, PUT or DELETE doesn't work!
|
||||
|
||||
Many web servers allow or demand that the administrator configures the
|
||||
server properly for these requests to work on the web server.
|
||||
|
||||
Some servers seem to support HEAD only on certain kinds of URLs.
|
||||
|
||||
To fully grasp this, try the documentation for the particular server
|
||||
software you're trying to interact with. This is not anything curl can do
|
||||
anything about.
|
||||
|
||||
|
||||
5. libcurl Issues
|
||||
|
||||
5.1. Is libcurl thread-safe?
|
||||
@@ -637,12 +688,10 @@ FAQ
|
||||
|
||||
6. License Issues
|
||||
|
||||
Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
|
||||
the Mozilla Public License. To get a really good answer to your license
|
||||
conflict questions, you should study the MPL and MIT/X licenses and the
|
||||
license you are about to use and check for clashes yourself. This section is
|
||||
just a brief summary for the cases we get the most questions. (Parts of this
|
||||
section was much enhanced by Bjorn Reese.)
|
||||
Curl and libcurl are released under a MIT/X derivate license. The license is
|
||||
very liberal and should not impose a problem for your project. This section
|
||||
is just a brief summary for the cases we get the most questions. (Parts of
|
||||
this section was much enhanced by Bjorn Reese.)
|
||||
|
||||
6.1. I have a GPL program, can I use the libcurl library?
|
||||
|
||||
|
113
docs/HISTORY
Normal file
113
docs/HISTORY
Normal file
@@ -0,0 +1,113 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
How cURL Become Like This
|
||||
|
||||
|
||||
In the second half of 1997, Daniel Stenberg came up with the idea to make
|
||||
currency-exchange calculations available to Internet Relay Chat (IRC)
|
||||
users. All the necessary data are published on the Web; he just needed to
|
||||
automate their retrieval.
|
||||
|
||||
Daniel simply adopted an existing command-line open-source tool, httpget, that
|
||||
Brazilian Rafael Sagula had written. After a few minor adjustments, it did
|
||||
just what he needed.
|
||||
|
||||
Soon, he found currencies on a GOPHER site, so support for that had to go in,
|
||||
and not before long FTP download support was added as well. The name of the
|
||||
project was changed to urlget to better fit what it actually did now, since
|
||||
the http-only days were already passed.
|
||||
|
||||
The project slowly grew bigger. When upload capabilities were added and the
|
||||
name once again was misleading, a second name change was made and on March 20,
|
||||
1998 curl 4 was released. (The version numbering from the previous names were
|
||||
kept.)
|
||||
|
||||
(Unrelated to this project a company called Curl Corporation filed a US
|
||||
trademark on the name "CURL" on May 18 1998. That company had then already
|
||||
registered the curl.com domain back in November of the previous year. All this
|
||||
was much later brought into the lights.)
|
||||
|
||||
SSL support was added, powered by the SSLeay library.
|
||||
|
||||
August 1998, added project curl to freshmeat.net.
|
||||
|
||||
October 1998, with the curl 4.9 release and the introduction of cookie
|
||||
support, curl was no longer released under the GPL license. Now we're at 4000
|
||||
lines of code, we switched over to the MPL license to restrict the effects of
|
||||
"copyleft".
|
||||
|
||||
November 1998, configure script and reported successful compiles on several
|
||||
major operating systems. The never-quite-understood -F option was added and
|
||||
curl could now simulate quite a lot of a browser.
|
||||
|
||||
Curl 5 was released in December 1998 and introduced the first ever curl man
|
||||
page. People started making Linux RPM packages out of it.
|
||||
|
||||
January 1999, DICT support added.
|
||||
|
||||
OpenSSL took over where SSLeay was abandoned.
|
||||
|
||||
May 1999, first Debian package.
|
||||
|
||||
August 1999, LDAP:// and FILE:// support added. The curl web site gets 1300
|
||||
visits daily.
|
||||
|
||||
Released curl 6.0 in September. 15000 lines of code.
|
||||
|
||||
December 28 1999, added project to Sourceforge and started using its services
|
||||
for managing the project.
|
||||
|
||||
Spring 2000, major internal overhaul to provide a suitable library interface.
|
||||
The first non-beta release was named 7.1 and arrived in August. This offered
|
||||
the easy interface and turned out to be the beginning of actually getting
|
||||
other software and programs to get based on and powered by libcurl. Almost
|
||||
20000 lines of code.
|
||||
|
||||
August 2000, the curl web site gets 4000 visits daily.
|
||||
|
||||
The PHP guys adopted libcurl already the same month, when the first ever third
|
||||
party libcurl binding showed up. CURL has been a supported module in PHP since
|
||||
the release of PHP 4.0.2. This would soon get followers. More than 16
|
||||
different bindings exist at the time of this writing.
|
||||
|
||||
September 2000, kerberos4 support was added.
|
||||
|
||||
In November 2000 started the work on a test suite for curl. It was later
|
||||
re-written from scratch again.
|
||||
|
||||
January 2001, Daniel released curl 7.5.2 under a new license again: MIT (or
|
||||
MPL). The MIT license is extremely liberal and can be used combined with GPL
|
||||
in other projects. This would finally put an end to the "complaints" from
|
||||
people involved in GPLed projects that previously were prohibited from using
|
||||
libcurl while it was released under MPL only. (Due to the fact that MPL is
|
||||
deemed "GPL incompatible".)
|
||||
|
||||
curl supports HTTP 1.1 starting with the release of 7.7, March 22 2001. This
|
||||
also introduced libcurl's ability to do persistent connections. 24000 lines of
|
||||
code.
|
||||
|
||||
August 2001. curl is bundled in Mac OS X, 10.1. It was already becoming more
|
||||
and more of a standard utility of Linux distributions and a regular in the BSD
|
||||
ports collections. The curl web site gets 8000 visits daily. Curl Corporation
|
||||
contacted Daniel to discuss "the name issue". After Daniel's reply, they have
|
||||
never since got in touch again.
|
||||
|
||||
September 2001, libcurl 7.9 introduces cookie jar and curl_formadd(). During
|
||||
the forthcoming 7.9.x releases, we introduced the multi interface slowly and
|
||||
without much whistles.
|
||||
|
||||
June 2002, the curl web site gets 13000 visits daily. curl and libcurl is
|
||||
35000 lines of code. Reported successful compiles on more than 40 combinations
|
||||
of CPUs and operating systems.
|
||||
|
||||
To estimate number of users of the curl tool or libcurl library is next to
|
||||
impossible. Around 5000 downloaded packages each week from the main site gives
|
||||
a hint, but the packages are mirrored extensively, bundled with numerous OS
|
||||
distributions and otherwise retrieved as part of other software.
|
||||
|
||||
September 2002, with the release of curl 7.10 it is released under the MIT
|
||||
license only.
|
35
docs/INSTALL
35
docs/INSTALL
@@ -236,6 +236,30 @@ Win32
|
||||
project properties to use the SSL include path, link with the SSL libs
|
||||
and define the USE_SSLEAY symbol.
|
||||
|
||||
Disabling Specific Protocols:
|
||||
|
||||
The configure utility, unfortunately, is not available for the Windows
|
||||
environment, therefore, you cannot use the various disable-protocol
|
||||
options of the configure utility on this platform.
|
||||
|
||||
However, you can use the following defines to disable specific
|
||||
protocols:
|
||||
|
||||
HTTP_ONLY disables all protocols except HTTP
|
||||
CURL_DISABLE_FTP disables FTP
|
||||
CURL_DISABLE_LDAP disables LDAP
|
||||
CURL_DISABLE_TELNET disables TELNET
|
||||
CURL_DISABLE_DICT disables DICT
|
||||
CURL_DISABLE_FILE disables FILE
|
||||
CURL_DISABLE_GOPHER disables GOPHER
|
||||
|
||||
If you want to set any of these defines you have the following
|
||||
possibilities:
|
||||
|
||||
- Modify lib/setup.h
|
||||
- Modify lib/Makefile.vc6
|
||||
- Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
|
||||
in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project.
|
||||
|
||||
IBM OS/2
|
||||
========
|
||||
@@ -395,13 +419,15 @@ CROSS COMPILE
|
||||
PORTS
|
||||
=====
|
||||
This is a probably incomplete list of known hardware and operating systems
|
||||
that curl has been compiled for. If you know one system curl compiles and
|
||||
that curl has been compiled for. If you know a system curl compiles and
|
||||
runs on, that isn't listed, please let us know!
|
||||
|
||||
- Alpha DEC OSF 4
|
||||
- Alpha Digital UNIX v3.2
|
||||
- Alpha FreeBSD 4.1
|
||||
- Alpha Linux 2.2.16
|
||||
- Alpha FreeBSD 4.1, 4.5
|
||||
- Alpha Linux 2.2, 2.4
|
||||
- Alpha NetBSD 1.5.2
|
||||
- Alpha OpenBSD 3.0
|
||||
- Alpha OpenVMS V7.1-1H2
|
||||
- Alpha Tru64 v5.0 5.1
|
||||
- HP-PA HP-UX 9.X 10.X 11.X
|
||||
@@ -409,7 +435,7 @@ PORTS
|
||||
- MIPS IRIX 6.2, 6.5
|
||||
- MIPS Linux
|
||||
- Pocket PC/Win CE 3.0
|
||||
- Power AIX 4.2, 4.3.1, 4.3.2
|
||||
- Power AIX 4.2, 4.3.1, 4.3.2, 5.1
|
||||
- PowerPC Darwin 1.0
|
||||
- PowerPC Linux
|
||||
- PowerPC Mac OS 9
|
||||
@@ -432,6 +458,7 @@ PORTS
|
||||
- i386 SCO unix
|
||||
- i386 Solaris 2.7
|
||||
- i386 Windows 95, 98, ME, NT, 2000
|
||||
- i386 QNX 6
|
||||
- ia64 Linux 2.3.99
|
||||
- m68k AmigaOS 3
|
||||
- m68k Linux
|
||||
|
@@ -3,9 +3,6 @@ join in and help us correct one or more of these! Also be sure to check the
|
||||
changelog of the current development status, as one or more of these problems
|
||||
may have been fixed since this was written!
|
||||
|
||||
* curl_formadd() fails on OSF1. Why? Fix! Need help from OSF1 dudes.
|
||||
https://sourceforge.net/tracker/index.php?func=detail&aid=524433&group_id=976&atid=100976
|
||||
|
||||
* Running 'make test' on Mac OS X gives 4 errors. This seems to be related
|
||||
to some kind of libtool problem:
|
||||
http://curl.haxx.se/mail/archive-2002-03/0029.html and
|
||||
@@ -15,6 +12,19 @@ may have been fixed since this was written!
|
||||
|
||||
* GOPHER transfers seem broken
|
||||
|
||||
* configure --disable-http is not fully supported. All other protocols seem
|
||||
to work to disable.
|
||||
|
||||
* If a HTTP server responds to a HEAD request and includes a body (thus
|
||||
violating the RFC2616), curl won't wait to read the response but just stop
|
||||
reading and return back. If a second request (let's assume a GET) is then
|
||||
immediately made to the same server again, the connection will be re-used
|
||||
fine of course, and the second request will be sent off but when the
|
||||
response is to get read, the previous response-body is what curl will read
|
||||
and havoc is what happens.
|
||||
More details on this is found in this libcurl mailing list thread:
|
||||
http://curl.haxx.se/mail/lib-2002-08/0000.html
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Q: My program blows up when I run lots of curl_easy_perform() calls on a
|
||||
|
@@ -716,9 +716,9 @@ NETRC
|
||||
passwords, so therefor most unix programs won't read this file unless it is
|
||||
only readable by yourself (curl doesn't care though).
|
||||
|
||||
Curl supports .netrc files if told so (using the -n/--netrc option). This is
|
||||
not restricted to only ftp, but curl can use it for all protocols where
|
||||
authentication is used.
|
||||
Curl supports .netrc files if told so (using the -n/--netrc and
|
||||
--netrc-optional options). This is not restricted to only ftp,
|
||||
but curl can use it for all protocols where authentication is used.
|
||||
|
||||
A very simple .netrc file could look something like:
|
||||
|
||||
|
@@ -16,7 +16,8 @@ SUBDIRS = examples libcurl
|
||||
|
||||
EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
|
||||
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS \
|
||||
VERSIONS KNOWN_BUGS $(man_MANS) $(HTMLPAGES)
|
||||
VERSIONS KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) \
|
||||
HISTORY
|
||||
|
||||
MAN2HTML= gnroff -man $< | man2html >$@
|
||||
|
||||
|
@@ -5,10 +5,9 @@
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
|
||||
This document has been introduced in order to let you find documents that
|
||||
specify standards used by curl, software that extends curl, web pages with
|
||||
"competing" utilities and information pages that describe some of the tools
|
||||
that we use to build/compile/develop curl.
|
||||
This document lists documents that specify standards used by curl, software
|
||||
that extends curl, web pages with similar utilities and information pages that
|
||||
describe some of the tools that we use to build/compile/develop curl.
|
||||
|
||||
Standards
|
||||
---------
|
||||
|
@@ -81,3 +81,4 @@ that have contributed with non-trivial parts:
|
||||
- G<>tz Babin-Ebell <babin<69>ebell@trustcenter.de>
|
||||
- Andreas Damm <andreas-sourceforge@radab.org>
|
||||
- Jacky Lam <sylam@emsoftltd.com>
|
||||
- James Gallagher <jgallagher@gso.uri.edu>
|
||||
|
74
docs/TODO
74
docs/TODO
@@ -6,30 +6,33 @@
|
||||
|
||||
TODO
|
||||
|
||||
Things to do in project cURL. Please tell me what you think, contribute and
|
||||
send me patches that improve things! Also check the http://curl.haxx.se/dev
|
||||
web section for various development notes.
|
||||
Things to do in project cURL. Please tell us what you think, contribute and
|
||||
send us patches that improve things! Also check the http://curl.haxx.se/dev
|
||||
web section for various technical development notes.
|
||||
|
||||
LIBCURL
|
||||
|
||||
* Consider an interface to libcurl that allows applications to easier get to
|
||||
know what cookies that are sent back in the response headers.
|
||||
* Introduce an interface to libcurl that allows applications to easier get to
|
||||
know what cookies that are received. Pushing interface that calls a
|
||||
callback on each received cookie? Querying interface that asks about
|
||||
existing cookies? We probably need both.
|
||||
|
||||
* Make content encoding/decoding internally be made using a filter system.
|
||||
|
||||
* Test the 'multi' interface more.
|
||||
|
||||
* Introduce another callback interface for upload/download that makes one
|
||||
less copy of data and thus a faster operation.
|
||||
[http://curl.haxx.se/dev/no_copy_callbacks.txt]
|
||||
|
||||
* Add configure options that disables certain protocols in libcurl to
|
||||
decrease footprint. '--disable-[protocol]' where protocol is http, ftp,
|
||||
telnet, ldap, dict or file.
|
||||
* Run-time querying about library characterics. What protocols do this
|
||||
running libcurl support? What is the version number of the running libcurl
|
||||
(returning the well-defined version-#define). This could possibly be made
|
||||
by allowing curl_easy_getinfo() work with a NULL pointer for global info,
|
||||
but perhaps better would be to introduce a new curl_getinfo() (or similar)
|
||||
function for global info reading.
|
||||
|
||||
* Add asynchronous name resolving. http://curl.haxx.se/dev/async-resolver.txt
|
||||
This should be made to work on most of the supported platforms, or
|
||||
otherwise it isn't really interesting.
|
||||
* Add asynchronous name resolving (http://daniel.haxx.se/resolver/). This
|
||||
should be made to work on most of the supported platforms, or otherwise it
|
||||
isn't really interesting.
|
||||
|
||||
* Data sharing. Tell which easy handles within a multi handle that should
|
||||
share cookies, connection cache, dns cache, ssl session cache. Full
|
||||
@@ -41,28 +44,39 @@ TODO
|
||||
implement, libcurl will merely call 'getmutex' and 'leavemutex' callbacks.
|
||||
Part of the sharing suggestion at: http://curl.haxx.se/dev/sharing.txt
|
||||
|
||||
* No-faster-then-this transfers. Many people have limited bandwidth and they
|
||||
want the ability to make sure their transfers never use more bandwith than
|
||||
they think is good.
|
||||
|
||||
* Set the SO_KEEPALIVE socket option to make libcurl notice and disconnect
|
||||
very long time idle connections.
|
||||
|
||||
* Go through the code and verify that libcurl deals with big files >2GB and
|
||||
>4GB all over. Bug reports (and source reviews) indicate that it doesn't
|
||||
currently work properly.
|
||||
|
||||
* Make the built-in progress meter use its own dedicated output stream, and
|
||||
make it possible to set it. Use stderr by default.
|
||||
|
||||
* CURLOPT_MAXFILESIZE. Prevent downloads that are larger than the specified
|
||||
size. CURLE_FILESIZE_EXCEEDED would then be returned. Gautam Mani
|
||||
requested. That is, the download should even begin but be aborted
|
||||
immediately.
|
||||
|
||||
* Allow the http_proxy (and other) environment variables to contain user and
|
||||
password as well in the style: http://proxyuser:proxypasswd@proxy:port
|
||||
Berend Reitsma suggested.
|
||||
|
||||
LIBCURL - multi interface
|
||||
|
||||
* Make sure we don't ever loop because of non-blocking sockets return
|
||||
EWOULDBLOCK or similar. This concerns the HTTP request sending (and
|
||||
especially regular HTTP POST), the FTP command sending etc.
|
||||
|
||||
* Go through the code and verify that libcurl deals with big files >2GB and
|
||||
>4GB all over. Bug reports indicate that it doesn't currently work
|
||||
properly.
|
||||
|
||||
* Make the built-in progress meter use its own dedicated output stream, and
|
||||
make it possible to set it. Use stderr by default.
|
||||
* Make uploads treated better. We need a way to tell libcurl we have data to
|
||||
write, as the current system expects us to upload data each time the socket
|
||||
is writable and there is no way to say that we want to upload data soon
|
||||
just not right now, without that aborting the upload.
|
||||
|
||||
DOCUMENTATION
|
||||
|
||||
* Include documentation in the main archive about all the various libcurl
|
||||
bindings.
|
||||
* More and better
|
||||
|
||||
FTP
|
||||
|
||||
@@ -77,7 +91,9 @@ TODO
|
||||
already working http dito works. It of course requires that 'MDTM' works,
|
||||
and it isn't a standard FTP command.
|
||||
|
||||
* Add FTPS support with SSL for the data connection too.
|
||||
* Add FTPS support with SSL for the data connection too. This should be made
|
||||
according to the specs written in draft-murray-auth-ftp-ssl-08.txt,
|
||||
"Securing FTP with TLS"
|
||||
|
||||
HTTP
|
||||
|
||||
@@ -170,6 +186,12 @@ TODO
|
||||
|
||||
CLIENT
|
||||
|
||||
* Add an option that prevents cURL from overwiting existing local files. When
|
||||
used, and there already is an existing file with the target file name
|
||||
(either -O or -o), a number should be appended (and increased if already
|
||||
existing). So that index.html becomes first index.html.1 and then
|
||||
index.html.2 etc. Jeff Pohlmeyer suggested.
|
||||
|
||||
* "curl ftp://site.com/*.txt"
|
||||
|
||||
* Several URLs can be specified to get downloaded. We should be able to use
|
||||
|
176
docs/curl.1
176
docs/curl.1
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man curl.1
|
||||
.\" Written by Daniel Stenberg
|
||||
.\"
|
||||
.TH curl 1 "10 Apr 2002" "Curl 7.9.5" "Curl Manual"
|
||||
.TH curl 1 "11 Sep 2002" "Curl 7.10" "Curl Manual"
|
||||
.SH NAME
|
||||
curl \- transfer a URL
|
||||
.SH SYNOPSIS
|
||||
@@ -95,14 +95,11 @@ If this option is used twice, the second one will disable ASCII usage.
|
||||
must be using valid ciphers. Read up on SSL cipher list details on this URL:
|
||||
.I http://www.openssl.org/docs/apps/ciphers.html (Option added in curl 7.9)
|
||||
|
||||
If this option is used severl times, the last one will override the others.
|
||||
If this option is used several times, the last one will override the others.
|
||||
.IP "--connect-timeout <seconds>"
|
||||
Maximum time in seconds that you allow the connection to the server to take.
|
||||
This only limits the connection phase, once curl has connected this option is
|
||||
of no more use. This option didn't work in win32 systems until 7.7.2. See
|
||||
also the
|
||||
.I "--max-time"
|
||||
option.
|
||||
of no more use. See also the \fI--max-time\fP option.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-c/--cookie-jar <file name>"
|
||||
@@ -125,6 +122,10 @@ Use "-C -" to tell curl to automatically find out where/how to resume the
|
||||
transfer. It then uses the given output/input files to figure that out.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--crlf"
|
||||
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
|
||||
|
||||
If this option is used twice, the second will again disable crlf converting.
|
||||
.IP "-d/--data <data>"
|
||||
(HTTP) Sends the specified data in a POST request to the HTTP server, in a way
|
||||
that can emulate as if a user has filled in a HTML form and pressed the submit
|
||||
@@ -167,16 +168,17 @@ append data.
|
||||
downloads. Curl will normally always first attempt to use EPSV before PASV,
|
||||
but with this option, it will not try using EPSV.
|
||||
|
||||
IF this option is used several times, each occurrence will toggle this on/off.
|
||||
If this option is used several times, each occurrence will toggle this on/off.
|
||||
.IP "-D/--dump-header <file>"
|
||||
(HTTP/FTP)
|
||||
Write the HTTP headers to this file. Write the FTP file info to this
|
||||
file if -I/--head is used.
|
||||
Write the protocol headers to the specified file.
|
||||
|
||||
This option is handy to use when you want to store the cookies that a HTTP
|
||||
site sends to you. The cookies could then be read in a second curl invoke by
|
||||
using the -b/--cookie option!
|
||||
|
||||
When used on FTP, the ftp server response lines are considered being "headers"
|
||||
and thus are saved there.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-e/--referer <URL>"
|
||||
(HTTP) Sends the "Referer Page" information to the HTTP server. This can also
|
||||
@@ -187,6 +189,12 @@ previous URL when it follows a Location: header. The ";auto" string can be
|
||||
used alone, even if you don't set an initial referer.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--environment"
|
||||
(RISC OS ONLY) Sets a range of environment variables, using the names the -w
|
||||
option supports, to easier allow extraction of useful information after having
|
||||
run curl.
|
||||
|
||||
If this option is used several times, each occurrence will toggle this on/off.
|
||||
.IP "--egd-file <file>"
|
||||
(HTTPS) Specify the path name to the Entropy Gathering Daemon socket. The
|
||||
socket is used to seed the random engine for SSL connections. See also the
|
||||
@@ -203,17 +211,25 @@ certificate concatenated!
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--cacert <CA certificate>"
|
||||
(HTTPS) Tells curl to use the specified certificate file to verify the
|
||||
peer. The certificate must be in PEM format.
|
||||
peer. The file may contain multiple CA certificates. The certificate(s) must
|
||||
be in PEM format.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--capath <CA certificate directory>"
|
||||
(HTTPS) Tells curl to use the specified certificate directory to verify the
|
||||
peer. The certificates must be in PEM format, and the directory must have been
|
||||
processed using the c_rehash utility supplied with openssl. Certificate directories
|
||||
are not supported under Windows (because c_rehash uses symbolink links to
|
||||
create them). Using --capath can allow curl to make https connections much
|
||||
more efficiently than using --cacert if the --cacert file contains many CA certificates.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-f/--fail"
|
||||
(HTTP)
|
||||
Fail silently (no output at all) on server errors. This is mostly done
|
||||
like this to better enable scripts etc to better deal with failed
|
||||
attempts. In normal cases when a HTTP server fails to deliver a
|
||||
document, it returns a HTML document stating so (which often also
|
||||
describes why and more). This flag will prevent curl from
|
||||
outputting that and fail silently instead.
|
||||
(HTTP) Fail silently (no output at all) on server errors. This is mostly done
|
||||
like this to better enable scripts etc to better deal with failed attempts. In
|
||||
normal cases when a HTTP server fails to deliver a document, it returns a HTML
|
||||
document stating so (which often also describes why and more). This flag will
|
||||
prevent curl from outputting that and fail silently instead.
|
||||
|
||||
If this option is used twice, the second will again disable silent failure.
|
||||
.IP "-F/--form <name=content>"
|
||||
@@ -241,13 +257,17 @@ This option can be used multiple times.
|
||||
This option switches off the "URL globbing parser". When you set this option,
|
||||
you can specify URLs that contain the letters {}[] without having them being
|
||||
interpreted by curl itself. Note that these letters are not normal legal URL
|
||||
contents but they should be encoded according to the URI standard. (Option
|
||||
added in curl 7.6)
|
||||
contents but they should be encoded according to the URI standard.
|
||||
.IP "-G/--get"
|
||||
When used, this option will make all data specified with -d/--data or
|
||||
--data-binary to be used in a HTTP GET request instead of the POST request
|
||||
that otherwise would be used. The data will be appended to the URL with a '?'
|
||||
separator. (Option added in curl 7.9)
|
||||
|
||||
If used in combination with -I, the POST data will instead be appended to the
|
||||
URL with a HEAD request.
|
||||
|
||||
If used multiple times, nothing special happens.
|
||||
.IP "-h/--help"
|
||||
Usage help.
|
||||
.IP "-H/--header <header>"
|
||||
@@ -260,7 +280,7 @@ set headers without knowing perfectly well what you're doing. Replacing an
|
||||
internal header with one without content on the right side of the colon will
|
||||
prevent that header from appearing.
|
||||
|
||||
This option can be used multiple times.
|
||||
This option can be used multiple times to add/replace/remove multiple headers.
|
||||
.IP "-i/--include"
|
||||
(HTTP)
|
||||
Include the HTTP-header in the output. The HTTP-header includes things
|
||||
@@ -281,6 +301,21 @@ which this uses to get nothing but the header of a document. When used
|
||||
on a FTP file, curl displays the file size only.
|
||||
|
||||
If this option is used twice, the second will again disable header only.
|
||||
.IP "-j/--junk-session-cookies"
|
||||
(HTTP) When curl is told to read cookies from a given file, this option will
|
||||
make it discard all "session cookies". This will basicly have the same effect
|
||||
as if a new session is started. Typical browsers always discard session
|
||||
cookies when they're closed down. (Added in 7.9.7)
|
||||
|
||||
If this option is used several times, each occurrence will toggle this on/off.
|
||||
.IP "-k/--insecure"
|
||||
(SSL) This option explicitly allows curl to perform "insecure" SSL connections
|
||||
and transfers. Starting with curl 7.10, all SSL connections will be attempted
|
||||
to be made secure by using the CA certificate bundle installed by
|
||||
default. This makes all connections considered "insecure" to fail unless
|
||||
-k/--insecure is used.
|
||||
|
||||
If this option is used twice, the second time will again disable it.
|
||||
.IP "--krb4 <level>"
|
||||
(FTP) Enable kerberos4 authentication and use. The level must be entered and
|
||||
should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use
|
||||
@@ -305,6 +340,19 @@ line. So, it could look similar to this:
|
||||
url = "http://curl.haxx.se/docs/"
|
||||
|
||||
This option can be used multiple times.
|
||||
.IP "--limit-rate <speed>"
|
||||
Specify the maximum transfer rate you want curl to use. This feature is useful
|
||||
if you have a limited pipe and you'd prefer you have your transfer not use
|
||||
your entire bandwidth.
|
||||
|
||||
The given speed is measured in bytes/second, unless a suffix is
|
||||
appended. Appending 'k' or 'K' will count the number as kilobytes, 'm' or M'
|
||||
makes it megabytes while 'g' or 'G' makes it gigabytes. Examples: 200K, 3m and
|
||||
1G.
|
||||
|
||||
This option was introduced in curl 7.9.9.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-l/--list-only"
|
||||
(FTP)
|
||||
When listing an FTP directory, this switch forces a name-only view.
|
||||
@@ -312,6 +360,10 @@ Especially useful if you want to machine-parse the contents of an FTP
|
||||
directory since the normal directory view doesn't use a standard look
|
||||
or format.
|
||||
|
||||
This option causes an FTP NLST command to be sent. Some FTP servers
|
||||
list only files in their response to NLST; they do not include
|
||||
subdirectories and symbolic links.
|
||||
|
||||
If this option is used twice, the second will again disable list only.
|
||||
.IP "-L/--location"
|
||||
(HTTP/HTTPS) If the server reports that the requested page has a different
|
||||
@@ -325,10 +377,8 @@ If this option is used twice, the second will again disable location following.
|
||||
.IP "-m/--max-time <seconds>"
|
||||
Maximum time in seconds that you allow the whole operation to take. This is
|
||||
useful for preventing your batch jobs from hanging for hours due to slow
|
||||
networks or links going down. This doesn't work fully in win32 systems.
|
||||
See also the
|
||||
.I "--connect-timeout"
|
||||
option.
|
||||
networks or links going down. This doesn't work fully in win32 systems. See
|
||||
also the \fI--connect-timeout\fP option.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-M/--manual"
|
||||
@@ -485,6 +535,12 @@ If this option is used twice, the second will again disable mute.
|
||||
When used with -s it makes curl show error message if it fails.
|
||||
|
||||
If this option is used twice, the second will again disable show error.
|
||||
.IP "--stderr <file>"
|
||||
Redirect all writes to stderr to the specified file instead. If the file name
|
||||
is a plain '-', it is instead written to stdout. This option has no point when
|
||||
you're using a shell with decent redirecting capabilities.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-t/--telnet-option <OPT=val>"
|
||||
Pass options to the telnet protocol. Supported options are:
|
||||
|
||||
@@ -504,6 +560,24 @@ this is used on a http(s) server, the PUT command will be used.
|
||||
Use the file name "-" (a single dash) to use stdin instead of a given file.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "--trace <file>"
|
||||
Enables a full trace dump of all incoming and outgoing data, including
|
||||
descriptive information, to the given output file. Use "-" as filename to have
|
||||
the output sent to stdout.
|
||||
|
||||
If this option is used several times, the last one will be used. (Added in
|
||||
curl 7.9.7)
|
||||
.IP "--trace-ascii <file>"
|
||||
Enables a full trace dump of all incoming and outgoing data, including
|
||||
descriptive information, to the given output file. Use "-" as filename to have
|
||||
the output sent to stdout.
|
||||
|
||||
This is very similar to --trace, but leaves out the hex part and only shows
|
||||
the ASCII part of the dump. It makes smaller output that might be easier to
|
||||
read for untrained humans.
|
||||
|
||||
If this option is used several times, the last one will be used. (Added in
|
||||
curl 7.9.7)
|
||||
.IP "-u/--user <user:password>"
|
||||
Specify user and password to use when fetching. See README.curl for detailed
|
||||
examples of how to use this. If no password is specified, curl will
|
||||
@@ -525,10 +599,13 @@ or the
|
||||
.I -O
|
||||
options.
|
||||
.IP "-v/--verbose"
|
||||
Makes the fetching more verbose/talkative. Mostly usable for
|
||||
debugging. Lines starting with '>' means data sent by curl, '<'
|
||||
means data received by curl that is hidden in normal cases and lines
|
||||
starting with '*' means additional info provided by curl.
|
||||
Makes the fetching more verbose/talkative. Mostly usable for debugging. Lines
|
||||
starting with '>' means data sent by curl, '<' means data received by curl
|
||||
that is hidden in normal cases and lines starting with '*' means additional
|
||||
info provided by curl.
|
||||
|
||||
Note that if you want to see HTTP headers in the output, \fI-i/--include\fP
|
||||
might be option you're looking for.
|
||||
|
||||
If this option is used twice, the second will again disable verbose.
|
||||
.IP "-V/--version"
|
||||
@@ -610,6 +687,10 @@ If this option is used several times, the last one will be used.
|
||||
Use specified HTTP proxy. If the port number is not specified, it is assumed
|
||||
at port 1080.
|
||||
|
||||
This option overrides existing environment variables that sets proxy to
|
||||
use. If there's an environment variable setting a proxy, you can set proxy to
|
||||
"" to override it.
|
||||
|
||||
\fBNote\fP that all operations that are performed over a HTTP proxy will
|
||||
transparantly be converted to HTTP. It means that certain protocol specific
|
||||
operations might not be available. This is not the case if you can tunnel
|
||||
@@ -632,6 +713,9 @@ If a download is slower than speed-limit bytes per second during a speed-time
|
||||
period, the download gets aborted. If speed-time is used, the default
|
||||
speed-limit will be 1 unless set with -y.
|
||||
|
||||
This option controls transfers and thus will not affect slow connects etc. If
|
||||
this is a concern for you, try the \fI--connect-timeout\fP option.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-Y/--speed-limit <speed>"
|
||||
If a download is slower than this given speed, in bytes per second, for
|
||||
@@ -654,6 +738,12 @@ Start the date expression with a dash (-) to make it request for a document
|
||||
that is older than the given date/time, default is a document that is newer
|
||||
than the specified date/time.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-Z/--max-redirs <num>"
|
||||
Set maximum number of redirection-followings allowed. If -L/--location is
|
||||
used, this option can be used to prevent curl from following redirections "in
|
||||
absurdum".
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.IP "-3/--sslv3"
|
||||
(HTTPS)
|
||||
@@ -669,16 +759,6 @@ Make curl display progress information as a progress bar instead of the
|
||||
default statistics.
|
||||
|
||||
If this option is used twice, the second will again disable the progress bar.
|
||||
.IP "--crlf"
|
||||
(FTP) Convert LF to CRLF in upload. Useful for MVS (OS/390).
|
||||
|
||||
If this option is used twice, the second will again disable crlf converting.
|
||||
.IP "--stderr <file>"
|
||||
Redirect all writes to stderr to the specified file instead. If the file name
|
||||
is a plain '-', it is instead written to stdout. This option has no point when
|
||||
you're using a shell with decent redirecting capabilities.
|
||||
|
||||
If this option is used several times, the last one will be used.
|
||||
.SH FILES
|
||||
.I ~/.curlrc
|
||||
.RS
|
||||
@@ -808,6 +888,24 @@ Malformed telnet option.
|
||||
The remote peer's SSL certificate wasn't ok
|
||||
.IP 52
|
||||
The server didn't reply anything, which here is considered an error.
|
||||
.IP 53
|
||||
SSL crypto engine not found
|
||||
.IP 54
|
||||
Cannot set SSL crypto engine as default
|
||||
.IP 55
|
||||
Failed sending network data
|
||||
.IP 56
|
||||
Failure in receiving network data
|
||||
.IP 57
|
||||
Share is in use (internal error)
|
||||
.IP 58
|
||||
Problem with the local certificate
|
||||
.IP 59
|
||||
Couldn't use specified SSL cipher
|
||||
.IP 60
|
||||
Problem with the CA cert (path? permission?)
|
||||
.IP 61
|
||||
Unrecognized transfer encoding
|
||||
.IP XX
|
||||
There will appear more error codes here in future releases. The existing ones
|
||||
are meant to never change.
|
||||
|
2
docs/examples/.cvsignore
Normal file
2
docs/examples/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
@@ -5,10 +5,11 @@
|
||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||
|
||||
EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \
|
||||
win32sockets.c persistant.c ftpget.c Makefile.example \
|
||||
persistant.c ftpget.c Makefile.example \
|
||||
multithread.c getinmemory.c ftpupload.c httpput.c \
|
||||
simplessl.c ftpgetresp.c http-post.c post-callback.c \
|
||||
multi-app.c multi-double.c multi-single.c
|
||||
multi-app.c multi-double.c multi-single.c multi-post.c \
|
||||
fopen.c simplepost.c
|
||||
|
||||
all:
|
||||
@echo "done"
|
||||
|
@@ -35,7 +35,7 @@ LIBS = -lcurl -lsocket -lnsl -lssl -lcrypto -dl
|
||||
|
||||
# Link the target with all objects and libraries
|
||||
$(TARGET) : $(OBJS)
|
||||
$(CC) $(LDFLAGS) $(LIBS) -o $(TARGET) $(OBJS)
|
||||
$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS) $(LIBS)
|
||||
|
||||
# Compile the source files into object files
|
||||
ftpget.o : ftpget.c
|
||||
|
@@ -1,7 +1,7 @@
|
||||
EXAMPLES
|
||||
|
||||
This directory is for tiny libcurl programming examples. They are meant to
|
||||
show some simple steps on how you can build your own application to take full
|
||||
This directory is for libcurl programming examples. They are meant to show
|
||||
some simple steps on how you can build your own application to take full
|
||||
advantage of libcurl.
|
||||
|
||||
If you end up with other small but still useful example sources, please mail
|
||||
@@ -12,11 +12,14 @@ examples. Just edit the file according to your system and requirements first.
|
||||
|
||||
Most examples should build fine using a command line like this:
|
||||
|
||||
$ gcc `curl-config --cflags` `curl-config --libs` -o example example.c
|
||||
$ `curl-config --cc --cflags --libs` -o example example.c
|
||||
|
||||
Try the php/examples/ directory for PHP programming snippets!
|
||||
Some compilers don't like having the arguments in this order but instead
|
||||
want you do reorganize them like:
|
||||
|
||||
$ `curl-config --cc` -o example example.c `curl-config --cflags --libs`
|
||||
|
||||
*PLEASE* do not use the curl.haxx.se site as a test target for your libcurl
|
||||
applications/experiments. Even if the examples in this directory use that
|
||||
site as an example URL at some places, it doesn't mean that the URLs work or
|
||||
that we expect you to actually torture our web site with your tests! Thanks.
|
||||
applications/experiments. Even if the examples in this directory use that site
|
||||
as an example URL at some places, it doesn't mean that the URLs work or that
|
||||
we expect you to actually torture our web site with your tests! Thanks.
|
||||
|
222
docs/examples/fopen.c
Normal file
222
docs/examples/fopen.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* This example source code introduces an fopen()/fread()/fclose() emulation
|
||||
* for URL reads. Using an approach similar to this, you could replace your
|
||||
* program's fopen() with this url_fopen() and fread() with url_fread() and
|
||||
* it should be possible to read remote streams instead of (only) local files.
|
||||
*
|
||||
* See the main() function at the bottom that shows a tiny app in action.
|
||||
*
|
||||
* This source code is a proof of concept. It will need further attention to
|
||||
* become production-use useful and solid.
|
||||
*
|
||||
* This example requires libcurl 7.9.7 or later.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include <curl/types.h>
|
||||
#include <curl/easy.h>
|
||||
|
||||
struct data {
|
||||
int type;
|
||||
union {
|
||||
CURL *curl;
|
||||
FILE *file;
|
||||
} handle;
|
||||
|
||||
/* TODO: We should perhaps document the biggest possible buffer chunk we can
|
||||
get from libcurl in one single callback... */
|
||||
char buffer[CURL_MAX_WRITE_SIZE];
|
||||
|
||||
char *readptr; /* read from here */
|
||||
int bytes; /* bytes available from read pointer */
|
||||
|
||||
CURLMcode m; /* stored from a previous url_fread() */
|
||||
};
|
||||
|
||||
typedef struct data URL_FILE;
|
||||
|
||||
/* we use a global one for convenience */
|
||||
CURLM *multi_handle;
|
||||
|
||||
static
|
||||
size_t write_callback(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
void *userp)
|
||||
{
|
||||
URL_FILE *url = (URL_FILE *)userp;
|
||||
size *= nitems;
|
||||
|
||||
memcpy(url->readptr, buffer, size);
|
||||
url->readptr += size;
|
||||
url->bytes += size;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
URL_FILE *url_fopen(char *url, char *operation)
|
||||
{
|
||||
/* this code could check for URLs or types in the 'url' and
|
||||
basicly use the real fopen() for standard files */
|
||||
|
||||
URL_FILE *file;
|
||||
int still_running;
|
||||
|
||||
file = (URL_FILE *)malloc(sizeof(URL_FILE));
|
||||
if(!file)
|
||||
return NULL;
|
||||
|
||||
memset(file, 0, sizeof(URL_FILE));
|
||||
|
||||
file->type = 1; /* marked as URL, use 0 for plain file */
|
||||
file->handle.curl = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_FILE, file);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, FALSE);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
|
||||
if(!multi_handle)
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
curl_multi_add_handle(multi_handle, file->handle.curl);
|
||||
|
||||
while(CURLM_CALL_MULTI_PERFORM ==
|
||||
curl_multi_perform(multi_handle, &still_running));
|
||||
|
||||
/* if still_running would be 0 now, we should return NULL */
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
void url_fclose(URL_FILE *file)
|
||||
{
|
||||
/* make sure the easy handle is not in the multi handle anymore */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* cleanup */
|
||||
curl_easy_cleanup(file->handle.curl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file)
|
||||
{
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd;
|
||||
struct timeval timeout;
|
||||
int rc;
|
||||
int still_running = 0;
|
||||
|
||||
if(!file->bytes) { /* no data available at this point */
|
||||
|
||||
file->readptr = file->buffer; /* reset read pointer */
|
||||
|
||||
if(CURLM_CALL_MULTI_PERFORM == file->m) {
|
||||
while(CURLM_CALL_MULTI_PERFORM ==
|
||||
curl_multi_perform(multi_handle, &still_running)) {
|
||||
if(file->bytes) {
|
||||
printf("(fread) WOAH! THis happened!\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!still_running) {
|
||||
printf("NO MORE RUNNING AROUND!\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to fail on */
|
||||
timeout.tv_sec = 500; /* 5 minutes */
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
default:
|
||||
/* timeout or readable/writable sockets */
|
||||
do {
|
||||
file->m = curl_multi_perform(multi_handle, &still_running);
|
||||
|
||||
if(file->bytes)
|
||||
/* we have received data, return that now */
|
||||
break;
|
||||
|
||||
} while(CURLM_CALL_MULTI_PERFORM == file->m);
|
||||
|
||||
|
||||
if(!still_running)
|
||||
printf("NO MORE RUNNING AROUND!\n");
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
printf("(fread) Skip network read\n");
|
||||
|
||||
if(file->bytes) {
|
||||
/* data already available, return that */
|
||||
int want = size * nmemb;
|
||||
|
||||
if(file->bytes < want)
|
||||
want = file->bytes;
|
||||
|
||||
memcpy(ptr, file->readptr, want);
|
||||
file->readptr += want;
|
||||
file->bytes -= want;
|
||||
|
||||
printf("(fread) return %d bytes\n", want);
|
||||
|
||||
return want;
|
||||
}
|
||||
return 0; /* no data available to return */
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
URL_FILE *handle;
|
||||
int nread;
|
||||
char buffer[256];
|
||||
|
||||
handle = url_fopen("http://www.haxx.se", "r");
|
||||
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen()\n");
|
||||
}
|
||||
|
||||
do {
|
||||
nread = url_fread(buffer, sizeof(buffer), 1, handle);
|
||||
|
||||
printf("We got: %d bytes\n", nread);
|
||||
} while(nread);
|
||||
|
||||
url_fclose(handle);
|
||||
|
||||
return 0;
|
||||
}
|
126
docs/examples/multi-post.c
Normal file
126
docs/examples/multi-post.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* This is an example application source code using the multi interface
|
||||
* to do a multipart formpost without "blocking".
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
|
||||
CURLM *multi_handle;
|
||||
int still_running;
|
||||
|
||||
struct HttpPost *formpost=NULL;
|
||||
struct HttpPost *lastptr=NULL;
|
||||
struct curl_slist *headerlist=NULL;
|
||||
char buf[] = "Expect:";
|
||||
|
||||
/* Fill in the file upload field */
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "sendfile",
|
||||
CURLFORM_FILE, "postit2.c",
|
||||
CURLFORM_END);
|
||||
|
||||
/* Fill in the filename field */
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "filename",
|
||||
CURLFORM_COPYCONTENTS, "postit2.c",
|
||||
CURLFORM_END);
|
||||
|
||||
|
||||
/* Fill in the submit field too, even if this is rarely needed */
|
||||
curl_formadd(&formpost,
|
||||
&lastptr,
|
||||
CURLFORM_COPYNAME, "submit",
|
||||
CURLFORM_COPYCONTENTS, "send",
|
||||
CURLFORM_END);
|
||||
|
||||
curl = curl_easy_init();
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
/* initalize custom header list (stating that Expect: 100-continue is not
|
||||
wanted */
|
||||
headerlist = curl_slist_append(headerlist, buf);
|
||||
if(curl && multi_handle) {
|
||||
int perform=0;
|
||||
|
||||
/* what URL that receives this POST */
|
||||
curl_easy_setopt(curl, CURLOPT_URL,
|
||||
"http://www.fillinyoururl.com/upload.cgi");
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
|
||||
|
||||
curl_multi_add_handle(multi_handle, curl);
|
||||
|
||||
while(CURLM_CALL_MULTI_PERFORM ==
|
||||
curl_multi_perform(multi_handle, &still_running));
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
int rc; /* select() return code */
|
||||
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0:
|
||||
printf("timeout!\n");
|
||||
default:
|
||||
/* timeout or readable/writable sockets */
|
||||
printf("perform!\n");
|
||||
while(CURLM_CALL_MULTI_PERFORM ==
|
||||
curl_multi_perform(multi_handle, &still_running));
|
||||
printf("running: %d!\n", still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
curl_multi_cleanup(multi_handle);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
/* then cleanup the formpost chain */
|
||||
curl_formfree(formpost);
|
||||
|
||||
/* free slist */
|
||||
curl_slist_free_all (headerlist);
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -63,6 +63,10 @@ int main(int argc, char **argv)
|
||||
/* we want the headers to this file handle */
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEHEADER ,headerfile);
|
||||
|
||||
/*
|
||||
* Notice here that if you want the actual data sent anywhere else but
|
||||
* stdout, you should consider using the CURLOPT_WRITEDATA option. */
|
||||
|
||||
/* get it! */
|
||||
curl_easy_perform(curl_handle);
|
||||
|
||||
|
36
docs/examples/simplepost.c
Normal file
36
docs/examples/simplepost.c
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLcode res;
|
||||
|
||||
char *postthis="moo mooo moo moo";
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "http://posthere.com");
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis);
|
||||
|
||||
/* if we don't provide POSTFIELDSIZE, libcurl will strlen() by
|
||||
itself */
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(postthis));
|
||||
|
||||
res = curl_easy_perform(curl);
|
||||
|
||||
/* always cleanup */
|
||||
curl_easy_cleanup(curl);
|
||||
}
|
||||
return 0;
|
||||
}
|
@@ -1,49 +0,0 @@
|
||||
|
||||
/*
|
||||
* Note: This is only required if you use curl 7.8 or lower, later
|
||||
* versions provide an option to curl_global_init() that does the
|
||||
* win32 initialization for you.
|
||||
*/
|
||||
|
||||
/*
|
||||
* These are example functions doing socket init that Windows
|
||||
* require. If you don't use windows, you can safely ignore this crap.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
void win32_cleanup(void)
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
int win32_init(void)
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
wVersionRequested = MAKEWORD(1, 1);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
|
||||
if (err != 0)
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
/* winsock.dll. */
|
||||
return 1;
|
||||
|
||||
/* Confirm that the Windows Sockets DLL supports 1.1.*/
|
||||
/* Note that if the DLL supports versions greater */
|
||||
/* than 1.1 in addition to 1.1, it will still return */
|
||||
/* 1.1 in wVersion since that is the version we */
|
||||
/* requested. */
|
||||
|
||||
if ( LOBYTE( wsaData.wVersion ) != 1 ||
|
||||
HIBYTE( wsaData.wVersion ) != 1 ) {
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
|
||||
/* winsock.dll. */
|
||||
WSACleanup();
|
||||
return 1;
|
||||
}
|
||||
return 0; /* 0 is ok */
|
||||
}
|
21
docs/index.html
Normal file
21
docs/index.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<TITLE>Index to Curl documentation</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<H1 ALIGN="CENTER">Index to Curl documentation</H1>
|
||||
|
||||
<H2>Programs</H2>
|
||||
<a href="curl-config.html">curl-config</A>
|
||||
<br><a href="curl.html">curl</A>
|
||||
|
||||
<h2>Tutorial</h2>
|
||||
<a href="TheArtOfHttpScripting">The Art Of Scripting HTTP Requests Using Curl</a> (plain text)
|
||||
|
||||
<h2>libcurl</h2>
|
||||
See the <a href="libcurl/index.html">libcurl section</a>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
@@ -116,6 +116,7 @@ Global Preparation
|
||||
Repeated calls to curl_global_init() and curl_global_cleanup() should be
|
||||
avoided. They should only be called once each.
|
||||
|
||||
|
||||
Handle the Easy libcurl
|
||||
|
||||
libcurl version 7 is oriented around the so called easy interface. All
|
||||
@@ -215,6 +216,23 @@ Handle the Easy libcurl
|
||||
previous
|
||||
|
||||
|
||||
Multi-threading issues
|
||||
|
||||
libcurl is completely thread safe, except for two issues: signals and alarm
|
||||
handlers. Signals are needed for a SIGPIPE handler, and the alarm() syscall
|
||||
is used to catch timeouts (mostly during DNS lookup).
|
||||
|
||||
So when using multiple threads you should first ignore SIGPIPE in your main
|
||||
thread and set the CURLOPT_NOSIGNAL option to TRUE for all handles.
|
||||
|
||||
Everything will work fine except that timeouts are not honored during the DNS
|
||||
lookup - this would require some sort of asynchronous DNS lookup (which is
|
||||
planned for a future libcurl version).
|
||||
|
||||
For SIGPIPE info see the UNIX Socket FAQ at
|
||||
http://www.unixguide.net/network/socketfaq/2.22.shtml
|
||||
|
||||
|
||||
When It Doesn't Work
|
||||
|
||||
There will always be times when the transfer fails for some reason. You might
|
||||
@@ -735,7 +753,7 @@ Customizing Operations
|
||||
request, and you're free to pass any amount of extra headers that you think
|
||||
fit. Adding headers are this easy:
|
||||
|
||||
struct curl_slist *headers;
|
||||
struct curl_slist *headers=NULL; /* init to NULL is important */
|
||||
|
||||
headers = curl_slist_append(headers, "Hey-server-hey: how are you?");
|
||||
headers = curl_slist_append(headers, "X-silly-content: yes");
|
||||
@@ -949,11 +967,11 @@ Security Considerations
|
||||
.netrc is a pretty handy file/feature that allows you to login quickly and
|
||||
automaticly to frequently visited sites. The file contains passwords in
|
||||
clear text and is a real security risk. In some cases, your .netrc is also
|
||||
stored in a home directory that is NFS mounter or used on another network
|
||||
stored in a home directory that is NFS mounted or used on another network
|
||||
based file system, so the clear text password will fly through your
|
||||
network every time anyone reads that file!
|
||||
|
||||
To avoid this problem, don't use .netrc files and never store passwords as
|
||||
To avoid this problem, don't use .netrc files and never store passwords in
|
||||
plain text anywhere.
|
||||
|
||||
Clear Text Passwords
|
||||
|
3
docs/libcurl/.cvsignore
Normal file
3
docs/libcurl/.cvsignore
Normal file
@@ -0,0 +1,3 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
*html
|
@@ -19,8 +19,10 @@ man_MANS = \
|
||||
curl_slist_append.3 \
|
||||
curl_slist_free_all.3 \
|
||||
curl_version.3 \
|
||||
curl_version_info.3 \
|
||||
curl_escape.3 \
|
||||
curl_unescape.3 \
|
||||
curl_free.3 \
|
||||
curl_strequal.3 \
|
||||
curl_strnequal.3 \
|
||||
curl_mprintf.3 \
|
||||
@@ -52,8 +54,10 @@ HTMLPAGES = \
|
||||
curl_slist_append.html \
|
||||
curl_slist_free_all.html \
|
||||
curl_version.html \
|
||||
curl_version_info.html \
|
||||
curl_escape.html \
|
||||
curl_unescape.html \
|
||||
curl_free.html \
|
||||
curl_strequal.html \
|
||||
curl_strnequal.html \
|
||||
curl_mprintf.html \
|
||||
|
@@ -2,7 +2,7 @@
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_easy_init 3 "31 Jan 2001" "libcurl 7.9.4" "libcurl Manual"
|
||||
.TH curl_easy_init 3 "25 Apr 2002" "libcurl 7.9.7" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_getinfo - Extract information from a curl session (added in 7.4)
|
||||
.SH SYNOPSIS
|
||||
@@ -38,7 +38,9 @@ CURLOPT_FILETIME option to \fIcurl_easy_setopt(3)\fP. (Added in 7.5)
|
||||
.TP
|
||||
.B CURLINFO_TOTAL_TIME
|
||||
Pass a pointer to a double to receive the total transaction time in seconds
|
||||
for the previous transfer.
|
||||
for the previous transfer. This time does not include the connect time, so if
|
||||
you want the complete operation time, you should add the
|
||||
CURLINFO_CONNECT_TIME.
|
||||
.TP
|
||||
.B CURLINFO_NAMELOOKUP_TIME
|
||||
Pass a pointer to a double to receive the time, in seconds, it took from the
|
||||
@@ -60,6 +62,16 @@ start until the first byte is just about to be transfered. This includes
|
||||
CURLINFO_PRETRANSFER_TIME and also the time the server needs to calculate
|
||||
the result.
|
||||
.TP
|
||||
.B CURLINFO_REDIRECT_TIME
|
||||
Pass a pointer to a double to receive the total time, in seconds, it took for
|
||||
all redirection steps include name lookup, connect, pretransfer and transfer
|
||||
before final transaction was started. CURLINFO_REDIRECT_TIME contains the
|
||||
complete execution time for multiple redirections. (Added in 7.9.7)
|
||||
.TP
|
||||
.B CURLINFO_REDIRECT_COUNT
|
||||
Pass a pointer to a long to receive the total number of redirections that were
|
||||
actually followed. (Added in 7.9.7)
|
||||
.TP
|
||||
.B CURLINFO_SIZE_UPLOAD
|
||||
Pass a pointer to a double to receive the total amount of bytes that were
|
||||
uploaded.
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@ two-digit hexadecimal number).
|
||||
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.
|
||||
You must curl_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
|
||||
.I curl_unescape(), curl_free(), RFC 2396
|
||||
|
@@ -2,13 +2,13 @@
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_formadd 3 "1 Match 2002" "libcurl 7.9.1" "libcurl Manual"
|
||||
.TH curl_formadd 3 "24 June 2002" "libcurl 7.9.8" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_formadd - add a section to a multipart/formdata HTTP POST
|
||||
.SH SYNOPSIS
|
||||
.B #include <curl/curl.h>
|
||||
.sp
|
||||
.BI "int curl_formadd(struct HttpPost ** " firstitem,
|
||||
.BI "CURLFORMcode curl_formadd(struct HttpPost ** " firstitem,
|
||||
.BI "struct HttpPost ** " lastitem, " ...);"
|
||||
.ad
|
||||
.SH DESCRIPTION
|
||||
@@ -29,9 +29,10 @@ name). All options that use the word COPY in their names copy the given
|
||||
contents, while the ones with PTR in their names simply points to the (static)
|
||||
data you must make sure remain until curl no longer needs it.
|
||||
|
||||
The four options for providing values are: \fBCURLFORM_COPYCONTENTS\fP,
|
||||
\fBCURLFORM_PTRCONTENTS\fP, \fBCURLFORM_FILE\fP, or \fBCURLFORM_FILECONTENT\fP
|
||||
followed by a char or void pointer (allowed for PTRCONTENTS).
|
||||
The options for providing values are: \fBCURLFORM_COPYCONTENTS\fP,
|
||||
\fBCURLFORM_PTRCONTENTS\fP, \fBCURLFORM_FILE\fP, \fBCURLFORM_BUFFER\fP,
|
||||
or \fBCURLFORM_FILECONTENT\fP followed by a char or void pointer
|
||||
(allowed for PTRCONTENTS).
|
||||
|
||||
\fBCURLFORM_FILECONTENT\fP does a normal post like \fBCURLFORM_COPYCONTENTS\fP
|
||||
but the actual value is read from the filename given as a string.
|
||||
@@ -48,15 +49,25 @@ For \fBCURLFORM_FILE\fP the user may send multiple files in one section by
|
||||
providing multiple \fBCURLFORM_FILE\fP arguments each followed by the filename
|
||||
(and each FILE is allowed to have a CONTENTTYPE).
|
||||
|
||||
Another possibility to send single or multiple files in one section is to use
|
||||
\fBCURLFORM_ARRAY\fP that gets a struct curl_forms array pointer as its
|
||||
value. Each structure element has a CURLformoption and a char pointer. For the
|
||||
options only \fBCURLFORM_FILE\fP, \fBCURLFORM_CONTENTTYPE\fP, and
|
||||
\fBCURLFORM_END\fP (that is used to determine the end of the array and thus
|
||||
must be the option of the last and no other element of the curl_forms array)
|
||||
are allowed. The effect of this parameter is the same as giving multiple
|
||||
\fBCURLFORM_FILE\fP options possibly with \fBCURLFORM_CONTENTTYPE\fP after or
|
||||
before each \fBCURLFORM_FILE\fP option.
|
||||
\fBCURLFORM_BUFFER\fP
|
||||
tells libcurl that a buffer is to be used to upload data instead of using a
|
||||
file. The value of the next parameter is used as the value of the "filename"
|
||||
parameter in the content header.
|
||||
|
||||
\fBCURLFORM_BUFFERPTR\fP
|
||||
tells libcurl that the address of the next parameter is a pointer to the buffer
|
||||
containing data to upload. The buffer containing this data must not be freed
|
||||
until after curl_easy_cleanup is called.
|
||||
|
||||
\fBCURLFORM_BUFFERLENGTH\fP
|
||||
tells libcurl that the length of the buffer to upload is the value of the
|
||||
next parameter.
|
||||
|
||||
Another possibility to send options to curl_formadd() is the
|
||||
\fBCURLFORM_ARRAY\fP option, that passes a struct curl_forms array pointer as
|
||||
its value. Each curl_forms structure element has a CURLformoption and a char
|
||||
pointer. The final element in the array must be a CURLFORM_END. All available
|
||||
options can be used in an array, except the CURLFORM_ARRAY option itself!
|
||||
|
||||
Should you need to specify extra headers for the form POST section, use
|
||||
\fBCURLFORM_CONTENTHEADER\fP. This takes a curl_slist prepared in the usual way
|
||||
@@ -83,7 +94,9 @@ you call \fIcurl_form_free\fP and \fIcurl_easy_cleanup\fP.
|
||||
|
||||
See example below.
|
||||
.SH RETURN VALUE
|
||||
Returns non-zero if an error occurs.
|
||||
0 means everything was ok, non-zero means an error occurred as
|
||||
.I <curl/curl.h>
|
||||
defines.
|
||||
.SH EXAMPLE
|
||||
.nf
|
||||
|
||||
@@ -147,6 +160,14 @@ Returns non-zero if an error occurs.
|
||||
forms[1].value = file2;
|
||||
forms[2].option = CURLFORM_END;
|
||||
|
||||
/* Add a buffer to upload */
|
||||
curl_formadd(&post, &last,
|
||||
CURLFORM_COPYNAME, "name",
|
||||
CURLFORM_BUFFER, "data",
|
||||
CURLFORM_BUFFERPTR, record,
|
||||
CURLFORM_BUFFERLENGTH, record_length,
|
||||
CURLFORM_END);
|
||||
|
||||
/* no option needed for the end marker */
|
||||
curl_formadd(&post, &last, CURLFORM_COPYNAME, "pictures",
|
||||
CURLFORM_ARRAY, forms, CURLFORM_END);
|
||||
|
17
docs/libcurl/curl_free.3
Normal file
17
docs/libcurl/curl_free.3
Normal file
@@ -0,0 +1,17 @@
|
||||
.\" You can view this file with:
|
||||
.\" nroff -man [file]
|
||||
.\" $Id:
|
||||
.\"
|
||||
.TH curl_free 3 "24 Sept 2002" "libcurl 7.10" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_free - reclaim memory that has been obtained through a libcurl call
|
||||
.SH SYNOPSIS
|
||||
.B #include <curl/curl.h>
|
||||
.sp
|
||||
.BI "void *curl_free( char *" ptr " );"
|
||||
.ad
|
||||
.SH DESCRIPTION
|
||||
curl_free reclaims memory that has been obtained through a libcurl call.
|
||||
Use curl_free() instead of free() to avoid anomalies that can result from differences in memory management between your application and libcurl.
|
||||
.SH "SEE ALSO"
|
||||
.I curl_unescape(), curl_free()
|
@@ -1,6 +1,6 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_multi_fdset 3 "1 March 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||
.TH curl_multi_fdset 3 "3 May 2002" "libcurl 7.9.5" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_multi_fdset - add an easy handle to a multi session
|
||||
.SH SYNOPSIS
|
||||
@@ -17,6 +17,10 @@ This function extracts file descriptor information from a given multi_handle.
|
||||
libcurl returns its fd_set sets. The application can use these to select() or
|
||||
poll() on. The curl_multi_perform() function should be called as soon as one
|
||||
of them are ready to be read from or written to.
|
||||
|
||||
NOTE that once this call is made, you must not remove the sets you point to,
|
||||
as libcurl will need to be able to read them. It needs them after select()
|
||||
calls, to know if certain sockets are readable or writable.
|
||||
.SH RETURN VALUE
|
||||
CURLMcode type, general libcurl multi interface error code.
|
||||
.SH "SEE ALSO"
|
||||
|
@@ -20,8 +20,8 @@ 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.
|
||||
You must curl_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
|
||||
.I curl_escape(), curl_free(), RFC 2396
|
||||
|
93
docs/libcurl/curl_version_info.3
Normal file
93
docs/libcurl/curl_version_info.3
Normal file
@@ -0,0 +1,93 @@
|
||||
.\" You can view this file with:
|
||||
.\" nroff -man [file]
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_version_info 3 "30 Sep 2002" "libcurl 7.10" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_version_info - returns run-time libcurl version info
|
||||
.SH SYNOPSIS
|
||||
.B #include <curl/curl.h>
|
||||
.sp
|
||||
.BI "curl_version_info_data *curl_version_info( CURLversion "type ");"
|
||||
.ad
|
||||
.SH DESCRIPTION
|
||||
Returns a pointer to a filled in struct with information about various
|
||||
run-time features in libcurl. \fItype\fP should be set to the version of this
|
||||
functionality by the time you write your program. This way, libcurl will
|
||||
always return a proper struct that your program understands, while programs in
|
||||
the future might get an different struct. CURLVERSION_NOW will be the most
|
||||
recent one for the library you have installed:
|
||||
|
||||
data = curl_version_info(CURLVERSION_NOW);
|
||||
|
||||
Applications should use this information to judge if things are possible to do
|
||||
or not, instead of using compile-time checks, as dynamic/DLL libraries can be
|
||||
changed independent of applications.
|
||||
|
||||
The curl_version_info_data struct looks like this
|
||||
|
||||
.nf
|
||||
typedef struct {
|
||||
CURLversion age; /* 0 - this kind of struct */
|
||||
const char *version; /* human readable string */
|
||||
unsigned int version_num; /* numeric representation */
|
||||
const char *host; /* human readable string */
|
||||
int features; /* bitmask, see below */
|
||||
char *ssl_version; /* human readable string */
|
||||
long ssl_version_num; /* number */
|
||||
char *libz_version; /* human readable string */
|
||||
const char *protocols[]; /* list of protocols */
|
||||
} curl_version_info_data;
|
||||
.fi
|
||||
|
||||
\fIage\fP describes what kind of struct this is. It is always 0 now. In a
|
||||
future libcurl, if this struct changes, this age counter may be increased, and
|
||||
then the struct for number 1 will look different (except for this first struct
|
||||
field).
|
||||
|
||||
\fIversion\fP is just an ascii string for the libcurl version.
|
||||
|
||||
\fIversion_num\fP is a 6 digit hexadecimal number created like this: <2 digits
|
||||
major number> | <2 digits minor number> | <2 digits patch number>. Version
|
||||
7.9.8 is therefore returned as 0x070908.
|
||||
|
||||
\fIhost\fP is an ascii string showing what host information that this libcurl
|
||||
was built for. As discovered by a configure script or set by the build
|
||||
environment.
|
||||
|
||||
\fIfeatures\fP can have none, one or more bits set, and the currently defined
|
||||
bits are:
|
||||
.TP 5.5
|
||||
.B CURL_VERSION_IPV6
|
||||
supports IPv6
|
||||
.TP
|
||||
.B CURL_VERSION_KERBEROS4
|
||||
supports kerberos4 (when using FTP)
|
||||
.TP
|
||||
.B CURL_VERSION_SSL
|
||||
supports SSL (HTTPS/FTPS)
|
||||
.TP
|
||||
.B CURL_VERSION_LIBZ
|
||||
supports HTTP deflate using libz
|
||||
.PP
|
||||
\fIssl_version\fP is an ascii string for the OpenSSL version used. If libcurl
|
||||
has no SSL support, this is NULL.
|
||||
|
||||
\fIssl_version_num\fP is the numerical OpenSSL version value as defined by the
|
||||
OpenSSL project. If libcurl has no SSL support, this is 0.
|
||||
|
||||
\fIlibz_version\fP is an ascii string (there is no numerical version). If
|
||||
libcurl has no libz support, this is NULL.
|
||||
|
||||
\fIprotocols\fP is a pointer to an array of char * pointers, containing the
|
||||
names protocols that libcurl supports (using lowercase letters). The protocol
|
||||
names are the same as would be used in URLs. The array is terminated by a NULL
|
||||
entry.
|
||||
|
||||
|
||||
.SH RETURN VALUE
|
||||
A pointer to a curl_version_info_data struct.
|
||||
.SH "SEE ALSO"
|
||||
\fIcurl_version(3)\fP
|
||||
.SH BUGS
|
||||
No known bugs.
|
@@ -1,48 +1,52 @@
|
||||
HTML>
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
|
||||
<TITLE>Index to Curl documentation</TITLE>
|
||||
<TITLE>Index to libcurl documentation</TITLE>
|
||||
</HEAD>
|
||||
|
||||
<BODY>
|
||||
<H1 ALIGN="CENTER">Index to Curl documentation</H1>
|
||||
<H1 ALIGN="CENTER">Index to libcurl documentation</H1>
|
||||
|
||||
<H2>Programs</H2>
|
||||
<P><A HREF="curl-config.html">curl-config.html</A>
|
||||
<P><A HREF="curl.html">curl.html</A>
|
||||
<P><A HREF="../index.html">curl and tools</A>
|
||||
|
||||
<H2>Library routines</H2>
|
||||
<P><A HREF="libcurl.html">libcurl.html</A>
|
||||
<P><A HREF="curl_easy_cleanup.html">curl_easy_cleanup.html</A>
|
||||
<P><A HREF="curl_easy_duphandle.html">curl_easy_duphandle.html</A>
|
||||
<P><A HREF="curl_easy_getinfo.html">curl_easy_getinfo.html</A>
|
||||
<P><A HREF="curl_easy_init.html">curl_easy_init.html</A>
|
||||
<P><A HREF="curl_easy_perform.html">curl_easy_perform.html</A>
|
||||
<P><A HREF="curl_easy_setopt.html">curl_easy_setopt.html</A>
|
||||
<P><A HREF="curl_escape.html">curl_escape.html</A>
|
||||
<P><A HREF="curl_formadd.html">curl_formadd.html</A>
|
||||
<P><A HREF="curl_formfree.html">curl_formfree.html</A>
|
||||
<P><A HREF="curl_formparse.html">curl_formparse.html</A>
|
||||
<P><A HREF="curl_getdate.html">curl_getdate.html</A>
|
||||
<P><A HREF="curl_getenv.html">curl_getenv.html</A>
|
||||
<P><A HREF="curl_global_cleanup.html">curl_global_cleanup.html</A>
|
||||
<P><A HREF="curl_global_init.html">curl_global_init.html</A>
|
||||
<P><A HREF="curl_mprintf.html">curl_mprintf.html</A>
|
||||
<P><A HREF="curl_slist_append.html">curl_slist_append.html</A>
|
||||
<P><A HREF="curl_slist_free_all.html">curl_slist_free_all.html</A>
|
||||
<P><A HREF="curl_strequal.html">curl_strequal.html</A>
|
||||
<P><A HREF="curl_strnequal.html">curl_strnequal.html</A>
|
||||
<P><A HREF="curl_unescape.html">curl_unescape.html</A>
|
||||
<P><A HREF="curl_version.html">curl_version.html</A>
|
||||
<hr>
|
||||
<p><a href="curl_multi_add_handle.html">curl_multi_add_handle.html</a>
|
||||
<p><a href="curl_multi_cleanup.html">curl_multi_cleanup.html</a>
|
||||
<p><a href="curl_multi_fdset.html">curl_multi_fdset.html</a>
|
||||
<p><a href="curl_multi_info_read.html">curl_multi_info_read.html</a>
|
||||
<p><a href="curl_multi_init.html">curl_multi_init.html</a>
|
||||
<p><a href="curl_multi_perform.html">curl_multi_perform.html</a>
|
||||
<p><a href="curl_multi_remove_handle.html">curl_multi_remove_handle.html</a>
|
||||
<p><a href="libcurl-multi.html">libcurl-multi.html</a>
|
||||
<h2>Overviews</h2>
|
||||
<A HREF="libcurl.html">libcurl</A>
|
||||
<br><a href="libcurl-multi.html">libcurl-multi</a>
|
||||
<br><a href="libcurl-errors.html">libcurl-errors</a>
|
||||
<br><a href="../libcurl-the-guide">libcurl-the-guide</a> (plain text)
|
||||
|
||||
<H2>Library Functions (A-Z)</H2>
|
||||
<a href="curl_easy_cleanup.html">curl_easy_cleanup</A>
|
||||
<br><a href="curl_easy_duphandle.html">curl_easy_duphandle</A>
|
||||
<br><a href="curl_easy_getinfo.html">curl_easy_getinfo</A>
|
||||
<br><a href="curl_easy_init.html">curl_easy_init</A>
|
||||
<br><a href="curl_easy_perform.html">curl_easy_perform</A>
|
||||
<br><a href="curl_easy_setopt.html">curl_easy_setopt</A>
|
||||
<br><a href="curl_escape.html">curl_escape</A>
|
||||
<br><a href="curl_formadd.html">curl_formadd</A>
|
||||
<br><a href="curl_formfree.html">curl_formfree</A>
|
||||
<br><a href="curl_formparse.html">curl_formparse</A>
|
||||
<br><a href="curl_free.html">curl_free</A>
|
||||
<br><a href="curl_getdate.html">curl_getdate</A>
|
||||
<br><a href="curl_getenv.html">curl_getenv</A>
|
||||
<br><a href="curl_global_cleanup.html">curl_global_cleanup</A>
|
||||
<br><a href="curl_global_init.html">curl_global_init</A>
|
||||
<br><a href="curl_mprintf.html">curl_mprintf</A>
|
||||
<br><a href="curl_multi_add_handle.html">curl_multi_add_handle</a>
|
||||
<br><a href="curl_multi_cleanup.html">curl_multi_cleanup</a>
|
||||
<br><a href="curl_multi_fdset.html">curl_multi_fdset</a>
|
||||
<br><a href="curl_multi_info_read.html">curl_multi_info_read</a>
|
||||
<br><a href="curl_multi_init.html">curl_multi_init</a>
|
||||
<br><a href="curl_multi_perform.html">curl_multi_perform</a>
|
||||
<br><a href="curl_multi_remove_handle.html">curl_multi_remove_handle</a>
|
||||
<br><a href="curl_slist_append.html">curl_slist_append</A>
|
||||
<br><a href="curl_slist_free_all.html">curl_slist_free_all</A>
|
||||
<br><a href="curl_strequal.html">curl_strequal</A>
|
||||
<br><a href="curl_strnequal.html">curl_strnequal</A>
|
||||
<br><a href="curl_unescape.html">curl_unescape</A>
|
||||
<br><a href="curl_version.html">curl_version</A>
|
||||
<br><a href="curl_version_info.html">curl_version_info</A>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
2
include/.cvsignore
Normal file
2
include/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
2
include/curl/.cvsignore
Normal file
2
include/curl/.cvsignore
Normal file
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __CURL_CURL_H
|
||||
#define __CURL_CURL_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
/* The include stuff here is mainly for time_t! */
|
||||
@@ -49,7 +49,7 @@
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#include <curl/types.h>
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -65,6 +65,11 @@ struct curl_httppost {
|
||||
long namelength; /* length of name length */
|
||||
char *contents; /* pointer to allocated data contents */
|
||||
long contentslength; /* length of contents field */
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
char *buffer; /* pointer to allocated buffer contents */
|
||||
long bufferlength; /* length of buffer field */
|
||||
|
||||
char *contenttype; /* Content-Type */
|
||||
struct curl_slist* contentheader; /* list of extra headers for this form */
|
||||
struct curl_httppost *more; /* if one field name has more than one file, this
|
||||
@@ -76,6 +81,11 @@ struct curl_httppost {
|
||||
do not free in formfree */
|
||||
#define HTTPPOST_PTRCONTENTS (1<<3) /* contents is only stored pointer
|
||||
do not free in formfree */
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
#define HTTPPOST_BUFFER (1<<4) /* upload file from buffer */
|
||||
#define HTTPPOST_PTRBUFFER (1<<5) /* upload file from pointer contents */
|
||||
|
||||
char *showfilename; /* The file name to show. If not set, the actual
|
||||
file name will be used (if this is a file part) */
|
||||
};
|
||||
@@ -86,6 +96,8 @@ typedef int (*curl_progress_callback)(void *clientp,
|
||||
double ultotal,
|
||||
double ulnow);
|
||||
|
||||
#define CURL_MAX_WRITE_SIZE 20480
|
||||
|
||||
typedef size_t (*curl_write_callback)(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
@@ -162,7 +174,7 @@ typedef enum {
|
||||
CURLE_HTTP_RANGE_ERROR, /* 33 - RANGE "command" didn't work */
|
||||
CURLE_HTTP_POST_ERROR, /* 34 */
|
||||
CURLE_SSL_CONNECT_ERROR, /* 35 - wrong when connecting with SSL */
|
||||
CURLE_FTP_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
|
||||
CURLE_BAD_DOWNLOAD_RESUME, /* 36 - couldn't resume download */
|
||||
CURLE_FILE_COULDNT_READ_FILE, /* 37 */
|
||||
CURLE_LDAP_CANNOT_BIND, /* 38 */
|
||||
CURLE_LDAP_SEARCH_FAILED, /* 39 */
|
||||
@@ -180,13 +192,25 @@ typedef enum {
|
||||
CURLE_SSL_PEER_CERTIFICATE, /* 51 - peer's certificate wasn't ok */
|
||||
CURLE_GOT_NOTHING, /* 52 - when this is a specific error */
|
||||
CURLE_SSL_ENGINE_NOTFOUND, /* 53 - SSL crypto engine not found */
|
||||
CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as default */
|
||||
CURLE_SSL_ENGINE_SETFAILED, /* 54 - can not set SSL crypto engine as
|
||||
default */
|
||||
CURLE_SEND_ERROR, /* 55 - failed sending network data */
|
||||
CURLE_RECV_ERROR, /* 56 - failure in receiving network data */
|
||||
CURLE_SHARE_IN_USE, /* 57 - share is in use */
|
||||
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
|
||||
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
|
||||
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
|
||||
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */
|
||||
|
||||
CURL_LAST /* never use! */
|
||||
} CURLcode;
|
||||
|
||||
typedef enum {
|
||||
CURLPROXY_HTTP = 0,
|
||||
CURLPROXY_SOCKS4 = 4,
|
||||
CURLPROXY_SOCKS5 = 5
|
||||
} curl_proxytype;
|
||||
|
||||
/* this was the error code 50 in 7.7.3 and a few earlier versions, this
|
||||
is no longer used by libcurl but is instead #defined here only to not
|
||||
make programs break */
|
||||
@@ -194,6 +218,7 @@ typedef enum {
|
||||
|
||||
/* This is just to make older programs not break: */
|
||||
#define CURLE_FTP_PARTIAL_FILE CURLE_PARTIAL_FILE
|
||||
#define CURLE_FTP_BAD_DOWNLOAD_RESUME CURLE_BAD_DOWNLOAD_RESUME
|
||||
|
||||
#define CURL_ERROR_SIZE 256
|
||||
|
||||
@@ -209,7 +234,15 @@ typedef enum {
|
||||
#ifdef CINIT
|
||||
#undef CINIT
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(_MSC_VER)
|
||||
/*
|
||||
* Figure out if we can use the ## operator, which is supported by ISO/ANSI C
|
||||
* and C++. Some compilers support it without setting __STDC__ or __cplusplus
|
||||
* so we need to carefully check for them too. We don't use configure-checks
|
||||
* for these since we want these headers to remain generic and working for all
|
||||
* platforms.
|
||||
*/
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC)
|
||||
#define CINIT(name,type,number) CURLOPT_ ## name = CURLOPTTYPE_ ## type + number
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
@@ -377,7 +410,11 @@ typedef enum {
|
||||
CINIT(FTPLISTONLY, LONG, 48), /* Use NLST when listing ftp dir */
|
||||
|
||||
CINIT(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
|
||||
CINIT(NETRC, LONG, 51), /* read user+password from .netrc */
|
||||
|
||||
/* Specify whether to read the user+password from the .netrc or the URL.
|
||||
* This must be one of the CURL_NETRC_* enums below. */
|
||||
CINIT(NETRC, LONG, 51),
|
||||
|
||||
CINIT(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
|
||||
|
||||
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
|
||||
@@ -536,9 +573,42 @@ typedef enum {
|
||||
/* set the data for the debug function */
|
||||
CINIT(DEBUGDATA, OBJECTPOINT, 95),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unusued */
|
||||
/* mark this as start of a cookie session */
|
||||
CINIT(COOKIESESSION, LONG, 96),
|
||||
|
||||
/* The CApath directory used to validate the peer certificate
|
||||
this option is used only if SSL_VERIFYPEER is true */
|
||||
CINIT(CAPATH, OBJECTPOINT, 97),
|
||||
|
||||
/* Instruct libcurl to use a smaller receive buffer */
|
||||
CINIT(BUFFERSIZE, LONG, 98),
|
||||
|
||||
/* Instruct libcurl to not use any signal/alarm handlers, even when using
|
||||
timeouts. This option is useful for multi-threaded applications.
|
||||
See libcurl-the-guide for more background information. */
|
||||
CINIT(NOSIGNAL, LONG, 99),
|
||||
|
||||
/* Provide a CURLShare for mutexing non-ts data */
|
||||
CINIT(SHARE, OBJECTPOINT, 100),
|
||||
|
||||
/* indicates type of proxy. accepted values are CURLPROXY_HTTP (default),
|
||||
CURLPROXY_SOCKS4 and CURLPROXY_SOCKS5. */
|
||||
CINIT(PROXYTYPE, LONG, 101),
|
||||
|
||||
/* Set the Accept-Encoding string. Use this to tell a server you would like
|
||||
the response to be compressed. */
|
||||
CINIT(ENCODING, OBJECTPOINT, 102),
|
||||
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
/* two convenient "aliases" that follow the name scheme better */
|
||||
#define CURLOPT_WRITEDATA CURLOPT_FILE
|
||||
#define CURLOPT_READDATA CURLOPT_INFILE
|
||||
#define CURLOPT_HEADERDATA CURLOPT_WRITEHEADER
|
||||
|
||||
|
||||
/* These enums are for use with the CURLOPT_HTTP_VERSION option. */
|
||||
enum {
|
||||
CURL_HTTP_VERSION_NONE, /* setting this means we don't care, and that we'd
|
||||
@@ -550,6 +620,18 @@ enum {
|
||||
CURL_HTTP_VERSION_LAST /* *ILLEGAL* http version */
|
||||
};
|
||||
|
||||
/* These enums are for use with the CURLOPT_NETRC option. */
|
||||
enum CURL_NETRC_OPTION {
|
||||
CURL_NETRC_IGNORED, /* The .netrc will never be read.
|
||||
* This is the default. */
|
||||
CURL_NETRC_OPTIONAL, /* A user:password in the URL will be preferred
|
||||
* to one in the .netrc. */
|
||||
CURL_NETRC_REQUIRED, /* A user:password in the URL will be ignored.
|
||||
* Unless one is set programmatically, the .netrc
|
||||
* will be queried. */
|
||||
CURL_NETRC_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
CURL_SSLVERSION_DEFAULT,
|
||||
CURL_SSLVERSION_TLSv1,
|
||||
@@ -561,15 +643,26 @@ enum {
|
||||
|
||||
|
||||
typedef enum {
|
||||
TIMECOND_NONE,
|
||||
CURL_TIMECOND_NONE,
|
||||
|
||||
TIMECOND_IFMODSINCE,
|
||||
TIMECOND_IFUNMODSINCE,
|
||||
TIMECOND_LASTMOD,
|
||||
CURL_TIMECOND_IFMODSINCE,
|
||||
CURL_TIMECOND_IFUNMODSINCE,
|
||||
CURL_TIMECOND_LASTMOD,
|
||||
|
||||
TIMECOND_LAST
|
||||
CURL_TIMECOND_LAST
|
||||
} curl_TimeCond;
|
||||
|
||||
/* for backwards compatibility */
|
||||
#ifndef TIMECOND_IFMODSINCE
|
||||
#define TIMECOND_IFMODSINCE CURL_TIMECOND_IFMODSINCE
|
||||
#endif
|
||||
#ifndef TIMECOND_IFUNMODSINCE
|
||||
#define TIMECOND_IFUNMODSINCE CURL_TIMECOND_IFUNMODSINCE
|
||||
#endif
|
||||
#ifndef TIMECOND_LASTMOD
|
||||
#define TIMECOND_LASTMOD CURL_TIMECOND_LASTMOD
|
||||
#endif
|
||||
|
||||
#ifdef __BEOS__
|
||||
#include <support/SupportDefs.h>
|
||||
#endif
|
||||
@@ -596,7 +689,8 @@ int curl_formparse(char *, struct curl_httppost **,
|
||||
#undef CFINIT
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) || defined(_MSC_VER)
|
||||
#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) || \
|
||||
defined(__HP_aCC)
|
||||
#define CFINIT(name) CURLFORM_ ## name
|
||||
#else
|
||||
/* The macro "##" is ISO C, we assume pre-ISO C doesn't support it. */
|
||||
@@ -617,6 +711,11 @@ typedef enum {
|
||||
CFINIT(ARRAY),
|
||||
CFINIT(OBSOLETE),
|
||||
CFINIT(FILE),
|
||||
|
||||
CFINIT(BUFFER),
|
||||
CFINIT(BUFFERPTR),
|
||||
CFINIT(BUFFERLENGTH),
|
||||
|
||||
CFINIT(CONTENTTYPE),
|
||||
CFINIT(CONTENTHEADER),
|
||||
CFINIT(FILENAME),
|
||||
@@ -635,7 +734,35 @@ struct curl_forms {
|
||||
};
|
||||
|
||||
/* use this for multipart formpost building */
|
||||
int curl_formadd(struct curl_httppost **httppost,
|
||||
/* Returns code for curl_formadd()
|
||||
*
|
||||
* Returns:
|
||||
* CURL_FORMADD_OK on success
|
||||
* CURL_FORMADD_MEMORY if the FormInfo allocation fails
|
||||
* CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
|
||||
* CURL_FORMADD_NULL if a null pointer was given for a char
|
||||
* CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
|
||||
* CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
|
||||
* CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or error)
|
||||
* CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
|
||||
* CURL_FORMADD_MEMORY if some allocation for string copying failed.
|
||||
* CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
|
||||
*
|
||||
***************************************************************************/
|
||||
typedef enum {
|
||||
CURL_FORMADD_OK, /* first, no error */
|
||||
|
||||
CURL_FORMADD_MEMORY,
|
||||
CURL_FORMADD_OPTION_TWICE,
|
||||
CURL_FORMADD_NULL,
|
||||
CURL_FORMADD_UNKNOWN_OPTION,
|
||||
CURL_FORMADD_INCOMPLETE,
|
||||
CURL_FORMADD_ILLEGAL_ARRAY,
|
||||
|
||||
CURL_FORMADD_LAST /* last */
|
||||
} CURLFORMcode;
|
||||
|
||||
CURLFORMcode curl_formadd(struct curl_httppost **httppost,
|
||||
struct curl_httppost **last_post,
|
||||
...);
|
||||
|
||||
@@ -653,6 +780,9 @@ char *curl_version(void);
|
||||
* allocated string or NULL if an error occurred. */
|
||||
char *curl_escape(const char *string, int length);
|
||||
char *curl_unescape(const char *string, int length);
|
||||
/* 20020912 WJM. Provide for a de-allocation in the same translation unit
|
||||
that did the allocation. Added in libcurl 7.10 */
|
||||
void curl_free(void *p);
|
||||
|
||||
/* curl_global_init() should be invoked exactly once for each application that
|
||||
uses libcurl */
|
||||
@@ -663,8 +793,8 @@ CURLcode curl_global_init(long flags);
|
||||
void curl_global_cleanup(void);
|
||||
|
||||
/* This is the version number */
|
||||
#define LIBCURL_VERSION "7.9.6"
|
||||
#define LIBCURL_VERSION_NUM 0x070906
|
||||
#define LIBCURL_VERSION "7.10"
|
||||
#define LIBCURL_VERSION_NUM 0x070a00
|
||||
|
||||
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
|
||||
struct curl_slist {
|
||||
@@ -718,15 +848,18 @@ typedef enum {
|
||||
|
||||
CURLINFO_CONTENT_TYPE = CURLINFO_STRING + 18,
|
||||
|
||||
CURLINFO_REDIRECT_TIME = CURLINFO_DOUBLE + 19,
|
||||
CURLINFO_REDIRECT_COUNT = CURLINFO_LONG + 20,
|
||||
|
||||
/* Fill in new entries here! */
|
||||
|
||||
CURLINFO_LASTONE = 19
|
||||
CURLINFO_LASTONE = 21
|
||||
} CURLINFO;
|
||||
|
||||
/* unfortunately, the easy.h and multi.h include files need options and info
|
||||
stuff before they can be included! */
|
||||
#include <curl/easy.h> /* nothing in curl is fun without the easy stuff */
|
||||
#include <curl/multi.h>
|
||||
#include "easy.h" /* nothing in curl is fun without the easy stuff */
|
||||
#include "multi.h"
|
||||
|
||||
typedef enum {
|
||||
CURLCLOSEPOLICY_NONE, /* first, never use this */
|
||||
@@ -746,6 +879,78 @@ typedef enum {
|
||||
#define CURL_GLOBAL_NOTHING 0
|
||||
#define CURL_GLOBAL_DEFAULT CURL_GLOBAL_ALL
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Setup defines, protos etc for the sharing stuff.
|
||||
*/
|
||||
|
||||
/* Different types of locks that a share can aquire */
|
||||
typedef enum {
|
||||
CURL_LOCK_TYPE_NONE = 0,
|
||||
CURL_LOCK_TYPE_COOKIE = 1<<0,
|
||||
CURL_LOCK_TYPE_DNS = 1<<1,
|
||||
CURL_LOCK_TYPE_SSL_SESSION = 2<<1,
|
||||
CURL_LOCK_TYPE_CONNECT = 2<<2,
|
||||
CURL_LOCK_TYPE_LAST
|
||||
} curl_lock_type;
|
||||
|
||||
typedef void (*curl_lock_function)(CURL *, curl_lock_type, void *);
|
||||
typedef void (*curl_unlock_function)(CURL *, curl_lock_type, void *);
|
||||
|
||||
typedef struct {
|
||||
unsigned int specifier;
|
||||
unsigned int locked;
|
||||
unsigned int dirty;
|
||||
|
||||
curl_lock_function lockfunc;
|
||||
curl_unlock_function unlockfunc;
|
||||
void *clientdata;
|
||||
} curl_share;
|
||||
|
||||
curl_share *curl_share_init (void);
|
||||
CURLcode curl_share_setopt (curl_share *, curl_lock_type, int);
|
||||
CURLcode curl_share_set_lock_function (curl_share *, curl_lock_function);
|
||||
CURLcode curl_share_set_unlock_function (curl_share *, curl_unlock_function);
|
||||
CURLcode curl_share_set_lock_data (curl_share *, void *);
|
||||
CURLcode curl_share_destroy (curl_share *);
|
||||
|
||||
/****************************************************************************
|
||||
* Structures for querying information about the curl library at runtime.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
CURLVERSION_FIRST,
|
||||
CURLVERSION_LAST /* never actually use this */
|
||||
} CURLversion;
|
||||
|
||||
/* The 'CURLVERSION_NOW' is the symbolic name meant to be used by
|
||||
basicly all programs ever, that want to get version information. It is
|
||||
meant to be a built-in version number for what kind of struct the caller
|
||||
expects. If the struct ever changes, we redfine the NOW to another enum
|
||||
from above. */
|
||||
#define CURLVERSION_NOW CURLVERSION_FIRST
|
||||
|
||||
typedef struct {
|
||||
CURLversion age; /* age of the returned struct */
|
||||
const char *version; /* LIBCURL_VERSION */
|
||||
unsigned int version_num; /* LIBCURL_VERSION_NUM */
|
||||
const char *host; /* OS/host/cpu/machine when configured */
|
||||
int features; /* bitmask, see defines below */
|
||||
char *ssl_version; /* human readable string */
|
||||
long ssl_version_num; /* number */
|
||||
const char *libz_version; /* human readable string */
|
||||
/* protocols is terminated by an entry with a NULL protoname */
|
||||
const char **protocols;
|
||||
} curl_version_info_data;
|
||||
|
||||
#define CURL_VERSION_IPV6 (1<<0)
|
||||
#define CURL_VERSION_KERBEROS4 (1<<1)
|
||||
#define CURL_VERSION_SSL (1<<2)
|
||||
#define CURL_VERSION_LIBZ (1<<3)
|
||||
|
||||
/* returns a pointer to a static copy of the version info struct */
|
||||
curl_version_info_data *curl_version_info(CURLversion);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __CURL_MULTI_H
|
||||
#define __CURL_MULTI_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
/*
|
||||
This is meant to be the "external" header file. Don't give away any
|
||||
internals here!
|
||||
@@ -47,14 +47,15 @@
|
||||
Example sources using this interface is here: ../multi/
|
||||
|
||||
*/
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
|
||||
#include <winsock.h>
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include "curl.h"
|
||||
|
||||
typedef void CURLM;
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __STDC_HEADERS_H
|
||||
#define __STDC_HEADERS_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __CURL_TYPES_H
|
||||
#define __CURL_TYPES_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
typedef void CURL;
|
||||
typedef void CURLconnect;
|
||||
|
||||
|
@@ -1,6 +1,8 @@
|
||||
*.la
|
||||
*.lo
|
||||
Makefile
|
||||
Makefile.in
|
||||
*.in
|
||||
.deps
|
||||
.libs
|
||||
config.h
|
||||
stamp-h1
|
||||
|
@@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32 \
|
||||
Makefile.vc6 Makefile.riscos libcurl.def dllinit.c curllib.dsp \
|
||||
curllib.dsw config-vms.h config-win32.h config-riscos.h config-mac.h \
|
||||
config.h.in
|
||||
config.h.in ca-bundle.crt README.encoding
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
@@ -16,7 +16,7 @@ lib_LTLIBRARIES = libcurl.la
|
||||
# we use srcdir/lib for the lib-private header files
|
||||
INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/lib -I$(top_srcdir)/lib
|
||||
|
||||
libcurl_la_LDFLAGS = -no-undefined -version-info 2:2:0
|
||||
libcurl_la_LDFLAGS = -version-info 2:2:0
|
||||
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
# 1.
|
||||
@@ -45,23 +45,17 @@ libcurl_la_LDFLAGS = -no-undefined -version-info 2:2:0
|
||||
# set age to 0.
|
||||
#
|
||||
|
||||
libcurl_la_SOURCES = \
|
||||
arpa_telnet.h file.c getpass.h netrc.h timeval.c \
|
||||
base64.c file.h hostip.c progress.c timeval.h \
|
||||
base64.h formdata.c hostip.h progress.h \
|
||||
cookie.c formdata.h http.c sendf.c \
|
||||
cookie.h ftp.c http.h sendf.h url.c \
|
||||
dict.c ftp.h if2ip.c speedcheck.c url.h \
|
||||
dict.h getdate.c if2ip.h speedcheck.h urldata.h \
|
||||
getdate.h ldap.c ssluse.c version.c \
|
||||
getenv.c ldap.h ssluse.h \
|
||||
escape.c mprintf.c telnet.c \
|
||||
escape.h getpass.c netrc.c telnet.h \
|
||||
getinfo.c getinfo.h transfer.c strequal.c strequal.h easy.c \
|
||||
security.h security.c krb4.c krb4.h memdebug.c memdebug.h inet_ntoa_r.h \
|
||||
http_chunks.c http_chunks.h strtok.c strtok.h connect.c connect.h \
|
||||
llist.c llist.h hash.c hash.h multi.c
|
||||
|
||||
libcurl_la_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c \
|
||||
base64.c file.h hostip.c progress.c timeval.h base64.h formdata.c \
|
||||
hostip.h progress.h cookie.c formdata.h http.c sendf.c cookie.h ftp.c \
|
||||
http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h dict.h \
|
||||
getdate.c if2ip.h speedcheck.h urldata.h getdate.h ldap.c ssluse.c \
|
||||
version.c getenv.c ldap.h ssluse.h escape.c mprintf.c telnet.c escape.h \
|
||||
getpass.c netrc.c telnet.h getinfo.c getinfo.h transfer.c strequal.c \
|
||||
strequal.h easy.c security.h security.c krb4.c krb4.h memdebug.c \
|
||||
memdebug.h inet_ntoa_r.h http_chunks.c http_chunks.h strtok.c strtok.h \
|
||||
connect.c connect.h llist.c llist.h hash.c hash.h multi.c \
|
||||
content_encoding.c content_encoding.h
|
||||
|
||||
noinst_HEADERS = setup.h transfer.h
|
||||
|
||||
@@ -70,3 +64,14 @@ $(srcdir)/getdate.c: getdate.y
|
||||
cd $(srcdir) && \
|
||||
$(YACC) $(YFLAGS) getdate.y; \
|
||||
mv -f y.tab.c getdate.c
|
||||
|
||||
install-data-hook:
|
||||
@if test -n "@CURL_CA_BUNDLE@"; then \
|
||||
$(mkinstalldirs) `dirname $(DESTDIR)@CURL_CA_BUNDLE@`; \
|
||||
@INSTALL_DATA@ ca-bundle.crt $(DESTDIR)@CURL_CA_BUNDLE@; \
|
||||
fi
|
||||
|
||||
# this hook is mainly for non-unix systems to build even if configure
|
||||
# isn't run
|
||||
dist-hook:
|
||||
cp $(srcdir)/ca-bundle.h.in $(distdir)/ca-bundle.h
|
||||
|
@@ -11,7 +11,8 @@ CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip -g
|
||||
OPENSSL_PATH = ../../openssl-0.9.6b
|
||||
OPENSSL_PATH = ../../openssl-0.9.6d
|
||||
ZLIB_PATH = ../../zlib-1.1.3
|
||||
|
||||
########################################################
|
||||
## Nothing more to do below this line!
|
||||
@@ -21,7 +22,12 @@ CFLAGS = -g -O2 -DMINGW32
|
||||
ifdef SSL
|
||||
INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
|
||||
CFLAGS += -DUSE_SSLEAY
|
||||
DLL_LIBS = -leay32 -lssl32 -lRSAglue
|
||||
DLL_LIBS = -L$(OPENSSL_PATH)/out -leay32 -lssl32 -lRSAglue
|
||||
endif
|
||||
ifdef ZLIB
|
||||
INCLUDES += -I"$(ZLIB_PATH)"
|
||||
CFLAGS += -DHAVE_ZLIB
|
||||
DLL_LIBS += -L$(ZLIB_PATH) -lz
|
||||
endif
|
||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
||||
|
||||
@@ -35,14 +41,16 @@ libcurl_a_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c \
|
||||
ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c \
|
||||
telnet.h getinfo.c strequal.c strequal.h easy.c security.h \
|
||||
security.c krb4.h krb4.c memdebug.h memdebug.c inet_ntoa_r.h http_chunks.h http_chunks.c \
|
||||
strtok.c connect.c hash.c llist.c
|
||||
strtok.c connect.c hash.c llist.c multi.c \
|
||||
content_encoding.h content_encoding.c
|
||||
|
||||
libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
|
||||
formdata.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
|
||||
speedcheck.o getdate.o transfer.o ldap.o ssluse.o version.o \
|
||||
getenv.o escape.o mprintf.o telnet.o getpass.o netrc.o getinfo.o \
|
||||
strequal.o easy.o security.o krb4.o memdebug.o http_chunks.o \
|
||||
strtok.o connect.o hash.o llist.o
|
||||
strtok.o connect.o hash.o llist.o multi.o \
|
||||
content_encoding.o
|
||||
|
||||
LIBRARIES = $(libcurl_a_LIBRARIES)
|
||||
SOURCES = $(libcurl_a_SOURCES)
|
||||
@@ -61,7 +69,7 @@ libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES)
|
||||
|
||||
libcurl.dll libcurldll.a: libcurl.a libcurl.def dllinit.o
|
||||
-@erase $@
|
||||
dllwrap --dllname $@ --output-lib libcurldll.a --export-all --def libcurl.def $(libcurl_a_LIBRARIES) dllinit.o -L$(OPENSSL_PATH)/out $(DLL_LIBS) -lwsock32 -lws2_32
|
||||
dllwrap --dllname $@ --output-lib libcurldll.a --export-all --def libcurl.def $(libcurl_a_LIBRARIES) dllinit.o $(DLL_LIBS) -lwsock32 -lws2_32 -lwinmm
|
||||
$(STRIP) $@
|
||||
|
||||
# remove the last line above to keep debug info
|
||||
|
@@ -47,7 +47,7 @@ CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB
|
||||
LNKDLL = link.exe /DLL /def:libcurl.def
|
||||
LNKLIB = link.exe -lib
|
||||
LFLAGS = /nologo
|
||||
LINKLIBS = ws2_32.lib
|
||||
LINKLIBS = ws2_32.lib winmm.lib
|
||||
SSLLIBS = libeay32.lib ssleay32.lib RSAglue.lib
|
||||
CFGSET = FALSE
|
||||
|
||||
@@ -198,7 +198,8 @@ X_OBJS= \
|
||||
$(DIROBJ)\strtok.obj \
|
||||
$(DIROBJ)\connect.obj \
|
||||
$(DIROBJ)\hash.obj \
|
||||
$(DIROBJ)\llist.obj
|
||||
$(DIROBJ)\llist.obj \
|
||||
$(DIROBJ)\multi.obj
|
||||
|
||||
all : $(TARGET)
|
||||
|
||||
|
53
lib/README.encoding
Normal file
53
lib/README.encoding
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
Content Encoding Support for libcurl
|
||||
|
||||
* About content encodings:
|
||||
|
||||
HTTP/1.1 [RFC 2616] specifies that a client may request that a server encode
|
||||
its response. This is usually used to compress a response using one of a set
|
||||
of commonly available compression techniques. These schemes are `deflate'
|
||||
(the zlib algorithm), `gzip' and `compress' [sec 3.5, RFC 2616]. A client
|
||||
requests that the sever perform an encoding by including an Accept-Encoding
|
||||
header in the request document. The value of the header should be one of the
|
||||
recognized tokens `deflate', ... (there's a way to register new
|
||||
schemes/tokens, see sec 3.5 of the spec). A server MAY honor the client's
|
||||
encoding request. When a response is encoded, the server includes a
|
||||
Content-Encoding header in the response. The value of the Content-Encoding
|
||||
header indicates which scheme was used to encode the data.
|
||||
|
||||
A client may tell a server that it can understand several different encoding
|
||||
schemes. In this case the server may choose any one of those and use it to
|
||||
encode the response (indicating which one using the Content-Encoding header).
|
||||
It's also possible for a client to attach priorities to different schemes so
|
||||
that the server knows which it prefers. See sec 14.3 of RFC 2616 for more
|
||||
information on the Accept-Encoding header.
|
||||
|
||||
* Current support for content encoding:
|
||||
|
||||
I added support for the 'deflate' content encoding to both libcurl and curl.
|
||||
Both regular and chunked transfers should work although I've tested only the
|
||||
former. The library zlib is required for this feature. Places where I
|
||||
modified the source code are commented and typically include my initials and
|
||||
the date (e.g., 08/29/02 jhrg).
|
||||
|
||||
* The libcurl interface:
|
||||
|
||||
To cause libcurl to request a content encoding use:
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_ENCODING, <string>)
|
||||
|
||||
where <string> is the intended value of the Accept-Encoding header.
|
||||
|
||||
Currently, libcurl only understands how to process responses that use the
|
||||
`deflate' Content-Encoding, so the only value for CURLOPT_ENCODING that will
|
||||
work (besides "identity," which does nothing) is "deflate." If a response is
|
||||
encoded using either the `gzip' or `compress' methods, libcurl will return an
|
||||
error indicating that the response could not be decoded. If <string> is null
|
||||
or empty no Accept-Encoding header is generated.
|
||||
|
||||
* The curl interface:
|
||||
|
||||
Use the --compressed option with curl to cause it to ask servers to compress
|
||||
responses using deflate.
|
||||
|
||||
James Gallagher <jgallagher@gso.uri.edu>
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __ARPA_TELNET_H
|
||||
#define __ARPA_TELNET_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,20 +9,20 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_TELNET
|
||||
/*
|
||||
* Telnet option defines. Add more here if in need.
|
||||
*/
|
||||
@@ -97,5 +97,5 @@ static const char *telnetcmds[]=
|
||||
#define TELCMD_OK(x) ( ((unsigned int)(x) >= TELCMD_MINIMUM) && \
|
||||
((unsigned int)(x) <= TELCMD_MAXIMUM) )
|
||||
#define TELCMD(x) telnetcmds[(x)-TELCMD_MINIMUM]
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
12
lib/base64.c
12
lib/base64.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
/* Base64 encoding/decoding
|
||||
*
|
||||
|
12
lib/base64.h
12
lib/base64.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __BASE64_H
|
||||
#define __BASE64_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
int Curl_base64_encode(const void *data, int size, char **str);
|
||||
int Curl_base64_decode(const char *str, void *data);
|
||||
#endif
|
||||
|
4447
lib/ca-bundle.crt
Normal file
4447
lib/ca-bundle.crt
Normal file
File diff suppressed because it is too large
Load Diff
31
lib/ca-bundle.h.in
Normal file
31
lib/ca-bundle.h.in
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef __CA_BUNDLE_H
|
||||
#define __CA_BUNDLE_H
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CURL_CA_BUNDLE
|
||||
/* Set this to the full path file name of the ca cert bundle */
|
||||
#undef CURL_CA_BUNDLE
|
||||
#endif
|
||||
|
||||
#endif /* __CA_BUNDLE_H */
|
@@ -366,3 +366,6 @@
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
#define HAVE_FIONBIO 1
|
||||
|
||||
/* Define if you have the `sigsetjmp' function. */
|
||||
#define HAVE_SIGSETJMP 1
|
||||
|
@@ -170,6 +170,9 @@
|
||||
/* Define if you have the <winsock.h> header file. */
|
||||
#define HAVE_WINSOCK_H 1
|
||||
|
||||
/* Define if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define if you have the closesocket function. */
|
||||
#define HAVE_CLOSESOCKET 1
|
||||
|
||||
@@ -179,6 +182,9 @@
|
||||
/* Define if you have the RAND_screen function when using SSL */
|
||||
#define HAVE_RAND_SCREEN 1
|
||||
|
||||
/* Define if you have the `RAND_status' function. */
|
||||
#define HAVE_RAND_STATUS 1
|
||||
|
||||
/* Define this to if in_addr_t is not an available typedefed type */
|
||||
#define in_addr_t unsigned long
|
||||
|
||||
@@ -196,7 +202,7 @@
|
||||
*This is to eliminate the warnings when compiled *
|
||||
* using MS VC++ compiler *
|
||||
**************************************************/
|
||||
#ifdef _MSC_VER
|
||||
#if 0
|
||||
|
||||
#pragma warning (disable: 4244) /* truncation from 'const int' to 'char' */
|
||||
#pragma warning (disable: 4127) /* conditional expression is constant */
|
||||
@@ -215,4 +221,7 @@
|
||||
been initialized */
|
||||
#pragma warning (disable: 4715) /* ToHour' : not all control paths return a
|
||||
value */
|
||||
#pragma warning (disable: 4115) /* warning C4115: '_RPC_ASYNC_STATE' : named
|
||||
type definition in parentheses */
|
||||
#pragma warning (disable: 4206) /* this does what? */
|
||||
#endif
|
||||
|
166
lib/connect.c
166
lib/connect.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -185,7 +185,6 @@ int waitconnect(int sockfd, /* socket */
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef ENABLE_IPV6
|
||||
static CURLcode bindlocal(struct connectdata *conn,
|
||||
int sockfd)
|
||||
{
|
||||
@@ -207,24 +206,30 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
*************************************************************/
|
||||
if (strlen(data->set.device)<255) {
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *h=NULL;
|
||||
char *hostdataptr=NULL;
|
||||
Curl_addrinfo *h=NULL;
|
||||
size_t size;
|
||||
char myhost[256] = "";
|
||||
in_addr_t in;
|
||||
|
||||
if(Curl_if2ip(data->set.device, myhost, sizeof(myhost))) {
|
||||
h = Curl_resolv(data, myhost, 0, &hostdataptr);
|
||||
/*
|
||||
* We now have the numerical IPv4-style x.y.z.w in the 'myhost' buffer
|
||||
*/
|
||||
h = Curl_resolv(data, myhost, 0);
|
||||
}
|
||||
else {
|
||||
if(strlen(data->set.device)>1) {
|
||||
h = Curl_resolv(data, data->set.device, 0, &hostdataptr);
|
||||
}
|
||||
/*
|
||||
* This was not an interface, resolve the name as a host name
|
||||
* or IP number
|
||||
*/
|
||||
h = Curl_resolv(data, data->set.device, 0);
|
||||
if(h) {
|
||||
/* we know data->set.device is shorter than the myhost array */
|
||||
strcpy(myhost, data->set.device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(! *myhost) {
|
||||
/* need to fix this
|
||||
@@ -243,10 +248,13 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
|
||||
if ( h ) {
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr,
|
||||
h->h_addr,
|
||||
h->h_length);
|
||||
#ifdef ENABLE_IPV6
|
||||
memcpy((char *)&sa.sin_addr, h->ai_addr, h->ai_addrlen);
|
||||
sa.sin_family = h->ai_family;
|
||||
#else
|
||||
memcpy((char *)&sa.sin_addr, h->h_addr, h->h_length);
|
||||
sa.sin_family = AF_INET;
|
||||
#endif
|
||||
sa.sin_addr.s_addr = in;
|
||||
sa.sin_port = 0; /* get any port */
|
||||
|
||||
@@ -314,7 +322,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
}
|
||||
#endif /* end of ipv4-specific section */
|
||||
|
||||
|
||||
static
|
||||
int socketerror(int sockfd)
|
||||
@@ -329,6 +337,70 @@ int socketerror(int sockfd)
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_is_connected() is used from the multi interface to check if the
|
||||
* firstsocket has connected.
|
||||
*/
|
||||
|
||||
CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
int sockfd,
|
||||
bool *connected)
|
||||
{
|
||||
int rc;
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
*connected = FALSE; /* a very negative world view is best */
|
||||
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
/* there is a timeout set */
|
||||
|
||||
/* Evaluate in milliseconds how much time that has passed */
|
||||
long has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.start);
|
||||
|
||||
/* subtract the most strict timeout of the ones */
|
||||
if(data->set.timeout && data->set.connecttimeout) {
|
||||
if (data->set.timeout < data->set.connecttimeout)
|
||||
has_passed -= data->set.timeout*1000;
|
||||
else
|
||||
has_passed -= data->set.connecttimeout*1000;
|
||||
}
|
||||
else if(data->set.timeout)
|
||||
has_passed -= data->set.timeout*1000;
|
||||
else
|
||||
has_passed -= data->set.connecttimeout*1000;
|
||||
|
||||
if(has_passed > 0 ) {
|
||||
/* time-out, bail out, go home */
|
||||
failf(data, "Connection time-out");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
}
|
||||
}
|
||||
|
||||
/* check for connect without timeout as we want to return immediately */
|
||||
rc = waitconnect(sockfd, 0);
|
||||
|
||||
if(0 == rc) {
|
||||
int err = socketerror(sockfd);
|
||||
if ((0 == err) || (EISCONN == err)) {
|
||||
/* we are connected, awesome! */
|
||||
*connected = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
/* nope, not connected for real */
|
||||
}
|
||||
|
||||
/*
|
||||
* If the connection phase is "done" here, we should attempt to connect
|
||||
* to the "next address" in the Curl_hostaddr structure that we resolved
|
||||
* before. But we don't have that struct around anymore and we can't just
|
||||
* keep a pointer since the cache might in fact have gotten pruned by the
|
||||
* time we want to read this... Alas, we don't do this yet.
|
||||
*/
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TCP connect to the given host with timeout, proxy or remote doesn't matter.
|
||||
* There might be more than one IP address to try out. Fill in the passed
|
||||
@@ -339,12 +411,14 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
Curl_addrinfo *remotehost, /* use one in here */
|
||||
int port, /* connect to this */
|
||||
int *sockconn, /* the connected socket */
|
||||
Curl_ipconnect **addr) /* the one we used */
|
||||
Curl_ipconnect **addr, /* the one we used */
|
||||
bool *connected) /* really connected? */
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
int rc;
|
||||
int sockfd=-1;
|
||||
int aliasindex=0;
|
||||
char *hostname;
|
||||
|
||||
struct timeval after;
|
||||
struct timeval before = Curl_tvnow();
|
||||
@@ -353,6 +427,9 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
* Figure out what maximum time we have left
|
||||
*************************************************************/
|
||||
long timeout_ms=300000; /* milliseconds, default to five minutes */
|
||||
|
||||
*connected = FALSE; /* default to not connected */
|
||||
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
double has_passed;
|
||||
|
||||
@@ -385,8 +462,12 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
}
|
||||
}
|
||||
|
||||
infof(data, "About to connect() to %s:%d\n",
|
||||
data->change.proxy?conn->proxyhost:conn->hostname, port);
|
||||
hostname = data->change.proxy?conn->proxyhost:conn->hostname;
|
||||
infof(data, "About to connect() to %s%s%s:%d\n",
|
||||
conn->bits.ipv6_ip?"[":"",
|
||||
hostname,
|
||||
conn->bits.ipv6_ip?"]":"",
|
||||
port);
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
/*
|
||||
@@ -401,6 +482,14 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
if (sockfd < 0)
|
||||
continue;
|
||||
|
||||
if(conn->data->set.device) {
|
||||
/* user selected to bind the outgoing socket to a specified "device"
|
||||
before doing connect */
|
||||
CURLcode res = bindlocal(conn, sockfd);
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* set socket non-blocking */
|
||||
Curl_nonblock(sockfd, TRUE);
|
||||
|
||||
@@ -420,17 +509,21 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
case EAGAIN:
|
||||
#endif
|
||||
case EINTR:
|
||||
|
||||
/* asynchronous connect, wait for connect or timeout */
|
||||
if(data->state.used_interface == Curl_if_multi)
|
||||
/* don't hang when doing multi */
|
||||
timeout_ms = 0;
|
||||
|
||||
rc = waitconnect(sockfd, timeout_ms);
|
||||
break;
|
||||
case ECONNREFUSED: /* no one listening */
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect: %d", error);
|
||||
failf(data, "Failed connect to %s: %d", hostname, error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == rc) {
|
||||
/* we might be connected, if the socket says it is OK! Ask it! */
|
||||
int err;
|
||||
@@ -438,10 +531,17 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
err = socketerror(sockfd);
|
||||
if ((0 == err) || (EISCONN == err)) {
|
||||
/* we are connected, awesome! */
|
||||
*connected = TRUE; /* this is truly a connect */
|
||||
break;
|
||||
}
|
||||
failf(data, "socket error: %d", err);
|
||||
/* we are _not_ connected, it was a false alert, continue please */
|
||||
}
|
||||
else if(data->state.used_interface == Curl_if_multi) {
|
||||
/* When running the multi interface, we bail out here */
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* connect failed or timed out */
|
||||
sclose(sockfd);
|
||||
@@ -457,10 +557,8 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
before = after;
|
||||
continue;
|
||||
}
|
||||
if (sockfd < 0) {
|
||||
failf(data, "connect() failed");
|
||||
if (sockfd < 0)
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
/* leave the socket in non-blocking mode */
|
||||
|
||||
@@ -508,7 +606,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
(struct in_addr *)remotehost->h_addr_list[aliasindex],
|
||||
sizeof(struct in_addr));
|
||||
serv_addr.sin_family = remotehost->h_addrtype;
|
||||
serv_addr.sin_port = htons(port);
|
||||
serv_addr.sin_port = htons((unsigned short)port);
|
||||
|
||||
rc = connect(sockfd, (struct sockaddr *)&serv_addr,
|
||||
sizeof(serv_addr));
|
||||
@@ -526,14 +624,17 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
*/
|
||||
case EAGAIN:
|
||||
#endif
|
||||
|
||||
/* asynchronous connect, wait for connect or timeout */
|
||||
if(data->state.used_interface == Curl_if_multi)
|
||||
/* don't hang when doing multi */
|
||||
timeout_ms = 0;
|
||||
|
||||
rc = waitconnect(sockfd, timeout_ms);
|
||||
break;
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect to IP number %d: %d",
|
||||
aliasindex+1, error);
|
||||
failf(data, "Failed to connect to %s IP number %d: %d",
|
||||
hostname, aliasindex+1, error);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -542,6 +643,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
int err = socketerror(sockfd);
|
||||
if ((0 == err) || (EISCONN == err)) {
|
||||
/* we are connected, awesome! */
|
||||
*connected = TRUE; /* this is a true connect */
|
||||
break;
|
||||
}
|
||||
/* nope, not connected for real */
|
||||
@@ -549,6 +651,12 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
}
|
||||
|
||||
if(0 != rc) {
|
||||
if(data->state.used_interface == Curl_if_multi) {
|
||||
/* When running the multi interface, we bail out here */
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
/* get a new timeout for next attempt */
|
||||
after = Curl_tvnow();
|
||||
timeout_ms -= Curl_tvdiff(after, before);
|
||||
@@ -565,7 +673,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
/* no good connect was made */
|
||||
sclose(sockfd);
|
||||
*sockconn = -1;
|
||||
failf(data, "Couldn't connect to host");
|
||||
failf(data, "Connect failed");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __CONNECT_H
|
||||
#define __CONNECT_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,27 +9,32 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
int Curl_nonblock(int socket, /* operate on this */
|
||||
int nonblock /* TRUE or FALSE */);
|
||||
|
||||
CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
int sockfd,
|
||||
bool *connected);
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn,
|
||||
Curl_addrinfo *host, /* connect to this */
|
||||
int port, /* connect to this port number */
|
||||
int *sockconn, /* not set if error is returned */
|
||||
Curl_ipconnect **addr /* the one we used */
|
||||
); /* index we used */
|
||||
Curl_ipconnect **addr, /* the one we used */
|
||||
bool *connected /* truly connected? */
|
||||
);
|
||||
#endif
|
||||
|
122
lib/content_encoding.c
Normal file
122
lib/content_encoding.c
Normal file
@@ -0,0 +1,122 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
|
||||
#include "urldata.h"
|
||||
#include <curl/curl.h>
|
||||
#include <curl/types.h>
|
||||
#include "sendf.h"
|
||||
|
||||
#define DSIZ 4096 /* buffer size for decompressed data */
|
||||
|
||||
|
||||
static CURLcode
|
||||
process_zlib_error(struct SessionHandle *data, z_stream *z)
|
||||
{
|
||||
if (z->msg)
|
||||
failf (data, "Error while processing content unencoding.\n%s",
|
||||
z->msg);
|
||||
else
|
||||
failf (data, "Error while processing content unencoding.\n"
|
||||
"Unknown failure within decompression software.");
|
||||
|
||||
return CURLE_BAD_CONTENT_ENCODING;
|
||||
}
|
||||
|
||||
static CURLcode
|
||||
exit_zlib(z_stream *z, bool *zlib_init, CURLcode result)
|
||||
{
|
||||
inflateEnd(z);
|
||||
*zlib_init = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
CURLcode
|
||||
Curl_unencode_deflate_write(struct SessionHandle *data,
|
||||
struct Curl_transfer_keeper *k,
|
||||
ssize_t nread)
|
||||
{
|
||||
int status; /* zlib status */
|
||||
int result; /* Curl_client_write status */
|
||||
char decomp[DSIZ]; /* Put the decompressed data here. */
|
||||
z_stream *z = &k->z; /* zlib state structure */
|
||||
|
||||
/* Initialize zlib? */
|
||||
if (!k->zlib_init) {
|
||||
z->zalloc = (alloc_func)Z_NULL;
|
||||
z->zfree = (free_func)Z_NULL;
|
||||
z->opaque = 0; /* of dubious use 08/27/02 jhrg */
|
||||
if (inflateInit(z) != Z_OK)
|
||||
return process_zlib_error(data, z);
|
||||
k->zlib_init = 1;
|
||||
}
|
||||
|
||||
/* Set the compressed input when this fucntion is called */
|
||||
z->next_in = (Bytef *)k->str;
|
||||
z->avail_in = nread;
|
||||
|
||||
/* because the buffer size is fixed, iteratively decompress
|
||||
and transfer to the client via client_write. */
|
||||
for (;;) {
|
||||
/* (re)set buffer for decompressed output for every iteration */
|
||||
z->next_out = (Bytef *)&decomp[0];
|
||||
z->avail_out = DSIZ;
|
||||
|
||||
status = inflate(z, Z_SYNC_FLUSH);
|
||||
if (status == Z_OK || status == Z_STREAM_END) {
|
||||
result = Curl_client_write(data, CLIENTWRITE_BODY, decomp,
|
||||
DSIZ - z->avail_out);
|
||||
/* if !CURLE_OK, clean up, return */
|
||||
if (result) {
|
||||
return exit_zlib(z, &k->zlib_init, result);
|
||||
}
|
||||
|
||||
/* Done?; clean up, return */
|
||||
if (status == Z_STREAM_END) {
|
||||
if (inflateEnd(z) == Z_OK)
|
||||
return exit_zlib(z, &k->zlib_init, result);
|
||||
else
|
||||
return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
|
||||
}
|
||||
|
||||
/* Done with these bytes, exit */
|
||||
if (status == Z_OK && z->avail_in == 0 && z->avail_out > 0)
|
||||
return result;
|
||||
}
|
||||
else { /* Error; exit loop, handle below */
|
||||
return exit_zlib(z, &k->zlib_init, process_zlib_error(data, z));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_LIBZ */
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
* eval: (load-file "../curl-mode.el")
|
||||
* end:
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
34
lib/content_encoding.h
Normal file
34
lib/content_encoding.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
***************************************************************************/
|
||||
|
||||
CURLcode Curl_unencode_deflate_write(struct SessionHandle *data,
|
||||
struct Curl_transfer_keeper *k,
|
||||
ssize_t nread);
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
* eval: (load-file "../curl-mode.el")
|
||||
* end:
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
64
lib/cookie.c
64
lib/cookie.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
/***
|
||||
|
||||
@@ -79,6 +79,8 @@ Example set of cookies:
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -93,6 +95,21 @@ Example set of cookies:
|
||||
#include "memdebug.h"
|
||||
#endif
|
||||
|
||||
static void
|
||||
free_cookiemess(struct Cookie *co)
|
||||
{
|
||||
if(co->domain)
|
||||
free(co->domain);
|
||||
if(co->path)
|
||||
free(co->path);
|
||||
if(co->name)
|
||||
free(co->name);
|
||||
if(co->value)
|
||||
free(co->value);
|
||||
|
||||
free(co);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
*
|
||||
* Curl_cookie_add()
|
||||
@@ -104,7 +121,7 @@ Example set of cookies:
|
||||
struct Cookie *
|
||||
Curl_cookie_add(struct CookieInfo *c,
|
||||
bool httpheader, /* TRUE if HTTP header-style line */
|
||||
char *lineptr, /* first non-space of the line */
|
||||
char *lineptr, /* first character of the line */
|
||||
char *domain) /* default domain */
|
||||
{
|
||||
struct Cookie *clist;
|
||||
@@ -129,6 +146,10 @@ Curl_cookie_add(struct CookieInfo *c,
|
||||
/* This line was read off a HTTP-header */
|
||||
char *sep;
|
||||
semiptr=strchr(lineptr, ';'); /* first, find a semicolon */
|
||||
|
||||
while(*lineptr && isspace((int)*lineptr))
|
||||
lineptr++;
|
||||
|
||||
ptr = lineptr;
|
||||
do {
|
||||
/* we have a <what>=<this> pair or a 'secure' word here */
|
||||
@@ -326,22 +347,19 @@ Curl_cookie_add(struct CookieInfo *c,
|
||||
if(7 != fields) {
|
||||
/* we did not find the sufficient number of fields to recognize this
|
||||
as a valid line, abort and go home */
|
||||
|
||||
if(co->domain)
|
||||
free(co->domain);
|
||||
if(co->path)
|
||||
free(co->path);
|
||||
if(co->name)
|
||||
free(co->name);
|
||||
if(co->value)
|
||||
free(co->value);
|
||||
|
||||
free(co);
|
||||
free_cookiemess(co);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!c->running && /* read from a file */
|
||||
c->newsession && /* clean session cookies */
|
||||
!co->expires) { /* this is a session cookie since it doesn't expire! */
|
||||
free_cookiemess(co);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
co->livecookie = c->running;
|
||||
|
||||
/* now, we have parsed the incoming line, we must now check if this
|
||||
@@ -462,8 +480,12 @@ Curl_cookie_add(struct CookieInfo *c,
|
||||
* Inits a cookie struct to read data from a local file. This is always
|
||||
* called before any cookies are set. File may be NULL.
|
||||
*
|
||||
* If 'newsession' is TRUE, discard all "session cookies" on read from file.
|
||||
*
|
||||
****************************************************************************/
|
||||
struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc)
|
||||
struct CookieInfo *Curl_cookie_init(char *file,
|
||||
struct CookieInfo *inc,
|
||||
bool newsession)
|
||||
{
|
||||
char line[MAX_COOKIE_LINE];
|
||||
struct CookieInfo *c;
|
||||
@@ -491,6 +513,8 @@ struct CookieInfo *Curl_cookie_init(char *file, struct CookieInfo *inc)
|
||||
else
|
||||
fp = file?fopen(file, "r"):NULL;
|
||||
|
||||
c->newsession = newsession; /* new session? */
|
||||
|
||||
if(fp) {
|
||||
char *lineptr;
|
||||
bool headerline;
|
||||
@@ -743,6 +767,8 @@ int main(int argc, char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
* eval: (load-file "../curl-mode.el")
|
||||
|
15
lib/cookie.h
15
lib/cookie.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __COOKIE_H
|
||||
#define __COOKIE_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef WIN32
|
||||
@@ -58,6 +58,7 @@ struct CookieInfo {
|
||||
char *filename; /* file we read from/write to */
|
||||
bool running; /* state info, for cookie adding information */
|
||||
long numcookies; /* number of cookies in the "jar" */
|
||||
bool newsession; /* new session, discard session cookies on load */
|
||||
};
|
||||
|
||||
/* This is the maximum line length we accept for a cookie line */
|
||||
@@ -75,7 +76,7 @@ struct CookieInfo {
|
||||
struct Cookie *Curl_cookie_add(struct CookieInfo *, bool header, char *line,
|
||||
char *domain);
|
||||
|
||||
struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *);
|
||||
struct CookieInfo *Curl_cookie_init(char *, struct CookieInfo *, bool);
|
||||
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
|
||||
void Curl_cookie_freelist(struct Cookie *);
|
||||
void Curl_cookie_cleanup(struct CookieInfo *);
|
||||
|
@@ -31,12 +31,12 @@ RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "curllib - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_MFC 6
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libcurl.dll"
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /map /debug /machine:I386 /out:"Release/libcurl.dll"
|
||||
|
||||
!ELSEIF "$(CFG)" == "curllib - Win32 Debug"
|
||||
|
||||
@@ -81,7 +81,7 @@ BSC32=bscmake.exe
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libcurl.dll" /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib ws2_32.lib winmm.lib /nologo /dll /incremental:no /map /debug /machine:I386 /out:"Debug/libcurl.dll" /pdbtype:sept
|
||||
# SUBTRACT LINK32 /nodefaultlib
|
||||
|
||||
!ENDIF
|
||||
@@ -195,6 +195,10 @@ SOURCE=.\mprintf.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\multi.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\netrc.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
12
lib/dict.c
12
lib/dict.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
|
15
lib/dict.h
15
lib/dict.h
@@ -1,7 +1,7 @@
|
||||
#ifndef __DICT_H
|
||||
#define __DICT_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,20 +10,21 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_DICT
|
||||
CURLcode Curl_dict(struct connectdata *conn);
|
||||
CURLcode Curl_dict_done(struct connectdata *conn);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -64,6 +64,9 @@ DllMain (
|
||||
DWORD reason /* Reason this function is being called. */ ,
|
||||
LPVOID reserved /* Not used. */ )
|
||||
{
|
||||
/* prevent compiler warnings */
|
||||
(void) hInst;
|
||||
(void) reserved;
|
||||
|
||||
switch (reason)
|
||||
{
|
||||
|
19
lib/easy.c
19
lib/easy.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -238,7 +238,7 @@ CURLcode curl_easy_perform(CURL *curl)
|
||||
data->hostcache = Curl_global_host_cache_get();
|
||||
}
|
||||
else {
|
||||
data->hostcache = curl_hash_alloc(7, Curl_freeaddrinfo);
|
||||
data->hostcache = Curl_hash_alloc(7, Curl_freeaddrinfo);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ void curl_easy_cleanup(CURL *curl)
|
||||
{
|
||||
struct SessionHandle *data = (struct SessionHandle *)curl;
|
||||
if (!Curl_global_host_cache_use(data)) {
|
||||
curl_hash_destroy(data->hostcache);
|
||||
Curl_hash_destroy(data->hostcache);
|
||||
}
|
||||
Curl_close(data);
|
||||
}
|
||||
@@ -312,7 +312,8 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
||||
/* If cookies are enabled in the parent handle, we enable them
|
||||
in the clone as well! */
|
||||
outcurl->cookies = Curl_cookie_init(data->cookies->filename,
|
||||
outcurl->cookies);
|
||||
outcurl->cookies,
|
||||
data->set.cookiesession);
|
||||
|
||||
/* duplicate all values in 'change' */
|
||||
if(data->change.url) {
|
||||
|
32
lib/escape.c
32
lib/escape.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||
* allocated string or NULL if an error occurred. */
|
||||
@@ -48,9 +48,7 @@ char *curl_escape(const char *string, int length)
|
||||
length = alloc-1;
|
||||
while(length--) {
|
||||
in = *string;
|
||||
if(' ' == in)
|
||||
ns[index++] = '+';
|
||||
else if(!(in >= 'a' && in <= 'z') &&
|
||||
if(!(in >= 'a' && in <= 'z') &&
|
||||
!(in >= 'A' && in <= 'Z') &&
|
||||
!(in >= '0' && in <= '9')) {
|
||||
/* encode it */
|
||||
@@ -82,19 +80,10 @@ char *curl_unescape(const char *string, int length)
|
||||
unsigned char in;
|
||||
int index=0;
|
||||
unsigned int hex;
|
||||
char querypart=FALSE; /* everything to the right of a '?' letter is
|
||||
the "query part" where '+' should become ' '.
|
||||
RFC 2316, section 3.10 */
|
||||
|
||||
while(--alloc > 0) {
|
||||
in = *string;
|
||||
if(querypart && ('+' == in))
|
||||
in = ' ';
|
||||
else if(!querypart && ('?' == in)) {
|
||||
/* we have "walked in" to the query part */
|
||||
querypart=TRUE;
|
||||
}
|
||||
else if('%' == in) {
|
||||
if('%' == in) {
|
||||
/* encoded part */
|
||||
if(sscanf(string+1, "%02X", &hex)) {
|
||||
in = hex;
|
||||
@@ -111,6 +100,11 @@ char *curl_unescape(const char *string, int length)
|
||||
|
||||
}
|
||||
|
||||
void curl_free(void *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
* eval: (load-file "../curl-mode.el")
|
||||
|
12
lib/escape.h
12
lib/escape.h
@@ -1,7 +1,7 @@
|
||||
#ifndef __ESCAPE_H
|
||||
#define __ESCAPE_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,19 +10,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
/* Escape and unescape URL encoding in strings. The functions return a new
|
||||
* allocated string or NULL if an error occurred. */
|
||||
|
||||
|
32
lib/file.c
32
lib/file.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,22 +7,23 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
/* -- WIN32 approved -- */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -140,7 +141,7 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
*/
|
||||
CURLcode res = CURLE_OK;
|
||||
struct stat statbuf;
|
||||
ssize_t expected_size=-1;
|
||||
double expected_size=-1;
|
||||
ssize_t nread;
|
||||
struct SessionHandle *data = conn->data;
|
||||
char *buf = data->state.buffer;
|
||||
@@ -155,9 +156,19 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
/*VMS?? -- This only works reliable for STREAMLF files */
|
||||
if( -1 != fstat(fd, &statbuf)) {
|
||||
/* we could stat it, then read out the size */
|
||||
expected_size = statbuf.st_size;
|
||||
expected_size = (double)statbuf.st_size;
|
||||
}
|
||||
|
||||
/* Added by Dolbneff A.V & Spiridonoff A.V */
|
||||
if (conn->resume_from <= expected_size)
|
||||
expected_size -= conn->resume_from;
|
||||
else
|
||||
/* Is this error code suitable in such situation? */
|
||||
return CURLE_FTP_BAD_DOWNLOAD_RESUME;
|
||||
|
||||
if (expected_size == 0)
|
||||
return CURLE_OK;
|
||||
|
||||
/* The following is a shortcut implementation of file reading
|
||||
this is both more efficient than the former call to download() and
|
||||
it avoids problems with select() and recv() on file descriptors
|
||||
@@ -165,6 +176,10 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
if(expected_size != -1)
|
||||
Curl_pgrsSetDownloadSize(data, expected_size);
|
||||
|
||||
if(conn->resume_from)
|
||||
/* Added by Dolbneff A.V & Spiridonoff A.V */
|
||||
lseek(fd, conn->resume_from, SEEK_SET);
|
||||
|
||||
while (res == CURLE_OK) {
|
||||
nread = read(fd, buf, BUFSIZE-1);
|
||||
|
||||
@@ -204,3 +219,4 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
||||
#endif
|
||||
|
14
lib/file.h
14
lib/file.h
@@ -1,7 +1,7 @@
|
||||
#ifndef __FILE_H
|
||||
#define __FILE_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,19 +10,21 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_FILE
|
||||
CURLcode Curl_file(struct connectdata *conn);
|
||||
CURLcode Curl_file_connect(struct connectdata *conn);
|
||||
#endif
|
||||
#endif
|
||||
|
233
lib/formdata.c
233
lib/formdata.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
Debug the form generator stand-alone by compiling this source file with:
|
||||
@@ -109,6 +109,8 @@ Content-Disposition: form-data; name="FILECONTENT"
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -398,6 +400,10 @@ int curl_formparse(char *input,
|
||||
static struct curl_httppost *
|
||||
AddHttpPost(char * name, long namelength,
|
||||
char * value, long contentslength,
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
char * buffer, long bufferlength,
|
||||
|
||||
char *contenttype,
|
||||
long flags,
|
||||
struct curl_slist* contentHeader,
|
||||
@@ -414,6 +420,11 @@ AddHttpPost(char * name, long namelength,
|
||||
post->namelength = name?(namelength?namelength:(long)strlen(name)):0;
|
||||
post->contents = value;
|
||||
post->contentslength = contentslength;
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
post->buffer = buffer;
|
||||
post->bufferlength = bufferlength;
|
||||
|
||||
post->contenttype = contenttype;
|
||||
post->contentheader = contentHeader;
|
||||
post->showfilename = showfilename;
|
||||
@@ -602,39 +613,26 @@ static int AllocAndCopy (char **buffer, int buffer_length)
|
||||
* CURLFORM_FILE, "filename1", CURLFORM_FILE, "filename2", CURLFORM_END);
|
||||
*
|
||||
* Returns:
|
||||
* FORMADD_OK on success
|
||||
* FORMADD_MEMORY if the FormInfo allocation fails
|
||||
* FORMADD_OPTION_TWICE if one option is given twice for one Form
|
||||
* FORMADD_NULL if a null pointer was given for a char
|
||||
* FORMADD_MEMORY if the allocation of a FormInfo struct failed
|
||||
* FORMADD_UNKNOWN_OPTION if an unknown option was used
|
||||
* FORMADD_INCOMPLETE if the some FormInfo is not complete (or an error)
|
||||
* FORMADD_MEMORY if a HttpPost struct cannot be allocated
|
||||
* FORMADD_MEMORY if some allocation for string copying failed.
|
||||
* FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
|
||||
* CURL_FORMADD_OK on success
|
||||
* CURL_FORMADD_MEMORY if the FormInfo allocation fails
|
||||
* CURL_FORMADD_OPTION_TWICE if one option is given twice for one Form
|
||||
* CURL_FORMADD_NULL if a null pointer was given for a char
|
||||
* CURL_FORMADD_MEMORY if the allocation of a FormInfo struct failed
|
||||
* CURL_FORMADD_UNKNOWN_OPTION if an unknown option was used
|
||||
* CURL_FORMADD_INCOMPLETE if the some FormInfo is not complete (or an error)
|
||||
* CURL_FORMADD_MEMORY if a HttpPost struct cannot be allocated
|
||||
* CURL_FORMADD_MEMORY if some allocation for string copying failed.
|
||||
* CURL_FORMADD_ILLEGAL_ARRAY if an illegal option is used in an array
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
typedef enum {
|
||||
FORMADD_OK, /* first, no error */
|
||||
|
||||
FORMADD_MEMORY,
|
||||
FORMADD_OPTION_TWICE,
|
||||
FORMADD_NULL,
|
||||
FORMADD_UNKNOWN_OPTION,
|
||||
FORMADD_INCOMPLETE,
|
||||
FORMADD_ILLEGAL_ARRAY,
|
||||
|
||||
FORMADD_LAST /* last */
|
||||
} FORMcode;
|
||||
|
||||
static
|
||||
FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
||||
struct curl_httppost **last_post,
|
||||
va_list params)
|
||||
{
|
||||
FormInfo *first_form, *current_form, *form;
|
||||
FORMcode return_value = FORMADD_OK;
|
||||
CURLFORMcode return_value = CURL_FORMADD_OK;
|
||||
const char *prevtype = NULL;
|
||||
struct curl_httppost *post = NULL;
|
||||
CURLformoption option;
|
||||
@@ -655,7 +653,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
current_form = first_form;
|
||||
}
|
||||
else
|
||||
return FORMADD_MEMORY;
|
||||
return CURL_FORMADD_MEMORY;
|
||||
|
||||
/*
|
||||
* Loop through all the options set.
|
||||
@@ -663,7 +661,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
while (1) {
|
||||
|
||||
/* break if we have an error to report */
|
||||
if (return_value != FORMADD_OK)
|
||||
if (return_value != CURL_FORMADD_OK)
|
||||
break;
|
||||
|
||||
/* first see if we have more parts of the array param */
|
||||
@@ -690,13 +688,13 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
case CURLFORM_ARRAY:
|
||||
if(array_state)
|
||||
/* we don't support an array from within an array */
|
||||
return_value = FORMADD_ILLEGAL_ARRAY;
|
||||
return_value = CURL_FORMADD_ILLEGAL_ARRAY;
|
||||
else {
|
||||
forms = va_arg(params, struct curl_forms *);
|
||||
if (forms)
|
||||
array_state = TRUE;
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -707,19 +705,19 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
current_form->flags |= HTTPPOST_PTRNAME; /* fall through */
|
||||
case CURLFORM_COPYNAME:
|
||||
if (current_form->name)
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *name = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
if (name)
|
||||
current_form->name = name; /* store for the moment */
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
case CURLFORM_NAMELENGTH:
|
||||
if (current_form->namelength)
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->namelength =
|
||||
array_state?(long)array_value:va_arg(params, long);
|
||||
@@ -732,19 +730,19 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
current_form->flags |= HTTPPOST_PTRCONTENTS; /* fall through */
|
||||
case CURLFORM_COPYCONTENTS:
|
||||
if (current_form->value)
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *value =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (value)
|
||||
current_form->value = value; /* store for the moment */
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
case CURLFORM_CONTENTSLENGTH:
|
||||
if (current_form->contentslength)
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->contentslength =
|
||||
array_state?(long)array_value:va_arg(params, long);
|
||||
@@ -753,7 +751,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
/* Get contents from a given file name */
|
||||
case CURLFORM_FILECONTENT:
|
||||
if (current_form->flags != 0)
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *filename = array_state?
|
||||
array_value:va_arg(params, char *);
|
||||
@@ -762,7 +760,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
current_form->flags |= HTTPPOST_READFILE;
|
||||
}
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -777,23 +775,77 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if (filename) {
|
||||
if (!(current_form = AddFormInfo(strdup(filename),
|
||||
NULL, current_form)))
|
||||
return_value = FORMADD_MEMORY;
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
else
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (filename)
|
||||
current_form->value = strdup(filename);
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
current_form->flags |= HTTPPOST_FILENAME;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
case CURLFORM_BUFFER:
|
||||
{
|
||||
char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
|
||||
if (current_form->value) {
|
||||
if (current_form->flags & HTTPPOST_BUFFER) {
|
||||
if (filename) {
|
||||
if (!(current_form = AddFormInfo(strdup(filename),
|
||||
NULL, current_form)))
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
else
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (filename)
|
||||
current_form->value = strdup(filename);
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
current_form->flags |= HTTPPOST_BUFFER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
case CURLFORM_BUFFERPTR:
|
||||
current_form->flags |= HTTPPOST_PTRBUFFER;
|
||||
if (current_form->buffer)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else {
|
||||
char *buffer =
|
||||
array_state?array_value:va_arg(params, char *);
|
||||
if (buffer)
|
||||
current_form->buffer = buffer; /* store for the moment */
|
||||
else
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
case CURLFORM_BUFFERLENGTH:
|
||||
if (current_form->bufferlength)
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->bufferlength =
|
||||
array_state?(long)array_value:va_arg(params, long);
|
||||
break;
|
||||
|
||||
case CURLFORM_CONTENTTYPE:
|
||||
{
|
||||
char *contenttype =
|
||||
@@ -804,19 +856,19 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
if (!(current_form = AddFormInfo(NULL,
|
||||
strdup(contenttype),
|
||||
current_form)))
|
||||
return_value = FORMADD_MEMORY;
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
}
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
else
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
}
|
||||
else {
|
||||
if (contenttype)
|
||||
current_form->contenttype = strdup(contenttype);
|
||||
else
|
||||
return_value = FORMADD_NULL;
|
||||
return_value = CURL_FORMADD_NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -829,7 +881,7 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
va_arg(params, struct curl_slist*);
|
||||
|
||||
if( current_form->contentheader )
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->contentheader = list;
|
||||
|
||||
@@ -840,17 +892,17 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
char *filename = array_state?array_value:
|
||||
va_arg(params, char *);
|
||||
if( current_form->showfilename )
|
||||
return_value = FORMADD_OPTION_TWICE;
|
||||
return_value = CURL_FORMADD_OPTION_TWICE;
|
||||
else
|
||||
current_form->showfilename = strdup(filename);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return_value = FORMADD_UNKNOWN_OPTION;
|
||||
return_value = CURL_FORMADD_UNKNOWN_OPTION;
|
||||
}
|
||||
}
|
||||
|
||||
if(FORMADD_OK == return_value) {
|
||||
if(CURL_FORMADD_OK == return_value) {
|
||||
/* go through the list, check for copleteness and if everything is
|
||||
* alright add the HttpPost item otherwise set return_value accordingly */
|
||||
|
||||
@@ -863,14 +915,21 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
(form->flags & HTTPPOST_FILENAME) ) ||
|
||||
( (form->flags & HTTPPOST_FILENAME) &&
|
||||
(form->flags & HTTPPOST_PTRCONTENTS) ) ||
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
( (!form->buffer) &&
|
||||
(form->flags & HTTPPOST_BUFFER) &&
|
||||
(form->flags & HTTPPOST_PTRBUFFER) ) ||
|
||||
|
||||
( (form->flags & HTTPPOST_READFILE) &&
|
||||
(form->flags & HTTPPOST_PTRCONTENTS) )
|
||||
) {
|
||||
return_value = FORMADD_INCOMPLETE;
|
||||
return_value = CURL_FORMADD_INCOMPLETE;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if ( (form->flags & HTTPPOST_FILENAME) &&
|
||||
if ( ((form->flags & HTTPPOST_FILENAME) ||
|
||||
(form->flags & HTTPPOST_BUFFER)) &&
|
||||
!form->contenttype ) {
|
||||
/* our contenttype is missing */
|
||||
form->contenttype
|
||||
@@ -880,28 +939,36 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
(form == first_form) ) {
|
||||
/* copy name (without strdup; possibly contains null characters) */
|
||||
if (AllocAndCopy(&form->name, form->namelength)) {
|
||||
return_value = FORMADD_MEMORY;
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( !(form->flags & HTTPPOST_FILENAME) &&
|
||||
!(form->flags & HTTPPOST_READFILE) &&
|
||||
!(form->flags & HTTPPOST_PTRCONTENTS) ) {
|
||||
!(form->flags & HTTPPOST_PTRCONTENTS) &&
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
!(form->flags & HTTPPOST_PTRBUFFER) ) {
|
||||
|
||||
/* copy value (without strdup; possibly contains null characters) */
|
||||
if (AllocAndCopy(&form->value, form->contentslength)) {
|
||||
return_value = FORMADD_MEMORY;
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
post = AddHttpPost(form->name, form->namelength,
|
||||
form->value, form->contentslength,
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
form->buffer, form->bufferlength,
|
||||
|
||||
form->contenttype, form->flags,
|
||||
form->contentheader, form->showfilename,
|
||||
post, httppost,
|
||||
last_post);
|
||||
|
||||
if(!post)
|
||||
return_value = FORMADD_MEMORY;
|
||||
return_value = CURL_FORMADD_MEMORY;
|
||||
|
||||
if (form->contenttype)
|
||||
prevtype = form->contenttype;
|
||||
@@ -922,12 +989,12 @@ FORMcode FormAdd(struct curl_httppost **httppost,
|
||||
return return_value;
|
||||
}
|
||||
|
||||
int curl_formadd(struct curl_httppost **httppost,
|
||||
CURLFORMcode curl_formadd(struct curl_httppost **httppost,
|
||||
struct curl_httppost **last_post,
|
||||
...)
|
||||
{
|
||||
va_list arg;
|
||||
int result;
|
||||
CURLFORMcode result;
|
||||
va_start(arg, last_post);
|
||||
result = FormAdd(httppost, last_post, arg);
|
||||
va_end(arg);
|
||||
@@ -1044,22 +1111,24 @@ void curl_formfree(struct curl_httppost *form)
|
||||
} while((form=next)); /* continue */
|
||||
}
|
||||
|
||||
struct FormData *Curl_getFormData(struct curl_httppost *post,
|
||||
CURLcode Curl_getFormData(struct FormData **finalform,
|
||||
struct curl_httppost *post,
|
||||
int *sizep)
|
||||
{
|
||||
struct FormData *form = NULL;
|
||||
struct FormData *firstform;
|
||||
|
||||
struct curl_httppost *file;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
int size =0;
|
||||
char *boundary;
|
||||
char *fileboundary=NULL;
|
||||
struct curl_slist* curList;
|
||||
|
||||
*finalform=NULL; /* default form is empty */
|
||||
|
||||
if(!post)
|
||||
return NULL; /* no input => no output! */
|
||||
return result; /* no input => no output! */
|
||||
|
||||
boundary = Curl_FormBoundary();
|
||||
|
||||
@@ -1116,7 +1185,11 @@ struct FormData *Curl_getFormData(struct curl_httppost *post,
|
||||
(file->showfilename?file->showfilename:
|
||||
file->contents));
|
||||
}
|
||||
else if(post->flags & HTTPPOST_FILENAME) {
|
||||
else if((post->flags & HTTPPOST_FILENAME) ||
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
(post->flags & HTTPPOST_BUFFER)) {
|
||||
|
||||
size += AddFormDataf(&form,
|
||||
"; filename=\"%s\"",
|
||||
(post->showfilename?post->showfilename:
|
||||
@@ -1166,19 +1239,29 @@ struct FormData *Curl_getFormData(struct curl_httppost *post,
|
||||
/*VMS?? Stream files are OK, as are FIXED & VAR files WITHOUT implied CC */
|
||||
/*VMS?? For implied CC, every record needs to have a \n appended & 1 added to SIZE */
|
||||
if(fileread) {
|
||||
while((nread = fread(buffer, 1, 1024, fileread))) {
|
||||
size += AddFormData(&form,
|
||||
buffer,
|
||||
nread);
|
||||
}
|
||||
while((nread = fread(buffer, 1, 1024, fileread)))
|
||||
size += AddFormData(&form, buffer, nread);
|
||||
|
||||
if(fileread != stdin)
|
||||
fclose(fileread);
|
||||
}
|
||||
else {
|
||||
#if 0
|
||||
/* File wasn't found, add a nothing field! */
|
||||
size += AddFormData(&form, "", 0);
|
||||
#endif
|
||||
Curl_formclean(firstform);
|
||||
free(boundary);
|
||||
*finalform = NULL;
|
||||
return CURLE_READ_ERROR;
|
||||
}
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
} else if (post->flags & HTTPPOST_BUFFER) {
|
||||
/* include contents of buffer */
|
||||
size += AddFormData(&form, post->buffer, post->bufferlength);
|
||||
}
|
||||
|
||||
else {
|
||||
/* include the contents we got */
|
||||
size += AddFormData(&form, post->contents, post->contentslength);
|
||||
@@ -1205,7 +1288,9 @@ struct FormData *Curl_getFormData(struct curl_httppost *post,
|
||||
|
||||
free(boundary);
|
||||
|
||||
return firstform;
|
||||
*finalform=firstform;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int Curl_FormInit(struct Form *form, struct FormData *formdata )
|
||||
@@ -1510,6 +1595,8 @@ int main(int argc, char **argv)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
* eval: (load-file "../curl-mode.el")
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#ifndef __FORMDATA_H
|
||||
#define __FORMDATA_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,19 +10,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
/* plain and simple linked list with lines to send */
|
||||
struct FormData {
|
||||
struct FormData *next;
|
||||
@@ -45,6 +45,10 @@ typedef struct FormInfo {
|
||||
char *contenttype;
|
||||
long flags;
|
||||
|
||||
/* CMC: Added support for buffer uploads */
|
||||
char *buffer; /* pointer to existing buffer used for file upload */
|
||||
long bufferlength;
|
||||
|
||||
char *showfilename; /* The file name to show. If not set, the actual
|
||||
file name will be used */
|
||||
struct curl_slist* contentheader;
|
||||
@@ -53,7 +57,9 @@ typedef struct FormInfo {
|
||||
|
||||
int Curl_FormInit(struct Form *form, struct FormData *formdata );
|
||||
|
||||
struct FormData *Curl_getFormData(struct HttpPost *post,
|
||||
CURLcode
|
||||
Curl_getFormData(struct FormData **,
|
||||
struct HttpPost *post,
|
||||
int *size);
|
||||
|
||||
/* fread() emulation */
|
||||
|
435
lib/ftp.c
435
lib/ftp.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,22 +7,23 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -210,16 +211,6 @@ int Curl_GetFTPResponse(char *buf,
|
||||
if (ftpcode)
|
||||
*ftpcode = 0; /* 0 for errors */
|
||||
|
||||
if(data->set.timeout) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
timeout = data->set.timeout - /* timeout time */
|
||||
Curl_tvdiff(Curl_tvnow(), conn->now)/1000; /* spent time */
|
||||
if(timeout <=0 ) {
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
return -SELECT_TIMEOUT; /* already too little time */
|
||||
}
|
||||
}
|
||||
|
||||
FD_ZERO (&readfd); /* clear it */
|
||||
FD_SET (sockfd, &readfd); /* read socket */
|
||||
|
||||
@@ -235,11 +226,22 @@ int Curl_GetFTPResponse(char *buf,
|
||||
keepon=TRUE;
|
||||
|
||||
while((nread<BUFSIZE) && (keepon && !error)) {
|
||||
/* check and reset timeout value every lap */
|
||||
if(data->set.timeout) {
|
||||
/* if timeout is requested, find out how much remaining time we have */
|
||||
timeout = data->set.timeout - /* timeout time */
|
||||
Curl_tvdiff(Curl_tvnow(), conn->now)/1000; /* spent time */
|
||||
if(timeout <=0 ) {
|
||||
failf(data, "Transfer aborted due to timeout");
|
||||
return -SELECT_TIMEOUT; /* already too little time */
|
||||
}
|
||||
}
|
||||
|
||||
if(!ftp->cache) {
|
||||
readfd = rkeepfd; /* set every lap */
|
||||
interval.tv_sec = timeout;
|
||||
interval.tv_usec = 0;
|
||||
|
||||
if(!ftp->cache)
|
||||
switch (select (sockfd+1, &readfd, NULL, NULL, &interval)) {
|
||||
case -1: /* select() error, stop reading */
|
||||
error = SELECT_ERROR;
|
||||
@@ -253,6 +255,7 @@ int Curl_GetFTPResponse(char *buf,
|
||||
error = SELECT_OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(SELECT_OK == error) {
|
||||
/*
|
||||
* This code previously didn't use the kerberos sec_read() code
|
||||
@@ -384,33 +387,10 @@ int Curl_GetFTPResponse(char *buf,
|
||||
return nread; /* total amount of bytes read */
|
||||
}
|
||||
|
||||
#ifndef ENABLE_IPV6
|
||||
/*
|
||||
* This function is only used by code that works on IPv4. When we add proper
|
||||
* support for that functionality with IPv6, this function can go in again.
|
||||
* Curl_ftp_connect() should do everything that is to be considered a part of
|
||||
* the connection phase.
|
||||
*/
|
||||
/* -- who are we? -- */
|
||||
static char *getmyhost(char *buf, int buf_size)
|
||||
{
|
||||
#if defined(HAVE_GETHOSTNAME)
|
||||
gethostname(buf, buf_size);
|
||||
#elif defined(HAVE_UNAME)
|
||||
struct utsname ugnm;
|
||||
strncpy(buf, uname(&ugnm) < 0 ? "localhost" : ugnm.nodename, buf_size - 1);
|
||||
buf[buf_size - 1] = '\0';
|
||||
#else
|
||||
/* We have no means of finding the local host name! */
|
||||
strncpy(buf, "localhost", buf_size);
|
||||
buf[buf_size - 1] = '\0';
|
||||
#endif
|
||||
return buf;
|
||||
}
|
||||
|
||||
#endif /* ipv4-only function */
|
||||
|
||||
|
||||
/* ftp_connect() should do everything that is to be considered a part
|
||||
of the connection phase. */
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn)
|
||||
{
|
||||
/* this is FTP and no proxy */
|
||||
@@ -633,9 +613,9 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
failf(data, "Received only partial file: %d bytes", *ftp->bytecountp);
|
||||
return CURLE_PARTIAL_FILE;
|
||||
}
|
||||
else if(!conn->bits.resume_done &&
|
||||
!data->set.no_body &&
|
||||
(0 == *ftp->bytecountp)) {
|
||||
else if(!ftp->dont_check &&
|
||||
!*ftp->bytecountp &&
|
||||
(conn->size>0)) {
|
||||
/* We consider this an error, but there's no true FTP error received
|
||||
why we need to continue to "read out" the server response too.
|
||||
We don't want to leave a "waiting" server reply if we'll get told
|
||||
@@ -652,21 +632,25 @@ CURLcode Curl_ftp_done(struct connectdata *conn)
|
||||
sclose(conn->secondarysocket);
|
||||
conn->secondarysocket = -1;
|
||||
|
||||
if(!data->set.no_body && !conn->bits.resume_done) {
|
||||
/* now let's see what the server says about the transfer we
|
||||
just performed: */
|
||||
if(!ftp->no_transfer) {
|
||||
/* now let's see what the server says about the transfer we just
|
||||
performed: */
|
||||
nread = Curl_GetFTPResponse(buf, conn, &ftpcode);
|
||||
if(nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
if(!ftp->dont_check) {
|
||||
/* 226 Transfer complete, 250 Requested file action okay, completed. */
|
||||
if((ftpcode != 226) && (ftpcode != 250)) {
|
||||
failf(data, "server did not report OK, got %d", ftpcode);
|
||||
return CURLE_FTP_WRITE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
conn->bits.resume_done = FALSE; /* clean this for next connection */
|
||||
/* clear these for next connection */
|
||||
ftp->no_transfer = FALSE;
|
||||
ftp->dont_check = FALSE;
|
||||
|
||||
/* Send any post-transfer QUOTE strings? */
|
||||
if(!result && data->set.postquote)
|
||||
@@ -727,8 +711,7 @@ CURLcode ftp_cwd(struct connectdata *conn, char *path)
|
||||
CURLcode result;
|
||||
|
||||
FTPSENDF(conn, "CWD %s", path);
|
||||
nread = Curl_GetFTPResponse(
|
||||
conn->data->state.buffer, conn, &ftpcode);
|
||||
nread = Curl_GetFTPResponse(conn->data->state.buffer, conn, &ftpcode);
|
||||
if (nread < 0)
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
|
||||
@@ -897,9 +880,11 @@ ftp_pasv_verbose(struct connectdata *conn,
|
||||
/* Bjorn Reese (November 28 2001):
|
||||
The Tru64 man page on gethostbyaddr_r() says that
|
||||
the hostent struct must be filled with zeroes before the call to
|
||||
gethostbyaddr_r(). */
|
||||
gethostbyaddr_r().
|
||||
|
||||
memset(hostent_buf, 0, sizeof(struct hostent));
|
||||
... as must be struct hostent_data Craig Markwardt 19 Sep 2002. */
|
||||
|
||||
memset(hostent_buf, 0, sizeof(struct hostent)+sizeof(struct hostent_data));
|
||||
|
||||
if(gethostbyaddr_r((char *) &address,
|
||||
sizeof(address), AF_INET,
|
||||
@@ -1065,13 +1050,13 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
if (portsock < 0) {
|
||||
failf(data, strerror(errno));
|
||||
failf(data, "%s", strerror(errno));
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
|
||||
sslen = sizeof(ss);
|
||||
if (getsockname(portsock, sa, &sslen) < 0) {
|
||||
failf(data, strerror(errno));
|
||||
failf(data, "%s", strerror(errno));
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
|
||||
@@ -1202,26 +1187,35 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
char *hostdataptr=NULL;
|
||||
unsigned short porttouse;
|
||||
char myhost[256] = "";
|
||||
bool sa_filled_in = FALSE;
|
||||
|
||||
if(data->set.ftpport) {
|
||||
if(Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
|
||||
h = Curl_resolv(data, myhost, 0, &hostdataptr);
|
||||
h = Curl_resolv(data, myhost, 0);
|
||||
}
|
||||
else {
|
||||
int len = strlen(data->set.ftpport);
|
||||
if(len>1)
|
||||
h = Curl_resolv(data, data->set.ftpport, 0, &hostdataptr);
|
||||
h = Curl_resolv(data, data->set.ftpport, 0);
|
||||
if(h)
|
||||
strcpy(myhost, data->set.ftpport); /* buffer overflow risk */
|
||||
}
|
||||
}
|
||||
if(! *myhost) {
|
||||
char *tmp_host = getmyhost(myhost, sizeof(myhost));
|
||||
h=Curl_resolv(data, tmp_host, 0, &hostdataptr);
|
||||
}
|
||||
infof(data, "We connect from %s\n", myhost);
|
||||
/* pick a suitable default here */
|
||||
|
||||
if ( h ) {
|
||||
socklen_t sslen;
|
||||
|
||||
sslen = sizeof(sa);
|
||||
if (getsockname(conn->firstsocket, (struct sockaddr *)&sa, &sslen) < 0) {
|
||||
failf(data, "getsockname() failed");
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
|
||||
sa_filled_in = TRUE; /* the sa struct is filled in */
|
||||
}
|
||||
|
||||
if ( h || sa_filled_in) {
|
||||
if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) >= 0 ) {
|
||||
int size;
|
||||
|
||||
@@ -1230,12 +1224,15 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
we fail before the true secondary stuff is made */
|
||||
conn->secondarysocket = portsock;
|
||||
|
||||
if(!sa_filled_in) {
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr,
|
||||
h->h_addr,
|
||||
h->h_length);
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
|
||||
sa.sin_port = 0;
|
||||
size = sizeof(sa);
|
||||
|
||||
@@ -1279,7 +1276,10 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
#endif
|
||||
struct in_addr in;
|
||||
unsigned short ip[5];
|
||||
(void) memcpy(&in.s_addr, *h->h_addr_list, sizeof (in.s_addr));
|
||||
(void) memcpy(&in.s_addr,
|
||||
h?*h->h_addr_list:(char *)&sa.sin_addr.s_addr,
|
||||
sizeof (in.s_addr));
|
||||
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
/* ignore the return code from inet_ntoa_r() as it is int or
|
||||
char * depending on system */
|
||||
@@ -1290,6 +1290,9 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu",
|
||||
&ip[0], &ip[1], &ip[2], &ip[3]);
|
||||
#endif
|
||||
infof(data, "Telling server to connect to %d.%d.%d.%d:%d\n",
|
||||
ip[0], ip[1], ip[2], ip[3], porttouse);
|
||||
|
||||
result=Curl_ftpsendf(conn, "PORT %d,%d,%d,%d,%d,%d",
|
||||
ip[0], ip[1], ip[2], ip[3],
|
||||
porttouse >> 8,
|
||||
@@ -1321,7 +1324,8 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
*/
|
||||
|
||||
static
|
||||
CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
CURLcode ftp_use_pasv(struct connectdata *conn,
|
||||
bool *connected)
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
ssize_t nread;
|
||||
@@ -1360,7 +1364,6 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
int modeoff;
|
||||
unsigned short connectport; /* the local port connect() should use! */
|
||||
unsigned short newport; /* remote port, not necessary the local one */
|
||||
char *hostdataptr=NULL;
|
||||
|
||||
/* newhost must be able to hold a full IP-style address in ASCII, which
|
||||
in the IPv6 case means 5*8-1 = 39 letters */
|
||||
@@ -1369,7 +1372,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
|
||||
for (modeoff = (data->set.ftp_use_epsv?0:1);
|
||||
mode[modeoff]; modeoff++) {
|
||||
result = Curl_ftpsendf(conn, mode[modeoff]);
|
||||
result = Curl_ftpsendf(conn, "%s", mode[modeoff]);
|
||||
if(result)
|
||||
return result;
|
||||
nread = Curl_GetFTPResponse(buf, conn, &ftpcode);
|
||||
@@ -1450,16 +1453,19 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
if(data->change.proxy) {
|
||||
/*
|
||||
* This is a tunnel through a http proxy and we need to connect to the
|
||||
* proxy again here. We already have the name info for it since the
|
||||
* previous lookup.
|
||||
* proxy again here.
|
||||
*
|
||||
* We don't want to rely on a former host lookup that might've expired
|
||||
* now, instead we remake the lookup here and now!
|
||||
*/
|
||||
addr = conn->hostaddr;
|
||||
addr = Curl_resolv(data, conn->proxyhost, conn->port);
|
||||
connectport =
|
||||
(unsigned short)conn->port; /* we connect to the proxy's port */
|
||||
|
||||
}
|
||||
else {
|
||||
/* normal, direct, ftp connection */
|
||||
addr = Curl_resolv(data, newhostp, newport, &hostdataptr);
|
||||
addr = Curl_resolv(data, newhostp, newport);
|
||||
if(!addr) {
|
||||
failf(data, "Can't resolve new host %s:%d", newhostp, newport);
|
||||
return CURLE_FTP_CANT_GET_HOST;
|
||||
@@ -1471,7 +1477,14 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
addr,
|
||||
connectport,
|
||||
&conn->secondarysocket,
|
||||
&conninfo);
|
||||
&conninfo,
|
||||
connected);
|
||||
|
||||
/*
|
||||
* When this is used from the multi interface, this might've returned with
|
||||
* the 'connected' set to FALSE and thus we are now awaiting a non-blocking
|
||||
* connect to connect and we should not be "hanging" here waiting.
|
||||
*/
|
||||
|
||||
if((CURLE_OK == result) &&
|
||||
data->set.verbose)
|
||||
@@ -1492,125 +1505,24 @@ CURLcode ftp_use_pasv(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
/*
|
||||
* Curl_ftp_nextconnect()
|
||||
*
|
||||
* ftp_perform()
|
||||
*
|
||||
* This is the actual DO function for FTP. Get a file/directory according to
|
||||
* the options previously setup.
|
||||
* This function shall be called when the second FTP connection has been
|
||||
* established and is confirmed connected.
|
||||
*/
|
||||
|
||||
static
|
||||
CURLcode ftp_perform(struct connectdata *conn)
|
||||
CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
{
|
||||
/* this is FTP and no proxy */
|
||||
ssize_t nread;
|
||||
CURLcode result=CURLE_OK;
|
||||
struct SessionHandle *data=conn->data;
|
||||
char *buf = data->state.buffer; /* this is our buffer */
|
||||
CURLcode result;
|
||||
ssize_t nread;
|
||||
int ftpcode; /* for ftp status */
|
||||
|
||||
/* the ftp struct is already inited in ftp_connect() */
|
||||
struct FTP *ftp = conn->proto.ftp;
|
||||
|
||||
long *bytecountp = ftp->bytecountp;
|
||||
int ftpcode; /* for ftp status */
|
||||
|
||||
/* Send any QUOTE strings? */
|
||||
if(data->set.quote) {
|
||||
if ((result = ftp_sendquote(conn, data->set.quote)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is a re-used connection. Since we change directory to where the
|
||||
transfer is taking place, we must now get back to the original dir
|
||||
where we ended up after login: */
|
||||
if (conn->bits.reuse) {
|
||||
if ((result = ftp_cwd(conn, ftp->entrypath)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* change directory first! */
|
||||
if(ftp->dir && ftp->dir[0]) {
|
||||
if ((result = ftp_cwd(conn, ftp->dir)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Requested time of file? */
|
||||
if(data->set.get_filetime && ftp->file) {
|
||||
result = ftp_getfiletime(conn, ftp->file);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* If we have selected NOBODY and HEADER, it means that we only want file
|
||||
information. Which in FTP can't be much more than the file size and
|
||||
date. */
|
||||
if(data->set.no_body && data->set.include_header && ftp->file) {
|
||||
/* The SIZE command is _not_ RFC 959 specified, and therefor many servers
|
||||
may not support it! It is however the only way we have to get a file's
|
||||
size! */
|
||||
ssize_t filesize;
|
||||
|
||||
/* Some servers return different sizes for different modes, and thus we
|
||||
must set the proper type before we check the size */
|
||||
result = ftp_transfertype(conn, data->set.ftp_ascii);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
/* failing to get size is not a serious error */
|
||||
result = ftp_getsize(conn, ftp->file, &filesize);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
sprintf(buf, "Content-Length: %d\r\n", filesize);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* If we asked for a time of the file and we actually got one as
|
||||
well, we "emulate" a HTTP-style header in our output. */
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
if(data->set.get_filetime && data->info.filetime) {
|
||||
struct tm *tm;
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm buffer;
|
||||
tm = (struct tm *)localtime_r(&data->info.filetime, &buffer);
|
||||
#else
|
||||
tm = localtime((unsigned long *)&data->info.filetime);
|
||||
#endif
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n",
|
||||
tm);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(data->set.no_body)
|
||||
/* don't transfer the data */
|
||||
;
|
||||
/* Get us a second connection up and connected */
|
||||
else if(data->set.ftp_use_port) {
|
||||
/* We have chosen to use the PORT command */
|
||||
result = ftp_use_port(conn);
|
||||
if(CURLE_OK == result)
|
||||
/* we have the data connection ready */
|
||||
infof(data, "Connected the data stream with PORT!\n");
|
||||
}
|
||||
else {
|
||||
/* We have chosen (this is default) to use the PASV command */
|
||||
result = ftp_use_pasv(conn);
|
||||
if(CURLE_OK == result)
|
||||
infof(data, "Connected the data stream with PASV!\n");
|
||||
}
|
||||
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(data->set.upload) {
|
||||
|
||||
@@ -1689,10 +1601,9 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
/* no data to transfer */
|
||||
result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||
|
||||
/* Set resume done so that we won't get any error in
|
||||
* Curl_ftp_done() because we didn't transfer the amount of bytes
|
||||
* that the local file file obviously is */
|
||||
conn->bits.resume_done = TRUE;
|
||||
/* Set no_transfer so that we won't get any error in
|
||||
* Curl_ftp_done() because we didn't transfer anything! */
|
||||
ftp->no_transfer = TRUE;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -1781,6 +1692,7 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
}
|
||||
infof(data, "range-download from %d to %d, totally %d bytes\n",
|
||||
from, to, totalsize);
|
||||
ftp->dont_check = TRUE; /* dont check for successful transfer */
|
||||
}
|
||||
|
||||
if((data->set.ftp_list_only) || !ftp->file) {
|
||||
@@ -1873,11 +1785,9 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
result=Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
|
||||
infof(data, "File already completely downloaded\n");
|
||||
|
||||
/* Set resume done so that we won't get any error in Curl_ftp_done()
|
||||
* because we didn't transfer the amount of bytes that the remote
|
||||
* file obviously is */
|
||||
conn->bits.resume_done = TRUE;
|
||||
|
||||
/* Set no_transfer so that we won't get any error in Curl_ftp_done()
|
||||
* because we didn't transfer the any file */
|
||||
ftp->no_transfer = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -1989,6 +1899,128 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* ftp_perform()
|
||||
*
|
||||
* This is the actual DO function for FTP. Get a file/directory according to
|
||||
* the options previously setup.
|
||||
*/
|
||||
|
||||
static
|
||||
CURLcode ftp_perform(struct connectdata *conn,
|
||||
bool *connected) /* for the TCP connect status after
|
||||
PASV / PORT */
|
||||
{
|
||||
/* this is FTP and no proxy */
|
||||
CURLcode result=CURLE_OK;
|
||||
struct SessionHandle *data=conn->data;
|
||||
char *buf = data->state.buffer; /* this is our buffer */
|
||||
|
||||
/* the ftp struct is already inited in ftp_connect() */
|
||||
struct FTP *ftp = conn->proto.ftp;
|
||||
|
||||
/* Send any QUOTE strings? */
|
||||
if(data->set.quote) {
|
||||
if ((result = ftp_sendquote(conn, data->set.quote)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* This is a re-used connection. Since we change directory to where the
|
||||
transfer is taking place, we must now get back to the original dir
|
||||
where we ended up after login: */
|
||||
if (conn->bits.reuse && ftp->entrypath) {
|
||||
if ((result = ftp_cwd(conn, ftp->entrypath)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* change directory first! */
|
||||
if(ftp->dir && ftp->dir[0]) {
|
||||
if ((result = ftp_cwd(conn, ftp->dir)) != CURLE_OK)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Requested time of file? */
|
||||
if(data->set.get_filetime && ftp->file) {
|
||||
result = ftp_getfiletime(conn, ftp->file);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* If we have selected NOBODY and HEADER, it means that we only want file
|
||||
information. Which in FTP can't be much more than the file size and
|
||||
date. */
|
||||
if(data->set.no_body && data->set.include_header && ftp->file) {
|
||||
/* The SIZE command is _not_ RFC 959 specified, and therefor many servers
|
||||
may not support it! It is however the only way we have to get a file's
|
||||
size! */
|
||||
ssize_t filesize;
|
||||
|
||||
ftp->no_transfer = TRUE; /* this means no actual transfer is made */
|
||||
|
||||
/* Some servers return different sizes for different modes, and thus we
|
||||
must set the proper type before we check the size */
|
||||
result = ftp_transfertype(conn, data->set.ftp_ascii);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
/* failing to get size is not a serious error */
|
||||
result = ftp_getsize(conn, ftp->file, &filesize);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
sprintf(buf, "Content-Length: %d\r\n", filesize);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
/* If we asked for a time of the file and we actually got one as
|
||||
well, we "emulate" a HTTP-style header in our output. */
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
if(data->set.get_filetime && data->info.filetime) {
|
||||
struct tm *tm;
|
||||
#ifdef HAVE_LOCALTIME_R
|
||||
struct tm buffer;
|
||||
tm = (struct tm *)localtime_r(&data->info.filetime, &buffer);
|
||||
#else
|
||||
tm = localtime((unsigned long *)&data->info.filetime);
|
||||
#endif
|
||||
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
|
||||
strftime(buf, BUFSIZE-1, "Last-Modified: %a, %d %b %Y %H:%M:%S %Z\r\n",
|
||||
tm);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(data->set.no_body)
|
||||
/* doesn't really transfer any data */
|
||||
ftp->no_transfer = TRUE;
|
||||
/* Get us a second connection up and connected */
|
||||
else if(data->set.ftp_use_port) {
|
||||
/* We have chosen to use the PORT command */
|
||||
result = ftp_use_port(conn);
|
||||
if(CURLE_OK == result) {
|
||||
/* we have the data connection ready */
|
||||
infof(data, "Ordered connect of the data stream with PORT!\n");
|
||||
*connected = TRUE; /* mark us "still connected" */
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* We have chosen (this is default) to use the PASV command */
|
||||
result = ftp_use_pasv(conn, connected);
|
||||
if(connected)
|
||||
infof(data, "Connected the data stream with PASV!\n");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Curl_ftp()
|
||||
@@ -2001,6 +2033,7 @@ CURLcode ftp_perform(struct connectdata *conn)
|
||||
CURLcode Curl_ftp(struct connectdata *conn)
|
||||
{
|
||||
CURLcode retcode;
|
||||
bool connected;
|
||||
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct FTP *ftp;
|
||||
@@ -2047,15 +2080,15 @@ CURLcode Curl_ftp(struct connectdata *conn)
|
||||
else
|
||||
ftp->dir = NULL;
|
||||
|
||||
retcode = ftp_perform(conn);
|
||||
retcode = ftp_perform(conn, &connected);
|
||||
|
||||
/* clean up here, success or error doesn't matter */
|
||||
if(ftp->file)
|
||||
free(ftp->file);
|
||||
if(ftp->dir)
|
||||
free(ftp->dir);
|
||||
|
||||
ftp->file = ftp->dir = NULL; /* zero */
|
||||
if(CURLE_OK == retcode) {
|
||||
if(connected)
|
||||
retcode = Curl_ftp_nextconnect(conn);
|
||||
else
|
||||
/* since we didn't connect now, we want do_more to get called */
|
||||
conn->do_more = TRUE;
|
||||
}
|
||||
|
||||
return retcode;
|
||||
}
|
||||
@@ -2126,6 +2159,12 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
|
||||
free(ftp->entrypath);
|
||||
if(ftp->cache)
|
||||
free(ftp->cache);
|
||||
if(ftp->file)
|
||||
free(ftp->file);
|
||||
if(ftp->dir)
|
||||
free(ftp->dir);
|
||||
|
||||
ftp->file = ftp->dir = NULL; /* zero */
|
||||
}
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -2137,3 +2176,5 @@ CURLcode Curl_ftp_disconnect(struct connectdata *conn)
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
||||
|
||||
#endif /* CURL_DISABLE_FTP */
|
||||
|
20
lib/ftp.h
20
lib/ftp.h
@@ -1,7 +1,6 @@
|
||||
#ifndef __FTP_H
|
||||
#define __FTP_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,28 +9,29 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
CURLcode Curl_ftp(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_done(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_connect(struct connectdata *conn);
|
||||
CURLcode Curl_ftp_disconnect(struct connectdata *conn);
|
||||
|
||||
CURLcode Curl_ftpsendf(struct connectdata *, const char *fmt, ...);
|
||||
|
||||
/* The kerberos stuff needs this: */
|
||||
int Curl_GetFTPResponse(char *buf, struct connectdata *conn,
|
||||
int *ftpcode);
|
||||
CURLcode Curl_ftp_nextconnect(struct connectdata *conn);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
12
lib/getenv.c
12
lib/getenv.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -54,6 +54,7 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
|
||||
pro->t_pretransfer = 0;
|
||||
pro->t_starttransfer = 0;
|
||||
pro->timespent = 0;
|
||||
pro->t_redirect = 0;
|
||||
|
||||
info->httpcode = 0;
|
||||
info->httpversion=0;
|
||||
@@ -148,6 +149,12 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
||||
case CURLINFO_CONTENT_LENGTH_UPLOAD:
|
||||
*param_doublep = data->progress.size_ul;
|
||||
break;
|
||||
case CURLINFO_REDIRECT_TIME:
|
||||
*param_doublep = data->progress.t_redirect;
|
||||
break;
|
||||
case CURLINFO_REDIRECT_COUNT:
|
||||
*param_longp = data->set.followlocation;
|
||||
break;
|
||||
case CURLINFO_CONTENT_TYPE:
|
||||
*param_charp = data->info.contenttype;
|
||||
break;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __GETINFO_H
|
||||
#define __GETINFO_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...);
|
||||
CURLcode Curl_initinfo(struct SessionHandle *data);
|
||||
|
||||
|
@@ -93,14 +93,10 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
#include "memdebug.h"
|
||||
#endif
|
||||
|
||||
/* no perror? make an fprintf! */
|
||||
#ifndef HAVE_PERROR
|
||||
# define perror(x) fprintf(stderr, "Error in: %s\n", x)
|
||||
#endif
|
||||
|
||||
char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
{
|
||||
FILE *infp;
|
||||
char infp_fclose = 0;
|
||||
FILE *outfp;
|
||||
RETSIGTYPE (*sigint)();
|
||||
#ifndef __EMX__
|
||||
@@ -127,41 +123,30 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
sigtstp = signal(SIGTSTP, SIG_IGN);
|
||||
#endif
|
||||
|
||||
if( (infp=fopen("/dev/tty", "r")) == NULL )
|
||||
{
|
||||
infp=fopen("/dev/tty", "r");
|
||||
if( NULL == infp )
|
||||
infp = stdin;
|
||||
}
|
||||
if( (outfp=fopen("/dev/tty", "w")) == NULL )
|
||||
{
|
||||
else
|
||||
infp_fclose = 1;
|
||||
|
||||
outfp = stderr;
|
||||
}
|
||||
|
||||
infd = fileno(infp);
|
||||
outfd = fileno(outfp);
|
||||
|
||||
/* dissable echo */
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
if(tcgetattr(outfd, &orig) != 0)
|
||||
{
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
tcgetattr(outfd, &orig);
|
||||
|
||||
noecho = orig;
|
||||
noecho.c_lflag &= ~ECHO;
|
||||
if(tcsetattr(outfd, TCSANOW, &noecho) != 0)
|
||||
{
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
tcsetattr(outfd, TCSANOW, &noecho);
|
||||
#else
|
||||
# ifdef HAVE_TERMIO_H
|
||||
if(ioctl(outfd, TCGETA, &orig) != 0)
|
||||
{
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
ioctl(outfd, TCGETA, &orig);
|
||||
noecho = orig;
|
||||
noecho.c_lflag &= ~ECHO;
|
||||
if(ioctl(outfd, TCSETA, &noecho) != 0)
|
||||
{
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
ioctl(outfd, TCSETA, &noecho);
|
||||
# else
|
||||
# endif
|
||||
#endif
|
||||
@@ -187,16 +172,10 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
* user types more than buflen
|
||||
*/
|
||||
#ifdef HAVE_TERMIOS_H
|
||||
if(tcsetattr(outfd, TCSAFLUSH, &orig) != 0)
|
||||
{
|
||||
; /*perror("tcgetattr");*/
|
||||
}
|
||||
tcsetattr(outfd, TCSAFLUSH, &orig);
|
||||
#else
|
||||
# ifdef HAVE_TERMIO_H
|
||||
if(ioctl(outfd, TCSETA, &orig) != 0)
|
||||
{
|
||||
; /*perror("ioctl");*/
|
||||
}
|
||||
ioctl(outfd, TCSETA, &orig);
|
||||
# else
|
||||
# endif
|
||||
#endif
|
||||
@@ -206,6 +185,9 @@ char *getpass_r(const char *prompt, char *buffer, size_t buflen)
|
||||
signal(SIGTSTP, sigtstp);
|
||||
#endif
|
||||
|
||||
if(infp_fclose)
|
||||
fclose(infp);
|
||||
|
||||
return buffer; /* we always return success */
|
||||
}
|
||||
#endif /* VMS */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __GETPASS_H
|
||||
#define __GETPASS_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#ifndef HAVE_GETPASS_R
|
||||
/* If there's a system-provided function named like this, we trust it is
|
||||
also found in one of the standard headers. */
|
||||
|
72
lib/hash.c
72
lib/hash.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -72,7 +72,7 @@ _hash_element_dtor (void *user, void *element)
|
||||
/* {{{ void curl_hash_init (curl_hash *, int, curl_hash_dtor)
|
||||
*/
|
||||
void
|
||||
curl_hash_init (curl_hash *h, int slots, curl_hash_dtor dtor)
|
||||
Curl_hash_init (curl_hash *h, int slots, curl_hash_dtor dtor)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -82,7 +82,7 @@ curl_hash_init (curl_hash *h, int slots, curl_hash_dtor dtor)
|
||||
|
||||
h->table = (curl_llist **) malloc(slots * sizeof(curl_llist *));
|
||||
for (i = 0; i < slots; ++i) {
|
||||
h->table[i] = curl_llist_alloc((curl_llist_dtor) _hash_element_dtor);
|
||||
h->table[i] = Curl_llist_alloc((curl_llist_dtor) _hash_element_dtor);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
@@ -90,7 +90,7 @@ curl_hash_init (curl_hash *h, int slots, curl_hash_dtor dtor)
|
||||
/* {{{ curl_hash *curl_hash_alloc (int, curl_hash_dtor)
|
||||
*/
|
||||
curl_hash *
|
||||
curl_hash_alloc (int slots, curl_hash_dtor dtor)
|
||||
Curl_hash_alloc (int slots, curl_hash_dtor dtor)
|
||||
{
|
||||
curl_hash *h;
|
||||
|
||||
@@ -98,7 +98,7 @@ curl_hash_alloc (int slots, curl_hash_dtor dtor)
|
||||
if (NULL == h)
|
||||
return NULL;
|
||||
|
||||
curl_hash_init(h, slots, dtor);
|
||||
Curl_hash_init(h, slots, dtor);
|
||||
|
||||
return h;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ _mk_hash_element (curl_hash_element **e, char *key, size_t key_len, const void *
|
||||
/* {{{ int curl_hash_add (curl_hash *, char *, size_t, const void *)
|
||||
*/
|
||||
int
|
||||
curl_hash_add (curl_hash *h, char *key, size_t key_len, const void *p)
|
||||
Curl_hash_add (curl_hash *h, char *key, size_t key_len, const void *p)
|
||||
{
|
||||
curl_hash_element *he;
|
||||
curl_llist_element *le;
|
||||
@@ -162,7 +162,7 @@ curl_hash_add (curl_hash *h, char *key, size_t key_len, const void *p)
|
||||
if (_mk_hash_element(&he, key, key_len, p) != 0)
|
||||
return 0;
|
||||
|
||||
if (curl_llist_insert_next(l, CURL_LLIST_TAIL(l), he)) {
|
||||
if (Curl_llist_insert_next(l, CURL_LLIST_TAIL(l), he)) {
|
||||
++h->size;
|
||||
return 1;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ curl_hash_add (curl_hash *h, char *key, size_t key_len, const void *p)
|
||||
/* {{{ int curl_hash_delete (curl_hash *, char *, size_t)
|
||||
*/
|
||||
int
|
||||
curl_hash_delete(curl_hash *h, char *key, size_t key_len)
|
||||
Curl_hash_delete(curl_hash *h, char *key, size_t key_len)
|
||||
{
|
||||
curl_hash_element *he;
|
||||
curl_llist_element *le;
|
||||
@@ -185,7 +185,7 @@ curl_hash_delete(curl_hash *h, char *key, size_t key_len)
|
||||
le = CURL_LLIST_NEXT(le)) {
|
||||
he = CURL_LLIST_VALP(le);
|
||||
if (_hash_key_compare(he->key, he->key_len, key, key_len)) {
|
||||
curl_llist_remove(l, le, (void *) h);
|
||||
Curl_llist_remove(l, le, (void *) h);
|
||||
--h->size;
|
||||
return 1;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ curl_hash_delete(curl_hash *h, char *key, size_t key_len)
|
||||
/* {{{ int curl_hash_find (curl_hash *, char *, size_t, void **)
|
||||
*/
|
||||
int
|
||||
curl_hash_find(curl_hash *h, char *key, size_t key_len, void **p)
|
||||
Curl_hash_find(curl_hash *h, char *key, size_t key_len, void **p)
|
||||
{
|
||||
curl_llist_element *le;
|
||||
curl_hash_element *he;
|
||||
@@ -221,13 +221,16 @@ curl_hash_find(curl_hash *h, char *key, size_t key_len, void **p)
|
||||
/* {{{ void curl_hash_apply (curl_hash *, void *, void (*)(void *, curl_hash_element *))
|
||||
*/
|
||||
void
|
||||
curl_hash_apply(curl_hash *h, void *user, void (*cb)(void *, curl_hash_element *))
|
||||
Curl_hash_apply(curl_hash *h, void *user,
|
||||
void (*cb)(void *, curl_hash_element *))
|
||||
{
|
||||
curl_llist_element *le;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < h->slots; ++i) {
|
||||
for (le = CURL_LLIST_HEAD(h->table[i]); le != NULL; le = CURL_LLIST_NEXT(le)) {
|
||||
for (le = CURL_LLIST_HEAD(h->table[i]);
|
||||
le != NULL;
|
||||
le = CURL_LLIST_NEXT(le)) {
|
||||
cb(user, (curl_hash_element *) CURL_LLIST_VALP(le));
|
||||
}
|
||||
}
|
||||
@@ -237,22 +240,47 @@ curl_hash_apply(curl_hash *h, void *user, void (*cb)(void *, curl_hash_element *
|
||||
/* {{{ void curl_hash_clean (curl_hash *)
|
||||
*/
|
||||
void
|
||||
curl_hash_clean(curl_hash *h)
|
||||
Curl_hash_clean(curl_hash *h)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < h->slots; ++i) {
|
||||
curl_llist_destroy(h->table[i], (void *) h);
|
||||
Curl_llist_destroy(h->table[i], (void *) h);
|
||||
}
|
||||
|
||||
free(h->table);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ void curl_hash_clean_with_criterium (curl_hash *, void *,
|
||||
int (*)(void *, void *))
|
||||
*/
|
||||
void
|
||||
Curl_hash_clean_with_criterium(curl_hash *h, void *user,
|
||||
int (*comp)(void *, void *))
|
||||
{
|
||||
curl_llist_element *le;
|
||||
curl_llist_element *lnext;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < h->slots; ++i) {
|
||||
le = CURL_LLIST_HEAD(h->table[i]);
|
||||
while(le != NULL)
|
||||
if (comp(user, ((curl_hash_element *) CURL_LLIST_VALP(le))->ptr)) {
|
||||
lnext = CURL_LLIST_NEXT(le);
|
||||
Curl_llist_remove(h->table[i], le, (void *) h);
|
||||
--h->size;
|
||||
le = lnext;
|
||||
}
|
||||
else
|
||||
le = CURL_LLIST_NEXT(le);
|
||||
}
|
||||
}
|
||||
|
||||
/* {{{ int curl_hash_count (curl_hash *)
|
||||
*/
|
||||
int
|
||||
curl_hash_count(curl_hash *h)
|
||||
Curl_hash_count(curl_hash *h)
|
||||
{
|
||||
return h->size;
|
||||
}
|
||||
@@ -261,12 +289,12 @@ curl_hash_count(curl_hash *h)
|
||||
/* {{{ void curl_hash_destroy (curl_hash *)
|
||||
*/
|
||||
void
|
||||
curl_hash_destroy(curl_hash *h)
|
||||
Curl_hash_destroy(curl_hash *h)
|
||||
{
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
curl_hash_clean(h);
|
||||
Curl_hash_clean(h);
|
||||
free(h);
|
||||
}
|
||||
/* }}} */
|
||||
|
34
lib/hash.h
34
lib/hash.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __HASH_H
|
||||
#define __HASH_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -45,18 +45,18 @@ typedef struct _curl_hash_element {
|
||||
} curl_hash_element;
|
||||
|
||||
|
||||
void curl_hash_init(curl_hash *, int, curl_hash_dtor);
|
||||
curl_hash *curl_hash_alloc(int, curl_hash_dtor);
|
||||
int curl_hash_add(curl_hash *, char *, size_t, const void *);
|
||||
int curl_hash_delete(curl_hash *h, char *key, size_t key_len);
|
||||
int curl_hash_find(curl_hash *, char *, size_t, void **p);
|
||||
void curl_hash_apply(curl_hash *h, void *user, void (*cb)(void *, curl_hash_element *));
|
||||
int curl_hash_count(curl_hash *h);
|
||||
void curl_hash_clean(curl_hash *h);
|
||||
void curl_hash_destroy(curl_hash *h);
|
||||
|
||||
#define curl_hash_update curl_hash_add
|
||||
void Curl_hash_init(curl_hash *, int, curl_hash_dtor);
|
||||
curl_hash *Curl_hash_alloc(int, curl_hash_dtor);
|
||||
int Curl_hash_add(curl_hash *, char *, size_t, const void *);
|
||||
int Curl_hash_delete(curl_hash *h, char *key, size_t key_len);
|
||||
int Curl_hash_find(curl_hash *, char *, size_t, void **p);
|
||||
void Curl_hash_apply(curl_hash *h, void *user, void (*cb)(void *, curl_hash_element *));
|
||||
int Curl_hash_count(curl_hash *h);
|
||||
void Curl_hash_clean(curl_hash *h);
|
||||
void Curl_hash_clean_with_criterium(curl_hash *h, void *user, int (*comp)(void *, void *));
|
||||
void Curl_hash_destroy(curl_hash *h);
|
||||
|
||||
#define Curl_hash_update Curl_hash_add
|
||||
|
||||
#endif
|
||||
|
||||
|
251
lib/hostip.c
251
lib/hostip.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SETJMP_H
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
#include "urldata.h"
|
||||
#include "sendf.h"
|
||||
#include "hostip.h"
|
||||
@@ -79,7 +83,7 @@ static int host_cache_initialized;
|
||||
void Curl_global_host_cache_init(void)
|
||||
{
|
||||
if (!host_cache_initialized) {
|
||||
curl_hash_init(&hostname_cache, 7, Curl_freeaddrinfo);
|
||||
Curl_hash_init(&hostname_cache, 7, Curl_freeaddrinfo);
|
||||
host_cache_initialized = 1;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +96,7 @@ curl_hash *Curl_global_host_cache_get(void)
|
||||
void Curl_global_host_cache_dtor(void)
|
||||
{
|
||||
if (host_cache_initialized) {
|
||||
curl_hash_clean(&hostname_cache);
|
||||
Curl_hash_clean(&hostname_cache);
|
||||
host_cache_initialized = 0;
|
||||
}
|
||||
}
|
||||
@@ -152,6 +156,38 @@ _create_hostcache_id(char *server, int port, ssize_t *entry_len)
|
||||
return id;
|
||||
}
|
||||
|
||||
struct hostcache_prune_data {
|
||||
int cache_timeout;
|
||||
int now;
|
||||
};
|
||||
|
||||
static int
|
||||
_curl_hostcache_timestamp_remove(void *datap, void *hc)
|
||||
{
|
||||
struct hostcache_prune_data *data =
|
||||
(struct hostcache_prune_data *) datap;
|
||||
struct curl_dns_cache_entry *c = (struct curl_dns_cache_entry *) hc;
|
||||
|
||||
if (data->now - c->timestamp < data->cache_timeout) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
hostcache_prune(curl_hash *hostcache, int cache_timeout, int now)
|
||||
{
|
||||
struct hostcache_prune_data user;
|
||||
|
||||
user.cache_timeout = cache_timeout;
|
||||
user.now = now;
|
||||
|
||||
Curl_hash_clean_with_criterium(hostcache,
|
||||
(void *) &user,
|
||||
_curl_hostcache_timestamp_remove);
|
||||
}
|
||||
|
||||
/* Macro to save redundant free'ing of entry_id */
|
||||
#define _hostcache_return(__v) \
|
||||
{ \
|
||||
@@ -159,53 +195,65 @@ _create_hostcache_id(char *server, int port, ssize_t *entry_len)
|
||||
return (__v); \
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGSETJMP
|
||||
/* Beware this is a global and unique instance */
|
||||
sigjmp_buf curl_jmpenv;
|
||||
#endif
|
||||
|
||||
Curl_addrinfo *Curl_resolv(struct SessionHandle *data,
|
||||
char *hostname,
|
||||
int port,
|
||||
char **bufp)
|
||||
int port)
|
||||
{
|
||||
char *entry_id = NULL;
|
||||
struct curl_dns_cache_entry *p = NULL;
|
||||
ssize_t entry_len;
|
||||
time_t now;
|
||||
char *bufp;
|
||||
|
||||
#ifdef HAVE_SIGSETJMP
|
||||
if(sigsetjmp(curl_jmpenv, 1) != 0) {
|
||||
/* this is coming from a siglongjmp() */
|
||||
failf(data, "name lookup time-outed");
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the host cache timeout is 0, we don't do DNS cach'ing
|
||||
so fall through */
|
||||
if (data->set.dns_cache_timeout == 0) {
|
||||
return Curl_getaddrinfo(data, hostname, port, bufp);
|
||||
return Curl_getaddrinfo(data, hostname, port, &bufp);
|
||||
}
|
||||
|
||||
time(&now);
|
||||
|
||||
/* Remove outdated entries from the hostcache */
|
||||
hostcache_prune(data->hostcache,
|
||||
data->set.dns_cache_timeout,
|
||||
now);
|
||||
|
||||
/* Create an entry id, based upon the hostname and port */
|
||||
entry_len = strlen(hostname);
|
||||
entry_id = _create_hostcache_id(hostname, port, &entry_len);
|
||||
/* If we can't create the entry id, don't cache, just fall-through
|
||||
to the plain Curl_getaddrinfo() */
|
||||
if (!entry_id) {
|
||||
return Curl_getaddrinfo(data, hostname, port, bufp);
|
||||
return Curl_getaddrinfo(data, hostname, port, &bufp);
|
||||
}
|
||||
|
||||
time(&now);
|
||||
/* See if its already in our dns cache */
|
||||
if (entry_id && curl_hash_find(data->hostcache, entry_id, entry_len+1, (void **) &p)) {
|
||||
/* Do we need to check for a cache timeout? */
|
||||
if (data->set.dns_cache_timeout != -1) {
|
||||
/* Return if the entry has not timed out */
|
||||
if ((now - p->timestamp) < data->set.dns_cache_timeout) {
|
||||
if (entry_id &&
|
||||
Curl_hash_find(data->hostcache, entry_id, entry_len+1, (void **) &p)) {
|
||||
_hostcache_return(p->addr);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_hostcache_return(p->addr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new cache entry */
|
||||
p = (struct curl_dns_cache_entry *) malloc(sizeof(struct curl_dns_cache_entry));
|
||||
p = (struct curl_dns_cache_entry *)
|
||||
malloc(sizeof(struct curl_dns_cache_entry));
|
||||
if (!p) {
|
||||
_hostcache_return(NULL);
|
||||
}
|
||||
|
||||
p->addr = Curl_getaddrinfo(data, hostname, port, bufp);
|
||||
p->addr = Curl_getaddrinfo(data, hostname, port, &bufp);
|
||||
if (!p->addr) {
|
||||
free(p);
|
||||
_hostcache_return(NULL);
|
||||
@@ -213,7 +261,7 @@ Curl_addrinfo *Curl_resolv(struct SessionHandle *data,
|
||||
p->timestamp = now;
|
||||
|
||||
/* Save it in our host cache */
|
||||
curl_hash_update(data->hostcache, entry_id, entry_len+1, (const void *) p);
|
||||
Curl_hash_update(data->hostcache, entry_id, entry_len+1, (const void *) p);
|
||||
|
||||
_hostcache_return(p->addr);
|
||||
}
|
||||
@@ -304,7 +352,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
/* This seems to be an IPv6-capable stack, use PF_UNSPEC for the widest
|
||||
* possible checks. And close the socket again.
|
||||
*/
|
||||
close(s);
|
||||
sclose(s);
|
||||
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = pf;
|
||||
@@ -313,7 +361,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
snprintf(sbuf, sizeof(sbuf), "%d", port);
|
||||
error = getaddrinfo(hostname, sbuf, &hints, &res);
|
||||
if (error) {
|
||||
infof(data, "getaddrinfo(3) failed for %s\n", hostname);
|
||||
infof(data, "getaddrinfo(3) failed for %s:%d\n", hostname, port);
|
||||
return NULL;
|
||||
}
|
||||
*bufp=(char *)res; /* make it point to the result struct */
|
||||
@@ -323,22 +371,24 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
#else /* following code is IPv4-only */
|
||||
|
||||
#ifndef HAVE_GETHOSTBYNAME_R
|
||||
static void hostcache_fixoffset(struct hostent *h, int offset);
|
||||
/**
|
||||
* Performs a "deep" copy of a hostent into a buffer (returns a pointer to the
|
||||
* copy). Make absolutely sure the destination buffer is big enough!
|
||||
*
|
||||
* Keith McGuigan
|
||||
* 10/3/2001 */
|
||||
static struct hostent* pack_hostent(char* buf, struct hostent* orig)
|
||||
static struct hostent* pack_hostent(char** buf, struct hostent* orig)
|
||||
{
|
||||
char *bufptr;
|
||||
char *newbuf;
|
||||
struct hostent* copy;
|
||||
|
||||
int i;
|
||||
char *str;
|
||||
int len;
|
||||
|
||||
bufptr = buf;
|
||||
bufptr = *buf;
|
||||
copy = (struct hostent*)bufptr;
|
||||
|
||||
bufptr += sizeof(struct hostent);
|
||||
@@ -348,10 +398,12 @@ static struct hostent* pack_hostent(char* buf, struct hostent* orig)
|
||||
bufptr += len;
|
||||
|
||||
/* we align on even 64bit boundaries for safety */
|
||||
#define MEMALIGN(x) (((unsigned long)(x)&0xfffffff8)+8)
|
||||
#define MEMALIGN(x) ((x)+(8-(((unsigned long)(x))&0x7)))
|
||||
|
||||
/* This must be aligned properly to work on many CPU architectures! */
|
||||
copy->h_aliases = (char**)MEMALIGN(bufptr);
|
||||
bufptr = MEMALIGN(bufptr);
|
||||
|
||||
copy->h_aliases = (char**)bufptr;
|
||||
|
||||
/* Figure out how many aliases there are */
|
||||
for (i = 0; orig->h_aliases[i] != NULL; ++i);
|
||||
@@ -373,7 +425,7 @@ static struct hostent* pack_hostent(char* buf, struct hostent* orig)
|
||||
copy->h_length = orig->h_length;
|
||||
|
||||
/* align it for (at least) 32bit accesses */
|
||||
bufptr = (char *)MEMALIGN(bufptr);
|
||||
bufptr = MEMALIGN(bufptr);
|
||||
|
||||
copy->h_addr_list = (char**)bufptr;
|
||||
|
||||
@@ -394,6 +446,18 @@ static struct hostent* pack_hostent(char* buf, struct hostent* orig)
|
||||
}
|
||||
copy->h_addr_list[i] = NULL;
|
||||
|
||||
/* now, shrink the allocated buffer to the size we actually need, which
|
||||
most often is only a fraction of the original alloc */
|
||||
newbuf=(char *)realloc(*buf, (int)bufptr-(int)(*buf));
|
||||
|
||||
/* if the alloc moved, we need to adjust things again */
|
||||
if(newbuf != *buf)
|
||||
hostcache_fixoffset((struct hostent*)newbuf, (int)newbuf-(int)*buf);
|
||||
|
||||
/* setup the return */
|
||||
*buf = newbuf;
|
||||
copy = (struct hostent*)newbuf;
|
||||
|
||||
return copy;
|
||||
}
|
||||
#endif
|
||||
@@ -419,14 +483,30 @@ static char *MakeIP(unsigned long num,char *addr, int addr_len)
|
||||
return (addr);
|
||||
}
|
||||
|
||||
/* The original code to this function was once stolen from the Dancer source
|
||||
code, written by Bjorn Reese, it has since been patched and modified
|
||||
considerably. */
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE (in_addr_t) ~0
|
||||
#endif
|
||||
|
||||
static void hostcache_fixoffset(struct hostent *h, int offset)
|
||||
{
|
||||
int i=0;
|
||||
h->h_name=(char *)((long)h->h_name+offset);
|
||||
h->h_aliases=(char **)((long)h->h_aliases+offset);
|
||||
while(h->h_aliases[i]) {
|
||||
h->h_aliases[i]=(char *)((long)h->h_aliases[i]+offset);
|
||||
i++;
|
||||
}
|
||||
h->h_addr_list=(char **)((long)h->h_addr_list+offset);
|
||||
i=0;
|
||||
while(h->h_addr_list[i]) {
|
||||
h->h_addr_list[i]=(char *)((long)h->h_addr_list[i]+offset);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
/* The original code to this function was once stolen from the Dancer source
|
||||
code, written by Bjorn Reese, it has since been patched and modified
|
||||
considerably. */
|
||||
Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
char *hostname,
|
||||
int port,
|
||||
@@ -441,51 +521,105 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
* everything. OSF1 is known to require at least 8872 bytes. The buffer
|
||||
* required for storing all possible aliases and IP numbers is according to
|
||||
* Stevens' Unix Network Programming 2nd editor, p. 304: 8192 bytes! */
|
||||
int *buf = (int *)malloc(CURL_NAMELOOKUP_SIZE);
|
||||
if(!buf)
|
||||
return NULL; /* major failure */
|
||||
*bufp = (char *)buf;
|
||||
|
||||
port=0; /* unused in IPv4 code */
|
||||
ret = 0; /* to prevent the compiler warning */
|
||||
|
||||
if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
|
||||
struct in_addr *addrentry;
|
||||
struct namebuf {
|
||||
struct hostent hostentry;
|
||||
char *h_addr_list[2];
|
||||
struct in_addr addrentry;
|
||||
char h_name[128];
|
||||
} *buf = (struct namebuf *)malloc(sizeof(struct namebuf));
|
||||
if(!buf)
|
||||
return NULL; /* major failure */
|
||||
*bufp = (char *)buf;
|
||||
|
||||
h = (struct hostent*)buf;
|
||||
h->h_addr_list = (char**)(buf + sizeof(*h));
|
||||
addrentry = (struct in_addr*)(h->h_addr_list + 2);
|
||||
h = &buf->hostentry;
|
||||
h->h_addr_list = &buf->h_addr_list[0];
|
||||
addrentry = &buf->addrentry;
|
||||
addrentry->s_addr = in;
|
||||
h->h_addr_list[0] = (char*)addrentry;
|
||||
h->h_addr_list[1] = NULL;
|
||||
h->h_addrtype = AF_INET;
|
||||
h->h_length = sizeof(*addrentry);
|
||||
h->h_name = *(h->h_addr_list) + h->h_length;
|
||||
/* bad one h->h_name = (char*)(h->h_addr_list + h->h_length); */
|
||||
MakeIP(ntohl(in),h->h_name, CURL_NAMELOOKUP_SIZE - (long)(h->h_name) + (long)buf);
|
||||
h->h_name = &buf->h_name[0];
|
||||
MakeIP(ntohl(in), h->h_name, sizeof(buf->h_name));
|
||||
}
|
||||
#if defined(HAVE_GETHOSTBYNAME_R)
|
||||
else {
|
||||
int h_errnop;
|
||||
int res=ERANGE;
|
||||
int step_size=200;
|
||||
int *buf = (int *)malloc(CURL_NAMELOOKUP_SIZE);
|
||||
if(!buf)
|
||||
return NULL; /* major failure */
|
||||
*bufp=(char *)buf;
|
||||
|
||||
/* Workaround for gethostbyname_r bug in qnx nto. It is also _required_
|
||||
for some of these functions. */
|
||||
memset(buf, 0, CURL_NAMELOOKUP_SIZE);
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_5
|
||||
/* Solaris, IRIX and more */
|
||||
if ((h = gethostbyname_r(hostname,
|
||||
(void)res; /* prevent compiler warning */
|
||||
while(!h) {
|
||||
h = gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
CURL_NAMELOOKUP_SIZE - sizeof(struct hostent),
|
||||
&h_errnop)) == NULL )
|
||||
step_size - sizeof(struct hostent),
|
||||
&h_errnop);
|
||||
|
||||
/* If the buffer is too small, it returns NULL and sets errno to
|
||||
ERANGE. The errno is thread safe if this is compiled with
|
||||
-D_REENTRANT as then the 'errno' variable is a macro defined to
|
||||
get used properly for threads. */
|
||||
|
||||
if(h || (errno != ERANGE))
|
||||
break;
|
||||
|
||||
step_size+=200;
|
||||
}
|
||||
|
||||
#ifdef MALLOCDEBUG
|
||||
infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
|
||||
#endif
|
||||
|
||||
if(h) {
|
||||
int offset;
|
||||
h=(struct hostent *)realloc(buf, step_size);
|
||||
offset=(long)h-(long)buf;
|
||||
hostcache_fixoffset(h, offset);
|
||||
buf=(int *)h;
|
||||
*bufp=(char *)buf;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
||||
/* Linux */
|
||||
if( gethostbyname_r(hostname,
|
||||
while((res=gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
CURL_NAMELOOKUP_SIZE - sizeof(struct hostent),
|
||||
step_size - sizeof(struct hostent),
|
||||
&h, /* DIFFERENCE */
|
||||
&h_errnop))
|
||||
&h_errnop))==ERANGE) {
|
||||
step_size+=200;
|
||||
}
|
||||
if(!h) /* failure */
|
||||
res=1;
|
||||
|
||||
#ifdef MALLOCDEBUG
|
||||
infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
|
||||
#endif
|
||||
if(!res) {
|
||||
int offset;
|
||||
h=(struct hostent *)realloc(buf, step_size);
|
||||
offset=(long)h-(long)buf;
|
||||
hostcache_fixoffset(h, offset);
|
||||
buf=(int *)h;
|
||||
*bufp=(char *)buf;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_3
|
||||
/* AIX, Digital Unix, HPUX 10, more? */
|
||||
@@ -499,7 +633,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
|
||||
ret = gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(struct hostent_data *)(buf + sizeof(struct hostent)));
|
||||
(struct hostent_data *)((char *)buf + sizeof(struct hostent)));
|
||||
else
|
||||
ret = -1; /* failure, too smallish buffer size */
|
||||
|
||||
@@ -518,14 +652,17 @@ Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
else {
|
||||
if ((h = gethostbyname(hostname)) == NULL ) {
|
||||
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
||||
free(buf);
|
||||
*bufp=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *buf=(char *)malloc(CURL_NAMELOOKUP_SIZE);
|
||||
/* we make a copy of the hostent right now, right here, as the
|
||||
static one we got a pointer to might get removed when we don't
|
||||
want/expect that */
|
||||
h = pack_hostent((char *)buf, h);
|
||||
h = pack_hostent(&buf, h);
|
||||
*bufp=(char *)buf;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return (h);
|
||||
|
15
lib/hostip.h
15
lib/hostip.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __HOSTIP_H
|
||||
#define __HOSTIP_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "hash.h"
|
||||
|
||||
@@ -37,8 +37,7 @@ curl_hash *Curl_global_host_cache_get(void);
|
||||
|
||||
Curl_addrinfo *Curl_resolv(struct SessionHandle *data,
|
||||
char *hostname,
|
||||
int port,
|
||||
char **bufp);
|
||||
int port);
|
||||
|
||||
/* Get name info */
|
||||
Curl_addrinfo *Curl_getaddrinfo(struct SessionHandle *data,
|
||||
|
73
lib/http.c
73
lib/http.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,22 +7,23 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
/* -- WIN32 approved -- */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -161,7 +162,7 @@ CURLcode add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in,
|
||||
free(in->buffer);
|
||||
free(in);
|
||||
|
||||
*bytes_written = amount;
|
||||
*bytes_written += amount;
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -419,7 +420,7 @@ CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
* has occured, can we start talking SSL
|
||||
*/
|
||||
|
||||
if(data->change.proxy &&
|
||||
if(data->change.proxy && (data->set.proxytype == CURLPROXY_HTTP) &&
|
||||
((conn->protocol & PROT_HTTPS) || data->set.tunnel_thru_httpproxy)) {
|
||||
|
||||
/* either HTTPS over proxy, OR explicitly asked for a tunnel */
|
||||
@@ -448,23 +449,21 @@ CURLcode Curl_http_connect(struct connectdata *conn)
|
||||
CURLcode Curl_http_done(struct connectdata *conn)
|
||||
{
|
||||
struct SessionHandle *data;
|
||||
long *bytecount = &conn->bytecount;
|
||||
struct HTTP *http;
|
||||
|
||||
data=conn->data;
|
||||
http=conn->proto.http;
|
||||
|
||||
if(HTTPREQ_POST_FORM == data->set.httpreq) {
|
||||
*bytecount = http->readbytecount + http->writebytecount;
|
||||
conn->bytecount = http->readbytecount + http->writebytecount;
|
||||
|
||||
Curl_formclean(http->sendit); /* Now free that whole lot */
|
||||
|
||||
data->set.fread = http->storefread; /* restore */
|
||||
data->set.in = http->in; /* restore */
|
||||
}
|
||||
else if(HTTPREQ_PUT == data->set.httpreq) {
|
||||
*bytecount = http->readbytecount + http->writebytecount;
|
||||
}
|
||||
else if(HTTPREQ_PUT == data->set.httpreq)
|
||||
conn->bytecount = http->readbytecount + http->writebytecount;
|
||||
|
||||
if(0 == (http->readbytecount + conn->headerbytecount)) {
|
||||
/* nothing was read from the HTTP server, this can't be right
|
||||
@@ -486,7 +485,6 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
struct Cookie *co=NULL; /* no cookies from start */
|
||||
char *ppath = conn->ppath; /* three previous function arguments */
|
||||
char *host = conn->name;
|
||||
long *bytecount = &conn->bytecount;
|
||||
|
||||
if(!conn->proto.http) {
|
||||
/* Only allocate this struct if we don't already have it! */
|
||||
@@ -551,7 +549,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
if(data->cookies) {
|
||||
co = Curl_cookie_getlist(data->cookies,
|
||||
host, ppath,
|
||||
conn->protocol&PROT_HTTPS?TRUE:FALSE);
|
||||
(conn->protocol&PROT_HTTPS?TRUE:FALSE));
|
||||
}
|
||||
if (data->change.proxy &&
|
||||
!data->set.tunnel_thru_httpproxy &&
|
||||
@@ -562,7 +560,13 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
if(HTTPREQ_POST_FORM == data->set.httpreq) {
|
||||
/* we must build the whole darned post sequence first, so that we have
|
||||
a size of the whole shebang before we start to send it */
|
||||
http->sendit = Curl_getFormData(data->set.httppost, &http->postsize);
|
||||
result = Curl_getFormData(&http->sendit, data->set.httppost,
|
||||
&http->postsize);
|
||||
if(CURLE_OK != result) {
|
||||
/* Curl_getFormData() doesn't use failf() */
|
||||
failf(data, "failed creating formpost data");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if(!checkheaders(data, "Host:")) {
|
||||
@@ -574,13 +578,22 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
if(conn->allocptr.host)
|
||||
free(conn->allocptr.host);
|
||||
|
||||
/* When building Host: headers, we must put the host name within
|
||||
[brackets] if the host name is a plain IPv6-address. RFC2732-style. */
|
||||
|
||||
if(((conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTPS)) ||
|
||||
(!(conn->protocol&PROT_HTTPS) && (conn->remote_port == PORT_HTTP)) )
|
||||
/* If (HTTPS on port 443) OR (non-HTTPS on port 80) then don't include
|
||||
the port number in the host string */
|
||||
conn->allocptr.host = aprintf("Host: %s\r\n", host);
|
||||
conn->allocptr.host = aprintf("Host: %s%s%s\r\n",
|
||||
conn->bits.ipv6_ip?"[":"",
|
||||
host,
|
||||
conn->bits.ipv6_ip?"]":"");
|
||||
else
|
||||
conn->allocptr.host = aprintf("Host: %s:%d\r\n", host,
|
||||
conn->allocptr.host = aprintf("Host: %s%s%s:%d\r\n",
|
||||
conn->bits.ipv6_ip?"[":"",
|
||||
host,
|
||||
conn->bits.ipv6_ip?"]":"",
|
||||
conn->remote_port);
|
||||
}
|
||||
|
||||
@@ -656,6 +669,9 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
*/
|
||||
if((data->set.httpreq == HTTPREQ_GET) &&
|
||||
!checkheaders(data, "Range:")) {
|
||||
/* if a line like this was already allocated, free the previous one */
|
||||
if(conn->allocptr.rangeline)
|
||||
free(conn->allocptr.rangeline);
|
||||
conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", conn->range);
|
||||
}
|
||||
else if((data->set.httpreq != HTTPREQ_GET) &&
|
||||
@@ -700,6 +716,7 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
"%s" /* host */
|
||||
"%s" /* pragma */
|
||||
"%s" /* accept */
|
||||
"%s" /* accept-encoding */
|
||||
"%s", /* referer */
|
||||
|
||||
data->set.customrequest?data->set.customrequest:
|
||||
@@ -720,6 +737,8 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
(conn->allocptr.host?conn->allocptr.host:""), /* Host: host */
|
||||
http->p_pragma?http->p_pragma:"",
|
||||
http->p_accept?http->p_accept:"",
|
||||
(data->set.encoding && *data->set.encoding && conn->allocptr.accept_encoding)?
|
||||
conn->allocptr.accept_encoding:"", /* 08/28/02 jhrg */
|
||||
(data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: <data> <CRLF> */
|
||||
);
|
||||
|
||||
@@ -775,16 +794,16 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
strcpy(buf, "no strftime() support");
|
||||
#endif
|
||||
switch(data->set.timecondition) {
|
||||
case TIMECOND_IFMODSINCE:
|
||||
case CURL_TIMECOND_IFMODSINCE:
|
||||
default:
|
||||
add_bufferf(req_buffer,
|
||||
"If-Modified-Since: %s\r\n", buf);
|
||||
break;
|
||||
case TIMECOND_IFUNMODSINCE:
|
||||
case CURL_TIMECOND_IFUNMODSINCE:
|
||||
add_bufferf(req_buffer,
|
||||
"If-Unmodified-Since: %s\r\n", buf);
|
||||
break;
|
||||
case TIMECOND_LASTMOD:
|
||||
case CURL_TIMECOND_LASTMOD:
|
||||
add_bufferf(req_buffer,
|
||||
"Last-Modified: %s\r\n", buf);
|
||||
break;
|
||||
@@ -918,8 +937,9 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
actually set your own */
|
||||
add_bufferf(req_buffer,
|
||||
"Content-Length: %d\r\n",
|
||||
(data->set.postfieldsize?data->set.postfieldsize:
|
||||
strlen(data->set.postfields)) );
|
||||
data->set.postfieldsize?
|
||||
data->set.postfieldsize:
|
||||
(data->set.postfields?strlen(data->set.postfields):0) );
|
||||
|
||||
if(!checkheaders(data, "Content-Type:"))
|
||||
add_bufferf(req_buffer,
|
||||
@@ -945,7 +965,8 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
failf(data, "Failed sending HTTP POST request");
|
||||
else
|
||||
result =
|
||||
Curl_Transfer(conn, conn->firstsocket, -1, TRUE, bytecount,
|
||||
Curl_Transfer(conn, conn->firstsocket, -1, TRUE,
|
||||
&http->readbytecount,
|
||||
data->set.postfields?-1:conn->firstsocket,
|
||||
data->set.postfields?NULL:&http->writebytecount);
|
||||
break;
|
||||
@@ -961,7 +982,8 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
failf(data, "Failed sending HTTP request");
|
||||
else
|
||||
/* HTTP GET/HEAD download: */
|
||||
result = Curl_Transfer(conn, conn->firstsocket, -1, TRUE, bytecount,
|
||||
result = Curl_Transfer(conn, conn->firstsocket, -1, TRUE,
|
||||
&http->readbytecount,
|
||||
-1, NULL); /* nothing to upload */
|
||||
}
|
||||
if(result)
|
||||
@@ -980,3 +1002,4 @@ CURLcode Curl_http(struct connectdata *conn)
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
||||
#endif
|
||||
|
16
lib/http.h
16
lib/http.h
@@ -1,7 +1,7 @@
|
||||
#ifndef __HTTP_H
|
||||
#define __HTTP_H
|
||||
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -10,20 +10,20 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
|
||||
***************************************************************************/
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
/* ftp can use this as well */
|
||||
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
|
||||
int tunnelsocket,
|
||||
@@ -38,5 +38,5 @@ CURLcode Curl_http_connect(struct connectdata *conn);
|
||||
void Curl_httpchunk_init(struct connectdata *conn);
|
||||
CHUNKcode Curl_httpchunk_read(struct connectdata *conn, char *datap,
|
||||
ssize_t length, ssize_t *wrote);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,21 +7,22 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP
|
||||
/* -- WIN32 approved -- */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -32,6 +33,8 @@
|
||||
#include "urldata.h" /* it includes http_chunks.h */
|
||||
#include "sendf.h" /* for the client write stuff */
|
||||
|
||||
#include "content_encoding.h" /* 08/29/02 jhrg */
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
@@ -171,7 +174,32 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
||||
piece = (ch->datasize >= length)?length:ch->datasize;
|
||||
|
||||
/* Write the data portion available */
|
||||
result = Curl_client_write(conn->data, CLIENTWRITE_BODY, datap, piece);
|
||||
/* Added content-encoding here; untested but almost identical to the
|
||||
tested code in transfer.c. 08/29/02 jhrg */
|
||||
#ifdef HAVE_LIBZ
|
||||
switch (conn->keep.content_encoding) {
|
||||
case IDENTITY:
|
||||
#endif
|
||||
result = Curl_client_write(conn->data, CLIENTWRITE_BODY, datap,
|
||||
piece);
|
||||
#ifdef HAVE_LIBZ
|
||||
break;
|
||||
|
||||
case DEFLATE:
|
||||
result = Curl_unencode_deflate_write(conn->data, &conn->keep, piece);
|
||||
break;
|
||||
|
||||
case GZIP:
|
||||
case COMPRESS:
|
||||
default:
|
||||
failf (conn->data,
|
||||
"Unrecognized content encoding type. "
|
||||
"libcurl understands `identity' and `deflate' "
|
||||
"content encodings.");
|
||||
return CHUNKE_BAD_ENCODING;
|
||||
}
|
||||
#endif
|
||||
|
||||
if(result)
|
||||
return CHUNKE_WRITE_ERROR;
|
||||
*wrote += piece;
|
||||
@@ -228,3 +256,4 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
||||
* vim600: fdm=marker
|
||||
* vim: et sw=2 ts=2 sts=2 tw=78
|
||||
*/
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#ifndef __HTTP_CHUNKS_H
|
||||
#define __HTTP_CHUNKS_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
/*
|
||||
* The longest possible hexadecimal number we support in a chunked transfer.
|
||||
* Weird enough, RFC2616 doesn't set a maximum size! Since we use strtoul()
|
||||
@@ -73,6 +73,7 @@ typedef enum {
|
||||
CHUNKE_BAD_CHUNK,
|
||||
CHUNKE_WRITE_ERROR,
|
||||
CHUNKE_STATE_ERROR,
|
||||
CHUNKE_BAD_ENCODING,
|
||||
CHUNKE_LAST
|
||||
} CHUNKcode;
|
||||
|
||||
|
12
lib/if2ip.c
12
lib/if2ip.c
@@ -1,4 +1,4 @@
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -7,19 +7,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
|
12
lib/if2ip.h
12
lib/if2ip.h
@@ -1,6 +1,6 @@
|
||||
#ifndef __IF2IP_H
|
||||
#define __IF2IP_H
|
||||
/*****************************************************************************
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
@@ -9,19 +9,19 @@
|
||||
*
|
||||
* Copyright (C) 1998 - 2002, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* In order to be useful for every potential user, curl and libcurl are
|
||||
* dual-licensed under the MPL and the MIT/X-derivate licenses.
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
|
||||
* licenses. You may pick one of these licenses.
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* $Id$
|
||||
*****************************************************************************/
|
||||
***************************************************************************/
|
||||
#include "setup.h"
|
||||
|
||||
#if ! defined(WIN32) && ! defined(__BEOS__) && !defined(__CYGWIN32__)
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#ifndef CURL_DISABLE_FTP
|
||||
#ifdef KRB4
|
||||
|
||||
#include "security.h"
|
||||
@@ -197,7 +198,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
|
||||
int checksum;
|
||||
u_int32_t cs;
|
||||
struct krb4_data *d = app_data;
|
||||
char *host = conn->hostaddr->h_name;
|
||||
char *host = conn->hostname;
|
||||
ssize_t nread;
|
||||
int l = sizeof(conn->local_addr);
|
||||
struct SessionHandle *data = conn->data;
|
||||
@@ -362,7 +363,7 @@ void Curl_krb_kauth(struct connectdata *conn)
|
||||
if (strcmp ((char*)tktcopy.dat + 8,
|
||||
KRB_TICKET_GRANTING_TICKET) != 0) {
|
||||
afs_string_to_key (passwd,
|
||||
krb_realmofhost(conn->hostaddr->h_name),
|
||||
krb_realmofhost(conn->hostname),
|
||||
&key);
|
||||
des_key_sched (&key, schedule);
|
||||
des_pcbc_encrypt((des_cblock*)tkt.dat, (des_cblock*)tktcopy.dat,
|
||||
@@ -391,6 +392,7 @@ void Curl_krb_kauth(struct connectdata *conn)
|
||||
}
|
||||
|
||||
#endif /* KRB4 */
|
||||
#endif /* CURL_DISABLE_FTP */
|
||||
|
||||
/*
|
||||
* local variables:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user