Compare commits

..

163 Commits

Author SHA1 Message Date
Daniel Stenberg
948c3b3aa9 7.6.1 commit 2001-02-13 13:37:14 +00:00
Daniel Stenberg
a140e5311d moved the protocol-specific free to allow easier multiple transfers 2001-02-13 13:34:16 +00:00
Daniel Stenberg
7686ac3f2c ftp response fix, netrc fix for non-http/ftp, https put research 2001-02-12 13:20:04 +00:00
Daniel Stenberg
54778134e4 corrected the prototype 2001-02-12 13:19:09 +00:00
Daniel Stenberg
c59baa06f0 Added 3.10 and a few minor updates 2001-02-12 10:05:09 +00:00
Daniel Stenberg
c107303ade very minor indentation fix 2001-02-12 08:22:19 +00:00
Daniel Stenberg
21b05afc99 removed getenv.h from the package as it was unused 2001-02-12 08:21:45 +00:00
Daniel Stenberg
eebcf7d4f5 Not used anymore 2001-02-09 07:33:58 +00:00
Daniel Stenberg
8d169dfadd Added a failf() call in the error-check just added 2001-02-09 07:14:28 +00:00
Daniel Stenberg
b12e334d83 if netrc is parsed and our host was found in there, set data->bits.user_passwd
unconditioanlly!
2001-02-08 13:53:13 +00:00
Daniel Stenberg
7e36c4437e today's FTP response check fix 2001-02-08 13:52:38 +00:00
Daniel Stenberg
3c7a80a275 postit.c was added as a HTML form file upload example 2001-02-08 08:26:54 +00:00
Daniel Stenberg
61e2a8108b 7.6.1-pre3 2001-02-07 09:49:06 +00:00
Daniel Stenberg
abb14de7e0 GetLine() didn't properly act on -1 lengths returned from Curl_read() 2001-02-07 09:31:03 +00:00
Daniel Stenberg
ccd57e58f6 Added #define ssize_t int since ssize_t doesn't seem to exist in normal
win32 systems
2001-02-07 09:23:54 +00:00
Daniel Stenberg
58d70db92e no longer #includes "getenv.h" 2001-02-07 08:36:23 +00:00
Daniel Stenberg
09f6fc22ed silly me, corrected the strlcat() to compile 2001-02-06 09:12:39 +00:00
Daniel Stenberg
833ce37cb9 new openbsd inspired implementation of strlcat() 2001-02-06 09:08:24 +00:00
Daniel Stenberg
07e7018564 nntp@iname.com's suggested fix to set the libpath 2001-02-06 07:14:44 +00:00
Daniel Stenberg
db70cd28b3 adjusted the IPv6 stuff to compile and build on Linux as well 2001-02-05 23:35:44 +00:00
Daniel Stenberg
f6e2bfd464 Jun-ichiro itojun Hagino's IPv6 adjustments 2001-02-05 23:04:44 +00:00
Daniel Stenberg
1ae5dab8fb Robert Weaver's VC experiences 2001-02-05 22:35:55 +00:00
Daniel Stenberg
c6355e6a43 Added a telnet section 2001-02-05 22:35:21 +00:00
Daniel Stenberg
7d26eb61fe Added a few more configure option explanations 2001-02-05 10:24:12 +00:00
Daniel Stenberg
8613ce377f the new getinfo() stuff and the cygwin patch 2001-02-04 20:10:52 +00:00
Daniel Stenberg
d6b94488a1 Added blurb about the win32 thing that precents a DLL from using a pointer
passed to it from user-space!
2001-02-04 20:10:02 +00:00
Daniel Stenberg
5d7b32d09f extended 5.5 2001-02-04 20:08:42 +00:00
Daniel Stenberg
ed16d30ea8 CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD documented 2001-02-04 20:07:53 +00:00
Daniel Stenberg
6f7c70fbbc CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD were
added as suggested by Bob Schader
2001-02-04 20:03:30 +00:00
Daniel Stenberg
9ab5d30e3b Ingo Ralf Blum made it compile with the newest cygwin 2001-02-04 19:00:27 +00:00
Daniel Stenberg
3b44a3df76 7.6.1-pre2 2001-02-01 07:59:46 +00:00
Daniel Stenberg
572c29a4a3 Added support for --enable-debug 2001-02-01 07:58:49 +00:00
Daniel Stenberg
9464c5430d Curl_read() uses ssize_t now 2001-01-31 15:06:56 +00:00
Daniel Stenberg
a14aaaf23f fixed up the telnet to work (using support from Linus Nielsen) 2001-01-31 15:05:44 +00:00
Daniel Stenberg
c41c5a0ef2 curl_read() and Curl_read() now have ssize_t in the last argument 2001-01-31 13:54:12 +00:00
Daniel Stenberg
c0c0283356 Added a check for a working getaddrinfo() that is required for the IPv6
to be considered enabled
2001-01-31 13:53:31 +00:00
Daniel Stenberg
1bcd3e601a changed order of the range and follow-location checks so that a range-request
will work even when following a Location:
2001-01-30 11:52:59 +00:00
Daniel Stenberg
e721f85c83 new test case 2001-01-29 16:04:19 +00:00
Daniel Stenberg
7015c61b86 removed upload.NN files after each test 2001-01-29 15:07:28 +00:00
Daniel Stenberg
30ec0af109 test case 33, HTTP PUT resume 2001-01-29 14:36:49 +00:00
Daniel Stenberg
f585b66af7 7.6-pre1 2001-01-29 11:36:08 +00:00
Daniel Stenberg
1b77c18430 Added an extra text about % in POST data after comments from Daniel Marell 2001-01-29 10:24:51 +00:00
Daniel Stenberg
bd0bd35771 s/to I/do I/ 2001-01-29 10:16:47 +00:00
Daniel Stenberg
368e3526ea Added "3.9 How to I use curl in PHP?" 2001-01-29 10:16:21 +00:00
Daniel Stenberg
1bbe407a4d The PUT stuff is never set! It is set with the UPLOAD... 2001-01-29 07:26:50 +00:00
Daniel Stenberg
513bc44421 HTTP PUT resume now sends Content-Range: headers as I believe the RFC2616
describes, Bob Schader's research seems to agree.
2001-01-29 07:24:20 +00:00
Daniel Stenberg
4cc76d1576 upload sets HTTP request to PUT for "HTTP upload" 2001-01-29 07:23:11 +00:00
Daniel Stenberg
6dc5c6ffc7 the keep-alive issue 2001-01-27 20:51:31 +00:00
Daniel Stenberg
c69c79dd04 bettersupport for HTTP return codes 300-399 2001-01-27 20:31:51 +00:00
Daniel Stenberg
7fca24b14b PUT resume things
progress meter modified for resume
POST/GET/Location adjustments
2001-01-27 20:25:52 +00:00
Daniel Stenberg
2fa0d3dd5f test case 31 and 32 were added 2001-01-27 20:02:11 +00:00
Daniel Stenberg
3a8210c975 Resume is now done with a Content-Range header instead of a Range header if
the request isn't GET. Presumably, this is how it should be made.
2001-01-27 18:57:07 +00:00
Daniel Stenberg
d69302202d minor output fix 2001-01-27 18:51:10 +00:00
Daniel Stenberg
227662d2ed Added -d that enables easier protocol/server debug overview (it invokes
the servers with their -v options)
2001-01-27 18:50:54 +00:00
Daniel Stenberg
3cb3d43913 added test 29 and 30, HTTP resume and partial download tests 2001-01-27 18:49:48 +00:00
Daniel Stenberg
c8a546c941 The progess meter title get an extra output when a resumed transfer is
taking place
2001-01-27 18:23:59 +00:00
Daniel Stenberg
62fec1d28d data->httpreq was not set properly 2001-01-27 17:58:15 +00:00
Daniel Stenberg
ac98c73b04 7.6 2001-01-27 16:16:54 +00:00
Daniel Stenberg
a145654394 http upload resume 2001-01-26 15:53:33 +00:00
Daniel Stenberg
e8382ba290 moved the symbols talk to the library part, updated slightly to match 2001-01-26 15:52:51 +00:00
Daniel Stenberg
fcb347d124 Added a httpreq field in the main struct so that there's one field to check
for what HTTP request that is being used. The old bit-style fields are still
in there as well.
2001-01-26 15:52:01 +00:00
Daniel Stenberg
c331ef02f9 The check for that content-range is received must only be made if we requested
GET resume. Other resumes are upload-wise and don't care about this header
in the download stream
2001-01-26 15:50:56 +00:00
Daniel Stenberg
3a3f632bf0 Made it possible to do "upload resume" over HTTP 2001-01-26 15:49:39 +00:00
Daniel Stenberg
68d7b6f871 7.6-pre4 2001-01-25 13:48:28 +00:00
Daniel Stenberg
c43a9d9068 timespent is now updated in every call to the progress meter update function 2001-01-25 12:32:40 +00:00
Daniel Stenberg
64e80091db Rick's and Jeff's stuff 2001-01-25 12:31:44 +00:00
Daniel Stenberg
4f255ffbeb make the configure script die if select() or socket() is missing 2001-01-25 12:28:46 +00:00
Daniel Stenberg
80d75b0eaf Added Ingo Ralf Blum 2001-01-25 12:28:10 +00:00
Daniel Stenberg
808c4020e6 use this function only once note added 2001-01-25 12:27:44 +00:00
Daniel Stenberg
149d6363b3 modified the Curl_ConnectHTTPProxyTunnel proto 2001-01-25 12:24:34 +00:00
Daniel Stenberg
30eab8ca51 moved curl_read() and curl_write() to sendf.c 2001-01-25 12:23:57 +00:00
Daniel Stenberg
e49a82b06c converted to use Curl_read() and Curl_write() 2001-01-25 12:23:12 +00:00
Daniel Stenberg
45fdb48189 uses Curl_read() and Curl_write()
unfolded telwrite() instead of being a separate single function
2001-01-25 12:22:17 +00:00
Daniel Stenberg
3fcc9677c4 use recv()/send() instead of read()/write() with sockets 2001-01-25 12:21:10 +00:00
Daniel Stenberg
1552bd9c8c sendf is now only Curl_sendf
Curl_write() and Curl_read() are here
2001-01-25 12:20:30 +00:00
Daniel Stenberg
939c0c5521 removed two compiler warnings 2001-01-25 12:19:36 +00:00
Daniel Stenberg
f0b9aefd2e Curl_read() and Curl_write() are now used for reading/writing sockets.
Some functions changed prototype due to this change as well.
2001-01-25 12:19:02 +00:00
Daniel Stenberg
11f3c51e8f Get get-ftp-response function is now using Curl_read() for reading from a
socket. Curl_ConnectHTTPProxyTunnel changed prototype.
2001-01-25 12:17:07 +00:00
Daniel Stenberg
1a329b98a3 replaced sendf() calls with Curl_sendf() 2001-01-25 12:13:35 +00:00
Daniel Stenberg
29bcba9a90 Ingo Ralf Blum's cygwin fixes 2001-01-24 14:44:05 +00:00
Daniel Stenberg
1716dbb68a Robert Weaver's win32 getenv fix, my added comments in some files 2001-01-24 14:04:47 +00:00
Daniel Stenberg
16ecfcf62c Added Robert Weaver as contributor 2001-01-24 14:04:14 +00:00
Daniel Stenberg
8bafc3692d fixed the comment for 'path' 2001-01-24 14:03:48 +00:00
Daniel Stenberg
8a75120568 added comments all over 2001-01-24 12:32:34 +00:00
Daniel Stenberg
3d96ee7423 extended the gname field one byte to avoid a possible overflow
added lots of explaining comments
2001-01-24 12:10:10 +00:00
Daniel Stenberg
b3dbdfa306 Robert Weaver's fix 2001-01-24 09:01:32 +00:00
Daniel Stenberg
25bad589ba generated by autoheader 2001-01-23 13:00:43 +00:00
Daniel Stenberg
0b6cd75004 ipv6 adjustments 2001-01-23 10:29:16 +00:00
Daniel Stenberg
7872cc131a Enabled support for IPv6-style IP-addresses if ENABLE_IPV6 is set. If it isn't,
curl will return an error when such an address is used.
2001-01-23 10:21:30 +00:00
Daniel Stenberg
210aa4371c big reorg to make it not exit when it fails, but instead just not do any
globbing, it makes IPv6 support easier and smoother to add.
2001-01-23 10:14:43 +00:00
Daniel Stenberg
6f438bc8fb Added 'ipv6 enabled' for ipv6 compiled versions 2001-01-23 08:16:59 +00:00
Daniel Stenberg
65840f1fd1 Added simple IPv6 recognition support 2001-01-22 23:54:54 +00:00
Daniel Stenberg
5fc492e5c6 Bjrn's progress meter fix, new test cases and ftpserver.pl patch 2001-01-22 16:25:55 +00:00
Daniel Stenberg
abcd1e7d5a Bjrn Stenberg's patch for making the progress meter betterlooking 2001-01-22 16:21:05 +00:00
Daniel Stenberg
6429c378a2 the custom reply engine was not inited properly 2001-01-22 16:16:18 +00:00
Daniel Stenberg
d830f10417 test case 121 2001-01-22 16:05:12 +00:00
Daniel Stenberg
3d6fcbf97b Added test case 120, ftp with '-Q -' 2001-01-22 16:00:28 +00:00
Daniel Stenberg
609be218c2 Removed the deprecated -c and -t from the --help output. 2001-01-22 10:09:04 +00:00
Daniel Stenberg
41084e57ca Added 5.5 the CURLOPT_FILE problem on win32, DeYoung provided it! 2001-01-22 08:42:00 +00:00
Daniel Stenberg
9afab85105 Added -g/--globoff description 2001-01-19 12:24:46 +00:00
Daniel Stenberg
7822233964 Made the complaint on free-twice errors a lot better 2001-01-19 12:20:30 +00:00
Daniel Stenberg
022315089b removed URL length restrictions, added a test case 2001-01-19 12:20:02 +00:00
Daniel Stenberg
faa5c14aee No more URL length restrictions 2001-01-19 12:15:23 +00:00
Daniel Stenberg
3dd886955b removed MAX_URL_LENGTH, there is no longer any length restrictions on URLs
anywhere within libcurl
2001-01-19 12:14:55 +00:00
Daniel Stenberg
c2dbf21459 corrected url memory handling with --globoff 2001-01-19 12:14:09 +00:00
Daniel Stenberg
133eb220b9 Added files for test case 28 2001-01-19 12:13:37 +00:00
Daniel Stenberg
c5796d9e39 --globoff test case 2001-01-19 12:12:54 +00:00
Daniel Stenberg
d80f87554c version 7.6-pre3 2001-01-19 09:38:48 +00:00
Daniel Stenberg
c1d37470f6 spelling error FPL should be GPL 2001-01-19 09:38:29 +00:00
Daniel Stenberg
9c695393b2 edited the portable code section 2001-01-19 09:37:39 +00:00
Daniel Stenberg
444024ea14 brought up-to-date and extended 2001-01-17 14:17:49 +00:00
Daniel Stenberg
afcd933b4c Transfer and file renaming 2001-01-17 14:17:26 +00:00
Daniel Stenberg
ae0a6835bd Transfer is now Curl_Tranfer() and transfer.h is used instead of highlevel.h
and download.h
2001-01-17 13:23:01 +00:00
Daniel Stenberg
f2f11be8ba download.[ch] is renamed to transfer.[ch], highlevel.[ch] is history 2001-01-17 13:22:27 +00:00
Daniel Stenberg
e09eda9c7c download and highlevel are replaced with transfer 2001-01-17 13:19:01 +00:00
Daniel Stenberg
c6877a414e clarified that vcvars32.bat is not part of the curl package 2001-01-17 08:24:29 +00:00
Daniel Stenberg
a3eb91ffb1 shortened the "what is libcurl" text 2001-01-15 14:59:07 +00:00
Daniel Stenberg
12708473a6 Added a few more similar tools 2001-01-15 12:12:36 +00:00
Daniel Stenberg
9012f8cdb3 removed an old reference to previous license conditions 2001-01-15 10:28:41 +00:00
Daniel Stenberg
e26ee09586 4.2 and 4.3 were updated 2001-01-15 10:26:37 +00:00
Daniel Stenberg
7d09e51162 TELNET was missing in the basic initial description! Updated the language
in the thread-safe question 5.1 to be more clear.
2001-01-11 12:52:07 +00:00
Daniel Stenberg
18ebde6960 I successfully compiled on built curl for StrongARM NetBSD
Added other known platforms
Added the faked autoconf and autoheader trick posted about recently
2001-01-11 12:33:26 +00:00
Daniel Stenberg
b0c0e8d815 7.6-pre2 2001-01-11 09:29:30 +00:00
Daniel Stenberg
16502d7d15 -g added, no more space requirements between short options and their parameters 2001-01-11 08:02:07 +00:00
Daniel Stenberg
ce05deece8 Added -g, fixed so that short options worked again. My last "merged"fix did
screw a few things up.
2001-01-11 08:01:24 +00:00
Daniel Stenberg
b77e2528e7 made short options and their parmaters possible to specify without space
separation
2001-01-10 23:47:08 +00:00
Daniel Stenberg
27f8cf6dfc made "short options" possible to specify -m20 as well as -m 200. 2001-01-10 23:42:03 +00:00
Daniel Stenberg
f5aa7f64bd added missing newlines to two infof() functions about document dates 2001-01-10 22:46:26 +00:00
Daniel Stenberg
44254c4945 getpass_r() fix for SCO (hopefully) 2001-01-10 11:42:00 +00:00
Daniel Stenberg
a9ea507c6a version 7.6-pre1 2001-01-09 12:25:32 +00:00
Daniel Stenberg
b137d5ec23 bugfix for when more -o than URLs is used 2001-01-09 12:25:14 +00:00
Daniel Stenberg
4792eee5d0 multiple URL adjustments 2001-01-09 12:24:49 +00:00
Daniel Stenberg
a84625eca6 Added two tests for multiple URLs (26 + 27) 2001-01-09 12:24:08 +00:00
Daniel Stenberg
19d3fd1185 Loic's fix that removes the % from the instructions in the bottom 2001-01-09 10:09:39 +00:00
Daniel Stenberg
a9be9bc7f5 Additional "docs" about 'make rpms' added by Loic 2001-01-09 10:09:13 +00:00
Daniel Stenberg
e8b99d21e5 Added the curl source-header 2001-01-09 07:41:04 +00:00
Daniel Stenberg
f6c57990ee removed FILES from the RPM 2001-01-08 23:35:45 +00:00
Daniel Stenberg
370d7f7527 Added source header. Made the prototype not being set if HAVE_GETPASS_R is
set, as those systems are likely to have it already set in a system header
and this prototype has proven to cause problems on SCO systems.
2001-01-08 22:30:30 +00:00
Daniel Stenberg
7d38692c4f Added Loic Dachary as a contributor after his major makefile session! 2001-01-08 22:29:31 +00:00
Daniel Stenberg
a997d60304 Loic Dachary's updates to get 'make distcheck' work, including running the
test suite
2001-01-08 22:18:30 +00:00
Daniel Stenberg
ff8fb8cdb0 krb4.c header file, no source header (yet) 2001-01-08 22:02:23 +00:00
Daniel Stenberg
b915ca68f9 'make distcheck' works now 2001-01-08 17:38:23 +00:00
Daniel Stenberg
703fc264f0 Had to add this to get 'make distcheck' to run! 2001-01-08 17:28:53 +00:00
Daniel Stenberg
19d92834ed corrected 2001-01-08 16:32:36 +00:00
Daniel Stenberg
9ade752fa7 distcheck fixes 2001-01-08 16:31:29 +00:00
Daniel Stenberg
e8a5f3026f Added mprintf #include 2001-01-08 16:22:55 +00:00
Daniel Stenberg
2cac4a9c72 better cleanup when existing due to bad usage 2001-01-08 15:02:58 +00:00
Daniel Stenberg
39e939a507 corrected the separator when using URL globbing 2001-01-08 14:48:34 +00:00
Daniel Stenberg
803005892c mostly a dummy 2001-01-08 14:36:34 +00:00
Daniel Stenberg
08cfdf909e use .spec.in files instead of plain .spec files 2001-01-08 13:42:18 +00:00
Daniel Stenberg
434ce48016 removed multiple URL, we do that now! 2001-01-08 13:40:26 +00:00
Daniel Stenberg
10051e6916 generated file 2001-01-08 13:39:49 +00:00
Daniel Stenberg
d54cdf294b adjusted to work with automake 'make dist' 2001-01-08 13:39:21 +00:00
Daniel Stenberg
2e342d5d9b we're now using automake to build archives, this file is obsolete 2001-01-08 12:58:27 +00:00
Daniel Stenberg
fe84071e80 adjusted to use 'make dist' when building the package 2001-01-08 12:57:38 +00:00
Daniel Stenberg
044ca343ad Loic Dachary's makefile/dist/rpm fixes 2001-01-08 10:00:14 +00:00
Daniel Stenberg
f59ea9adb3 krb4 fix, big symbol renaming action, multiple URL support in the client 2001-01-08 07:45:43 +00:00
Daniel Stenberg
0cec4ba6bf generated 2001-01-08 07:42:35 +00:00
Daniel Stenberg
14ca732a8f Multiple URL support added 2001-01-08 07:37:44 +00:00
Daniel Stenberg
53c27c7722 generated file, don't CVS it 2001-01-08 07:37:13 +00:00
Daniel Stenberg
c2f5b71dc9 multiple uses of -d was wrong documented 2001-01-05 13:44:53 +00:00
Daniel Stenberg
6403257886 renamed Curl_ to curl_ for the printf() prefixes 2001-01-05 12:19:42 +00:00
Daniel Stenberg
4031104404 Internal symbols that aren't static are now prefixed with 'Curl_' 2001-01-05 10:11:41 +00:00
154 changed files with 3728 additions and 5005 deletions

237
CHANGES
View File

@@ -6,6 +6,243 @@
History of Changes
Version 7.6.1
Daniel (9 February 2001)
- Frank Reid and Cain Hopwood provided information and research around a HTTPS
PUT/upload problem we seem to have. No solution found yet.
Daniel (8 February 2001)
- An interesting discussion is how to specify an empty password without having
curl ask for it interactively? The current implmentation takes an empty
password as a request for a password prompt. However, I still want to
support a blank user field. Thus, today if you enter "-u :" (without user
and password) curl will prompt for the password. Tricky. How would you
specify you want the prompt otherwise?
- Made the netrc parse result possible to use for other protocols than FTP and
HTTP (such as the upcoming TELNET fixes).
- The previously mentioned "MSVC++ problems" turned out to be a non-issue.
- Added a HTTP file upload code example in the docs/examples/ section on
request.
- Adjusted the FTP response fix slightly.
Version 7.6.1-pre3
Daniel (7 February 2001)
- SM found a flaw in the response reading function for FTP that could make
libcurl not get out of the loop properly when it should, if libcurl got -1
returned when reading the socket.
- I found a similar mistake in http.c when using a proxy and reading the
results from the proxy connection.
Daniel (6 February 2001)
- A friendly person named "SM" (nntp at iname.com) pointed out that the VC
makefile in src/ needed the libpath set for the debug build to work.
- Daniel Gehriger stepped in to assist with the VC++ stuff Robert Weaver
brought up yesterday.
Daniel (5 February 2001)
- Jun-ichiro itojun Hagino brought a big patch that brings IPv6-awareness to
a bunch of different areas within libcurl.
- Robert Weaver told me about the problems the MS VC++ 6.0 compiler has with
the 'static' keyword on a number of libcurl functions. I might need to add a
patch that redefines static when libcurl is compiled with that compiler.
How do I know when VC++ compiles, anyone?
Daniel (4 February 2001)
- curl_getinfo() was extended with two new options:
CURLINFO_CONTENT_LENGTH_DOWNLOAD and CURLINFO_CONTENT_LENGTH_UPLOAD. They
return the full assumed content length of the transfer in the given
direction. The CURLINFO_CONTENT_LENGTH_DOWNLOAD will be the Content-Length:
size of a HTTP download. Added descriptions to the man page as well. This
was done after discussions with Bob Schader.
Daniel (3 February 2001)
- Ingo Ralf Blum provided another fix that makes curl build under the more
recent cygwin installations. It seems they've changed the preset defines to
not include WIN32 anymore.
Version 7.6.1-pre2
Daniel (31 January 2001)
- Curl_read() and curl_read() now return a ssize_t for the size, as it had to
be able to return -1. The telnet support crashed due to this and there was a
possibility to weird behaviour all over. Linus Nielsen Feltzing helped me
find this.
- Added a configure.in check for a working getaddrinfo() if IPv6 is requested.
I also made the configure script feature --enable-debug which sets a couple
of compiler options when used. It assumes gcc.
Daniel (30 January 2001)
- I finally took a stab at the long-term FIXME item I've had on myself, and
now libcurl will properly work when doing a HTTP range-request that follows
a Location:. Previously that would make libcurl fail saying that the server
doesn't seem to support range requests.
Daniel (29 January 2001)
- I added a test case for the HTTP PUT resume thing (test case 33).
Version 7.6.1-pre1
Daniel (29 January 2001)
- Yet another Content-Range change. Ok now? Bob Schader checks from his end
and it works for him.
Daniel (27 January 2001)
- So the HTTP PUT resume fix wasn't good. There should appearantly be a
Content-Range header when resuming a PUT.
- I noticed I broke the download-check that verifies that a resumed HTTP
download is actually resumed. It got broke because my new 'httpreq' field
in the main curl struct. I should get slapped. I added a test case for
this now, so I won't be able to ruin this again without noticing.
- Added a test case for content-length verifying when downloading HTTP.
- Made the progress meter title say if the transfer is being transfered. It
makes the output slightly better for resumes.
- When dealing with Location: and HTTP return codes, libcurl will not attempt
to follow the spirit of RFC2616 better. It means that when POSTing to a
URL that is being following to a second place, the standard will judge on
what to do. All HTTP codes except 303 and 305 will cause curl to make a
second POST operation. 303 will make a GET and 305 is not yet supported.
I also wrote two test cases for this POST/GET/Location stuff.
Version 7.6
Daniel (26 January 2001)
- Lots of mails back and forth with Bob Schader finally made me add a small
piece of code in the HTTP engine so that HTTP upload resume works. You can
now do an operation like 'curl -T file -C <offset> <URL>' and curl will PUT
the ending part of the file starting at given offet to the specified URL.
Version 7.6-pre4
Daniel (25 January 2001)
- I took hold of Rick Jones' question why we don't use recv() and send() for
reading/writing to the sockets and I've now modified the sread() and
swrite() macros to use them instead. If nothing else, they could be tested
in the next beta-round coming right up.
- Jeff Morrow found a problem with libcurl's usage of SSL_read() and supplied
his research results in how to fix this. It turns out we have to invoke the
function several times in some cases. The same goes for the SSL_write().
I made some rather drastic changes all over libcurl to make all writes and
reads get done on one single place so that this repeated-attempts thing
would only have to be implemented at one point.
- Rick Jones spotted that the 'total time' counter really didn't measure the
total time very accurate on subsecond levels.
- Johan Nilsson pointed out the need to more clearly specify that the timeout
value you set for a download is for the *entire* download. There's currently
no option available that sets a timeout for the connection phase only.
Daniel (24 January 2001)
- Ingo Ralf Blum submitted a series of patches required to get curl to compile
properly with cygwin.
- Robert Weaver posted a fix for the win32 section of the curl_getenv() code
that corrected a potential memory leak.
- Added comments in a few files in a sudden attempt to make the sources more
easy to read and understand!
Daniel (23 January 2001)
- Added simple IPv6 detection in the configure script and made the version
string add 'ipv6' to the enable section in that case. ENABLE_IPV6 will be
set if curl is compiled with IPv6 support enabled.
- Added a parser for IPv6-style specified IP-addresses in a URL. Thus, when
IPv6 gets enabled soon, we can use URLs like '[0::1]:80'...
- Made the URL globbing in the client possible to fail silently if there's an
error in the globbing. It makes it almost intuitive, so when you don't
follow the syntax rules, globbing is simply switched off and the raw string
is used instead.
I still think we'll get problems with IPv6-style IP-addresses when we *want*
globbing on parts of the URL as the initial part of the URL will for sure
seriously confuse the globber.
Daniel (22 January 2001)
- Bj<42>rn Stenberg supplied a progress meter patch that makes it look better even
during slow starts. Previously it made some silly assumptions...
- Added two FTP tests for -Q and -Q - stuff since it was being discussed on
the mailing list. Had to correct the ftpserver.pl too as it bugged slightly.
Daniel (19 January 2001)
- Made the Location: parsers deal with any-length URLs. Thus I removed the last
code that restricts the length of URLs that curl supports.
- Added a --globoff test case (#28) and it quickly identified a memory problem
in src/main.c that I took care of.
Version 7.6-pre3
Daniel (17 January 2001)
- Made the two former files lib/download.c and lib/highlevel.c become the new
lib/transfer.c which makes more sense. I also did the rename from Transfer()
to Curl_Transfer() in the other source files that use the transfer function
in the spirit of using Curl_ prefix for library-scoped global symbols.
Daniel (11 January 2001)
- Added -g/--globoff that switches OFF the URL globbing and thus enables {}[]
letters to be part of the URL. Do note that RFC2396 section 2.4.3 explicitly
mention these letters to be escaped. This was posted as a feature request by
Jorge Gutierrez and as a bug by Terry.
- Short options to curl that requires parameters can now be specified without
having the option and its parameter space separated. -ofile works as good as
-o file. -m20 is equal to -m 20. Do note that this goes for single-letter
options only, verbose --long-style options still must be separated with
space from their parameters.
Daniel (8 January 2001)
- Francis Dagenais reported that the SCO compiler still fails when compiling
curl due to that getpass_r() prototype. I've now put it around #ifndef
HAVE_GETPASS_R in an attempt to please the SCO systems.
- Made some minor corrections to get the client to cleanup properly and I made
the separator work again when getting multiple globbed URLs to stdout.
- Worked with Loic Dachary to get the make dist and make distcheck work
correctly. The 'maketgz' script is now using the automake generated 'make
dist' when creating release archives. Loic successfully made 'make rpms'
automatically build RPMs!
Loic Dachary (6 January 2001)
- Automated generation of rpm packages, no need to be root.
- make distcheck generates a proper distribution (EXTRA_DIST
in all Makefile.am modified to match FILES).
Daniel (5 January 2001)
- Huge client-side hack: now multiple URLs are supported. Any number of URLs
can be specified on the command line, and they'll all be downloaded. There
must be a corresponding -o or -O for each URL or the data will be written to
stdout. This needs more testing, time to release a 7.6-pre package.
- The krb4 support was broken in the release. Fixed now.
- Huge internal symbol rename operation. All non-static but still lib-internal
symbols should now be prefixed with 'Curl_' to prevent collisions with other
libs. All public symbols should be prefixed with 'curl_' and the rest should
be static and thus invisible to the outside world. I updated the INTERNALS
document to say this as well.
Version 7.5.2
Daniel (4 January 2001)

View File

@@ -14,7 +14,9 @@ perl/ is a subdirectory with various perl scripts
To build after having extracted everything from CVS, do this:
% automake
% autoconf
% ./configure
% make
automake
aclocal
autoheader
autoconf
./configure
make

86
FILES
View File

@@ -1,86 +0,0 @@
CHANGES
FILES
LEGAL
MPL-1.1.txt
MITX.txt
README
docs/BUGS
docs/CONTRIBUTE
docs/FAQ
docs/FEATURES
docs/INSTALL
docs/INTERNALS
docs/MANUAL
docs/README.win32
docs/LIBCURL
docs/RESOURCES
docs/TODO
docs/curl.1
docs/Makefile.in
docs/Makefile.am
docs/TheArtOfHttpScripting
docs/*.3
docs/examples/README
docs/examples/*.c
maketgz
Makefile.in
Makefile.am
acconfig.h
acinclude.m4
aclocal.m4
config.guess
config.h.in
config-win32.h
config.sub
configure
configure.in
install-sh
missing
mkinstalldirs
reconf
stamp-h.in
ltconfig
ltmain.sh
src/config-win32.h
src/hugehelp.c
src/main.c
src/setup.h
src/urlglob.c
src/urlglob.h
src/version.h
src/writeout.c
src/writeout.h
src/*.in
src/*.am
src/mkhelp.pl
src/Makefile.vc6
src/Makefile.b32
src/*m32
lib/getdate.y
lib/*.[ch]
lib/*in
lib/*am
lib/Makefile.vc6
lib/*m32
lib/Makefile.b32
lib/Makefile.b32.resp
lib/libcurl.def
include/README
include/Makefile.in
include/Makefile.am
include/curl/*.h
include/curl/Makefile.in
include/curl/Makefile.am
packages/Linux/RPM/curl-ssl.spec
packages/Linux/RPM/curl.spec
packages/Linux/RPM/make_curl_rpm
packages/Linux/RPM/README
packages/Win32/README
packages/README
tests/Makefile.am
tests/Makefile.in
tests/runtests.pl
tests/README
tests/httpserver.pl
tests/ftpserver.pl
tests/data/*.txt

View File

@@ -4,9 +4,44 @@
AUTOMAKE_OPTIONS = foreign no-dependencies
EXTRA_DIST = curl.spec curl-ssl.spec
EXTRA_DIST = \
CHANGES LEGAL maketgz MITX.txt MPL-1.1.txt \
config-win32.h reconf packages/README Makefile.dist
SUBDIRS = docs lib src include tests
SUBDIRS = docs lib src include tests packages
# create a root makefile in the distribution:
dist-hook:
cp $(srcdir)/Makefile.dist $(distdir)/Makefile
check: test
test:
@(cd tests; make quiet-test)
#
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
# must contain the following line:
# %_topdir /home/loic/local/rpm
# and that /home/loic/local/rpm contains the directory SOURCES, BUILD etc.
#
# cd /home/loic/local/rpm ; mkdir -p SOURCES BUILD RPMS/i386 SPECS SRPMS
#
# If additional configure flags are needed to build the package, add the
# following in ~/.rpmmacros
# %configure CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix} ${AM_CONFIGFLAGS}
# and run make rpm in the following way:
# AM_CONFIGFLAGS='--with-uri=/home/users/loic/local/RedHat-6.2' make rpm
#
rpms:
$(MAKE) RPMDIST=curl rpm
$(MAKE) RPMDIST=curl-ssl rpm
rpm:
RPM_TOPDIR=`rpm --showrc | $(PERL) -n -e 'print if(s/.*_topdir\s+(.*)/$$1/)'` ; \
cp $(srcdir)/packages/Linux/RPM/$(RPMDIST).spec $$RPM_TOPDIR/SPECS ; \
cp $(PACKAGE)-$(VERSION).tar.gz $$RPM_TOPDIR/SOURCES ; \
rpm -ba --clean --rmsource $$RPM_TOPDIR/SPECS/$(RPMDIST).spec ; \
mv $$RPM_TOPDIR/RPMS/i386/$(RPMDIST)-*.rpm . ; \
mv $$RPM_TOPDIR/SRPMS/$(RPMDIST)-*.src.rpm .

View File

@@ -36,3 +36,10 @@
/* Define if you have the Kerberos4 libraries (including -ldes) */
#undef KRB4
/* Define if you want to enable IPv6 support */
#undef ENABLE_IPV6
/* Define this to 'int' if ssize_t is not an available typedefed type */
#undef ssize_t

616
aclocal.m4 vendored
View File

@@ -1,616 +0,0 @@
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
#serial 12
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
dnl Written by Paul Eggert <eggert@twinsun.com>.
dnl Internal subroutine of AC_SYS_LARGEFILE.
dnl AC_SYS_LARGEFILE_TEST_INCLUDES
AC_DEFUN(AC_SYS_LARGEFILE_TEST_INCLUDES,
[[#include <sys/types.h>
int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
]])
dnl Internal subroutine of AC_SYS_LARGEFILE.
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
[AC_CACHE_CHECK([for $1 value needed for large files], $3,
[$3=no
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES
$5
,
[$6],
,
[AC_TRY_COMPILE([#define $1 $2]
AC_SYS_LARGEFILE_TEST_INCLUDES
$5
,
[$6],
[$3=$2])])])
if test "[$]$3" != no; then
AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
fi])
AC_DEFUN(AC_SYS_LARGEFILE,
[AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CACHE_CHECK([for special C compiler options needed for large files],
ac_cv_sys_largefile_CC,
[ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
[ac_save_CC="$CC"
CC="$CC -n32"
AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, ,
ac_cv_sys_largefile_CC=' -n32')
CC="$ac_save_CC"])
fi])
if test "$ac_cv_sys_largefile_CC" != no; then
CC="$CC$ac_cv_sys_largefile_CC"
fi
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
ac_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.])
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
ac_cv_sys_largefile_source,
[Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
[#include <stdio.h>], [return !ftello;])
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
ac_cv_sys_large_files,
[Define for large files, on AIX-style hosts.])
dnl lftp does not need ftello, and _XOPEN_SOURCE=500 makes resolv.h fail.
dnl AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
dnl ac_cv_sys_xopen_source,
dnl [Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
dnl [#include <stdio.h>], [return !ftello;])
fi
])
# Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER,
[AC_PREREQ([2.12])
AC_CONFIG_HEADER([$1])
dnl When config.status generates a header, we must update the stamp-h file.
dnl This file resides in the same directory as the config header
dnl that is generated. We must strip everything past the first ":",
dnl and everything past the last "/".
AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
<<am_indx=1
for am_file in <<$1>>; do
case " <<$>>CONFIG_HEADERS " in
*" <<$>>am_file "*<<)>>
echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
;;
esac
am_indx=`expr "<<$>>am_indx" + 1`
done<<>>dnl>>)
changequote([,]))])
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# serial 40 AC_PROG_LIBTOOL
AC_DEFUN(AC_PROG_LIBTOOL,
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
# Save cache, so that ltconfig can load it
AC_CACHE_SAVE
# Actually configure libtool. ac_aux_dir is where install-sh is found.
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \
DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| AC_MSG_ERROR([libtool configure failed])
# Reload cache, that may have been modified by ltconfig
AC_CACHE_LOAD
# This can be used to rebuild libtool when needed
LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
# Redirect the config.log output again, so that the ltconfig log is not
# clobbered by the next message.
exec 5>>./config.log
])
AC_DEFUN(AC_LIBTOOL_SETUP,
[AC_PREREQ(2.13)dnl
AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_RANLIB])dnl
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl
AC_REQUIRE([AC_PROG_NM])dnl
AC_REQUIRE([AC_PROG_LN_S])dnl
dnl
case "$target" in
NONE) lt_target="$host" ;;
*) lt_target="$target" ;;
esac
# Check for any special flags to pass to ltconfig.
libtool_flags="--cache-file=$cache_file"
test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared"
test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static"
test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install"
test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc"
test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld"
ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN],
[libtool_flags="$libtool_flags --enable-dlopen"])
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[libtool_flags="$libtool_flags --enable-win32-dll"])
AC_ARG_ENABLE(libtool-lock,
[ --disable-libtool-lock avoid locking (might break parallel builds)])
test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock"
test x"$silent" = xyes && libtool_flags="$libtool_flags --silent"
# Some flags need to be propagated to the compiler or linker for good
# libtool support.
case "$lt_target" in
*-*-irix6*)
# Find out which ABI we are using.
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case "`/usr/bin/file conftest.o`" in
*32-bit*)
LD="${LD-ld} -32"
;;
*N32*)
LD="${LD-ld} -n32"
;;
*64-bit*)
LD="${LD-ld} -64"
;;
esac
fi
rm -rf conftest*
;;
*-*-sco3.2v5*)
# On SCO OpenServer 5, we need -belf to get full-featured binaries.
SAVE_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL],
[*-*-cygwin* | *-*-mingw*)
AC_CHECK_TOOL(DLLTOOL, dlltool, false)
AC_CHECK_TOOL(AS, as, false)
AC_CHECK_TOOL(OBJDUMP, objdump, false)
;;
])
esac
])
# AC_LIBTOOL_DLOPEN - enable checks for dlopen support
AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])])
# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's
AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])])
# AC_ENABLE_SHARED - implement the --enable-shared flag
# Usage: AC_ENABLE_SHARED[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_SHARED, [dnl
define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(shared,
changequote(<<, >>)dnl
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_shared=yes ;;
no) enable_shared=no ;;
*)
enable_shared=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_shared=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
])
# AC_DISABLE_SHARED - set the default shared flag to --disable-shared
AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_SHARED(no)])
# AC_ENABLE_STATIC - implement the --enable-static flag
# Usage: AC_ENABLE_STATIC[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_STATIC, [dnl
define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(static,
changequote(<<, >>)dnl
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_static=yes ;;
no) enable_static=no ;;
*)
enable_static=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_static=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_static=AC_ENABLE_STATIC_DEFAULT)dnl
])
# AC_DISABLE_STATIC - set the default static flag to --disable-static
AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_STATIC(no)])
# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag
# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)]
# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to
# `yes'.
AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl
define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE(fast-install,
changequote(<<, >>)dnl
<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT],
changequote([, ])dnl
[p=${PACKAGE-default}
case "$enableval" in
yes) enable_fast_install=yes ;;
no) enable_fast_install=no ;;
*)
enable_fast_install=no
# Look at the argument we got. We use all the common list separators.
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:,"
for pkg in $enableval; do
if test "X$pkg" = "X$p"; then
enable_fast_install=yes
fi
done
IFS="$ac_save_ifs"
;;
esac],
enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl
])
# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install
AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_ENABLE_FAST_INSTALL(no)])
# AC_PROG_LD - find the path to the GNU or non-GNU linker
AC_DEFUN(AC_PROG_LD,
[AC_ARG_WITH(gnu-ld,
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$ac_cv_prog_gcc" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
AC_MSG_CHECKING([for ld used by GCC])
ac_prog=`($CC -print-prog-name=ld) 2>&5`
case "$ac_prog" in
# Accept absolute paths.
changequote(,)dnl
[\\/]* | [A-Za-z]:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
changequote([,])dnl
# Canonicalize the path of ld
ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
"")
# If it fails, then pretend we aren't using GCC.
ac_prog=ld
;;
*)
# If it is relative, then search for the first ld in PATH.
with_gnu_ld=unknown
;;
esac
elif test "$with_gnu_ld" = yes; then
AC_MSG_CHECKING([for GNU ld])
else
AC_MSG_CHECKING([for non-GNU ld])
fi
AC_CACHE_VAL(ac_cv_path_LD,
[if test -z "$LD"; then
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH; do
test -z "$ac_dir" && ac_dir=.
if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
ac_cv_path_LD="$ac_dir/$ac_prog"
# Check to see if the program is GNU ld. I'd rather use --version,
# but apparently some GNU ld's only accept -v.
# Break only if it was the GNU/non-GNU ld that we prefer.
if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then
test "$with_gnu_ld" != no && break
else
test "$with_gnu_ld" != yes && break
fi
fi
done
IFS="$ac_save_ifs"
else
ac_cv_path_LD="$LD" # Let the user override the test with a path.
fi])
LD="$ac_cv_path_LD"
if test -n "$LD"; then
AC_MSG_RESULT($LD)
else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
AC_PROG_LD_GNU
])
AC_DEFUN(AC_PROG_LD_GNU,
[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
if $LD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
ac_cv_prog_gnu_ld=yes
else
ac_cv_prog_gnu_ld=no
fi])
])
# AC_PROG_NM - find the path to a BSD-compatible name lister
AC_DEFUN(AC_PROG_NM,
[AC_MSG_CHECKING([for BSD-compatible nm])
AC_CACHE_VAL(ac_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
ac_cv_path_NM="$NM"
else
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do
test -z "$ac_dir" && ac_dir=.
if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then
# Check to see if the nm accepts a BSD-compat flag.
# Adding the `sed 1q' prevents false positives on HP-UX, which says:
# nm: unknown option "B" ignored
if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -B"
break
elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then
ac_cv_path_NM="$ac_dir/nm -p"
break
else
ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but
continue # so that we can try to find one that supports BSD flags
fi
fi
done
IFS="$ac_save_ifs"
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
fi])
NM="$ac_cv_path_NM"
AC_MSG_RESULT([$NM])
])
# AC_CHECK_LIBM - check for math library
AC_DEFUN(AC_CHECK_LIBM,
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case "$lt_target" in
*-*-beos* | *-*-cygwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
AC_CHECK_LIB(m, main, LIBM="$LIBM -lm")
;;
*)
AC_CHECK_LIB(m, main, LIBM="-lm")
;;
esac
])
# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl convenience library and INCLTDL to the include flags for
# the libltdl header and adds --enable-ltdl-convenience to the
# configure arguments. Note that LIBLTDL and INCLTDL are not
# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not
# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed
# with '${top_builddir}/' and INCLTDL will be prefixed with
# '${top_srcdir}/' (note the single quotes!). If your package is not
# flat and you're not using automake, define top_builddir and
# top_srcdir appropriately in the Makefiles.
AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
case "$enable_ltdl_convenience" in
no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
"") enable_ltdl_convenience=yes
ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
esac
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
])
# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for
# the libltdl installable library and INCLTDL to the include flags for
# the libltdl header and adds --enable-ltdl-install to the configure
# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is
# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed
# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will
# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed
# with '${top_srcdir}/' (note the single quotes!). If your package is
# not flat and you're not using automake, define top_builddir and
# top_srcdir appropriately in the Makefiles.
# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
AC_CHECK_LIB(ltdl, main,
[test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
[if test x"$enable_ltdl_install" = xno; then
AC_MSG_WARN([libltdl not installed, but installation disabled])
else
enable_ltdl_install=yes
fi
])
if test x"$enable_ltdl_install" = x"yes"; then
ac_configure_args="$ac_configure_args --enable-ltdl-install"
LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
else
ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
LIBLTDL="-lltdl"
INCLTDL=
fi
])
dnl old names
AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl
AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl
AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl
AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl
AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl
AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl
AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl
dnl This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL])dnl

View File

@@ -23,6 +23,9 @@
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* Define this to 'int' if ssize_t is not an available typedefed type */
#define ssize_t int
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1

View File

@@ -1,312 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define cpu-machine-OS */
#undef OS
/* Define if you have the gethostbyaddr_r() function with 5 arguments */
#undef HAVE_GETHOSTBYADDR_R_5
/* Define if you have the gethostbyaddr_r() function with 7 arguments */
#undef HAVE_GETHOSTBYADDR_R_7
/* Define if you have the gethostbyaddr_r() function with 8 arguments */
#undef HAVE_GETHOSTBYADDR_R_8
/* Define if you have the gethostbyname_r() function with 3 arguments */
#undef HAVE_GETHOSTBYNAME_R_3
/* Define if you have the gethostbyname_r() function with 5 arguments */
#undef HAVE_GETHOSTBYNAME_R_5
/* Define if you have the gethostbyname_r() function with 6 arguments */
#undef HAVE_GETHOSTBYNAME_R_6
/* Define if you have the inet_ntoa_r function declared. */
#undef HAVE_INET_NTOA_R_DECL
/* Define if you need the _REENTRANT define for some functions */
#undef NEED_REENTRANT
/* Define if you have the Kerberos4 libraries (including -ldes) */
#undef KRB4
/* The number of bytes in a long double. */
#undef SIZEOF_LONG_DOUBLE
/* The number of bytes in a long long. */
#undef SIZEOF_LONG_LONG
/* Define if you have the RAND_screen function. */
#undef HAVE_RAND_SCREEN
/* Define if you have the RAND_status function. */
#undef HAVE_RAND_STATUS
/* Define if you have the closesocket function. */
#undef HAVE_CLOSESOCKET
/* Define if you have the gethostbyaddr function. */
#undef HAVE_GETHOSTBYADDR
/* Define if you have the gethostbyaddr_r function. */
#undef HAVE_GETHOSTBYADDR_R
/* Define if you have the gethostbyname_r function. */
#undef HAVE_GETHOSTBYNAME_R
/* Define if you have the gethostname function. */
#undef HAVE_GETHOSTNAME
/* Define if you have the getpass_r function. */
#undef HAVE_GETPASS_R
/* Define if you have the getservbyname function. */
#undef HAVE_GETSERVBYNAME
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the inet_addr function. */
#undef HAVE_INET_ADDR
/* Define if you have the inet_ntoa function. */
#undef HAVE_INET_NTOA
/* Define if you have the inet_ntoa_r function. */
#undef HAVE_INET_NTOA_R
/* Define if you have the krb_get_our_ip_for_realm function. */
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the perror function. */
#undef HAVE_PERROR
/* Define if you have the select function. */
#undef HAVE_SELECT
/* Define if you have the setvbuf function. */
#undef HAVE_SETVBUF
/* Define if you have the sigaction function. */
#undef HAVE_SIGACTION
/* Define if you have the signal function. */
#undef HAVE_SIGNAL
/* Define if you have the socket function. */
#undef HAVE_SOCKET
/* Define if you have the strcasecmp function. */
#undef HAVE_STRCASECMP
/* Define if you have the strcmpi function. */
#undef HAVE_STRCMPI
/* Define if you have the strdup function. */
#undef HAVE_STRDUP
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if you have the stricmp function. */
#undef HAVE_STRICMP
/* Define if you have the strlcpy function. */
#undef HAVE_STRLCPY
/* Define if you have the strstr function. */
#undef HAVE_STRSTR
/* Define if you have the tcgetattr function. */
#undef HAVE_TCGETATTR
/* Define if you have the tcsetattr function. */
#undef HAVE_TCSETATTR
/* Define if you have the uname function. */
#undef HAVE_UNAME
/* Define if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define if you have the <crypto.h> header file. */
#undef HAVE_CRYPTO_H
/* Define if you have the <des.h> header file. */
#undef HAVE_DES_H
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <err.h> header file. */
#undef HAVE_ERR_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define if you have the <io.h> header file. */
#undef HAVE_IO_H
/* Define if you have the <krb.h> header file. */
#undef HAVE_KRB_H
/* Define if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define if you have the <net/if.h> header file. */
#undef HAVE_NET_IF_H
/* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H
/* Define if you have the <netinet/if_ether.h> header file. */
#undef HAVE_NETINET_IF_ETHER_H
/* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define if you have the <openssl/crypto.h> header file. */
#undef HAVE_OPENSSL_CRYPTO_H
/* Define if you have the <openssl/err.h> header file. */
#undef HAVE_OPENSSL_ERR_H
/* Define if you have the <openssl/pem.h> header file. */
#undef HAVE_OPENSSL_PEM_H
/* Define if you have the <openssl/rsa.h> header file. */
#undef HAVE_OPENSSL_RSA_H
/* Define if you have the <openssl/ssl.h> header file. */
#undef HAVE_OPENSSL_SSL_H
/* Define if you have the <openssl/x509.h> header file. */
#undef HAVE_OPENSSL_X509_H
/* Define if you have the <pem.h> header file. */
#undef HAVE_PEM_H
/* Define if you have the <rsa.h> header file. */
#undef HAVE_RSA_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
/* Define if you have the <ssl.h> header file. */
#undef HAVE_SSL_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/select.h> header file. */
#undef HAVE_SYS_SELECT_H
/* Define if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <termio.h> header file. */
#undef HAVE_TERMIO_H
/* Define if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the <winsock.h> header file. */
#undef HAVE_WINSOCK_H
/* Define if you have the <x509.h> header file. */
#undef HAVE_X509_H
/* Define if you have the crypto library (-lcrypto). */
#undef HAVE_LIBCRYPTO
/* Define if you have the dl library (-ldl). */
#undef HAVE_LIBDL
/* Define if you have the nsl library (-lnsl). */
#undef HAVE_LIBNSL
/* Define if you have the resolv library (-lresolv). */
#undef HAVE_LIBRESOLV
/* Define if you have the resolve library (-lresolve). */
#undef HAVE_LIBRESOLVE
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if you have the ssl library (-lssl). */
#undef HAVE_LIBSSL
/* Define if you have the ucb library (-lucb). */
#undef HAVE_LIBUCB
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
#undef _LARGEFILE_SOURCE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Set to explicitly specify we don't want to use thread-safe functions */
#undef DISABLED_THREADSAFE

View File

@@ -26,6 +26,66 @@ dnl The install stuff has already been taken care of by the automake stuff
dnl AC_PROG_INSTALL
AC_PROG_MAKE_SET
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="-Wall -pedantic -g"
;;
esac ],
AC_MSG_RESULT(no)
)
dnl
dnl check for working getaddrinfo()
dnl
AC_DEFUN(CURL_CHECK_WORKING_GETADDRINFO,[
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
AC_TRY_RUN( [
#include <netdb.h>
#include <sys/types.h>
#include <sys/socket.h>
void main(void) {
struct addrinfo hints, *ai;
int error;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
if (error) {
exit(1);
}
else {
exit(0);
}
}
],[
ac_cv_working_getaddrinfo="yes"
],[
ac_cv_working_getaddrinfo="no"
],[
ac_cv_working_getaddrinfo="yes"
])])
if test "$ac_cv_working_getaddrinfo" = "yes"; then
AC_DEFINE(HAVE_GETADDRINFO, 1, [Define if getaddrinfo exists and works])
AC_DEFINE(ENABLE_IPV6, 1, [Define if you want to enable IPv6 support])
fi
])
AC_DEFUN(CURL_CHECK_LOCALTIME_R,
[
dnl check for a few thread-safe functions
@@ -237,6 +297,47 @@ exit (rc != 0 ? 1 : 0); }],[
])
dnl **********************************************************************
dnl Checks for IPv6
dnl **********************************************************************
AC_MSG_CHECKING([whether to enable ipv6])
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 Enable ipv6 (with ipv4) support
--disable-ipv6 Disable ipv6 support],
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
ipv6=no
;;
*) AC_MSG_RESULT(yes)
ipv6=yes
;;
esac ],
AC_TRY_RUN([ /* is AF_INET6 available? */
#include <sys/types.h>
#include <sys/socket.h>
main()
{
if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
exit(1);
else
exit(0);
}
],
AC_MSG_RESULT(yes)
ipv6=yes,
AC_MSG_RESULT(no)
ipv6=no,
AC_MSG_RESULT(no)
ipv6=no
))
if test "$ipv6" = "yes"; then
CURL_CHECK_WORKING_GETADDRINFO
fi
dnl **********************************************************************
dnl Checks for libraries.
@@ -327,6 +428,10 @@ AC_MSG_CHECKING([if Kerberos4 support is requested])
if test "$want_krb4" = yes
then
if test "$ipv6" = "yes"; then
echo krb4 is not compatible with IPv6
exit 1
fi
AC_MSG_RESULT(yes)
dnl Check for & handle argument to --with-krb4
@@ -554,6 +659,9 @@ AC_CHECK_SIZEOF(long double, 8)
# check for 'long long'
AC_CHECK_SIZEOF(long long, 4)
# check for ssize_t
AC_CHECK_TYPE(ssize_t, int)
dnl Get system canonical name
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED(OS, "${host}")
@@ -584,12 +692,16 @@ AC_CHECK_FUNCS( socket \
setvbuf \
sigaction \
signal \
getpass_r
getpass_r \
strlcat
)
dnl removed 'getpass' check on October 26, 2000
if test "$ac_cv_func_select" != "yes"; then
AC_MSG_ERROR(Can't work without an existing select() function)
fi
if test "$ac_cv_func_socket" != "yes"; then
AC_MSG_ERROR(Can't work without an existing socket() function)
fi
@@ -609,12 +721,17 @@ dnl AC_SUBST(RANLIB)
AC_OUTPUT( Makefile \
docs/Makefile \
docs/examples/Makefile \
include/Makefile \
include/curl/Makefile \
src/Makefile \
lib/Makefile \
tests/Makefile)
dnl perl/checklinks.pl \
dnl perl/getlinks.pl \
dnl perl/formfind.pl \
dnl perl/recursiveftpget.pl )
tests/Makefile \
tests/data/Makefile \
packages/Makefile \
packages/Win32/Makefile \
packages/Linux/Makefile \
packages/Linux/RPM/Makefile \
packages/Linux/RPM/curl.spec \
packages/Linux/RPM/curl-ssl.spec )

View File

@@ -18,7 +18,7 @@ The License Issue
If you add a larger piece of code, you can opt to make that file or set of
files to use a different license as long as they don't enfore any changes to
the rest of the package and they make sense. Such "separate parts" can not be
GPL (as we don't want the FPL virus to attack users of libcurl) but they must
GPL (as we don't want the GPL virus to attack users of libcurl) but they must
use "GPL compatible" licenses.
Naming

131
docs/FAQ
View File

@@ -1,4 +1,4 @@
Updated: January 4, 2001 (http://curl.haxx.se/docs/faq.shtml)
Updated: February 12, 2001 (http://curl.haxx.se/docs/faq.shtml)
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -30,10 +30,12 @@ FAQ
3.6 Does curl support javascript, 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 PHP?
3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
4. Running Problems
4.1 Problems connecting to SSL servers.
4.2 Why do I get problems when I use & in the URL?
4.2 Why do I get problems when I use & or % in the URL?
4.3 How can I use {, }, [ or ] to specify multiple URLs?
4.4 Why do I get downloaded data even though the web page doesn't exist?
4.5 Why do I get return code XXX from a HTTP server?
@@ -48,10 +50,12 @@ FAQ
4.9 Curl can't authenticate to the server that requires NTLM?
5. libcurl Issues
5.1 Is libcurl thread safe?
5.1 Is libcurl thread-safe?
5.2 How can I receive all data into a large memory chunk?
5.3 How do I fetch multiple files with libcurl?
5.4 Does libcurl do Winsock initing on win32 systems?
5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
5.6 What about Keep-Alive or persistant connections?
6. License Issues
6.1 I have a GPL program, can I use the libcurl library?
@@ -73,19 +77,16 @@ FAQ
fact it can also be pronounced 'see URL' also helped.
Curl supports a range of common internet protocols, currently including
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT and FILE.
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT, TELNET and FILE.
Please spell it cURL or just curl.
We spell it cURL or just curl.
1.2 What is libcurl?
libcurl is the engine inside curl that does all the work. curl is more or
less the command line interface that converts the given options into libcurl
function invokes. libcurl is a reliable, higly portable multiprotocol file
transfer library.
libcurl is a reliable, higly portable multiprotocol file transfer library.
Any application is free to use libcurl, even commercial or closed-source
ones. Just make sure changes to the lib itself are made public.
ones.
1.3 What is cURL not?
@@ -106,8 +107,8 @@ FAQ
or with PHP.
Curl is not a single-OS program. Curl exists, compiles, builds and runs
under a wide range of operating systems, including all modern Unixes,
Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
under a wide range of operating systems, including all modern Unixes (and a
bunch of older ones too), Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
1.4 When will you make curl do XXXX ?
@@ -230,7 +231,7 @@ FAQ
You can't simply use -F or -d at your choice. The web server that will
receive your post assumes one of the formats. If the form you're trying to
"fake" sets the type to 'multipart/form-data', than and only then you must
"fake" sets the type to 'multipart/form-data', then and only then you must
use the -F type. In all the most common cases, you should use -d which then
causes a posting with the type 'application/x-www-form-urlencoded'.
@@ -281,6 +282,29 @@ FAQ
curl -L http://redirector.com
3.9 How do I use curl in PHP?
PHP4 has the ability to use libcurl as an internal module if built with that
option enabled. You then get a set of extra functions that can be used
within your PHP programs. You find all details about those functions in the
curl section in the PHP manual, see the online version at:
http://www.php.net/manual/ref.curl.php
PHP also offers the option to run a command line, and then you can of course
invoke the curl tool using a command line. This is the way to use curl if
you're using PHP3 or PHP4 built without curl module support.
3.10 What about SOAP, WEBDAV, XML-RPC or similar protocols over HTTP?
Curl adheres to the HTTP spec, which basically means you can play with *any*
protocol that is built ontop of HTTP. Protocols such as SOAP, WEBDAV and
XML-RPC are all such ones. You can use -X to set custom requests and -H to
set custom headers (or replace internally generated ones).
Using libcurl or PHP's curl modules is just as fine and you'd just use the
proper library options to do the same.
4. Running Problems
4.1. Problems connecting to SSL servers.
@@ -298,7 +322,7 @@ FAQ
I have also seen examples where the remote server didn't like the SSLv2
request and instead you had to force curl to use SSLv3 with -3/--sslv3.
4.2. Why do I get problems when I use & in the URL?
4.2. Why do I get problems when I use & or % in the URL?
In general unix shells, the & letter is treated special and when used it
runs the specified command in the background. To safely send the & as a part
@@ -309,6 +333,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.
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'.
4.3. How can I use {, }, [ or ] to specify multiple URLs?
Because those letters have a special meaning to the shell, and to be used in
@@ -318,6 +348,12 @@ FAQ
curl '{curl,www}.haxx.se'
To be able to use those letters as actual parts of the URL (without using
them for the curl URL "globbing" system), use the -g/--globoff option
(included in curl 7.6 and later):
curl -g 'www.site.com/weirdname[].html'
4.4. Why do I get downloaded data even though the web page doesn't exist?
Curl asks remote servers for the page you specify. If the page doesn't exist
@@ -392,8 +428,7 @@ FAQ
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 or mail a detailed bug description
to curl-bug@haxx.se.
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
@@ -402,15 +437,18 @@ FAQ
4.9. Curl can't authenticate to the server that requires NTLM?
NTLM is a Microsoft proprietary protocol. Unfortunately, curl does not
currently support that.
currently support that. Proprietary formats are evil. You should not use
such ones.
5. libcurl Issues
5.1. Is libcurl thread safe?
5.1. Is libcurl thread-safe?
We have attempted to write the entire code adjusted for multi-threaded
programs. If your system has such, curl will attempt to use threadsafe
functions instead of non-safe ones.
Yes.
We have written the libcurl code specificly adjusted for multi-threaded
programs. libcurl will use thread-safe functions instead of non-safe ones if
your system has such.
I am very interested in once and for all getting some kind of report or
README file from those who have used libcurl in a threaded environment,
@@ -465,9 +503,28 @@ FAQ
use several different libraries and parts, and there's no reason for every
single library to do this.
5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
that DLL use the FILE *. If you set CURLOPT_FILE you must also use
CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even
if that simply writes the data to the specified FILE*. Similarly, if you use
CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION.
(Provided by Joel DeYoung and Bob Schader)
5.6 What about Keep-Alive or persistant connections?
This is closely related to issue 5.3. Since libcurl has no real support
for doing multiple file transfers, there's no support for Keep-Alive or
persistant connections either.
This is of course subject to change as soon as libcurl gets support for
multiple files. Feel free to join in and make this change happen sooner!
6. License Issues
NOTE: This section is now updated to concern curl 7.5.2 or later!
NOTE: This section concerns curl 7.5.2 or later!
Curl and libcurl are released under a MIT/X derivate license *or* the MPL,
the Mozilla Public License. To get a really good answer to your license
@@ -485,27 +542,25 @@ FAQ
6.2. I have a closed-source program, can I use the libcurl library?
Yes.
Yes!
libcurl does not put any restrictions on the program that uses the
library.
libcurl does not put any restrictions on the program that uses the library.
6.3. I have a BSD licensed program, can I use the libcurl library?
Yes.
Yes!
libcurl does not put any restrictions on the program that uses the
library.
libcurl does not put any restrictions on the program that uses the library.
6.4. I have a program that uses LGPL libraries, can I use libcurl?
Yes.
Yes!
The LGPL license don't clash with other licenses.
The LGPL license doesn't clash with other licenses.
6.5. Can I modify curl/libcurl for my program and keep the changes secret?
Yes.
Yes!
The MIT/X derivate license practically allows you to do almost anything with
the sources, on the condition that the copyright texts in the sources are
@@ -513,9 +568,11 @@ FAQ
6.6. Can you please change the curl/libcurl license to XXXX?
No. We carefully picked this license years ago and a large amount of people
have contributed with source code knowing that this is the license we
use. This license puts the restrictions we want on curl/libcurl and it does
not spread to other programs or libraries that use it. The recent dual
license modification should make it possible for everyone to use libcurl or
curl in their projects, no matter what license they already have in use.
No.
We carefully picked this license years ago and a large amount of people have
contributed with source code knowing that this is the license we use. This
license puts the restrictions we want on curl/libcurl and it does not spread
to other programs or libraries that use it. The recent dual license
modification should make it possible for everyone to use libcurl or curl in
their projects, no matter what license they already have in use.

View File

@@ -84,15 +84,31 @@ UNIX
KNOWN PROBLEMS
If you happen to have autoconf installed, but a version older than
2.12 you will get into trouble. Then you can still build curl by
issuing these commands: (from Ralph Beckmann <rabe@uni-paderborn.de>)
If you happen to have autoconf installed, but a version older than 2.12
you will get into trouble. Then you can still build curl by issuing these
commands (note that this requires curl to be built staticly): (from Ralph
Beckmann)
./configure [...]
cd lib; make; cd ..
cd src; make; cd ..
cp src/curl elsewhere/bin/
As suggested by David West, you can make a faked version of autoconf and
autoheader:
----start of autoconf----
#!/bin/bash
#fake autoconf for building curl
if [ "$1" = "--version" ] then
echo "Autoconf version 2.13"
fi
----end of autoconf----
Then make autoheader a symbolic link to the same script and make sure
they're executable and set to appear in the path *BEFORE* the actual (but
obsolete) autoconf and autoheader scripts.
OPTIONS
Remember, to force configure to use the standard cc compiler if both
@@ -124,6 +140,14 @@ UNIX
./configure --with-krb4=/usr/athena
If your system support shared libraries, but you want to built a static
version only, you can disable building the shared version by using:
./configure --disable-shared
If you're a curl developer and use gcc, you might want to enable more
debug options with the --enable-debug option.
Win32
=====
@@ -154,6 +178,8 @@ Win32
set, then run 'nmake -f Makefile.vc6' in the lib/ dir and then
'nmake -f Makefile.vc6' in the src/ dir.
The vcvars32.bat file is part of the Microsoft development environment.
IDE-style
-------------------------
If you use VC++, Borland or similar compilers. Include all lib source
@@ -199,6 +225,8 @@ Win32
set, then run 'nmake -f Makefile.vc6 release-ssl' in the lib/ dir and
then 'nmake -f Makefile.vc6' in the src/ dir.
The vcvars32.bat file is part of the Microsoft development environment.
Microsoft / Borland style
-------------------------
If you have OpenSSL, and want curl to take advantage of it, edit your
@@ -256,18 +284,20 @@ PORTS
- PowerPC Mac OS X
- Sparc Linux
- Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8
- Sparc SunOS 4.1.*
- Sparc SunOS 4.1.X
- i386 BeOS
- i386 FreeBSD
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4
- i386 NetBSD
- i386 OS/2
- i386 OpenBSD
- i386 SCO unix
- i386 Solaris 2.7
- i386 Windows 95, 98, NT, 2000
- i386 Windows 95, 98, ME, NT, 2000
- ia64 Linux 2.3.99
- m68k AmigaOS 3
- m68k OpenBSD
- StrongARM NetBSD 1.4.1
OpenSSL
=======

View File

@@ -1,3 +1,4 @@
Updated for curl 7.6 on January 26, 2001
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
@@ -14,7 +15,6 @@ INTERNALS
CVS
===
All changes to the sources are committed to the CVS repository as soon as
they're somewhat verified to work. Changes shall be commited as independently
as possible so that individual changes can be easier spotted and tracked
@@ -27,25 +27,29 @@ Windows vs Unix
===============
There are a few differences in how to program curl the unix way compared to
the Windows way. The four most notable details are:
the Windows way. The four perhaps most notable details are:
1. Different function names for socket operations.
In curl, this is solved with defines and macros, so that the source looks
the same at all places except for the header file that defines them. The
macros in use are sclose(), sread() and swrite().
1. Different function names for close(), read(), write()
2. Windows requires a couple of init calls for the socket stuff
Those must be made by the application that uses libcurl, in curl that means
src/main.c has some code #ifdef'ed to do just that.
3. The file descriptors for network communication and file operations are
not easily interchangable as in unix
We avoid this by not trying any funny tricks on file descriptors.
4. When writing data to stdout, Windows makes end-of-lines the DOS way, thus
destroying binary data, although you do want that conversion if it is
text coming through... (sigh)
In curl, (1) is made with defines and macros, so that the source looks the
same at all places except for the header file that defines them.
(2) must be made by the application that uses libcurl, in curl that means
src/main.c has some code #ifdef'ed to do just that.
(3) is simply avoided by not trying any funny tricks on file descriptors.
(4) we set stdout to binary under windows
We set stdout to binary under windows
Inside the source code, I do make an effort to avoid '#ifdef WIN32'. All
conditionals that deal with features *should* instead be in the format
@@ -54,6 +58,9 @@ Windows vs Unix
supposed to look exactly as a config.h file would have looked like on a
Windows machine!
Generally speaking: always remember that this will be compiled on dozens of
operating systems. Don't walk on the edge.
Library
=======
@@ -68,6 +75,9 @@ Library
rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
put in the lib/easy.c file.
All printf()-style functions use the supplied clones in lib/mprintf.c. This
makes sure we stay absolutely platform independent.
curl_easy_init() allocates an internal struct and makes some initializations.
The returned handle does not revail internals.
@@ -77,27 +87,31 @@ Library
curl_easy_perform() does a whole lot of things:
The function analyzes the URL, get the different components and connects to
the remote host. This may involve using a proxy and/or using SSL. The
GetHost() function in lib/hostip.c is used for looking up host names.
It starts off in the lib/easy.c file by calling curl_transfer(), but the main
work is lib/url.c. The function first analyzes the URL, it separates the
different components and connects to the remote host. This may involve using
a proxy and/or using SSL. The Curl_gethost() function in lib/hostip.c is used
for looking up host names.
When connected, the proper function is called. The functions are named after
the protocols they handle. ftp(), http(), dict(), etc. They all reside in
their respective files (ftp.c, http.c and dict.c).
When connected, the proper protocol-specific function is called. The
functions are named after the protocols they handle. Curl_ftp(), Curl_http(),
Curl_dict(), etc. They all reside in their respective files (ftp.c, http.c
and dict.c).
The protocol-specific functions deal with protocol-specific negotiations and
setup. They have access to the sendf() (from lib/sendf.c) function to send
printf-style formatted data to the remote host and when they're ready to make
the actual file transfer they call the Transfer() function (in
lib/download.c) to do the transfer. All printf()-style functions use the
supplied clones in lib/mprintf.c.
The protocol-specific functions of course deal with protocol-specific
negotiations and setup. They have access to the Curl_sendf() (from
lib/sendf.c) function to send printf-style formatted data to the remote host
and when they're ready to make the actual file transfer they call the
Curl_Transfer() function (in lib/transfer.c) to setup the transfer and
returns. curl_transfer() then calls _Tranfer() in lib/transfer.c that
performs the entire file transfer.
While transfering, the progress functions in lib/progress.c are called at a
During transfer, the progress functions in lib/progress.c are called at a
frequent interval (or at the user's choice, a specified callback might get
called). The speedcheck functions in lib/speedcheck.c are also used to verify
that the transfer is as fast as required.
When completed curl_easy_cleanup() should be called to free up used
When completed, the curl_easy_cleanup() should be called to free up used
resources.
HTTP(S)
@@ -106,9 +120,8 @@ Library
code. There is a special file (lib/formdata.c) that offers all the multipart
post functions.
base64-functions for user+password stuff is in (lib/base64.c) and all
functions for parsing and sending cookies are found in
(lib/cookie.c).
base64-functions for user+password stuff (and more) is in (lib/base64.c) and
all functions for parsing and sending cookies are found in (lib/cookie.c).
HTTPS uses in almost every means the same procedure as HTTP, with only two
exceptions: the connect procedure is different and the function used to read
@@ -118,9 +131,17 @@ Library
FTP
The if2ip() function can be used for getting the IP number of a specified
network interface, and it resides in lib/if2ip.c. It is only used for the FTP
PORT command.
The Curl_if2ip() function can be used for getting the IP number of a
specified network interface, and it resides in lib/if2ip.c.
Curl_ftpsendf() is used for sending FTP commands to the remote server. It was
made a separate function to prevent us programmers from forgetting that they
must be CRLF terminated. They must also be sent in one single write() to make
firewalls and similar happy.
Kerberos
The kerberos support is mainly in lib/krb4.c and lib/security.c.
TELNET
@@ -139,32 +160,63 @@ Library
URL encoding and decoding, called escaping and unescaping in the source code,
is found in lib/escape.c.
While transfering data in Transfer() a few functions might get
While transfering data in _Transfer() a few functions might get
used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
more).
lib/getenv.c offers curl_getenv() which is for reading environment variables
in a neat platform independent way. That's used in the client, but also in
lib/url.c when checking the proxy environment variables.
lib/url.c when checking the proxy environment variables. Note that contrary
to the normal unix getenv(), this returns an allocated buffer that must be
free()ed after use.
lib/netrc.c holds the .netrc parser
lib/timeval.c features replacement functions for systems that don't have
gettimeofday().
gettimeofday() and a few support functions for timeval convertions.
A function named curl_version() that returns the full curl version string is
found in lib/version.c.
If authentication is requested but no password is given, a getpass_r() clone
exists in lib/getpass.c. libcurl offers a custom callback that can be used
instead of this, but it doesn't change much to us.
Library Symbols
===============
All symbols used internally in libcurl must use a 'Curl_' prefix if they're
used in more than a single file. Single-file symbols must be made
static. Public (exported) symbols must use a 'curl_' prefix. (There are
exceptions, but they are destined to be changed to follow this pattern in the
future.)
Return Codes and Informationals
===============================
I've made things simple. Almost every function in libcurl returns a CURLcode,
that must be CURLE_OK if everything is OK or otherwise a suitable error code
as the curl/curl.h include file defines. The very spot that detects an error
must use the Curl_failf() function to set the human-readable error
description.
In aiding the user to understand what's happening and to debug curl usage, we
must supply a fair amount of informational messages by using the Curl_infof()
function. Those messages are only displayed when the user explicitly asks for
them. They are best used when revealing information that isn't otherwise
obvious.
Client
======
main() resides in src/main.c together with most of the client code.
src/hugehelp.c is automatically generated by the mkhelp.pl perl script to
display the complete "manual" and the src/urlglob.c file holds the functions
used for the multiple-URL support.
used for the URL-"globbing" support. Globbing in the sense that the {} and []
expansion stuff is there.
The client mostly mess around to setup its config struct properly, then it
calls the curl_easy_*() functions of the library and when it gets back
The client mostly messes around to setup its 'config' struct properly, then
it calls the curl_easy_*() functions of the library and when it gets back
control after the curl_easy_perform() it cleans up the library, checks status
and exits.
@@ -173,10 +225,30 @@ Client
curl_easy_getinfo() function to extract useful information from the curl
session.
Recent versions may loop and do all that several times if many URLs were
specified on the command line or config file.
Memory Debugging
================
The file named lib/memdebug.c contains debug-versions of a few
functions. Functions such as malloc, free, fopen, fclose, etc that somehow
deal with resources that might give us problems if we "leak" them. The
functions in the memdebug system do nothing fancy, they do their normal
function and then log information about what they just did. The logged data
is then analyzed after a complete session,
memanalyze.pl is a perl script present only in CVS (not part of the release
archives) that analyzes a log file generated by the memdebug system. It
detects if resources are allocated but never freed and other kinds of errors
related to resource management.
Use -DMALLOCDEBUG when compiling to enable memory debugging.
Test Suite
==========
During November 2000, a test suite has evolved. It is placed in its own
Since November 2000, a test suite has evolved. It is placed in its own
subdirectory directly off the root in the curl archive tree, and it contains
a bunch of scripts and a lot of test case data.
@@ -186,3 +258,17 @@ Test Suite
You'll find a complete description of the test case data files in the README
file in the test directory.
The test suite automatically detects if curl was built with the memory
debugging enabled, and if it was it will detect memory leaks too.
Building Releases
=================
There's no magic to this. When you consider everything stable enough to be
released, run the 'maketgz' script (using 'make distcheck' will give you a
pretty good view on the status of the current sources). maketgz prompts for
version number of the client and the library before it creates a release
archive.
You must have autoconf installed to build release archives.

View File

@@ -726,6 +726,25 @@ KERBEROS4 FTP TRANSFER
There's no use for a password on the -u switch, but a blank one will make
curl ask for one and you already entered the real password to kauth.
TELNET
The curl telnet support is basic and very easy to use. Curl passes all data
passed to it on stdin to the remote server. Connect to a remote telnet
server using a command line similar to:
curl telnet://remote.server.com
And enter the data to pass to the server on stdin. The result will be sent
to stdout or to the file you specify with -o.
You might want the -N/--no-buffer option to switch off the buffered output
for slow connections or similar.
NOTE: the telnet protocol does not specify any way to login with a specified
user and password so curl can't do that automatically. To do that, you need
to track when the login prompt is received and send the username and
password accordingly.
MAILING LIST
We have an open mailing list to discuss curl, its development and things

View File

@@ -12,11 +12,15 @@ man_MANS = \
curl_easy_perform.3 \
curl_easy_setopt.3 \
curl_formparse.3 \
curl_formfree.3 \
curl_getdate.3 \
curl_getenv.3 \
curl_slist_append.3 \
curl_slist_free_all.3 \
curl_version.3
EXTRA_DIST = $(man_MANS)
EXTRA_DIST = $(man_MANS) \
MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS \
LIBCURL README.win32 RESOURCES TODO TheArtOfHttpScripting
SUBDIRS = examples

View File

@@ -102,6 +102,12 @@ Similar Tools
Kermit - http://www.columbia.edu/kermit/ftpclient
Pavuk - http://www.idata.sk/~ondrej/pavuk/
httpr - http://zwolak.dhs.org/httpr/
puf - http://www.inf.tu-dresden.de/~ob6/sw/puf.html
Related Software
----------------
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses

View File

@@ -16,10 +16,6 @@ For the future
* Make SSL session ids get used if multiple HTTPS documents from the same
host is requested.
* Improve the command line option parser to accept '-m300' as well as the '-m
300' convention. It should be able to work if '-m300' is considered to be
space separated to the next option.
* Make the curl tool support URLs that start with @ that would then mean that
the following is a plain list with URLs to download. Thus @filename.txt
reads a list of URLs from a local file. A fancy option would then be to
@@ -27,16 +23,12 @@ For the future
URLs mentioned in the list. I figure -O or something would have to be
implied by such an action.
* Make curl with multiple URLs, even outside of {}-letters. I could also
imagine an optional fork()ed system that downloads each URL in its own
thread. It should of course have a maximum amount of simultaneous fork()s.
* Improve the regular progress meter with --continue is used. It should be
noticable when there's a resume going on.
* Add a command line option that allows the output file to get the same time
stamp as the remote file. This requires some fiddling on FTP but comes
almost free for HTTP.
stamp as the remote file. We already are capable of fetching the remote
file's date.
* Make the SSL layer option capable of using the Mozilla Security Services as
an alternative to OpenSSL:
@@ -47,6 +39,7 @@ For the future
* Make the easy-interface support multiple file transfers. If they're done
to the same host, they should use persistant connections or similar.
Figure out a nice design for this.
* Add asynchronous name resolving, as this enables full timeout support for
fork() systems.

View File

@@ -2,18 +2,19 @@
.\" nroff -man curl.1
.\" Written by Daniel Stenberg
.\"
.TH curl 1 "4 January 2001" "Curl 7.5.2" "Curl Manual"
.TH curl 1 "19 January 2001" "Curl 7.6" "Curl Manual"
.SH NAME
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
HTTPS syntax.
.SH SYNOPSIS
.B curl [options]
.I url
.I [URL...]
.SH DESCRIPTION
.B curl
is a client to get documents/files from servers, using any of the
supported protocols. The command is designed to work without user
interaction or any kind of interactivity.
is a client to get documents/files from or send documents to a server, using
any of the supported protocols (HTTP, HTTPS, FTP, GOPHER, DICT, TELNET, LDAP
or FILE). The command is designed to work without user interaction or any kind
of interactivity.
curl offers a busload of useful tricks like proxy support, user
authentication, ftp upload, HTTP post, SSL (https:) connections, cookies, file
@@ -37,6 +38,9 @@ It is possible to specify up to 9 sets or series for a URL, but no nesting is
supported at the moment:
http://www.any.org/archive[1996-1999]/volume[1-4]part{a,b,c,index}.html
Starting with curl 7.6, you can specify any amount of URLs on the command
line. They will be fetched in a sequential manner in the specified order.
.SH OPTIONS
.IP "-a/--append"
(FTP)
@@ -120,11 +124,13 @@ To post data purely binary, you should instead use the --data-binary option.
-d/--data is the same as --data-ascii.
If this option is used serveral times, the last one will be used.
If this option is used serveral times, the ones following the first will
append data.
.IP "--data-ascii <data>"
(HTTP) This is an alias for the -d/--data option.
If this option is used serveral times, the last one will be used.
If this option is used serveral times, the ones following the first will
append data.
.IP "--data-binary <data>"
(HTTP) This posts data in a similar manner as --data-ascii does, although when
using this option the entire context of the posted data is kept as-is. If you
@@ -132,6 +138,9 @@ want to post a binary file without the strip-newlines feature of the
--data-ascii option, this is for you.
If this option is used serveral times, the last one will be used.
If this option is used serveral times, the ones following the first will
append data.
.IP "-D/--dump-header <file>"
(HTTP/FTP)
Write the HTTP headers to this file. Write the FTP file info to this
@@ -196,6 +205,12 @@ To read the file's content from stdin insted of a file, use - where the file
name should've been. This goes for both @ and < constructs.
This option can be used multiple times.
.IP "-g/--globoff"
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)
.IP "-h/--help"
Usage help.
.IP "-H/--header <header>"
@@ -311,11 +326,12 @@ or use several variables like:
curl http://{site,host}.host[1-5].com -o "#1_#2"
If this option is used serveral times, the last one will be used.
You may use this option as many times as you have number of URLs.
.IP "-O/--remote-name"
Write output to a local file named like the remote file we get. (Only
the file part of the remote file is used, the path is cut off.)
You may use this option as many times as you have number of URLs.
.IP "-p/--proxytunnel"
When an HTTP proxy is used, this option will cause non-HTTP protocols to
attempt to tunnel through the proxy instead of merely using it to do HTTP-like
@@ -436,10 +452,14 @@ password is specified, curl will ask for it interactively.
If this option is used serveral times, the last one will be used.
.IP "--url <URL>"
Set the URL to fetch. This option is mostly handy when you wanna specify URL
in a config file.
Specify a URL to fetch. This option is mostly handy when you wanna specify
URL(s) in a config file.
If this option is used serveral times, the last one will be used.
This option may be used any number of times. To control where this URL is written, use the
.I -o
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, '<'
@@ -765,6 +785,10 @@ If you do find bugs, mail them to curl-bug@haxx.se.
- T. Bharath <TBharath@responsenetworks.com>
- Alexander Kourakos <awk@users.sourceforge.net>
- James Griffiths <griffiths_james@yahoo.com>
- Loic Dachary <loic@senga.org>
- Robert Weaver <robert.weaver@sabre.com>
- Ingo Ralf Blum <ingoralfblum@ingoralfblum.com>
- Jun-ichiro itojun Hagino <itojun@iijlab.net>
.SH WWW
http://curl.haxx.se

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_init 3 "22 November 2000" "Curl 7.5" "libcurl Manual"
.TH curl_easy_init 3 "4 February 2001" "Curl 7.6.1" "libcurl Manual"
.SH NAME
curl_easy_getinfo - Extract information from a curl session (added in 7.4)
.SH SYNOPSIS
@@ -81,6 +81,14 @@ than one request if FOLLOWLOCATION is true.
Pass a pointer to a long to receive the result of the certification
verification that was requested (using the CURLOPT_SSL_VERIFYPEER option to
curl_easy_setopt). (Added in 7.4.2)
.TP
.B CURLINFO_CONTENT_LENGTH_DOWNLOAD
Pass a pointer to a double to receive the content-length of the download.
(Added in 7.6.1)
.TP
.B CURLINFO_CONTENT_LENGTH_UPLOAD
Pass a pointer to a double to receive the specified size of the upload.
(Added in 7.6.1)
.PP
.SH RETURN VALUE

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_perform 3 "26 May 2000" "Curl 7.0" "libcurl Manual"
.TH curl_easy_perform 3 "25 Jan 2001" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_easy_perform - Do the actual transfer in a "easy" session
.SH SYNOPSIS
@@ -16,6 +16,10 @@ are made, and will perform the transfer as described in the options.
It must be called with the same
.I handle
as input as the curl_easy_init call returned.
You are only allowed to call this function once using the same handle. If you
want to do repeated calls, you must call curl_easy_cleanup and curl_easy_init
again first.
.SH RETURN VALUE
0 means everything was ok, non-zero means an error occurred as
.I <curl/curl.h>

View File

@@ -2,7 +2,7 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_easy_setopt 3 "28 November 2000" "Curl 7.5" "libcurl Manual"
.TH curl_easy_setopt 3 "2 February 2001" "Curl 7.5" "libcurl Manual"
.SH NAME
curl_easy_setopt - Set curl easy-session options
.SH SYNOPSIS
@@ -35,6 +35,12 @@ Data pointer to pass instead of FILE * to the file write function. Note that
if you specify the
.I CURLOPT_WRITEFUNCTION
, this is the pointer you'll get as input.
NOTE: If you're using libcurl as a win32 .DLL, you MUST use a
.I CURLOPT_WRITEFUNCTION
if you set the
.I CURLOPT_FILE
option.
.TP
.B CURLOPT_WRITEFUNCTION
Function pointer that should use match the following prototype:
@@ -53,6 +59,12 @@ Data pointer to pass instead of FILE * to the file read function. Note that if
you specify the
.I CURLOPT_READFUNCTION
, this is the pointer you'll get as input.
NOTE: If you're using libcurl as a win32 .DLL, you MUST use a
.I CURLOPT_READFUNCTION
if you set the
.I CURLOPT_INFILE
option.
.TP
.B CURLOPT_READFUNCTION
Function pointer that should use match the following prototype:

View File

@@ -2,13 +2,13 @@
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_formparse 3 "6 June 2000" "Curl 7.0" "libcurl Manual"
.TH curl_formparse 3 "8 February 2001" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_formparse - add a section to a multipart/formdata HTTP POST
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "CURLcode *curl_formparse(char *" string, "struct HttpPost **" firstitem,
.BI "CURLcode curl_formparse(char *" string, "struct HttpPost **" firstitem,
.BI "struct HttpPost ** "lastitem ");"
.ad
.SH DESCRIPTION

11
docs/examples/Makefile.am Normal file
View File

@@ -0,0 +1,11 @@
#
# $Id$
#
AUTOMAKE_OPTIONS = foreign no-dependencies
EXTRA_DIST =
README curlgtk.c sepheaders.c simple.c postit.c
all:
@echo "done"

68
docs/examples/postit.c Normal file
View File

@@ -0,0 +1,68 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*
* Example code that uploads a file name 'foo' to a remote script that accepts
* "HTML form based" (as described in RFC1738) uploads using HTTP POST.
*
* The imaginary form we'll fill in looks like:
*
* <form method="post" enctype="multipart/form-data" action="examplepost.cgi">
* Enter file: <input type="file" name="sendfile" size="40">
* Enter file name: <input type="text" name="filename" size="30">
* <input type="submit" value="send" name="submit">
* </form>
*
* This exact source code has not been verified to work.
*/
#include <stdio.h>
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
struct HttpPost *formpost=NULL;
struct HttpPost *lastptr=NULL;
/* Fill in the file upload field */
curl_formparse("sendfile=@foo",
&formpost,
&lastptr);
/* Fill in the filename field */
curl_formparse("filename=foo",
&formpost,
&lastptr);
/* Fill in the submit field too, even if this is rarely needed */
curl_formparse("submit=send",
&formpost,
&lastptr);
curl = curl_easy_init();
if(curl) {
/* what URL that receives this POST */
curl_easy_setopt(curl, CURLOPT_URL, "http://curl.haxx.se/examplepost.cgi");
curl_easy_setopt(curl, CURLOPT_HTTPPOST, formpost);
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
/* then cleanup the formpost chain */
curl_formfree(formpost);
}
return 0;
}

View File

@@ -166,10 +166,6 @@ typedef enum {
#define CURL_ERROR_SIZE 256
/* maximum URL length we deal with in headers */
#define URL_MAX_LENGTH 4096
#define URL_MAX_LENGTH_TXT "4095"
/* name is uppercase CURLOPT_<name>,
type is one of the defined CURLOPTTYPE_<type>
number is unique identifier */
@@ -435,8 +431,10 @@ typedef enum {
NOTE: they return TRUE if the strings match *case insensitively*.
*/
extern int (strequal)(const char *s1, const char *s2);
extern int (strnequal)(const char *s1, const char *s2, size_t n);
extern int (Curl_strequal)(const char *s1, const char *s2);
extern int (Curl_strnequal)(const char *s1, const char *s2, size_t n);
#define strequal(a,b) Curl_strequal(a,b)
#define strnequal(a,b,c) Curl_strnequal(a,b,c)
/* external form function */
int curl_formparse(char *string,
@@ -454,8 +452,8 @@ char *curl_getenv(char *variable);
char *curl_version(void);
/* This is the version number */
#define LIBCURL_VERSION "7.5.2"
#define LIBCURL_VERSION_NUM 0x070502
#define LIBCURL_VERSION "7.6.1"
#define LIBCURL_VERSION_NUM 0x070601
/* linked-list structure for the CURLOPT_QUOTE option (and other) */
struct curl_slist {
@@ -556,7 +554,7 @@ CURLcode curl_setopt(CURL *handle, CURLoption option, ...);
CURLcode curl_close(CURL *curl); /* the opposite of curl_open() */
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
size_t *n);
ssize_t *n);
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
size_t *n);
@@ -678,7 +676,10 @@ typedef enum {
CURLINFO_SSL_VERIFYRESULT = CURLINFO_LONG + 13,
CURLINFO_FILETIME = CURLINFO_LONG + 14,
CURLINFO_LASTONE = 15
CURLINFO_CONTENT_LENGTH_DOWNLOAD = CURLINFO_DOUBLE + 15,
CURLINFO_CONTENT_LENGTH_UPLOAD = CURLINFO_DOUBLE + 16,
CURLINFO_LASTONE = 17
} CURLINFO;
/*

View File

@@ -55,26 +55,28 @@
#include <stdarg.h>
int mprintf(const char *format, ...);
int mfprintf(FILE *fd, const char *format, ...);
int msprintf(char *buffer, const char *format, ...);
int msnprintf(char *buffer, size_t maxlength, const char *format, ...);
int mvprintf(const char *format, va_list args);
int mvfprintf(FILE *fd, const char *format, va_list args);
int mvsprintf(char *buffer, const char *format, va_list args);
int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
char *maprintf(const char *format, ...);
char *mvaprintf(const char *format, va_list args);
int curl_mprintf(const char *format, ...);
int curl_mfprintf(FILE *fd, const char *format, ...);
int curl_msprintf(char *buffer, const char *format, ...);
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...);
int curl_mvprintf(const char *format, va_list args);
int curl_mvfprintf(FILE *fd, const char *format, va_list args);
int curl_mvsprintf(char *buffer, const char *format, va_list args);
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list args);
char *curl_maprintf(const char *format, ...);
char *curl_mvaprintf(const char *format, va_list args);
#ifdef _MPRINTF_REPLACE
# define printf mprintf
# define fprintf mfprintf
# define sprintf msprintf
# define snprintf msnprintf
# define vprintf mvprintf
# define vfprintf mvfprintf
# define vsprintf mvsprintf
# define vsnprintf mvsnprintf
# define printf curl_mprintf
# define fprintf curl_mfprintf
# define sprintf curl_msprintf
# define snprintf curl_msnprintf
# define vprintf curl_mvprintf
# define vfprintf curl_mvfprintf
# define vsprintf curl_mvsprintf
# define vsnprintf curl_mvsnprintf
# define aprintf curl_maprintf
# define vaprintf curl_mvaprintf
#endif
#endif /* H_MPRINTF */

View File

@@ -4,6 +4,10 @@
AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = getdate.y \
Makefile.b32 Makefile.b32.resp Makefile.m32 Makefile.vc6 \
libcurl.def dllinit.c
lib_LTLIBRARIES = libcurl.la
# Some flags needed when trying to cause warnings ;-)
@@ -49,12 +53,14 @@ 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 \
download.c getdate.h ldap.c ssluse.c version.c \
download.h getenv.c ldap.h ssluse.h \
escape.c getenv.h mprintf.c telnet.c \
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 highlevel.c strequal.c strequal.h easy.c \
security.h security.c krb4.c memdebug.c memdebug.h
getinfo.c transfer.c strequal.c strequal.h easy.c \
security.h security.c krb4.c krb4.h memdebug.c memdebug.h inet_ntoa_r.h
noinst_HEADERS = setup.h transfer.h
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
$(srcdir)/getdate.c: getdate.y

View File

@@ -29,7 +29,7 @@ LIBCURLLIB = libcurl.lib
SOURCES = \
base64.c \
cookie.c \
download.c \
transfer.c \
escape.c \
formdata.c \
ftp.c \
@@ -54,7 +54,6 @@ SOURCES = \
getinfo.c \
version.c \
easy.c \
highlevel.c \
strequal.c
OBJECTS = $(SOURCES:.c=.obj)

View File

@@ -1,6 +1,6 @@
+base64.obj &
+cookie.obj &
+download.obj &
+transfer.obj &
+escape.obj &
+formdata.obj &
+ftp.obj &
@@ -25,5 +25,4 @@
+getinfo.obj &
+version.obj &
+easy.obj &
+highlevel.obj &
+strequal.obj

View File

@@ -1,357 +0,0 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#
# $Id$
#
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CC = @CC@
DLLTOOL = @DLLTOOL@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
NROFF = @NROFF@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
PERL = @PERL@
RANLIB = @RANLIB@
VERSION = @VERSION@
YACC = @YACC@
AUTOMAKE_OPTIONS = foreign
lib_LTLIBRARIES = libcurl.la
# Some flags needed when trying to cause warnings ;-)
# CFLAGS = -DMALLOCDEBUG -g # -Wall #-pedantic
INCLUDES = -I$(top_srcdir)/include
libcurl_la_LDFLAGS = -version-info 1:0: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.
#
# If either revision or age are omitted, they default to 0. Also note that age
# must be less than or equal to the current interface number.
#
# Here are a set of rules to help you update your library version information:
#
# 1.Start with version information of 0:0:0 for each libtool library.
#
# 2.Update the version information only immediately before a public release of
# your software. More frequent updates are unnecessary, and only guarantee
# that the current interface number gets larger faster.
#
# 3.If the library source code has changed at all since the last update, then
# increment revision (c:r:a becomes c:r+1:a).
#
# 4.If any interfaces have been added, removed, or changed since the last
# update, increment current, and set revision to 0.
#
# 5.If any interfaces have been added since the last public release, then
# increment age.
#
# 6.If any interfaces have been removed since the last public release, then
# 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 download.c getdate.h ldap.c ssluse.c version.c download.h getenv.c ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c telnet.h getinfo.c highlevel.c strequal.c strequal.h easy.c security.h security.c krb4.c memdebug.c memdebug.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h ../src/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(lib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I../src
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libcurl_la_LIBADD =
libcurl_la_OBJECTS = file.lo timeval.lo base64.lo hostip.lo progress.lo \
formdata.lo cookie.lo http.lo sendf.lo ftp.lo url.lo dict.lo if2ip.lo \
speedcheck.lo getdate.lo download.lo ldap.lo ssluse.lo version.lo \
getenv.lo escape.lo mprintf.lo telnet.lo getpass.lo netrc.lo getinfo.lo \
highlevel.lo strequal.lo easy.lo security.lo krb4.lo memdebug.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(libcurl_la_SOURCES)
OBJECTS = $(libcurl_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libcurl.la: $(libcurl_la_OBJECTS) $(libcurl_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libcurl_la_LDFLAGS) $(libcurl_la_OBJECTS) $(libcurl_la_LIBADD) $(LIBS)
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = lib
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLTLIBRARIES
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLTLIBRARIES
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-libLTLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
distclean-compile clean-compile maintainer-clean-compile \
mostlyclean-libtool distclean-libtool clean-libtool \
maintainer-clean-libtool tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
# Say $(srcdir), so GNU make does not report an ambiguity with the .y.c rule.
$(srcdir)/getdate.c: getdate.y
cd $(srcdir) && \
$(YACC) $(YFLAGS) getdate.y; \
mv -f y.tab.c getdate.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -30,16 +30,16 @@ libcurl_a_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 download.c getdate.h ldap.c ssluse.c version.c download.h getenv.c \
urldata.h transfer.c getdate.h ldap.c ssluse.c version.c transfer.h getenv.c \
ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c \
telnet.h getinfo.c highlevel.c strequal.c strequal.h easy.c security.h \
telnet.h getinfo.c strequal.c strequal.h easy.c security.h \
security.c krb4.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 download.o ldap.o ssluse.o version.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 \
highlevel.o strequal.o easy.o security.o krb4.o
strequal.o easy.o security.o krb4.o
LIBRARIES = $(libcurl_a_LIBRARIES)
SOURCES = $(libcurl_a_SOURCES)

View File

@@ -33,7 +33,7 @@ LINKSLIBS = libeay32.lib ssleay32.lib RSAglue.lib
RELEASE_OBJS= \
base64r.obj \
cookier.obj \
downloadr.obj \
transferr.obj \
escaper.obj \
formdatar.obj \
ftpr.obj \
@@ -58,13 +58,12 @@ RELEASE_OBJS= \
getinfor.obj \
versionr.obj \
easyr.obj \
highlevelr.obj \
strequalr.obj
DEBUG_OBJS= \
base64d.obj \
cookied.obj \
downloadd.obj \
transferd.obj \
escaped.obj \
formdatad.obj \
ftpd.obj \
@@ -89,13 +88,12 @@ DEBUG_OBJS= \
getinfod.obj \
versiond.obj \
easyd.obj \
highleveld.obj \
strequald.obj
RELEASE_SSL_OBJS= \
base64rs.obj \
cookiers.obj \
downloadrs.obj \
transferrs.obj \
escapers.obj \
formdatars.obj \
ftprs.obj \
@@ -120,13 +118,12 @@ RELEASE_SSL_OBJS= \
getinfors.obj \
versionrs.obj \
easyrs.obj \
highlevelrs.obj \
strequalrs.obj
LINK_OBJS= \
base64.obj \
cookie.obj \
download.obj \
transfer.obj \
escape.obj \
formdata.obj \
ftp.obj \
@@ -151,7 +148,6 @@ LINK_OBJS= \
getinfo.obj \
version.obj \
easy.obj \
highlevel.obj \
strequal.obj
all : release
@@ -170,8 +166,8 @@ base64r.obj: base64.c
$(CCR) $(CFLAGS) base64.c
cookier.obj: cookie.c
$(CCR) $(CFLAGS) cookie.c
downloadr.obj: download.c
$(CCR) $(CFLAGS) download.c
transferr.obj: transfer.c
$(CCR) $(CFLAGS) transfer.c
escaper.obj: escape.c
$(CCR) $(CFLAGS) escape.c
formdatar.obj: formdata.c
@@ -220,8 +216,6 @@ versionr.obj: version.c
$(CCR) $(CFLAGS) version.c
easyr.obj: easy.c
$(CCR) $(CFLAGS) easy.c
highlevelr.obj: highlevel.c
$(CCR) $(CFLAGS) highlevel.c
strequalr.obj: strequal.c
$(CCR) $(CFLAGS) strequal.c
@@ -230,8 +224,8 @@ base64d.obj: base64.c
$(CCD) $(CFLAGS) base64.c
cookied.obj: cookie.c
$(CCD) $(CFLAGS) cookie.c
downloadd.obj: download.c
$(CCD) $(CFLAGS) download.c
transferd.obj: transfer.c
$(CCD) $(CFLAGS) transfer.c
escaped.obj: escape.c
$(CCD) $(CFLAGS) escape.c
formdatad.obj: formdata.c
@@ -280,8 +274,6 @@ versiond.obj: version.c
$(CCD) $(CFLAGS) version.c
easyd.obj: easy.c
$(CCD) $(CFLAGS) easy.c
highleveld.obj: highlevel.c
$(CCD) $(CFLAGS) highlevel.c
strequald.obj: strequal.c
$(CCD) $(CFLAGS) strequal.c
@@ -291,8 +283,8 @@ base64rs.obj: base64.c
$(CCRS) $(CFLAGS) base64.c
cookiers.obj: cookie.c
$(CCRS) $(CFLAGS) cookie.c
downloadrs.obj: download.c
$(CCRS) $(CFLAGS) download.c
transferrs.obj: transfer.c
$(CCRS) $(CFLAGS) transfer.c
escapers.obj: escape.c
$(CCRS) $(CFLAGS) escape.c
formdatars.obj: formdata.c
@@ -341,8 +333,6 @@ versionrs.obj: version.c
$(CCRS) $(CFLAGS) version.c
easyrs.obj: easy.c
$(CCRS) $(CFLAGS) easy.c
highlevelrs.obj: highlevel.c
$(CCRS) $(CFLAGS) highlevel.c
strequalrs.obj: strequal.c
$(CCRS) $(CFLAGS) strequal.c

View File

@@ -63,6 +63,7 @@
#define SYNCH 242 /* for telfunc calls */
#ifdef TELCMDS
static
char *telcmds[] = {
"EOF", "SUSP", "ABORT", "EOR",
"SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC",
@@ -124,6 +125,7 @@ extern char *telcmds[];
#define NTELOPTS (1+TELOPT_NEW_ENVIRON)
#ifdef TELOPTS
static
char *telopts[NTELOPTS+1] = {
"BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME",
"STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP",

View File

@@ -55,7 +55,7 @@ static int pos(char c)
}
#if 1
int base64_encode(const void *data, int size, char **str)
int Curl_base64_encode(const void *data, int size, char **str)
{
char *s, *p;
int i;
@@ -93,7 +93,7 @@ int base64_encode(const void *data, int size, char **str)
}
#endif
int base64_decode(const char *str, void *data)
int Curl_base64_decode(const char *str, void *data)
{
const char *p;
unsigned char *q;

View File

@@ -34,6 +34,7 @@
#ifndef __BASE64_H
#define __BASE64_H
int base64_encode(const void *data, int size, char **str);
int Curl_base64_encode(const void *data, int size, char **str);
int Curl_base64_decode(const char *str, void *data);
#endif

View File

@@ -100,9 +100,10 @@ Example set of cookies:
*
***************************************************************************/
struct Cookie *cookie_add(struct CookieInfo *c,
bool httpheader, /* TRUE if HTTP header-style line */
char *lineptr) /* first non-space of the line */
struct Cookie *
Curl_cookie_add(struct CookieInfo *c,
bool httpheader, /* TRUE if HTTP header-style line */
char *lineptr) /* first non-space of the line */
{
struct Cookie *clist;
char what[MAX_COOKIE_LINE];
@@ -347,7 +348,7 @@ struct Cookie *cookie_add(struct CookieInfo *c,
* called before any cookies are set. File may be NULL.
*
****************************************************************************/
struct CookieInfo *cookie_init(char *file)
struct CookieInfo *Curl_cookie_init(char *file)
{
char line[MAX_COOKIE_LINE];
struct CookieInfo *c;
@@ -375,7 +376,7 @@ struct CookieInfo *cookie_init(char *file)
while(*lineptr && isspace((int)*lineptr))
lineptr++;
cookie_add(c, TRUE, lineptr);
Curl_cookie_add(c, TRUE, lineptr);
}
else {
/* This might be a netscape cookie-file line, get it! */
@@ -383,7 +384,7 @@ struct CookieInfo *cookie_init(char *file)
while(*lineptr && isspace((int)*lineptr))
lineptr++;
cookie_add(c, FALSE, lineptr);
Curl_cookie_add(c, FALSE, lineptr);
}
}
if(fromfile)
@@ -405,8 +406,8 @@ struct CookieInfo *cookie_init(char *file)
*
****************************************************************************/
struct Cookie *cookie_getlist(struct CookieInfo *c,
char *host, char *path, bool secure)
struct Cookie *Curl_cookie_getlist(struct CookieInfo *c,
char *host, char *path, bool secure)
{
struct Cookie *newco;
struct Cookie *co;
@@ -473,7 +474,7 @@ struct Cookie *cookie_getlist(struct CookieInfo *c,
*
****************************************************************************/
void cookie_freelist(struct Cookie *co)
void Curl_cookie_freelist(struct Cookie *co)
{
struct Cookie *next;
if(co) {
@@ -493,7 +494,7 @@ void cookie_freelist(struct Cookie *co)
* Free a "cookie object" previous created with cookie_init().
*
****************************************************************************/
void cookie_cleanup(struct CookieInfo *c)
void Curl_cookie_cleanup(struct CookieInfo *c)
{
struct Cookie *co;
struct Cookie *next;

View File

@@ -63,10 +63,10 @@ struct CookieInfo {
#define MAX_NAME 256
#define MAX_NAME_TXT "255"
struct Cookie *cookie_add(struct CookieInfo *, bool, char *);
struct CookieInfo *cookie_init(char *);
struct Cookie *cookie_getlist(struct CookieInfo *, char *, char *, bool);
void cookie_freelist(struct Cookie *);
void cookie_cleanup(struct CookieInfo *);
struct Cookie *Curl_cookie_add(struct CookieInfo *, bool, char *);
struct CookieInfo *Curl_cookie_init(char *);
struct Cookie *Curl_cookie_getlist(struct CookieInfo *, char *, char *, bool);
void Curl_cookie_freelist(struct Cookie *);
void Curl_cookie_cleanup(struct CookieInfo *);
#endif

View File

@@ -71,7 +71,7 @@
#include "urldata.h"
#include <curl/curl.h>
#include "download.h"
#include "transfer.h"
#include "sendf.h"
#include "progress.h"
@@ -80,12 +80,12 @@
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
CURLcode dict_done(struct connectdata *conn)
CURLcode Curl_dict_done(struct connectdata *conn)
{
return CURLE_OK;
}
CURLcode dict(struct connectdata *conn)
CURLcode Curl_dict(struct connectdata *conn)
{
int nth;
char *word;
@@ -141,21 +141,21 @@ CURLcode dict(struct connectdata *conn)
nth = atoi(nthdef);
}
sendf(data->firstsocket, data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"MATCH "
"%s " /* database */
"%s " /* strategy */
"%s\n" /* word */
"QUIT\n",
Curl_sendf(data->firstsocket, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"MATCH "
"%s " /* database */
"%s " /* strategy */
"%s\n" /* word */
"QUIT\n",
database,
strategy,
word
);
database,
strategy,
word
);
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
if(result)
return result;
@@ -191,20 +191,20 @@ CURLcode dict(struct connectdata *conn)
nth = atoi(nthdef);
}
sendf(data->firstsocket, data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"DEFINE "
"%s " /* database */
"%s\n" /* word */
"QUIT\n",
database,
word
);
Curl_sendf(data->firstsocket, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"DEFINE "
"%s " /* database */
"%s\n" /* word */
"QUIT\n",
database,
word
);
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL); /* no upload */
if(result)
return result;
@@ -220,14 +220,14 @@ CURLcode dict(struct connectdata *conn)
if (ppath[i] == ':')
ppath[i] = ' ';
}
sendf(data->firstsocket, data,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"%s\n"
"QUIT\n",
ppath);
Curl_sendf(data->firstsocket, conn,
"CLIENT " LIBCURL_NAME " " LIBCURL_VERSION "\n"
"%s\n"
"QUIT\n",
ppath);
result = Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL);
result = Curl_Transfer(conn, data->firstsocket, -1, FALSE, bytecount,
-1, NULL);
if(result)
return result;

View File

@@ -23,7 +23,7 @@
*
* $Id$
*****************************************************************************/
CURLcode dict(struct connectdata *conn);
CURLcode dict_done(struct connectdata *conn);
CURLcode Curl_dict(struct connectdata *conn);
CURLcode Curl_dict_done(struct connectdata *conn);
#endif

View File

@@ -1,100 +0,0 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2000, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* In order to be useful for every potential user, curl and libcurl are
* dual-licensed under the MPL and the MIT/X-derivate licenses.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the MPL or the MIT/X-derivate
* licenses. You may pick one of these licenses.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id$
*****************************************************************************/
#include "setup.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
#include "urldata.h"
#include <curl/curl.h>
#ifdef __BEOS__
#include <net/socket.h>
#endif
#ifdef WIN32
#if !defined( __GNUC__) || defined(__MINGW32__)
#include <winsock.h>
#endif
#include <time.h> /* for the time_t typedef! */
#if defined(__GNUC__) && defined(TIME_WITH_SYS_TIME)
#include <sys/time.h>
#endif
#endif
#include "progress.h"
#include "speedcheck.h"
#include "sendf.h"
#include <curl/types.h>
/* --- download and upload a stream from/to a socket --- */
/* Parts of this function was brought to us by the friendly Mark Butler
<butlerm@xmission.com>. */
CURLcode
Transfer(CURLconnect *c_conn,
/* READ stuff */
int sockfd, /* socket to read from or -1 */
int size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */
long *bytecountp, /* return number of bytes read or NULL */
/* WRITE stuff */
int writesockfd, /* socket to write to, it may very well be
the same we read from. -1 disables */
long *writebytecountp /* return number of bytes written or NULL */
)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!conn)
return CURLE_BAD_FUNCTION_ARGUMENT;
/* now copy all input parameters */
conn->sockfd = sockfd;
conn->size = size;
conn->getheader = getheader;
conn->bytecountp = bytecountp;
conn->writesockfd = writesockfd;
conn->writebytecountp = writebytecountp;
return CURLE_OK;
}

View File

@@ -72,7 +72,7 @@
#include "urldata.h"
#include <curl/curl.h>
#include "highlevel.h"
#include "transfer.h"
#include <curl/types.h>
#define _MPRINTF_REPLACE /* use our functions only */

View File

@@ -106,7 +106,7 @@ CURLcode file(struct connectdata *conn)
struct UrlData *data = conn->data;
char *buf = data->buffer;
int bytecount = 0;
struct timeval start = tvnow();
struct timeval start = Curl_tvnow();
struct timeval now = start;
int fd;
char *actual_path = curl_unescape(path, 0);
@@ -139,7 +139,7 @@ CURLcode file(struct connectdata *conn)
it avoids problems with select() and recv() on file descriptors
in Winsock */
if(expected_size != -1)
pgrsSetDownloadSize(data, expected_size);
Curl_pgrsSetDownloadSize(data, expected_size);
while (res == CURLE_OK) {
nread = read(fd, buf, BUFSIZE-1);
@@ -155,16 +155,16 @@ CURLcode file(struct connectdata *conn)
to prevent CR/LF translation (this then goes to a binary mode
file descriptor). */
res = client_write(data, CLIENTWRITE_BODY, buf, nread);
res = Curl_client_write(data, CLIENTWRITE_BODY, buf, nread);
if(res)
return res;
now = tvnow();
if(pgrsUpdate(data))
now = Curl_tvnow();
if(Curl_pgrsUpdate(data))
res = CURLE_ABORTED_BY_CALLBACK;
}
now = tvnow();
if(pgrsUpdate(data))
now = Curl_tvnow();
if(Curl_pgrsUpdate(data))
res = CURLE_ABORTED_BY_CALLBACK;
close(fd);

View File

@@ -91,16 +91,10 @@ static void GetStr(char **string,
*
***************************************************************************/
int curl_formparse(char *input,
struct HttpPost **httppost,
struct HttpPost **last_post)
{
return FormParse(input, httppost, last_post);
}
#define FORM_FILE_SEPARATOR ','
#define FORM_TYPE_SEPARATOR ';'
static
int FormParse(char *input,
struct HttpPost **httppost,
struct HttpPost **last_post)
@@ -298,6 +292,13 @@ int FormParse(char *input,
return 0;
}
int curl_formparse(char *input,
struct HttpPost **httppost,
struct HttpPost **last_post)
{
return FormParse(input, httppost, last_post);
}
static int AddFormData(struct FormData **formp,
void *line,
long length)
@@ -339,7 +340,7 @@ static int AddFormDataf(struct FormData **formp,
}
char *MakeFormBoundary(void)
char *Curl_FormBoundary(void)
{
char *retstring;
static int randomizer=0; /* this is just so that two boundaries within
@@ -367,7 +368,7 @@ char *MakeFormBoundary(void)
}
/* Used from http.c */
void FormFree(struct FormData *form)
void Curl_FormFree(struct FormData *form)
{
struct FormData *next;
do {
@@ -400,8 +401,8 @@ void curl_formfree(struct HttpPost *form)
} while((form=next)); /* continue */
}
struct FormData *getFormData(struct HttpPost *post,
int *sizep)
struct FormData *Curl_getFormData(struct HttpPost *post,
int *sizep)
{
struct FormData *form = NULL;
struct FormData *firstform;
@@ -415,7 +416,7 @@ struct FormData *getFormData(struct HttpPost *post,
if(!post)
return NULL; /* no input => no output! */
boundary = MakeFormBoundary();
boundary = Curl_FormBoundary();
/* Make the first line of the output */
AddFormDataf(&form,
@@ -439,7 +440,7 @@ struct FormData *getFormData(struct HttpPost *post,
/* If used, this is a link to more file names, we must then do
the magic to include several files with the same field name */
fileboundary = MakeFormBoundary();
fileboundary = Curl_FormBoundary();
size += AddFormDataf(&form,
"\r\nContent-Type: multipart/mixed,"
@@ -535,24 +536,11 @@ struct FormData *getFormData(struct HttpPost *post,
return firstform;
}
int FormInit(struct Form *form, struct FormData *formdata )
int Curl_FormInit(struct Form *form, struct FormData *formdata )
{
if(!formdata)
return 1; /* error */
#if 0
struct FormData *lastnode=formdata;
/* find the last node in the list */
while(lastnode->next) {
lastnode = lastnode->next;
}
/* Now, make sure that we'll send a nice terminating sequence at the end
* of the post. We *DONT* add this string to the size of the data since this
* is actually AFTER the data. */
AddFormDataf(&lastnode, "\r\n\r\n");
#endif
form->data = formdata;
form->sent = 0;
@@ -560,10 +548,10 @@ int FormInit(struct Form *form, struct FormData *formdata )
}
/* fread() emulation */
int FormReader(char *buffer,
size_t size,
size_t nitems,
FILE *mydata)
int Curl_FormReader(char *buffer,
size_t size,
size_t nitems,
FILE *mydata)
{
struct Form *form;
int wantedsize;
@@ -638,7 +626,7 @@ int main(int argc, char **argv)
}
}
form=getFormData(httppost, &size);
form=Curl_getFormData(httppost, &size);
FormInit(&formread, form);

View File

@@ -36,23 +36,19 @@ struct Form {
been sent in a previous invoke */
};
int FormParse(char *string,
struct HttpPost **httppost,
struct HttpPost **last_post);
int Curl_FormInit(struct Form *form, struct FormData *formdata );
int FormInit(struct Form *form, struct FormData *formdata );
struct FormData *getFormData(struct HttpPost *post,
int *size);
struct FormData *Curl_getFormData(struct HttpPost *post,
int *size);
/* fread() emulation */
int FormReader(char *buffer,
size_t size,
size_t nitems,
FILE *mydata);
int Curl_FormReader(char *buffer,
size_t size,
size_t nitems,
FILE *mydata);
char *MakeFormBoundary(void);
char *Curl_FormBoundary(void);
void FormFree(struct FormData *);
void Curl_FormFree(struct FormData *);
#endif

437
lib/ftp.c
View File

@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <errno.h>
@@ -66,18 +67,27 @@
#include "if2ip.h"
#include "hostip.h"
#include "progress.h"
#include "download.h"
#include "transfer.h"
#include "escape.h"
#include "http.h" /* for HTTP proxy tunnel stuff */
#include "ftp.h"
#ifdef KRB4
#include "security.h"
#include "krb4.h"
#endif
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
/* The last #include file should be: */
#ifdef MALLOCDEBUG
#include "memdebug.h"
#endif
/* easy-to-use macro: */
#define ftpsendf Curl_ftpsendf
/* returns last node in linked list */
static struct curl_slist *slist_get_last(struct curl_slist *list)
{
@@ -202,12 +212,16 @@ static CURLcode AllowServerConnect(struct UrlData *data,
#define lastline(line) (isdigit((int)line[0]) && isdigit((int)line[1]) && \
isdigit((int)line[2]) && (' ' == line[3]))
int GetLastResponse(int sockfd, char *buf,
struct connectdata *conn,
int *ftpcode)
/*
* We allow the ftpcode pointer to be NULL if no reply integer is wanted
*/
int Curl_GetFTPResponse(int sockfd, char *buf,
struct connectdata *conn,
int *ftpcode)
{
int nread;
int keepon=TRUE;
ssize_t keepon=TRUE;
char *ptr;
int timeout = 3600; /* in seconds */
struct timeval interval;
@@ -220,12 +234,13 @@ int GetLastResponse(int sockfd, char *buf,
#define SELECT_TIMEOUT 2
int error = SELECT_OK;
*ftpcode=0; /* 0 for errors */
if(ftpcode)
*ftpcode=0; /* 0 for errors */
if(data->timeout) {
/* if timeout is requested, find out how much remaining time we have */
timeout = data->timeout - /* timeout time */
(tvlong(tvnow()) - tvlong(conn->now)); /* spent time */
(Curl_tvlong(Curl_tvnow()) - Curl_tvlong(conn->now)); /* spent time */
if(timeout <=0 ) {
failf(data, "Transfer aborted due to timeout");
return -SELECT_TIMEOUT; /* already too little time */
@@ -257,22 +272,21 @@ int GetLastResponse(int sockfd, char *buf,
break;
case 0: /* timeout */
error = SELECT_TIMEOUT;
infof(data, "Transfer aborted due to timeout\n");
failf(data, "Transfer aborted due to timeout");
break;
default:
#ifdef USE_SSLEAY
if (data->ssl.use) {
keepon = SSL_read(data->ssl.handle, ptr, 1);
/*
* This code previously didn't use the kerberos sec_read() code
* to read, but when we use Curl_read() it may do so. Do confirm
* that this is still ok and then remove this comment!
*/
if(CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &keepon))
keepon = FALSE;
else if(keepon <= 0) {
error = SELECT_ERROR;
failf(data, "Connection aborted");
}
else {
#endif
keepon = sread(sockfd, ptr, 1);
#ifdef USE_SSLEAY
}
#endif /* USE_SSLEAY */
if ((*ptr == '\n') || (*ptr == '\r'))
else if ((*ptr == '\n') || (*ptr == '\r'))
keepon = FALSE;
}
if(keepon) {
@@ -306,13 +320,14 @@ int GetLastResponse(int sockfd, char *buf,
if(error)
return -error;
*ftpcode=atoi(buf); /* return the initial number like this */
if(ftpcode)
*ftpcode=atoi(buf); /* return the initial number like this */
return nread;
}
/* -- who are we? -- */
char *getmyhost(char *buf, int buf_size)
char *Curl_getmyhost(char *buf, int buf_size)
{
#if defined(HAVE_GETHOSTNAME)
gethostname(buf, buf_size);
@@ -330,7 +345,7 @@ char *getmyhost(char *buf, int buf_size)
/* ftp_connect() should do everything that is to be considered a part
of the connection phase. */
CURLcode ftp_connect(struct connectdata *conn)
CURLcode Curl_ftp_connect(struct connectdata *conn)
{
/* this is FTP and no proxy */
int nread;
@@ -356,14 +371,14 @@ CURLcode ftp_connect(struct connectdata *conn)
if (data->bits.tunnel_thru_httpproxy) {
/* We want "seamless" FTP operations through HTTP proxy tunnel */
result = GetHTTPProxyTunnel(data, data->firstsocket,
data->hostname, data->remote_port);
result = Curl_ConnectHTTPProxyTunnel(conn, data->firstsocket,
data->hostname, data->remote_port);
if(CURLE_OK != result)
return result;
}
/* The first thing we do is wait for the "220*" line: */
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -396,7 +411,7 @@ CURLcode ftp_connect(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "USER %s", ftp->user);
/* wait for feedback */
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -410,7 +425,7 @@ CURLcode ftp_connect(struct connectdata *conn)
/* 331 Password required for ...
(the server requires to send the user's password too) */
ftpsendf(data->firstsocket, conn, "PASS %s", ftp->passwd);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -459,7 +474,7 @@ CURLcode ftp_connect(struct connectdata *conn)
/* argument is already checked for validity */
CURLcode ftp_done(struct connectdata *conn)
CURLcode Curl_ftp_done(struct connectdata *conn)
{
struct UrlData *data = conn->data;
struct FTP *ftp = data->proto.ftp;
@@ -496,7 +511,7 @@ CURLcode ftp_done(struct connectdata *conn)
if(!data->bits.no_body) {
/* now let's see what the server says about the transfer we
just performed: */
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -516,7 +531,7 @@ CURLcode ftp_done(struct connectdata *conn)
if (qitem->data) {
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -530,9 +545,6 @@ CURLcode ftp_done(struct connectdata *conn)
}
}
free(ftp);
data->proto.ftp=NULL; /* it is gone */
return CURLE_OK;
}
@@ -553,6 +565,9 @@ CURLcode _ftp(struct connectdata *conn)
#if defined (HAVE_INET_NTOA_R)
char ntoa_buf[64];
#endif
#ifdef ENABLE_IPV6
struct addrinfo *ai;
#endif
struct curl_slist *qitem; /* QUOTE item */
/* the ftp struct is already inited in ftp_connect() */
@@ -570,7 +585,7 @@ CURLcode _ftp(struct connectdata *conn)
if (qitem->data) {
ftpsendf(data->firstsocket, conn, "%s", qitem->data);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -587,7 +602,7 @@ CURLcode _ftp(struct connectdata *conn)
/* change directory first! */
if(ftp->dir && ftp->dir[0]) {
ftpsendf(data->firstsocket, conn, "CWD %s", ftp->dir);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -602,7 +617,7 @@ CURLcode _ftp(struct connectdata *conn)
again a grey area as the MDTM is not kosher RFC959 */
ftpsendf(data->firstsocket, conn, "MDTM %s", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -639,7 +654,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "TYPE %s",
(data->bits.ftp_ascii)?"A":"I");
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -652,7 +667,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -664,7 +679,7 @@ CURLcode _ftp(struct connectdata *conn)
filesize = atoi(buf+4);
sprintf(buf, "Content-Length: %d\r\n", filesize);
result = client_write(data, CLIENTWRITE_BOTH, buf, 0);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
if(result)
return result;
@@ -680,7 +695,7 @@ CURLcode _ftp(struct connectdata *conn)
/* 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 = client_write(data, CLIENTWRITE_BOTH, buf, 0);
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
if(result)
return result;
}
@@ -691,6 +706,178 @@ CURLcode _ftp(struct connectdata *conn)
/* We have chosen to use the PORT command */
if(data->bits.ftp_use_port) {
#ifdef ENABLE_IPV6
struct addrinfo hints, *res, *ai;
struct sockaddr_storage ss;
int sslen;
char hbuf[NI_MAXHOST];
char *localaddr;
struct sockaddr *sa=(struct sockaddr *)&ss;
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
#endif
unsigned char *ap;
unsigned char *pp;
int alen, plen;
char portmsgbuf[4096], tmp[4096];
char *p;
char *mode[] = { "EPRT", "LPRT", "PORT", NULL };
char **modep;
/*
* we should use Curl_if2ip? given pickiness of recent ftpd,
* I believe we should use the same address as the control connection.
*/
sslen = sizeof(ss);
if (getsockname(data->firstsocket, (struct sockaddr *)&ss, &sslen) < 0)
return CURLE_FTP_PORT_FAILED;
if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf), NULL, 0,
niflags))
return CURLE_FTP_PORT_FAILED;
memset(&hints, 0, sizeof(hints));
hints.ai_family = sa->sa_family;
/*hints.ai_family = ss.ss_family;
this way can be used if sockaddr_storage is properly defined, as glibc
2.1.X doesn't do*/
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE;
if (getaddrinfo(hbuf, "0", &hints, &res))
return CURLE_FTP_PORT_FAILED;
portsock = -1;
for (ai = res; ai; ai = ai->ai_next) {
portsock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (portsock < 0)
continue;
if (bind(portsock, ai->ai_addr, ai->ai_addrlen) < 0) {
close(portsock);
portsock = -1;
continue;
}
if (listen(portsock, 1) < 0) {
close(portsock);
portsock = -1;
continue;
}
break;
}
if (portsock < 0) {
failf(data, strerror(errno));
freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
sslen = sizeof(ss);
if (getsockname(portsock, sa, &sslen) < 0) {
failf(data, strerror(errno));
freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
for (modep = mode; modep && *modep; modep++) {
int lprtaf, eprtaf;
switch (sa->sa_family) {
case AF_INET:
ap = (char *)&((struct sockaddr_in *)&ss)->sin_addr;
alen = sizeof(((struct sockaddr_in *)&ss)->sin_addr);
pp = (char *)&((struct sockaddr_in *)&ss)->sin_port;
plen = sizeof(((struct sockaddr_in *)&ss)->sin_port);
lprtaf = 4;
eprtaf = 1;
break;
case AF_INET6:
ap = (char *)&((struct sockaddr_in6 *)&ss)->sin6_addr;
alen = sizeof(((struct sockaddr_in6 *)&ss)->sin6_addr);
pp = (char *)&((struct sockaddr_in6 *)&ss)->sin6_port;
plen = sizeof(((struct sockaddr_in6 *)&ss)->sin6_port);
lprtaf = 6;
eprtaf = 2;
break;
default:
ap = pp = NULL;
lprtaf = eprtaf = -1;
break;
}
if (strcmp(*modep, "EPRT") == 0) {
if (eprtaf < 0)
continue;
if (getnameinfo((struct sockaddr *)&ss, sslen,
portmsgbuf, sizeof(portmsgbuf), tmp, sizeof(tmp), niflags))
continue;
/* do not transmit IPv6 scope identifier to the wire */
if (sa->sa_family == AF_INET6) {
char *q = strchr(portmsgbuf, '%');
if (q)
*q = '\0';
}
ftpsendf(data->firstsocket, conn, "%s |%d|%s|%s|", *modep, eprtaf,
portmsgbuf, tmp);
} else if (strcmp(*modep, "LPRT") == 0 || strcmp(*modep, "PORT") == 0) {
int i;
if (strcmp(*modep, "LPRT") == 0 && lprtaf < 0)
continue;
if (strcmp(*modep, "PORT") == 0 && sa->sa_family != AF_INET)
continue;
portmsgbuf[0] = '\0';
if (strcmp(*modep, "LPRT") == 0) {
snprintf(tmp, sizeof(tmp), "%d,%d", lprtaf, alen);
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf)) {
goto again;
}
}
for (i = 0; i < alen; i++) {
if (portmsgbuf[0])
snprintf(tmp, sizeof(tmp), ",%u", ap[i]);
else
snprintf(tmp, sizeof(tmp), "%u", ap[i]);
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf)) {
goto again;
}
}
if (strcmp(*modep, "LPRT") == 0) {
snprintf(tmp, sizeof(tmp), ",%d", plen);
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf))
goto again;
}
for (i = 0; i < plen; i++) {
snprintf(tmp, sizeof(tmp), ",%u", pp[i]);
if (strlcat(portmsgbuf, tmp, sizeof(portmsgbuf)) >= sizeof(portmsgbuf)) {
goto again;
}
}
ftpsendf(data->firstsocket, conn, "%s %s", *modep, portmsgbuf);
}
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if (nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if (ftpcode != 200) {
failf(data, "Server does not grok %s", *modep);
continue;
} else
break;
again:;
}
if (!*modep) {
close(portsock);
freeaddrinfo(res);
return CURLE_FTP_PORT_FAILED;
}
#else
struct sockaddr_in sa;
struct hostent *h=NULL;
char *hostdataptr=NULL;
@@ -699,18 +886,20 @@ CURLcode _ftp(struct connectdata *conn)
char myhost[256] = "";
if(data->ftpport) {
if(if2ip(data->ftpport, myhost, sizeof(myhost))) {
h = GetHost(data, myhost, &hostdataptr);
if(Curl_if2ip(data->ftpport, myhost, sizeof(myhost))) {
h = Curl_gethost(data, myhost, &hostdataptr);
}
else {
if(strlen(data->ftpport)>1)
h = GetHost(data, data->ftpport, &hostdataptr);
h = Curl_gethost(data, data->ftpport, &hostdataptr);
if(h)
strcpy(myhost, data->ftpport); /* buffer overflow risk */
}
}
if(! *myhost) {
h=GetHost(data, getmyhost(myhost, sizeof(myhost)), &hostdataptr);
h=Curl_gethost(data,
Curl_getmyhost(myhost, sizeof(myhost)),
&hostdataptr);
}
infof(data, "We connect from %s\n", myhost);
@@ -788,7 +977,7 @@ CURLcode _ftp(struct connectdata *conn)
porttouse & 255);
}
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -796,26 +985,43 @@ CURLcode _ftp(struct connectdata *conn)
failf(data, "Server does not grok PORT, try without it!");
return CURLE_FTP_PORT_FAILED;
}
#endif /* ENABLE_IPV6 */
}
else { /* we use the PASV command */
#if 0
char *mode[] = { "EPSV", "LPSV", "PASV", NULL };
int results[] = { 229, 228, 227, 0 };
#else
char *mode[] = { "PASV", NULL };
int results[] = { 227, 0 };
#endif
int modeoff;
ftpsendf(data->firstsocket, conn, "PASV");
for (modeoff = 0; mode[modeoff]; modeoff++) {
ftpsendf(data->firstsocket, conn, mode[modeoff]);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if (ftpcode == results[modeoff])
break;
}
if(ftpcode != 227) {
if (!mode[modeoff]) {
failf(data, "Odd return code after PASV");
return CURLE_FTP_WEIRD_PASV_REPLY;
}
else {
else if (strcmp(mode[modeoff], "PASV") == 0) {
int ip[4];
int port[2];
unsigned short newport; /* remote port, not necessary the local one */
unsigned short connectport; /* the local port connect() should use! */
char newhost[32];
#ifdef ENABLE_IPV6
struct addrinfo *res;
#else
struct hostent *he;
#endif
char *str=buf,*ip_addr;
char *hostdataptr=NULL;
@@ -850,20 +1056,78 @@ CURLcode _ftp(struct connectdata *conn)
* proxy again here. We already have the name info for it since the
* previous lookup.
*/
#ifdef ENABLE_IPV6
res = conn->res;
#else
he = conn->hp;
#endif
connectport =
(unsigned short)data->port; /* we connect to the proxy's port */
}
else {
/* normal, direct, ftp connection */
he = GetHost(data, newhost, &hostdataptr);
if(!he) {
#ifdef ENABLE_IPV6
res = Curl_getaddrinfo(data, newhost, newport);
if(!res)
#else
he = Curl_gethost(data, newhost, &hostdataptr);
if(!he)
#endif
{
failf(data, "Can't resolve new host %s", newhost);
return CURLE_FTP_CANT_GET_HOST;
}
connectport = newport; /* we connect to the remote port */
}
#ifdef ENABLE_IPV6
data->secondarysocket = -1;
for (ai = res; ai; ai = ai->ai_next) {
/* XXX for now, we can do IPv4 only */
if (ai->ai_family != AF_INET)
continue;
data->secondarysocket = socket(ai->ai_family, ai->ai_socktype,
ai->ai_protocol);
if (data->secondarysocket < 0)
continue;
if(data->bits.verbose) {
char hbuf[NI_MAXHOST];
char nbuf[NI_MAXHOST];
char sbuf[NI_MAXSERV];
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
#endif
if (getnameinfo(res->ai_addr, res->ai_addrlen, nbuf, sizeof(nbuf),
sbuf, sizeof(sbuf), niflags)) {
snprintf(nbuf, sizeof(nbuf), "?");
snprintf(sbuf, sizeof(sbuf), "?");
}
if (getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf),
NULL, 0, 0)) {
infof(data, "Connecting to %s port %s\n", nbuf, sbuf);
} else {
infof(data, "Connecting to %s (%s) port %s\n", hbuf, nbuf, sbuf);
}
}
if (connect(data->secondarysocket, ai->ai_addr, ai->ai_addrlen) < 0) {
close(data->secondarysocket);
data->secondarysocket = -1;
continue;
}
break;
}
if (data->secondarysocket < 0) {
failf(data, strerror(errno));
return CURLE_FTP_CANT_RECONNECT;
}
#else
data->secondarysocket = socket(AF_INET, SOCK_STREAM, 0);
memset((char *) &serv_addr, '\0', sizeof(serv_addr));
@@ -958,14 +1222,17 @@ CURLcode _ftp(struct connectdata *conn)
}
return CURLE_FTP_CANT_RECONNECT;
}
#endif /*ENABLE_IPV6*/
if (data->bits.tunnel_thru_httpproxy) {
/* We want "seamless" FTP operations through HTTP proxy tunnel */
result = GetHTTPProxyTunnel(data, data->secondarysocket,
newhost, newport);
result = Curl_ConnectHTTPProxyTunnel(conn, data->secondarysocket,
newhost, newport);
if(CURLE_OK != result)
return result;
}
} else {
return CURLE_FTP_CANT_RECONNECT;
}
}
/* we have the (new) data connection ready */
@@ -977,7 +1244,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "TYPE %s",
(data->bits.ftp_ascii)?"A":"I");
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1008,7 +1275,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1069,7 +1336,7 @@ CURLcode _ftp(struct connectdata *conn)
else
ftpsendf(data->firstsocket, conn, "STOR %s", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1090,9 +1357,9 @@ CURLcode _ftp(struct connectdata *conn)
/* When we know we're uploading a specified file, we can get the file
size prior to the actual upload. */
pgrsSetUploadSize(data, data->infilesize);
Curl_pgrsSetUploadSize(data, data->infilesize);
result = Transfer(conn, -1, -1, FALSE, NULL, /* no download */
result = Curl_Transfer(conn, -1, -1, FALSE, NULL, /* no download */
data->secondarysocket, bytecountp);
if(result)
return result;
@@ -1149,7 +1416,7 @@ CURLcode _ftp(struct connectdata *conn)
/* Set type to ASCII */
ftpsendf(data->firstsocket, conn, "TYPE A");
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1171,7 +1438,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "TYPE %s",
(data->bits.ftp_ascii)?"A":"I");
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1192,7 +1459,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "SIZE %s", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1236,7 +1503,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "REST %d", data->resume_from);
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1249,7 +1516,7 @@ CURLcode _ftp(struct connectdata *conn)
ftpsendf(data->firstsocket, conn, "RETR %s", ftp->file);
}
nread = GetLastResponse(data->firstsocket, buf, conn, &ftpcode);
nread = Curl_GetFTPResponse(data->firstsocket, buf, conn, &ftpcode);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
@@ -1321,7 +1588,7 @@ CURLcode _ftp(struct connectdata *conn)
infof(data, "Getting file with size: %d\n", size);
/* FTP download: */
result=Transfer(conn, data->secondarysocket, size, FALSE,
result=Curl_Transfer(conn, data->secondarysocket, size, FALSE,
bytecountp,
-1, NULL); /* no upload here */
if(result)
@@ -1341,7 +1608,7 @@ CURLcode _ftp(struct connectdata *conn)
/* -- deal with the ftp server! -- */
/* argument is already checked for validity */
CURLcode ftp(struct connectdata *conn)
CURLcode Curl_ftp(struct connectdata *conn)
{
CURLcode retcode;
@@ -1403,3 +1670,39 @@ CURLcode ftp(struct connectdata *conn)
return retcode;
}
/*
* ftpsendf() sends the formated string as a ftp command to a ftp server
*
* NOTE: we build the command in a fixed-length buffer, which sets length
* restrictions on the command!
*
*/
size_t Curl_ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
{
size_t bytes_written;
char s[256];
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
va_end(ap);
if(conn->data->bits.verbose)
fprintf(conn->data->err, "> %s\n", s);
strcat(s, "\r\n"); /* append a trailing CRLF */
#ifdef KRB4
if(conn->sec_complete && conn->data->cmdchannel) {
bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
fflush(conn->data->cmdchannel);
}
else
#endif /* KRB4 */
{
bytes_written = swrite(fd, s, strlen(s));
}
return(bytes_written);
}

View File

@@ -23,11 +23,18 @@
*
* $Id$
*****************************************************************************/
CURLcode ftp(struct connectdata *conn);
CURLcode ftp_done(struct connectdata *conn);
CURLcode ftp_connect(struct connectdata *conn);
CURLcode Curl_ftp(struct connectdata *conn);
CURLcode Curl_ftp_done(struct connectdata *conn);
CURLcode Curl_ftp_connect(struct connectdata *conn);
size_t Curl_ftpsendf(int fd, struct connectdata *, char *fmt, ...);
struct curl_slist *curl_slist_append(struct curl_slist *list, char *data);
void curl_slist_free_all(struct curl_slist *list);
/* The kerberos stuff needs this: */
int Curl_GetFTPResponse(int sockfd, char *buf,
struct connectdata *conn,
int *ftpcode);
#endif

View File

@@ -33,6 +33,7 @@
#include "memdebug.h"
#endif
static
char *GetEnv(char *variable)
{
#ifdef WIN32
@@ -40,12 +41,13 @@ char *GetEnv(char *variable)
char env[MAX_PATH]; /* MAX_PATH is from windef.h */
char *temp = getenv(variable);
env[0] = '\0';
ExpandEnvironmentStrings(temp, env, sizeof(env));
if (temp != NULL)
ExpandEnvironmentStrings(temp, env, sizeof(env));
#else
/* no length control */
char *env = getenv(variable);
#endif
return env?strdup(env):NULL;
return (env && env[0])?strdup(env):NULL;
}
char *curl_getenv(char *v)

View File

@@ -1,29 +0,0 @@
#ifndef __GETENV_H
#define __GETENV_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2000, 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$
*****************************************************************************/
/* Unix and Win32 getenv function call */
char *GetEnv(char *variable);
#endif

View File

@@ -103,6 +103,12 @@ CURLcode curl_getinfo(CURL *curl, CURLINFO info, ...)
case CURLINFO_SSL_VERIFYRESULT:
*param_longp = data->ssl.certverifyresult;
break;
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
*param_doublep = data->progress.size_dl;
break;
case CURLINFO_CONTENT_LENGTH_UPLOAD:
*param_doublep = data->progress.size_ul;
break;
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}

View File

@@ -1,8 +1,35 @@
#ifndef __GETPASS_H
#define __GETPASS_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 2000, 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 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. */
/*
* Returning NULL will abort the continued operation!
*/
char* getpass_r(char *prompt, char* buffer, size_t buflen );
#endif
#endif

View File

@@ -62,7 +62,7 @@
/* --- resolve name or IP-number --- */
char *MakeIP(unsigned long num,char *addr, int addr_len)
static char *MakeIP(unsigned long num,char *addr, int addr_len)
{
#if defined(HAVE_INET_NTOA) || defined(HAVE_INET_NTOA_R)
struct in_addr in;
@@ -83,14 +83,40 @@ char *MakeIP(unsigned long num,char *addr, int addr_len)
return (addr);
}
/* The original code to this function was stolen from the Dancer source code,
written by Bjorn Reese, it has since been patched and modified. */
#ifdef ENABLE_IPV6
struct addrinfo *Curl_getaddrinfo(struct UrlData *data,
char *hostname,
int port)
{
struct addrinfo hints, *res;
int error;
char sbuf[NI_MAXSERV];
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_CANONNAME;
snprintf(sbuf, sizeof(sbuf), "%d", port);
error = getaddrinfo(hostname, sbuf, &hints, &res);
if (error) {
infof(data, "getaddrinfo(3) failed for %s\n", hostname);
return NULL;
}
return res;
}
#endif
/* 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 (unsigned long) ~0
#endif
struct hostent *GetHost(struct UrlData *data,
char *hostname,
char **bufp)
struct hostent *Curl_gethost(struct UrlData *data,
char *hostname,
char **bufp)
{
struct hostent *h = NULL;
unsigned long in;

View File

@@ -23,6 +23,13 @@
* $Id$
*****************************************************************************/
struct hostent *GetHost(struct UrlData *data, char *hostname, char **bufp );
struct addrinfo;
struct addrinfo *Curl_getaddrinfo(struct UrlData *data,
char *hostname,
int port);
struct hostent *Curl_gethost(struct UrlData *data,
char *hostname,
char **bufp);
#endif

View File

@@ -87,14 +87,13 @@
#include "urldata.h"
#include <curl/curl.h>
#include "download.h"
#include "transfer.h"
#include "sendf.h"
#include "formdata.h"
#include "progress.h"
#include "base64.h"
#include "cookie.h"
#include "strequal.h"
#include "url.h"
#include "ssluse.h"
#define _MPRINTF_REPLACE /* use our functions only */
@@ -105,6 +104,144 @@
#include "memdebug.h"
#endif
/*
* The add_buffer series of functions are used to build one large memory chunk
* from repeated function invokes. Used so that the entire HTTP request can
* be sent in one go.
*/
static CURLcode
add_buffer(send_buffer *in, void *inptr, size_t size);
/*
* add_buffer_init() returns a fine buffer struct
*/
static
send_buffer *add_buffer_init(void)
{
send_buffer *blonk;
blonk=(send_buffer *)malloc(sizeof(send_buffer));
if(blonk) {
memset(blonk, 0, sizeof(send_buffer));
return blonk;
}
return NULL; /* failed, go home */
}
/*
* add_buffer_send() sends a buffer and frees all associated memory.
*/
static
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
{
size_t amount;
if(conn->data->bits.verbose) {
fputs("> ", conn->data->err);
/* this data _may_ contain binary stuff */
fwrite(in->buffer, in->size_used, 1, conn->data->err);
}
Curl_write(conn, sockfd, in->buffer, in->size_used, &amount);
if(in->buffer)
free(in->buffer);
free(in);
return amount;
}
/*
* add_bufferf() builds a buffer from the formatted input
*/
static
CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
{
CURLcode result = CURLE_OUT_OF_MEMORY;
char *s;
va_list ap;
va_start(ap, fmt);
s = vaprintf(fmt, ap); /* this allocs a new string to append */
va_end(ap);
if(s) {
result = add_buffer(in, s, strlen(s));
free(s);
}
return result;
}
/*
* add_buffer() appends a memory chunk to the existing one
*/
static
CURLcode add_buffer(send_buffer *in, void *inptr, size_t size)
{
char *new_rb;
int new_size;
if(size > 0) {
if(!in->buffer ||
((in->size_used + size) > (in->size_max - 1))) {
new_size = (in->size_used+size)*2;
if(in->buffer)
/* we have a buffer, enlarge the existing one */
new_rb = (char *)realloc(in->buffer, new_size);
else
/* create a new buffer */
new_rb = (char *)malloc(new_size);
if(!new_rb)
return CURLE_OUT_OF_MEMORY;
in->buffer = new_rb;
in->size_max = new_size;
}
memcpy(&in->buffer[in->size_used], inptr, size);
in->size_used += size;
}
return CURLE_OK;
}
/* end of the add_buffer functions */
/*****************************************************************************/
/*
* Read everything until a newline.
*/
static
int GetLine(int sockfd, char *buf, struct connectdata *conn)
{
ssize_t nread;
int read_rc=1;
char *ptr;
struct UrlData *data=conn->data;
ptr=buf;
/* get us a full line, terminated with a newline */
for(nread=0;
(nread<BUFSIZE) && read_rc;
nread++, ptr++) {
if((CURLE_OK != Curl_read(conn, sockfd, ptr, 1, &nread)) ||
(nread <= 0) ||
(*ptr == '\n'))
break;
}
*ptr=0; /* zero terminate */
if(data->bits.verbose) {
fputs("< ", data->err);
fwrite(buf, 1, nread, data->err);
fputs("\n", data->err);
}
return nread>0?nread:0;
}
/*
* This function checks the linked list of custom HTTP headers for a particular
* header (prefix).
@@ -123,32 +260,34 @@ bool static checkheaders(struct UrlData *data, char *thisheader)
}
/*
* GetHTTPProxyTunnel() requires that we're connected to a HTTP proxy. This
* ConnectHTTPProxyTunnel() requires that we're connected to a HTTP proxy. This
* function will issue the necessary commands to get a seamless tunnel through
* this proxy. After that, the socket can be used just as a normal socket.
*/
CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
char *hostname, int remote_port)
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
int tunnelsocket,
char *hostname, int remote_port)
{
int httperror=0;
int subversion=0;
struct UrlData *data=conn->data;
infof(data, "Establish HTTP proxy tunnel to %s:%d\n", hostname, remote_port);
/* OK, now send the connect statment */
sendf(tunnelsocket, data,
"CONNECT %s:%d HTTP/1.0\015\012"
"%s"
"%s"
"\r\n",
hostname, remote_port,
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
(data->useragent?data->ptr_uagent:"")
);
/* OK, now send the connect request to the proxy */
Curl_sendf(tunnelsocket, conn,
"CONNECT %s:%d HTTP/1.0\015\012"
"%s"
"%s"
"\r\n",
hostname, remote_port,
(data->bits.proxy_user_passwd)?data->ptr_proxyuserpwd:"",
(data->useragent?data->ptr_uagent:"")
);
/* wait for the proxy to send us a HTTP/1.0 200 OK header */
while(GetLine(tunnelsocket, data->buffer, data)) {
while(GetLine(tunnelsocket, data->buffer, conn)) {
if('\r' == data->buffer[0])
break; /* end of headers */
if(2 == sscanf(data->buffer, "HTTP/1.%d %d",
@@ -170,7 +309,7 @@ CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
return CURLE_OK;
}
CURLcode http_connect(struct connectdata *conn)
CURLcode Curl_http_connect(struct connectdata *conn)
{
struct UrlData *data;
CURLcode result;
@@ -186,16 +325,15 @@ CURLcode http_connect(struct connectdata *conn)
if (conn->protocol & PROT_HTTPS) {
if (data->bits.httpproxy) {
/* HTTPS through a proxy can only be done with a tunnel */
result = GetHTTPProxyTunnel(data, data->firstsocket,
data->hostname, data->remote_port);
result = Curl_ConnectHTTPProxyTunnel(conn, data->firstsocket,
data->hostname, data->remote_port);
if(CURLE_OK != result)
return result;
}
/* now, perform the SSL initialization for this socket */
if(UrgSSLConnect (data)) {
if(Curl_SSLConnect(data))
return CURLE_SSL_CONNECT_ERROR;
}
}
if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
@@ -209,14 +347,14 @@ CURLcode http_connect(struct connectdata *conn)
/* called from curl_close() when this struct is about to get wasted, free
protocol-specific resources */
CURLcode http_close(struct connectdata *conn)
CURLcode Curl_http_close(struct connectdata *conn)
{
if(conn->data->auth_host)
free(conn->data->auth_host);
return CURLE_OK;
}
CURLcode http_done(struct connectdata *conn)
CURLcode Curl_http_done(struct connectdata *conn)
{
struct UrlData *data;
long *bytecount = &conn->bytecount;
@@ -228,7 +366,7 @@ CURLcode http_done(struct connectdata *conn)
if(data->bits.http_formpost) {
*bytecount = http->readbytecount + http->writebytecount;
FormFree(http->sendit); /* Now free that whole lot */
Curl_FormFree(http->sendit); /* Now free that whole lot */
data->fread = http->storefread; /* restore */
data->in = http->in; /* restore */
@@ -237,14 +375,11 @@ CURLcode http_done(struct connectdata *conn)
*bytecount = http->readbytecount + http->writebytecount;
}
free(http);
data->proto.http=NULL; /* it is gone */
return CURLE_OK;
}
CURLcode http(struct connectdata *conn)
CURLcode Curl_http(struct connectdata *conn)
{
struct UrlData *data=conn->data;
char *buf = data->buffer; /* this is a short cut to the buffer */
@@ -284,29 +419,26 @@ CURLcode http(struct connectdata *conn)
!data->auth_host ||
strequal(data->auth_host, data->hostname)) {
sprintf(data->buffer, "%s:%s", data->user, data->passwd);
if(base64_encode(data->buffer, strlen(data->buffer),
&authorization) >= 0) {
data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012",
authorization);
if(Curl_base64_encode(data->buffer, strlen(data->buffer),
&authorization) >= 0) {
data->ptr_userpwd = aprintf( "Authorization: Basic %s\015\012",
authorization);
free(authorization);
}
}
}
if((data->bits.set_range) && !checkheaders(data, "Range:")) {
data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range);
}
if((data->bits.http_set_referer) && !checkheaders(data, "Referer:")) {
data->ptr_ref = maprintf("Referer: %s\015\012", data->referer);
data->ptr_ref = aprintf("Referer: %s\015\012", data->referer);
}
if(data->cookie && !checkheaders(data, "Cookie:")) {
data->ptr_cookie = maprintf("Cookie: %s\015\012", data->cookie);
data->ptr_cookie = aprintf("Cookie: %s\015\012", data->cookie);
}
if(data->cookies) {
co = cookie_getlist(data->cookies,
host,
ppath,
conn->protocol&PROT_HTTPS?TRUE:FALSE);
co = Curl_cookie_getlist(data->cookies,
host,
ppath,
conn->protocol&PROT_HTTPS?TRUE:FALSE);
}
if ((data->bits.httpproxy) && !(conn->protocol&PROT_HTTPS)) {
/* The path sent to the proxy is in fact the entire URL */
@@ -315,7 +447,7 @@ CURLcode http(struct connectdata *conn)
if(data->bits.http_formpost) {
/* 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 = getFormData(data->httppost, &http->postsize);
http->sendit = Curl_getFormData(data->httppost, &http->postsize);
}
if(!checkheaders(data, "Host:")) {
@@ -323,9 +455,9 @@ CURLcode http(struct connectdata *conn)
(!(conn->protocol&PROT_HTTPS) && (data->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 */
data->ptr_host = maprintf("Host: %s\r\n", host);
data->ptr_host = aprintf("Host: %s\r\n", host);
else
data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port);
data->ptr_host = aprintf("Host: %s:%d\r\n", host, data->remote_port);
}
if(!checkheaders(data, "Pragma:"))
@@ -334,6 +466,92 @@ CURLcode http(struct connectdata *conn)
if(!checkheaders(data, "Accept:"))
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
if((data->bits.http_post ||
data->bits.http_formpost ||
data->bits.http_put) &&
data->resume_from) {
/**********************************************************************
* Resuming upload in HTTP means that we PUT or POST and that we have
* got a resume_from value set. The resume value has already created
* a Range: header that will be passed along. We need to "fast forward"
* the file the given number of bytes and decrease the assume upload
* file size before we continue this venture in the dark lands of HTTP.
*********************************************************************/
if(data->resume_from < 0 ) {
/*
* This is meant to get the size of the present remote-file by itself.
* We don't support this now. Bail out!
*/
data->resume_from = 0;
}
if(data->resume_from) {
/* do we still game? */
int passed=0;
/* Now, let's read off the proper amount of bytes from the
input. If we knew it was a proper file we could've just
fseek()ed but we only have a stream here */
do {
int readthisamountnow = (data->resume_from - passed);
int actuallyread;
if(readthisamountnow > BUFSIZE)
readthisamountnow = BUFSIZE;
actuallyread =
data->fread(data->buffer, 1, readthisamountnow, data->in);
passed += actuallyread;
if(actuallyread != readthisamountnow) {
failf(data, "Could only read %d bytes from the input\n",
passed);
return CURLE_READ_ERROR;
}
} while(passed != data->resume_from); /* loop until done */
/* now, decrease the size of the read */
if(data->infilesize>0) {
data->infilesize -= data->resume_from;
if(data->infilesize <= 0) {
failf(data, "File already completely uploaded\n");
return CURLE_PARTIAL_FILE;
}
}
/* we've passed, proceed as normal */
}
}
if(data->bits.set_range) {
/*
* A range is selected. We use different headers whether we're downloading
* or uploading and we always let customized headers override our internal
* ones if any such are specified.
*/
if((data->httpreq == HTTPREQ_GET) &&
!checkheaders(data, "Range:")) {
data->ptr_rangeline = aprintf("Range: bytes=%s\r\n", data->range);
}
else if((data->httpreq != HTTPREQ_GET) &&
!checkheaders(data, "Content-Range:")) {
if(data->resume_from) {
/* This is because "resume" was selected */
long total_expected_size= data->resume_from + data->infilesize;
data->ptr_rangeline = aprintf("Content-Range: bytes %s%ld/%ld\r\n",
data->range, total_expected_size-1,
total_expected_size);
}
else {
/* Range was selected and then we just pass the incoming range and
append total size */
data->ptr_rangeline = aprintf("Content-Range: bytes %s/%d\r\n",
data->range, data->infilesize);
}
}
}
do {
send_buffer *req_buffer;
struct curl_slist *headers=data->headers;
@@ -389,7 +607,7 @@ CURLcode http(struct connectdata *conn)
if(count) {
add_buffer(req_buffer, "\r\n", 2);
}
cookie_freelist(store); /* free the cookie list */
Curl_cookie_freelist(store); /* free the cookie list */
co=NULL;
}
@@ -451,7 +669,7 @@ CURLcode http(struct connectdata *conn)
}
if(data->bits.http_formpost) {
if(FormInit(&http->form, http->sendit)) {
if(Curl_FormInit(&http->form, http->sendit)) {
failf(data, "Internal HTTP POST error!\n");
return CURLE_HTTP_POST_ERROR;
}
@@ -461,24 +679,24 @@ CURLcode http(struct connectdata *conn)
data->fread =
(size_t (*)(char *, size_t, size_t, FILE *))
FormReader; /* set the read function to read from the
generated form data */
Curl_FormReader; /* set the read function to read from the
generated form data */
data->in = (FILE *)&http->form;
add_bufferf(req_buffer,
"Content-Length: %d\r\n", http->postsize-2);
/* set upload size to the progress meter */
pgrsSetUploadSize(data, http->postsize);
Curl_pgrsSetUploadSize(data, http->postsize);
data->request_size =
add_buffer_send(data->firstsocket, conn, req_buffer);
result = Transfer(conn, data->firstsocket, -1, TRUE,
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
&http->readbytecount,
data->firstsocket,
&http->writebytecount);
if(result) {
FormFree(http->sendit); /* free that whole lot */
Curl_FormFree(http->sendit); /* free that whole lot */
return result;
}
}
@@ -494,14 +712,14 @@ CURLcode http(struct connectdata *conn)
add_bufferf(req_buffer, "\015\012");
/* set the upload size to the progress meter */
pgrsSetUploadSize(data, data->infilesize);
Curl_pgrsSetUploadSize(data, data->infilesize);
/* this sends the buffer and frees all the buffer resources */
data->request_size =
add_buffer_send(data->firstsocket, conn, req_buffer);
/* prepare for transfer */
result = Transfer(conn, data->firstsocket, -1, TRUE,
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE,
&http->readbytecount,
data->firstsocket,
&http->writebytecount);
@@ -547,7 +765,7 @@ CURLcode http(struct connectdata *conn)
add_buffer_send(data->firstsocket, conn, req_buffer);
/* HTTP GET/HEAD download: */
result = Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
result = Curl_Transfer(conn, data->firstsocket, -1, TRUE, bytecount,
-1, NULL); /* nothing to upload */
}
if(result)

View File

@@ -25,13 +25,14 @@
*****************************************************************************/
/* ftp can use this as well */
CURLcode GetHTTPProxyTunnel(struct UrlData *data, int tunnelsocket,
char *hostname, int remote_port);
CURLcode Curl_ConnectHTTPProxyTunnel(struct connectdata *conn,
int tunnelsocket,
char *hostname, int remote_port);
/* protocol-specific functions set up to be called by the main engine */
CURLcode http(struct connectdata *conn);
CURLcode http_done(struct connectdata *conn);
CURLcode http_connect(struct connectdata *conn);
CURLcode http_close(struct connectdata *conn);
CURLcode Curl_http(struct connectdata *conn);
CURLcode Curl_http_done(struct connectdata *conn);
CURLcode Curl_http_connect(struct connectdata *conn);
CURLcode Curl_http_close(struct connectdata *conn);
#endif

View File

@@ -32,7 +32,7 @@
#include <unistd.h>
#endif
#if ! defined(WIN32) && ! defined(__BEOS__)
#if ! defined(WIN32) && ! defined(__BEOS__) && !defined(__CYGWIN32__)
#ifdef NEED_REENTRANT
#define _REENTRANT
@@ -72,7 +72,7 @@
#define SYS_ERROR -1
char *if2ip(char *interface, char *buf, int buf_size)
char *Curl_if2ip(char *interface, char *buf, int buf_size)
{
int dummy;
char *ip=NULL;

View File

@@ -24,10 +24,10 @@
*****************************************************************************/
#include "setup.h"
#if ! defined(WIN32) && ! defined(__BEOS__)
extern char *if2ip(char *interface, char *buf, int buf_size);
#if ! defined(WIN32) && ! defined(__BEOS__) && !defined(__CYGWIN32__)
extern char *Curl_if2ip(char *interface, char *buf, int buf_size);
#else
#define if2ip(a,b,c) NULL
#define Curl_if2ip(a,b,c) NULL
#endif
#endif

View File

@@ -47,6 +47,9 @@
#include <string.h>
#include <krb.h>
#include "ftp.h"
#include "sendf.h"
/* The last #include file should be: */
#ifdef MALLOCDEBUG
#include "memdebug.h"
@@ -95,7 +98,8 @@ strlcpy (char *dst, const char *src, size_t dst_sz)
else
return n + strlen (src);
}
#else
size_t strlcpy (char *dst, const char *src, size_t dst_sz);
#endif
static int
@@ -279,12 +283,15 @@ krb4_auth(void *app_data, struct connectdata *conn)
u_int32_t cs;
struct krb4_data *d = app_data;
struct sockaddr_in *localaddr = (struct sockaddr_in *)LOCAL_ADDR;
#if 0
struct sockaddr_in *remoteaddr = (struct sockaddr_in *)REMOTE_ADDR;
#endif
char *host = conn->hp->h_name;
size_t nread;
int l = sizeof(local_addr);
if(getsockname(conn->data->firstsocket, LOCAL_ADDR, &l) < 0)
if(getsockname(conn->data->firstsocket,
(struct sockaddr *)LOCAL_ADDR, &l) < 0)
perror("getsockname()");
checksum = getpid();
@@ -308,7 +315,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
else {
if (natAddr.s_addr != localaddr->sin_addr.s_addr) {
printf("Using NAT IP address (%s) for kerberos 4\n",
inet_ntoa(natAddr));
(char *)inet_ntoa(natAddr));
localaddr->sin_addr = natAddr;
/*
@@ -327,15 +334,15 @@ krb4_auth(void *app_data, struct connectdata *conn)
/*printf("Local address is %s\n", inet_ntoa(localaddr->sin_addr));***/
/*printf("Remote address is %s\n", inet_ntoa(remoteaddr->sin_addr));***/
if(base64_encode(adat.dat, adat.length, &p) < 0) {
if(Curl_base64_encode(adat.dat, adat.length, &p) < 0) {
printf("Out of memory base64-encoding.\n");
return AUTH_CONTINUE;
}
/*ret = command("ADAT %s", p)*/
ftpsendf(conn->data->firstsocket, conn, "ADAT %s", p);
Curl_ftpsendf(conn->data->firstsocket, conn, "ADAT %s", p);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket,
conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket,
conn->data->buffer, conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/-1;
free(p);
@@ -351,7 +358,7 @@ krb4_auth(void *app_data, struct connectdata *conn)
return AUTH_ERROR;
}
p += 5;
len = base64_decode(p, adat.dat);
len = Curl_base64_decode(p, adat.dat);
if(len < 0){
printf("Failed to decode base64 from server.\n");
return AUTH_ERROR;
@@ -389,14 +396,11 @@ struct sec_client_mech krb4_client_mech = {
void krb_kauth(struct connectdata *conn)
{
int ret;
char buf[1024];
des_cblock key;
des_key_schedule schedule;
KTEXT_ST tkt, tktcopy;
char *name;
char *p;
int overbose;
char passwd[100];
int tmp;
size_t nread;
@@ -405,20 +409,19 @@ void krb_kauth(struct connectdata *conn)
save = set_command_prot(conn, prot_private);
/*ret = command("SITE KAUTH %s", name);***/
ftpsendf(conn->data->firstsocket, conn,
Curl_ftpsendf(conn->data->firstsocket, conn,
"SITE KAUTH %s", conn->data->user);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket, conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket, conn->data->buffer,
conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/;
if(/*ret != CONTINUE*/conn->data->buffer[0] != '3'){
/*verbose = overbose;***/
set_command_prot(conn, save);
/*code = -1;***/
return;
}
/*verbose = overbose;***/
p = strstr(/*reply_string***/conn->data->buffer, "T=");
if(!p){
printf("Bad reply from server.\n");
@@ -427,7 +430,7 @@ void krb_kauth(struct connectdata *conn)
return;
}
p += 2;
tmp = base64_decode(p, &tkt.dat);
tmp = Curl_base64_decode(p, &tkt.dat);
if(tmp < 0){
printf("Failed to decode base64 in reply.\n");
set_command_prot(conn, save);
@@ -440,7 +443,6 @@ void krb_kauth(struct connectdata *conn)
p = strstr(/*reply_string***/conn->data->buffer, "P=");
if(!p){
printf("Bad reply from server.\n");
/*verbose = overbose;***/
set_command_prot(conn, save);
/*code = -1;***/
return;
@@ -476,7 +478,7 @@ void krb_kauth(struct connectdata *conn)
memset(key, 0, sizeof(key));
memset(schedule, 0, sizeof(schedule));
memset(passwd, 0, sizeof(passwd));
if(base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) {
if(Curl_base64_encode(tktcopy.dat, tktcopy.length, &p) < 0) {
failf(conn->data, "Out of memory base64-encoding.\n");
set_command_prot(conn, save);
/*code = -1;***/
@@ -484,10 +486,11 @@ void krb_kauth(struct connectdata *conn)
}
memset (tktcopy.dat, 0, tktcopy.length);
/*ret = command("SITE KAUTH %s %s", name, p);***/
ftpsendf(conn->data->firstsocket, conn,
Curl_ftpsendf(conn->data->firstsocket, conn,
"SITE KAUTH %s %s", name, p);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket, conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket, conn->data->buffer,
conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/;
free(p);

View File

@@ -1,5 +1,5 @@
#ifndef __HIGHLEVEL_H
#define __HIGHLEVEL_H
#ifndef __KRB4_H
#define __KRB4_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@@ -22,5 +22,6 @@
*
* $Id$
*****************************************************************************/
CURLcode curl_transfer(CURL *curl);
void krb_kauth(struct connectdata *conn);
#endif

View File

@@ -117,18 +117,18 @@ static void * DynaGetFunction(char *name)
static int WriteProc(void *param, char *text, int len)
{
struct UrlData *data = (struct UrlData *)param;
client_write(data, CLIENTWRITE_BODY, text, 0);
Curl_client_write(data, CLIENTWRITE_BODY, text, 0);
return 0;
}
CURLcode ldap_done(struct connectdata *conn)
CURLcode Curl_ldap_done(struct connectdata *conn)
{
return CURLE_OK;
}
/***********************************************************************
*/
CURLcode ldap(struct connectdata *conn)
CURLcode Curl_ldap(struct connectdata *conn)
{
CURLcode status = CURLE_OK;
int rc;

View File

@@ -23,7 +23,7 @@
*
* $Id$
*****************************************************************************/
CURLcode ldap(struct connectdata *conn);
CURLcode ldap_done(struct connectdata *conn);
CURLcode Curl_ldap(struct connectdata *conn);
CURLcode Curl_ldap_done(struct connectdata *conn);
#endif /* __LDAP_H */

View File

@@ -135,7 +135,7 @@ int curl_sclose(int sockfd, int line, char *source)
int res=sclose(sockfd);
fprintf(logfile?logfile:stderr, "FD %s:%d sclose(%d)\n",
source, line, sockfd);
return sockfd;
return res;
}
FILE *curl_fopen(char *file, char *mode, int line, char *source)

View File

@@ -207,7 +207,7 @@ struct asprintf {
size_t alloc; /* length of alloc */
};
int msprintf(char *buffer, const char *format, ...);
int curl_msprintf(char *buffer, const char *format, ...);
static int dprintf_DollarString(char *input, char **end)
{
@@ -955,11 +955,11 @@ static int dprintf_formatf(
if(width >= 0) {
/* RECURSIVE USAGE */
fptr += msprintf(fptr, "%d", width);
fptr += curl_msprintf(fptr, "%d", width);
}
if(prec >= 0) {
/* RECURSIVE USAGE */
fptr += msprintf(fptr, ".%d", prec);
fptr += curl_msprintf(fptr, ".%d", prec);
}
if (p->flags & FLAGS_LONG)
strcat(fptr, "l");
@@ -1025,7 +1025,7 @@ static int addbyter(int output, FILE *data)
return -1;
}
int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
int curl_msnprintf(char *buffer, size_t maxlength, const char *format, ...)
{
va_list ap_save; /* argument pointer */
int retcode;
@@ -1045,7 +1045,7 @@ int msnprintf(char *buffer, size_t maxlength, const char *format, ...)
return retcode;
}
int mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list ap_save)
int curl_mvsnprintf(char *buffer, size_t maxlength, const char *format, va_list ap_save)
{
int retcode;
struct nsprintf info;
@@ -1092,7 +1092,7 @@ static int alloc_addbyter(int output, FILE *data)
}
char *maprintf(const char *format, ...)
char *curl_maprintf(const char *format, ...)
{
va_list ap_save; /* argument pointer */
int retcode;
@@ -1113,7 +1113,7 @@ char *maprintf(const char *format, ...)
return NULL;
}
char *mvaprintf(const char *format, va_list ap_save)
char *curl_mvaprintf(const char *format, va_list ap_save)
{
int retcode;
struct asprintf info;
@@ -1140,7 +1140,7 @@ static int storebuffer(int output, FILE *data)
return output; /* act like fputc() ! */
}
int msprintf(char *buffer, const char *format, ...)
int curl_msprintf(char *buffer, const char *format, ...)
{
va_list ap_save; /* argument pointer */
int retcode;
@@ -1153,7 +1153,7 @@ int msprintf(char *buffer, const char *format, ...)
extern int fputc(int, FILE *);
int mprintf(const char *format, ...)
int curl_mprintf(const char *format, ...)
{
int retcode;
va_list ap_save; /* argument pointer */
@@ -1163,7 +1163,7 @@ int mprintf(const char *format, ...)
return retcode;
}
int mfprintf(FILE *whereto, const char *format, ...)
int curl_mfprintf(FILE *whereto, const char *format, ...)
{
int retcode;
va_list ap_save; /* argument pointer */
@@ -1173,7 +1173,7 @@ int mfprintf(FILE *whereto, const char *format, ...)
return retcode;
}
int mvsprintf(char *buffer, const char *format, va_list ap_save)
int curl_mvsprintf(char *buffer, const char *format, va_list ap_save)
{
int retcode;
retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save);
@@ -1181,12 +1181,12 @@ int mvsprintf(char *buffer, const char *format, va_list ap_save)
return retcode;
}
int mvprintf(const char *format, va_list ap_save)
int curl_mvprintf(const char *format, va_list ap_save)
{
return dprintf_formatf(stdout, fputc, format, ap_save);
}
int mvfprintf(FILE *whereto, const char *format, va_list ap_save)
int curl_mvfprintf(FILE *whereto, const char *format, va_list ap_save)
{
return dprintf_formatf(whereto, fputc, format, ap_save);
}

View File

@@ -27,7 +27,8 @@
#include <stdlib.h>
#include <string.h>
#include "getenv.h"
#include <curl/curl.h>
#include "strequal.h"
/* Debug this single source file with:
@@ -51,15 +52,15 @@ enum {
#define LOGINSIZE 64
#define PASSWORDSIZE 64
int ParseNetrc(char *host,
char *login,
char *password)
int Curl_parsenetrc(char *host,
char *login,
char *password)
{
FILE *file;
char netrcbuffer[256];
int retcode=1;
char *home = GetEnv("HOME"); /* portable environment reader */
char *home = curl_getenv("HOME"); /* portable environment reader */
int state=NOTHING;
char state_login=0;

View File

@@ -22,7 +22,7 @@
*
* $Id$
*****************************************************************************/
int ParseNetrc(char *host,
char *login,
char *password);
int Curl_parsenetrc(char *host,
char *login,
char *password);
#endif

View File

@@ -45,7 +45,7 @@
#include "progress.h"
void time2str(char *r, int t)
static void time2str(char *r, int t)
{
int h = (t/3600);
int m = (t-(h*3600))/60;
@@ -55,7 +55,7 @@ void time2str(char *r, int t)
/* The point of this function would be to return a string of the input data,
but never longer than 5 columns. Add suffix k, M, G when suitable... */
char *max5data(double bytes, char *max5)
static char *max5data(double bytes, char *max5)
{
#define ONE_KILOBYTE 1024
#define ONE_MEGABYTE (1024*1024)
@@ -91,16 +91,16 @@ char *max5data(double bytes, char *max5)
*/
void pgrsDone(struct UrlData *data)
void Curl_pgrsDone(struct UrlData *data)
{
if(!(data->progress.flags & PGRS_HIDE)) {
data->progress.lastshow=0;
pgrsUpdate(data); /* the final (forced) update */
Curl_pgrsUpdate(data); /* the final (forced) update */
fprintf(data->err, "\n");
}
}
void pgrsTime(struct UrlData *data, timerid timer)
void Curl_pgrsTime(struct UrlData *data, timerid timer)
{
switch(timer) {
default:
@@ -111,19 +111,19 @@ void pgrsTime(struct UrlData *data, timerid timer)
/* This is set at the start of a single fetch, there may be several
fetches within an operation, why we add all other times relative
to this one */
data->progress.t_startsingle = tvnow();
data->progress.t_startsingle = Curl_tvnow();
break;
case TIMER_NAMELOOKUP:
data->progress.t_nslookup += tvdiff(tvnow(),
data->progress.t_nslookup += Curl_tvdiff(Curl_tvnow(),
data->progress.t_startsingle);
break;
case TIMER_CONNECT:
data->progress.t_connect += tvdiff(tvnow(),
data->progress.t_connect += Curl_tvdiff(Curl_tvnow(),
data->progress.t_startsingle);
break;
case TIMER_PRETRANSFER:
data->progress.t_pretransfer += tvdiff(tvnow(),
data->progress.t_pretransfer += Curl_tvdiff(Curl_tvnow(),
data->progress.t_startsingle);
break;
case TIMER_POSTRANSFER:
@@ -132,22 +132,22 @@ void pgrsTime(struct UrlData *data, timerid timer)
}
}
void pgrsStartNow(struct UrlData *data)
void Curl_pgrsStartNow(struct UrlData *data)
{
data->progress.start = tvnow();
data->progress.start = Curl_tvnow();
}
void pgrsSetDownloadCounter(struct UrlData *data, double size)
void Curl_pgrsSetDownloadCounter(struct UrlData *data, double size)
{
data->progress.downloaded = size;
}
void pgrsSetUploadCounter(struct UrlData *data, double size)
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size)
{
data->progress.uploaded = size;
}
void pgrsSetDownloadSize(struct UrlData *data, double size)
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size)
{
if(size > 0) {
data->progress.size_dl = size;
@@ -155,7 +155,7 @@ void pgrsSetDownloadSize(struct UrlData *data, double size)
}
}
void pgrsSetUploadSize(struct UrlData *data, double size)
void Curl_pgrsSetUploadSize(struct UrlData *data, double size)
{
if(size > 0) {
data->progress.size_ul = size;
@@ -171,7 +171,7 @@ void pgrsSetUploadSize(struct UrlData *data, double size)
*/
int pgrsUpdate(struct UrlData *data)
int Curl_pgrsUpdate(struct UrlData *data)
{
struct timeval now;
int result;
@@ -203,6 +203,9 @@ int pgrsUpdate(struct UrlData *data)
even when not displayed! */
else if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
if (!data->progress.callback) {
if(data->resume_from)
fprintf(data->err, "** Resuming transfer from byte position %d\n",
data->resume_from);
fprintf(data->err,
" %% Total %% Received %% Xferd Average Speed Time Curr.\n"
" Dload Upload Total Current Left Speed\n");
@@ -210,16 +213,16 @@ int pgrsUpdate(struct UrlData *data)
data->progress.flags |= PGRS_HEADERS_OUT; /* headers are shown */
}
now = tvnow(); /* what time is it */
now = Curl_tvnow(); /* what time is it */
if(data->progress.lastshow == tvlong(now))
/* The exact time spent so far */
data->progress.timespent = Curl_tvdiff (now, data->progress.start);
if(data->progress.lastshow == Curl_tvlong(now))
return 0; /* never update this more than once a second if the end isn't
reached */
data->progress.lastshow = now.tv_sec;
/* The exact time spent so far */
data->progress.timespent = tvdiff (now, data->progress.start);
/* The average download speed this far */
data->progress.dlspeed = data->progress.downloaded/(data->progress.timespent!=0.0?data->progress.timespent:1.0);
@@ -257,17 +260,13 @@ int pgrsUpdate(struct UrlData *data)
}
/* Figure out the estimated time of arrival for the upload */
if(data->progress.flags & PGRS_UL_SIZE_KNOWN) {
if(!data->progress.ulspeed)
data->progress.ulspeed=1;
if((data->progress.flags & PGRS_UL_SIZE_KNOWN) && data->progress.ulspeed){
ulestimate = data->progress.size_ul / data->progress.ulspeed;
ulpercen = (data->progress.uploaded / data->progress.size_ul)*100;
}
/* ... and the download */
if(data->progress.flags & PGRS_DL_SIZE_KNOWN) {
if(!data->progress.dlspeed)
data->progress.dlspeed=1;
if((data->progress.flags & PGRS_DL_SIZE_KNOWN) && data->progress.dlspeed) {
dlestimate = data->progress.size_dl / data->progress.dlspeed;
dlpercen = (data->progress.downloaded / data->progress.size_dl)*100;
}

View File

@@ -36,14 +36,14 @@ typedef enum {
TIMER_LAST /* must be last */
} timerid;
void pgrsDone(struct UrlData *data);
void pgrsStartNow(struct UrlData *data);
void pgrsSetDownloadSize(struct UrlData *data, double size);
void pgrsSetUploadSize(struct UrlData *data, double size);
void pgrsSetDownloadCounter(struct UrlData *data, double size);
void pgrsSetUploadCounter(struct UrlData *data, double size);
int pgrsUpdate(struct UrlData *data);
void pgrsTime(struct UrlData *data, timerid timer);
void Curl_pgrsDone(struct UrlData *data);
void Curl_pgrsStartNow(struct UrlData *data);
void Curl_pgrsSetDownloadSize(struct UrlData *data, double size);
void Curl_pgrsSetUploadSize(struct UrlData *data, double size);
void Curl_pgrsSetDownloadCounter(struct UrlData *data, double size);
void Curl_pgrsSetUploadCounter(struct UrlData *data, double size);
int Curl_pgrsUpdate(struct UrlData *data);
void Curl_pgrsTime(struct UrlData *data, timerid timer);
/* Don't show progress for sizes smaller than: */

View File

@@ -40,13 +40,22 @@
#ifdef KRB4
#define _MPRINTF_REPLACE /* we want curl-functions instead of native ones */
#include <curl/mprintf.h>
#include "security.h"
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "base64.h"
#include "sendf.h"
#include "ftp.h"
/* The last #include file should be: */
#ifdef MALLOCDEBUG
#include "memdebug.h"
@@ -64,6 +73,7 @@ static struct {
{ prot_private, "private" }
};
#if 0
static const char *
level_to_name(enum protection_level level)
{
@@ -73,6 +83,7 @@ level_to_name(enum protection_level level)
return level_names[i].name;
return "unknown";
}
#endif
#ifndef FTP_SERVER /* not used in server */
static enum protection_level
@@ -319,7 +330,7 @@ sec_vfprintf2(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
if(conn->data_prot == prot_clear)
return vfprintf(f, fmt, ap);
else {
buf = maprintf(fmt, ap);
buf = aprintf(fmt, ap);
ret = buffer_write(&conn->out_buffer, buf, strlen(buf));
free(buf);
return ret;
@@ -360,7 +371,7 @@ sec_read_msg(struct connectdata *conn, char *s, int level)
int code;
buf = malloc(strlen(s));
len = base64_decode(s + 4, buf); /* XXX */
len = Curl_base64_decode(s + 4, buf); /* XXX */
len = (*mech->decode)(conn->app_data, buf, len, level, conn);
if(len < 0)
@@ -390,7 +401,7 @@ sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
if(!conn->sec_complete)
return vfprintf(f, fmt, ap);
buf = maprintf(fmt, ap);
buf = aprintf(fmt, ap);
len = (*mech->encode)(conn->app_data, buf, strlen(buf),
conn->command_prot, &enc,
conn);
@@ -399,7 +410,7 @@ sec_vfprintf(struct connectdata *conn, FILE *f, const char *fmt, va_list ap)
failf(conn->data, "Failed to encode command.\n");
return -1;
}
if(base64_encode(enc, len, &buf) < 0){
if(Curl_base64_encode(enc, len, &buf) < 0){
failf(conn->data, "Out of memory base64-encoding.\n");
return -1;
}
@@ -461,7 +472,6 @@ sec_status(void)
static int
sec_prot_internal(struct connectdata *conn, int level)
{
int ret;
char *p;
unsigned int s = 1048576;
size_t nread;
@@ -472,11 +482,11 @@ sec_prot_internal(struct connectdata *conn, int level)
}
if(level){
ftpsendf(conn->data->firstsocket, conn,
"PBSZ %u", s);
Curl_ftpsendf(conn->data->firstsocket, conn,
"PBSZ %u", s);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket,
conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket,
conn->data->buffer, conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/-1;
if(/*ret != COMPLETE*/conn->data->buffer[0] != '2'){
@@ -491,11 +501,11 @@ sec_prot_internal(struct connectdata *conn, int level)
conn->buffer_size = s;
}
ftpsendf(conn->data->firstsocket, conn,
"PROT %c", level["CSEP"]);
Curl_ftpsendf(conn->data->firstsocket, conn,
"PROT %c", level["CSEP"]);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket,
conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket,
conn->data->buffer, conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/-1;
if(/*ret != COMPLETE*/conn->data->buffer[0] != '2'){
@@ -600,11 +610,11 @@ sec_login(struct connectdata *conn)
}
infof(data, "Trying %s...\n", (*m)->name);
/*ret = command("AUTH %s", (*m)->name);***/
ftpsendf(conn->data->firstsocket, conn,
Curl_ftpsendf(conn->data->firstsocket, conn,
"AUTH %s", (*m)->name);
/* wait for feedback */
nread = GetLastResponse(conn->data->firstsocket,
conn->data->buffer, conn);
nread = Curl_GetFTPResponse(conn->data->firstsocket,
conn->data->buffer, conn, NULL);
if(nread < 0)
return /*CURLE_OPERATION_TIMEOUTED*/-1;
if(/*ret != CONTINUE*/conn->data->buffer[0] != '3'){

View File

@@ -52,7 +52,7 @@
/* infof() is for info message along the way */
void infof(struct UrlData *data, char *fmt, ...)
void Curl_infof(struct UrlData *data, char *fmt, ...)
{
va_list ap;
if(data->bits.verbose) {
@@ -66,7 +66,7 @@ void infof(struct UrlData *data, char *fmt, ...)
/* failf() is for messages stating why we failed, the LAST one will be
returned for the user (if requested) */
void failf(struct UrlData *data, char *fmt, ...)
void Curl_failf(struct UrlData *data, char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
@@ -77,103 +77,96 @@ void failf(struct UrlData *data, char *fmt, ...)
va_end(ap);
}
/* sendf() sends the formated data to the server */
size_t sendf(int fd, struct UrlData *data, char *fmt, ...)
/* Curl_sendf() sends formated data to the server */
size_t Curl_sendf(int sockfd, struct connectdata *conn,
char *fmt, ...)
{
struct UrlData *data = conn->data;
size_t bytes_written;
char *s;
va_list ap;
va_start(ap, fmt);
s = mvaprintf(fmt, ap);
s = vaprintf(fmt, ap); /* returns an allocated string */
va_end(ap);
if(!s)
return 0; /* failure */
if(data->bits.verbose)
fprintf(data->err, "> %s", s);
#ifndef USE_SSLEAY
bytes_written = swrite(fd, s, strlen(s));
#else /* USE_SSLEAY */
if (data->ssl.use) {
bytes_written = SSL_write(data->ssl.handle, s, strlen(s));
} else {
bytes_written = swrite(fd, s, strlen(s));
}
#endif /* USE_SSLEAY */
/* Write the buffer to the socket */
Curl_write(conn, sockfd, s, strlen(s), &bytes_written);
free(s); /* free the output string */
return(bytes_written);
return bytes_written;
}
/*
* ftpsendf() sends the formated string as a ftp command to a ftp server
*
* NOTE: we build the command in a fixed-length buffer, which sets length
* restrictions on the command!
* Curl_write() is an internal write function that sends plain (binary) data
* to the server. Works with plain sockets, SSL or kerberos.
*
*/
size_t ftpsendf(int fd, struct connectdata *conn, char *fmt, ...)
{
size_t bytes_written;
char s[256];
va_list ap;
va_start(ap, fmt);
vsnprintf(s, 250, fmt, ap);
va_end(ap);
if(conn->data->bits.verbose)
fprintf(conn->data->err, "> %s\n", s);
strcat(s, "\r\n"); /* append a trailing CRLF */
#ifdef KRB4
if(conn->sec_complete && conn->data->cmdchannel) {
bytes_written = sec_fprintf(conn, conn->data->cmdchannel, s);
fflush(conn->data->cmdchannel);
}
else
#endif /* KRB4 */
{
bytes_written = swrite(fd, s, strlen(s));
}
return(bytes_written);
}
/* ssend() sends plain (binary) data to the server */
size_t ssend(int fd, struct connectdata *conn, void *mem, size_t len)
CURLcode Curl_write(struct connectdata *conn, int sockfd,
void *mem, size_t len,
size_t *written)
{
size_t bytes_written;
struct UrlData *data=conn->data; /* conn knows data, not vice versa */
#ifdef USE_SSLEAY
if (data->ssl.use) {
bytes_written = SSL_write(data->ssl.handle, mem, len);
int loop=100; /* just a precaution to never loop endlessly */
while(loop--) {
bytes_written = SSL_write(data->ssl.handle, mem, len);
if((-1 != bytes_written) ||
(SSL_ERROR_WANT_WRITE != SSL_get_error(data->ssl.handle,
bytes_written) ))
break;
}
}
else {
#endif
#ifdef KRB4
if(conn->sec_complete) {
bytes_written = sec_write(conn, fd, mem, len);
bytes_written = sec_write(conn, sockfd, mem, len);
}
else
#endif /* KRB4 */
bytes_written = swrite(fd, mem, len);
bytes_written = swrite(sockfd, mem, len);
#ifdef USE_SSLEAY
}
#endif
return bytes_written;
*written = bytes_written;
return CURLE_OK;
}
/*
* External write-function, writes to the data-socket.
* Takes care of plain sockets, SSL or kerberos transparently.
*/
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
size_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
return Curl_write(conn, conn->sockfd, buf, amount, n);
}
/* client_write() sends data to the write callback(s)
The bit pattern defines to what "streams" to write to. Body and/or header.
The defines are in sendf.h of course.
*/
CURLcode client_write(struct UrlData *data,
int type,
char *ptr,
size_t len)
CURLcode Curl_client_write(struct UrlData *data,
int type,
char *ptr,
size_t len)
{
size_t wrote;
@@ -200,90 +193,54 @@ CURLcode client_write(struct UrlData *data,
/*
* add_buffer_init() returns a fine buffer struct
* Internal read-from-socket function. This is meant to deal with plain
* sockets, SSL sockets and kerberos sockets.
*/
send_buffer *add_buffer_init(void)
CURLcode Curl_read(struct connectdata *conn, int sockfd,
char *buf, size_t buffersize,
ssize_t *n)
{
send_buffer *blonk;
blonk=(send_buffer *)malloc(sizeof(send_buffer));
if(blonk) {
memset(blonk, 0, sizeof(send_buffer));
return blonk;
}
return NULL; /* failed, go home */
}
struct UrlData *data = conn->data;
ssize_t nread;
/*
* add_buffer_send() sends a buffer and frees all associated memory.
*/
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
{
size_t amount;
if(conn->data->bits.verbose) {
fputs("> ", conn->data->err);
/* this data _may_ contain binary stuff */
fwrite(in->buffer, in->size_used, 1, conn->data->err);
}
amount = ssend(sockfd, conn, in->buffer, in->size_used);
if(in->buffer)
free(in->buffer);
free(in);
return amount;
}
/*
* add_bufferf() builds a buffer from the formatted input
*/
CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
{
CURLcode result = CURLE_OUT_OF_MEMORY;
char *s;
va_list ap;
va_start(ap, fmt);
s = mvaprintf(fmt, ap); /* this allocs a new string to append */
va_end(ap);
if(s) {
result = add_buffer(in, s, strlen(s));
free(s);
}
return result;
}
/*
* add_buffer() appends a memory chunk to the existing one
*/
CURLcode add_buffer(send_buffer *in, void *inptr, size_t size)
{
char *new_rb;
int new_size;
if(size > 0) {
if(!in->buffer ||
((in->size_used + size) > (in->size_max - 1))) {
new_size = (in->size_used+size)*2;
if(in->buffer)
/* we have a buffer, enlarge the existing one */
new_rb = (char *)realloc(in->buffer, new_size);
else
/* create a new buffer */
new_rb = (char *)malloc(new_size);
if(!new_rb)
return CURLE_OUT_OF_MEMORY;
in->buffer = new_rb;
in->size_max = new_size;
#ifdef USE_SSLEAY
if (data->ssl.use) {
int loop=100; /* just a precaution to never loop endlessly */
while(loop--) {
nread = SSL_read(data->ssl.handle, buf, buffersize);
if((-1 != nread) ||
(SSL_ERROR_WANT_READ != SSL_get_error(data->ssl.handle, nread) ))
break;
}
memcpy(&in->buffer[in->size_used], inptr, size);
in->size_used += size;
}
else {
#endif
#ifdef KRB4
if(conn->sec_complete)
nread = sec_read(conn, sockfd, buf, buffersize);
else
#endif
nread = sread (sockfd, buf, buffersize);
#ifdef USE_SSLEAY
}
#endif /* USE_SSLEAY */
*n = nread;
return CURLE_OK;
}
/*
* The public read function reads from the 'sockfd' file descriptor only.
* Use the Curl_read() internally when you want to specify fd.
*/
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
ssize_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
return Curl_read(conn, conn->sockfd, buf, buffersize, n);
}

View File

@@ -23,11 +23,12 @@
* $Id$
*****************************************************************************/
size_t ftpsendf(int fd, struct connectdata *, char *fmt, ...);
size_t sendf(int fd, struct UrlData *, char *fmt, ...);
size_t ssend(int fd, struct connectdata *, void *fmt, size_t len);
void infof(struct UrlData *, char *fmt, ...);
void failf(struct UrlData *, char *fmt, ...);
size_t Curl_sendf(int fd, struct connectdata *, char *fmt, ...);
void Curl_infof(struct UrlData *, char *fmt, ...);
void Curl_failf(struct UrlData *, char *fmt, ...);
#define infof Curl_infof
#define failf Curl_failf
struct send_buffer {
char *buffer;
@@ -40,12 +41,16 @@ typedef struct send_buffer send_buffer;
#define CLIENTWRITE_HEADER 2
#define CLIENTWRITE_BOTH (CLIENTWRITE_BODY|CLIENTWRITE_HEADER)
CURLcode client_write(struct UrlData *data, int type, char *ptr,
size_t len);
send_buffer *add_buffer_init(void);
CURLcode add_buffer(send_buffer *in, void *inptr, size_t size);
CURLcode add_bufferf(send_buffer *in, char *fmt, ...);
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in);
CURLcode Curl_client_write(struct UrlData *data, int type, char *ptr,
size_t len);
/* internal read-function, does plain socket, SSL and krb4 */
CURLcode Curl_read(struct connectdata *conn, int sockfd,
char *buf, size_t buffersize,
ssize_t *n);
/* internal write-function, does plain socket, SSL and krb4 */
CURLcode Curl_write(struct connectdata *conn, int sockfd,
void *mem, size_t len,
size_t *written);
#endif

View File

@@ -100,7 +100,6 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
1. close a socket
2. read from a socket
3. write to a socket
(Hopefully, only win32-crap do this weird name changing)
4. set the SIGALRM signal timeout
5. set dir/file naming defines
@@ -115,8 +114,8 @@ defined(HAVE_LIBSSL) && defined(HAVE_LIBCRYPTO)
#else
/* gcc-for-win is still good :) */
#define sclose(x) close(x)
#define sread(x,y,z) read(x,y,z)
#define swrite(x,y,z) write(x,y,z)
#define sread(x,y,z) recv(x,y,z,0)
#define swrite(x,y,z) send(x,y,z,0)
#define myalarm(x) alarm(x)
#endif

View File

@@ -33,24 +33,24 @@
#include "sendf.h"
#include "speedcheck.h"
void speedinit(struct UrlData *data)
void Curl_speedinit(struct UrlData *data)
{
memset(&data->keeps_speed, 0, sizeof(struct timeval));
}
CURLcode speedcheck(struct UrlData *data,
struct timeval now)
CURLcode Curl_speedcheck(struct UrlData *data,
struct timeval now)
{
if((data->progress.current_speed >= 0) &&
data->low_speed_time &&
(tvlong(data->keeps_speed) != 0) &&
(Curl_tvlong(data->keeps_speed) != 0) &&
(data->progress.current_speed < data->low_speed_limit)) {
/* We are now below the "low speed limit". If we are below it
for "low speed time" seconds we consider that enough reason
to abort the download. */
if( tvdiff(now, data->keeps_speed) > data->low_speed_time) {
if( Curl_tvdiff(now, data->keeps_speed) > data->low_speed_time) {
/* we have been this slow for long enough, now die */
failf(data,
"Operation too slow. "

View File

@@ -27,8 +27,8 @@
#include "timeval.h"
void speedinit(struct UrlData *data);
CURLcode speedcheck(struct UrlData *data,
struct timeval now);
void Curl_speedinit(struct UrlData *data);
CURLcode Curl_speedcheck(struct UrlData *data,
struct timeval now);
#endif

View File

@@ -62,9 +62,10 @@ static int passwd_callback(char *buf, int num, int verify
* from) source from the SSLeay package written by Eric Young
* (eay@cryptsoft.com). */
int SSL_cert_stuff(struct UrlData *data,
char *cert_file,
char *key_file)
static
int cert_stuff(struct UrlData *data,
char *cert_file,
char *key_file)
{
if (cert_file != NULL) {
SSL *ssl;
@@ -124,6 +125,7 @@ int SSL_cert_stuff(struct UrlData *data,
#endif
#ifdef USE_SSLEAY
static
int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
{
X509 *err_cert;
@@ -139,7 +141,7 @@ int cert_verify_callback(int ok, X509_STORE_CTX *ctx)
/* ====================================================== */
int
UrgSSLConnect (struct UrlData *data)
Curl_SSLConnect (struct UrlData *data)
{
#ifdef USE_SSLEAY
int err;
@@ -163,7 +165,7 @@ UrgSSLConnect (struct UrlData *data)
RAND_screen();
#else
int len;
char *area = MakeFormBoundary();
char *area = Curl_FormBoundary();
if(!area)
return 3; /* out of memory */
@@ -198,7 +200,7 @@ UrgSSLConnect (struct UrlData *data)
}
if(data->cert) {
if (!SSL_cert_stuff(data, data->cert, data->cert)) {
if (!cert_stuff(data, data->cert, data->cert)) {
failf(data, "couldn't use certificate!\n");
return 2;
}

View File

@@ -22,8 +22,5 @@
*
* $Id$
*****************************************************************************/
int SSL_cert_stuff(struct UrlData *data,
char *cert_file,
char *key_file);
int UrgSSLConnect (struct UrlData *data);
int Curl_SSLConnect (struct UrlData *data);
#endif

View File

@@ -25,7 +25,7 @@
#include <string.h>
int strequal(const char *first, const char *second)
int Curl_strequal(const char *first, const char *second)
{
#if defined(HAVE_STRCASECMP)
return !strcasecmp(first, second);
@@ -45,7 +45,7 @@ int strequal(const char *first, const char *second)
#endif
}
int strnequal(const char *first, const char *second, size_t max)
int Curl_strnequal(const char *first, const char *second, size_t max)
{
#if defined(HAVE_STRCASECMP)
return !strncasecmp(first, second, max);
@@ -66,3 +66,44 @@ int strnequal(const char *first, const char *second, size_t max)
#endif
}
#ifndef HAVE_STRLCAT
/*
* The strlcat() function appends the NUL-terminated string src to the end
* of dst. It will append at most size - strlen(dst) - 1 bytes, NUL-termi-
* nating the result.
*
* The strlcpy() and strlcat() functions return the total length of the
* string they tried to create. For strlcpy() that means the length of src.
* For strlcat() that means the initial length of dst plus the length of
* src. While this may seem somewhat confusing it was done to make trunca-
* tion detection simple.
*
*
*/
size_t strlcat(char *dst, const char *src, size_t siz)
{
char *d = dst;
const char *s = src;
size_t n = siz;
size_t dlen;
/* Find the end of dst and adjust bytes left but don't go past end */
while (n-- != 0 && *d != '\0')
d++;
dlen = d - dst;
n = siz - dlen;
if (n == 0)
return(dlen + strlen(s));
while (*s != '\0') {
if (n != 1) {
*d++ = *s;
n--;
}
s++;
}
*d = '\0';
return(dlen + (s - src)); /* count does not include NUL */
}
#endif

View File

@@ -22,7 +22,10 @@
*
* $Id$
*****************************************************************************/
int strequal(const char *first, const char *second);
int strnequal(const char *first, const char *second, size_t max);
int Curl_strequal(const char *first, const char *second);
int Curl_strnequal(const char *first, const char *second, size_t max);
#define strequal(a,b) Curl_strequal(a,b)
#define strnequal(a,b,c) Curl_strnequal(a,b,c)
#endif

View File

@@ -71,17 +71,14 @@
#include "urldata.h"
#include <curl/curl.h>
#include "download.h"
#include "transfer.h"
#include "sendf.h"
#include "formdata.h"
#include "progress.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
#define TELOPTS
#define TELCMDS
#define SLC_NAMES
#include "arpa_telnet.h"
@@ -98,10 +95,7 @@
#define SB_EOF() (subpointer >= subend)
#define SB_LEN() (subend - subpointer)
void telwrite(struct UrlData *data,
unsigned char *buffer, /* Data to write */
int count); /* Number of bytes to write */
static
void telrcv(struct UrlData *data,
unsigned char *inbuf, /* Data received from socket */
int count); /* Number of bytes received */
@@ -155,6 +149,7 @@ static int him[256];
static int himq[256];
static int him_preferred[256];
static
void init_telnet(struct UrlData *data)
{
telrcv_state = TS_DATA;
@@ -246,6 +241,7 @@ static void send_negotiation(struct UrlData *data, int cmd, int option)
printoption(data, "SENT", cmd, option);
}
static
void set_remote_option(struct UrlData *data, int option, int newstate)
{
if(newstate == YES)
@@ -326,6 +322,7 @@ void set_remote_option(struct UrlData *data, int option, int newstate)
}
}
static
void rec_will(struct UrlData *data, int option)
{
switch(him[option])
@@ -377,6 +374,7 @@ void rec_will(struct UrlData *data, int option)
}
}
static
void rec_wont(struct UrlData *data, int option)
{
switch(him[option])
@@ -500,6 +498,7 @@ void set_local_option(struct UrlData *data, int option, int newstate)
}
}
static
void rec_do(struct UrlData *data, int option)
{
switch(us[option])
@@ -550,7 +549,8 @@ void rec_do(struct UrlData *data, int option)
break;
}
}
static
void rec_dont(struct UrlData *data, int option)
{
switch(us[option])
@@ -669,6 +669,7 @@ static void suboption(struct UrlData *data)
return;
}
static
void telrcv(struct UrlData *data,
unsigned char *inbuf, /* Data received from socket */
int count) /* Number of bytes received */
@@ -689,7 +690,7 @@ void telrcv(struct UrlData *data,
break; /* Ignore \0 after CR */
}
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
continue;
case TS_DATA:
@@ -703,7 +704,7 @@ void telrcv(struct UrlData *data,
telrcv_state = TS_CR;
}
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
continue;
case TS_IAC:
@@ -727,7 +728,7 @@ void telrcv(struct UrlData *data,
telrcv_state = TS_SB;
continue;
case IAC:
client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
Curl_client_write(data, CLIENTWRITE_BODY, (char *)&c, 1);
break;
case DM:
case NOP:
@@ -818,41 +819,12 @@ void telrcv(struct UrlData *data,
}
}
void telwrite(struct UrlData *data,
unsigned char *buffer, /* Data to write */
int count) /* Number of bytes to write */
{
unsigned char outbuf[2];
int out_count = 0;
int bytes_written;
while(count--)
{
outbuf[0] = *buffer++;
out_count = 1;
if(outbuf[0] == IAC)
outbuf[out_count++] = IAC;
#ifndef USE_SSLEAY
bytes_written = swrite(data->firstsocket, outbuf, out_count);
#else
if (data->ssl.use) {
bytes_written = SSL_write(data->ssl.handle, (char *)outbuf,
out_count);
}
else {
bytes_written = swrite(data->firstsocket, outbuf, out_count);
}
#endif /* USE_SSLEAY */
}
}
CURLcode telnet_done(struct connectdata *conn)
CURLcode Curl_telnet_done(struct connectdata *conn)
{
return CURLE_OK;
}
CURLcode telnet(struct connectdata *conn)
CURLcode Curl_telnet(struct connectdata *conn)
{
struct UrlData *data = conn->data;
int sockfd = data->firstsocket;
@@ -861,7 +833,7 @@ CURLcode telnet(struct connectdata *conn)
bool keepon = TRUE;
char *buf = data->buffer;
int nread;
ssize_t nread;
init_telnet(data);
@@ -871,49 +843,51 @@ CURLcode telnet(struct connectdata *conn)
keepfd = readfd;
while (keepon)
{
readfd = keepfd; /* set this every lap in the loop */
while (keepon) {
readfd = keepfd; /* set this every lap in the loop */
switch (select (sockfd + 1, &readfd, NULL, NULL, NULL))
{
case -1: /* error, stop reading */
keepon = FALSE;
continue;
case 0: /* timeout */
break;
default: /* read! */
if(FD_ISSET(1, &readfd))
{
nread = read(1, buf, 255);
telwrite(data, (unsigned char *)buf, nread);
}
switch (select (sockfd + 1, &readfd, NULL, NULL, NULL)) {
case -1: /* error, stop reading */
keepon = FALSE;
continue;
case 0: /* timeout */
break;
default: /* read! */
if(FD_ISSET(1, &readfd)) { /* read from stdin */
unsigned char outbuf[2];
int out_count = 0;
size_t bytes_written;
char *buffer = buf;
nread = read(1, buf, 255);
if(FD_ISSET(sockfd, &readfd))
{
#ifndef USE_SSLEAY
nread = sread (sockfd, buf, BUFSIZE - 1);
#else
if (data->ssl.use) {
nread = SSL_read (data->ssl.handle, buf, BUFSIZE - 1);
}
else {
nread = sread (sockfd, buf, BUFSIZE - 1);
}
#endif /* USE_SSLEAY */
}
/* if we receive 0 or less here, the server closed the connection and
we bail out from this! */
if (nread <= 0) {
keepon = FALSE;
break;
}
telrcv(data, (unsigned char *)buf, nread);
while(nread--) {
outbuf[0] = *buffer++;
out_count = 1;
if(outbuf[0] == IAC)
outbuf[out_count++] = IAC;
Curl_write(conn, data->firstsocket, outbuf,
out_count, &bytes_written);
}
}
}
return CURLE_OK;
if(FD_ISSET(sockfd, &readfd)) {
Curl_read(conn, sockfd, buf, BUFSIZE - 1, &nread);
/* if we receive 0 or less here, the server closed the connection and
we bail out from this! */
if (nread <= 0) {
keepon = FALSE;
break;
}
telrcv(data, (unsigned char *)buf, nread);
}
}
}
/* mark this as "no further transfer wanted" */
return Curl_Transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
}

View File

@@ -23,7 +23,7 @@
*
* $Id$
*****************************************************************************/
CURLcode telnet(struct connectdata *conn);
CURLcode telnet_done(struct connectdata *conn);
CURLcode Curl_telnet(struct connectdata *conn);
CURLcode Curl_telnet_done(struct connectdata *conn);
#endif

View File

@@ -53,7 +53,7 @@ gettimeofday (struct timeval *tp, void *nothing)
#endif
#endif
struct timeval tvnow ()
struct timeval Curl_tvnow ()
{
struct timeval now;
#ifdef HAVE_GETTIMEOFDAY
@@ -65,12 +65,12 @@ struct timeval tvnow ()
return now;
}
double tvdiff (struct timeval t1, struct timeval t2)
double Curl_tvdiff (struct timeval t1, struct timeval t2)
{
return (double)(t1.tv_sec - t2.tv_sec) + ((t1.tv_usec-t2.tv_usec)/1000000.0);
}
long tvlong (struct timeval t1)
long Curl_tvlong (struct timeval t1)
{
return t1.tv_sec;
}

View File

@@ -42,8 +42,8 @@ struct timeval {
#endif
#endif
struct timeval tvnow ();
double tvdiff (struct timeval t1, struct timeval t2);
long tvlong (struct timeval t1);
struct timeval Curl_tvnow ();
double Curl_tvdiff (struct timeval t1, struct timeval t2);
long Curl_tvlong (struct timeval t1);
#endif

View File

@@ -82,9 +82,8 @@
#include <curl/types.h>
#include "netrc.h"
#include "getenv.h"
#include "hostip.h"
#include "download.h"
#include "transfer.h"
#include "sendf.h"
#include "speedcheck.h"
#include "getpass.h"
@@ -103,14 +102,17 @@
#define min(a, b) ((a) < (b) ? (a) : (b))
#endif
CURLcode
/* Parts of this function was written by the friendly Mark Butler
<butlerm@xmission.com>. */
CURLcode static
_Transfer(struct connectdata *c_conn)
{
size_t nread; /* number of bytes read */
ssize_t nread; /* number of bytes read */
int bytecount = 0; /* total number of bytes read */
int writebytecount = 0; /* number of bytes written */
long contentlength=0; /* size of incoming data */
struct timeval start = tvnow();
struct timeval start = Curl_tvnow();
struct timeval now = start; /* current time */
bool header = TRUE; /* incoming data has HTTP header */
int headerline = 0; /* counts header lines to better track the
@@ -130,8 +132,6 @@ _Transfer(struct connectdata *c_conn)
CURLcode urg;
time_t timeofdoc=0;
long bodywrites=0;
char newurl[URL_MAX_LENGTH]; /* buffer for Location: URL */
int writetype;
/* the highest fd we use + 1 */
@@ -151,19 +151,25 @@ _Transfer(struct connectdata *c_conn)
myalarm (0); /* switch off the alarm-style timeout */
now = tvnow();
now = Curl_tvnow();
start = now;
#define KEEP_READ 1
#define KEEP_WRITE 2
pgrsTime(data, TIMER_PRETRANSFER);
speedinit(data);
Curl_pgrsTime(data, TIMER_PRETRANSFER);
Curl_speedinit(data);
if((conn->sockfd == -1) &&
(conn->writesockfd == -1)) {
/* nothing to read, nothing to write, we're already OK! */
return CURLE_OK;
}
if (!conn->getheader) {
header = FALSE;
if(conn->size > 0)
pgrsSetDownloadSize(data, conn->size);
Curl_pgrsSetDownloadSize(data, conn->size);
}
/* we want header and/or body, if neither then don't do this! */
if(conn->getheader ||
@@ -221,7 +227,7 @@ _Transfer(struct connectdata *c_conn)
default:
if((keepon & KEEP_READ) && FD_ISSET(conn->sockfd, &readfd)) {
/* read! */
urg = curl_read(conn, buf, BUFSIZE -1, &nread);
urg = Curl_read(conn, conn->sockfd, buf, BUFSIZE -1, &nread);
/* NULL terminate, allowing string ops to be used */
if (0 < (signed int) nread)
@@ -314,7 +320,7 @@ _Transfer(struct connectdata *c_conn)
if ('\n' == *p)
p++; /* pass the \n byte */
pgrsSetDownloadSize(data, conn->size);
Curl_pgrsSetDownloadSize(data, conn->size);
header = FALSE; /* no more header to parse! */
@@ -324,8 +330,8 @@ _Transfer(struct connectdata *c_conn)
if (data->bits.http_include_header)
writetype |= CLIENTWRITE_BODY;
urg = client_write(data, writetype, data->headerbuff,
p - data->headerbuff);
urg = Curl_client_write(data, writetype, data->headerbuff,
p - data->headerbuff);
if(urg)
return urg;
@@ -374,7 +380,7 @@ _Transfer(struct connectdata *c_conn)
}
else if(data->cookies &&
strnequal("Set-Cookie: ", p, 11)) {
cookie_add(data->cookies, TRUE, &p[12]);
Curl_cookie_add(data->cookies, TRUE, &p[12]);
}
else if(strnequal("Last-Modified:", p,
strlen("Last-Modified:")) &&
@@ -386,19 +392,28 @@ _Transfer(struct connectdata *c_conn)
}
else if ((code >= 300 && code < 400) &&
(data->bits.http_follow_location) &&
strnequal("Location", p, 8) &&
sscanf (p+8, ": %" URL_MAX_LENGTH_TXT "s",
newurl)) {
/* this is the URL that the server advices us to get
instead */
data->newurl = strdup (newurl);
strnequal("Location: ", p, 10)) {
/* this is the URL that the server advices us to get instead */
char *ptr;
char *start=p;
char backup;
start += 10; /* pass "Location: " */
ptr = start; /* start scanning here */
/* scan through the string to find the end */
while(*ptr && !isspace((int)*ptr))
ptr++;
backup = *ptr; /* store the ending letter */
*ptr = '\0'; /* zero terminate */
data->newurl = strdup(start); /* clone string */
*ptr = backup; /* restore ending letter */
}
writetype = CLIENTWRITE_HEADER;
if (data->bits.http_include_header)
writetype |= CLIENTWRITE_BODY;
urg = client_write(data, writetype, p, hbuflen);
urg = Curl_client_write(data, writetype, p, hbuflen);
if(urg)
return urg;
@@ -434,17 +449,21 @@ _Transfer(struct connectdata *c_conn)
write a chunk of the body */
if(conn->protocol&PROT_HTTP) {
/* HTTP-only checks */
if (data->resume_from && !content_range ) {
/* we wanted to resume a download, although the server
doesn't seem to support this */
failf (data, "HTTP server doesn't seem to support byte ranges. Cannot resume.");
return CURLE_HTTP_RANGE_ERROR;
}
else if (data->newurl) {
if (data->newurl) {
/* abort after the headers if "follow Location" is set */
infof (data, "Follow to new URL: %s\n", data->newurl);
return CURLE_OK;
}
else if (data->resume_from &&
!content_range &&
(data->httpreq==HTTPREQ_GET)) {
/* we wanted to resume a download, although the server
doesn't seem to support this and we did this with a GET
(if it wasn't a GET we did a POST or PUT resume) */
failf (data, "HTTP server doesn't seem to support "
"byte ranges. Cannot resume.");
return CURLE_HTTP_RANGE_ERROR;
}
else if(data->timecondition && !data->range) {
/* A time condition has been set AND no ranges have been
requested. This seems to be what chapter 13.3.4 of
@@ -456,14 +475,14 @@ _Transfer(struct connectdata *c_conn)
default:
if(timeofdoc < data->timevalue) {
infof(data,
"The requested document is not new enough");
"The requested document is not new enough\n");
return CURLE_OK;
}
break;
case TIMECOND_IFUNMODSINCE:
if(timeofdoc > data->timevalue) {
infof(data,
"The requested document is not old enough");
"The requested document is not old enough\n");
return CURLE_OK;
}
break;
@@ -484,9 +503,9 @@ _Transfer(struct connectdata *c_conn)
bytecount += nread;
pgrsSetDownloadCounter(data, (double)bytecount);
Curl_pgrsSetDownloadCounter(data, (double)bytecount);
urg = client_write(data, CLIENTWRITE_BODY, str, nread);
urg = Curl_client_write(data, CLIENTWRITE_BODY, str, nread);
if(urg)
return urg;
@@ -513,7 +532,7 @@ _Transfer(struct connectdata *c_conn)
break;
}
writebytecount += nread;
pgrsSetUploadCounter(data, (double)writebytecount);
Curl_pgrsSetUploadCounter(data, (double)writebytecount);
/* convert LF to CRLF if so asked */
if (data->crlf) {
@@ -531,7 +550,8 @@ _Transfer(struct connectdata *c_conn)
}
/* write to socket */
urg = curl_write(conn, buf, nread, &bytes_written);
urg = Curl_write(conn, conn->writesockfd, buf, nread,
&bytes_written);
if(nread != bytes_written) {
failf(data, "Failed uploading data");
@@ -543,11 +563,11 @@ _Transfer(struct connectdata *c_conn)
break;
}
now = tvnow();
if(pgrsUpdate(data))
now = Curl_tvnow();
if(Curl_pgrsUpdate(data))
urg = CURLE_ABORTED_BY_CALLBACK;
else
urg = speedcheck (data, now);
urg = Curl_speedcheck (data, now);
if (urg)
return urg;
@@ -560,7 +580,7 @@ _Transfer(struct connectdata *c_conn)
conn->upload_bufsize=(long)min(data->progress.ulspeed, BUFSIZE);
}
if (data->timeout && (tvdiff (now, start) > data->timeout)) {
if (data->timeout && (Curl_tvdiff (now, start) > data->timeout)) {
failf (data, "Operation timed out with %d out of %d bytes received",
bytecount, conn->size);
return CURLE_OPERATION_TIMEOUTED;
@@ -573,7 +593,7 @@ _Transfer(struct connectdata *c_conn)
contentlength-bytecount);
return CURLE_PARTIAL_FILE;
}
if(pgrsUpdate(data))
if(Curl_pgrsUpdate(data))
return CURLE_ABORTED_BY_CALLBACK;
if(conn->bytecountp)
@@ -592,10 +612,10 @@ CURLcode curl_transfer(CURL *curl)
struct UrlData *data = curl;
struct connectdata *c_connect=NULL;
pgrsStartNow(data);
Curl_pgrsStartNow(data);
do {
pgrsTime(data, TIMER_STARTSINGLE);
Curl_pgrsTime(data, TIMER_STARTSINGLE);
res = curl_connect(curl, (CURLconnect **)&c_connect);
if(res == CURLE_OK) {
res = curl_do(c_connect);
@@ -610,8 +630,9 @@ CURLcode curl_transfer(CURL *curl)
This is assumed to happen for HTTP(S) only!
*/
char prot[16];
char path[URL_MAX_LENGTH];
char prot[16]; /* URL protocol string storage */
char letter; /* used for a silly sscanf */
if (data->maxredirs && (data->followlocation >= data->maxredirs)) {
failf(data,"Maximum (%d) redirects followed", data->maxredirs);
curl_disconnect(c_connect);
@@ -635,12 +656,11 @@ CURLcode curl_transfer(CURL *curl)
}
data->referer = strdup(data->url);
data->free_referer = TRUE; /* yes, free this later */
data->free_referer = TRUE; /* yes, free this later */
data->bits.http_set_referer = TRUE; /* might have been false */
}
if(2 != sscanf(data->newurl, "%15[^:]://%" URL_MAX_LENGTH_TXT
"s", prot, path)) {
if(2 != sscanf(data->newurl, "%15[^:]://%c", prot, &letter)) {
/***
*DANG* this is an RFC 2068 violation. The URL is supposed
to be absolute and this doesn't seem to be that!
@@ -710,13 +730,48 @@ CURLcode curl_transfer(CURL *curl)
data->newurl = NULL; /* don't show! */
data->bits.urlstringalloc = TRUE; /* the URL is allocated */
/* Disable both types of POSTs, since doing a second POST when
following isn't what anyone would want! */
data->bits.http_post = FALSE;
data->bits.http_formpost = FALSE;
infof(data, "Follows Location: to new URL: '%s'\n", data->url);
/*
* We get here when the HTTP code is 300-399. We need to perform
* differently based on exactly what return code there was.
* Discussed on the curl mailing list and posted about on the 26th
* of January 2001.
*/
switch(data->progress.httpcode) {
case 300: /* Multiple Choices */
case 301: /* Moved Permanently */
case 302: /* Found */
case 306: /* Not used */
case 307: /* Temporary Redirect */
default: /* for all unknown ones */
/* These are explicitly mention since I've checked RFC2616 and they
* seem to be OK to POST to.
*/
break;
case 303: /* See Other */
/* Disable both types of POSTs, since doing a second POST when
* following isn't what anyone would want! */
data->bits.http_post = FALSE;
data->bits.http_formpost = FALSE;
data->httpreq = HTTPREQ_GET; /* enfore GET request */
infof(data, "Disables POST\n");
break;
case 304: /* Not Modified */
/* 304 means we did a conditional request and it was "Not modified".
* We shouldn't get any Location: header in this response!
*/
break;
case 305: /* Use Proxy */
/* (quote from RFC2616, section 10.3.6):
* "The requested resource MUST be accessed through the proxy given
* by the Location field. The Location field gives the URI of the
* proxy. The recipient is expected to repeat this single request
* via the proxy. 305 responses MUST only be generated by origin
* servers."
*/
break;
}
curl_disconnect(c_connect);
continue;
}
@@ -733,3 +788,32 @@ CURLcode curl_transfer(CURL *curl)
return res;
}
CURLcode
Curl_Transfer(struct connectdata *c_conn, /* connection data */
int sockfd, /* socket to read from or -1 */
int size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */
long *bytecountp, /* return number of bytes read or NULL */
int writesockfd, /* socket to write to, it may very well be
the same we read from. -1 disables */
long *writebytecountp /* return number of bytes written or
NULL */
)
{
struct connectdata *conn = (struct connectdata *)c_conn;
if(!conn)
return CURLE_BAD_FUNCTION_ARGUMENT;
/* now copy all input parameters */
conn->sockfd = sockfd;
conn->size = size;
conn->getheader = getheader;
conn->bytecountp = bytecountp;
conn->writesockfd = writesockfd;
conn->writebytecountp = writebytecountp;
return CURLE_OK;
}

View File

@@ -1,5 +1,5 @@
#ifndef __DOWNLOAD_H
#define __DOWNLOAD_H
#ifndef __TRANSFER_H
#define __TRANSFER_H
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
@@ -22,15 +22,23 @@
*
* $Id$
*****************************************************************************/
CURLcode curl_transfer(CURL *curl);
CURLcode
Transfer (struct connectdata *data,
int sockfd, /* socket to read from or -1 */
int size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */
long *bytecountp, /* return number of bytes read */
int writesockfd, /* socket to write to, it may very well be
the same we read from. -1 disables */
long *writebytecountp /* return number of bytes written */
Curl_Transfer (struct connectdata *data,
int sockfd, /* socket to read from or -1 */
int size, /* -1 if unknown at this point */
bool getheader, /* TRUE if header parsing is wanted */
long *bytecountp, /* return number of bytes read */
int writesockfd, /* socket to write to, it may very well be
the same we read from. -1 disables */
long *writebytecountp /* return number of bytes written */
);
#ifdef _OLDCURL
/* "hackish" define to make sources compile without too much human editing.
Don't use "Tranfer()" anymore! */
#define Transfer(a,b,c,d,e,f,g) Curl_Transfer(a,b,c,d,e,f,g)
#endif
#endif

551
lib/url.c
View File

@@ -80,14 +80,12 @@
#include "netrc.h"
#include "formdata.h"
#include "getenv.h"
#include "base64.h"
#include "ssluse.h"
#include "hostip.h"
#include "if2ip.h"
#include "download.h"
#include "transfer.h"
#include "sendf.h"
#include "speedcheck.h"
#include "getpass.h"
#include "progress.h"
#include "cookie.h"
@@ -224,7 +222,7 @@ void static urlfree(struct UrlData *data, bool totally)
/* the URL is allocated, free it! */
free(data->url);
cookie_cleanup(data->cookies);
Curl_cookie_cleanup(data->cookies);
free(data);
@@ -248,6 +246,7 @@ CURLcode curl_close(CURL *curl)
return CURLE_OK;
}
static
int my_getpass(void *clientp, char *prompt, char* buffer, int buflen )
{
char *retbuf;
@@ -301,6 +300,8 @@ CURLcode curl_open(CURL **curl, char *url)
data->current_speed = -1; /* init to negative == impossible */
data->httpreq = HTTPREQ_GET; /* Default HTTP request */
*curl = data;
return CURLE_OK;
}
@@ -337,9 +338,14 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
break;
case CURLOPT_UPLOAD:
data->bits.upload = va_arg(param, long)?TRUE:FALSE;
if(data->bits.upload)
/* If this is HTTP, PUT is what's needed to "upload" */
data->httpreq = HTTPREQ_PUT;
break;
case CURLOPT_POST:
data->bits.http_post = va_arg(param, long)?TRUE:FALSE;
if(data->bits.http_post)
data->httpreq = HTTPREQ_POST;
break;
case CURLOPT_FILETIME:
data->bits.get_filetime = va_arg(param, long)?TRUE:FALSE;
@@ -361,19 +367,18 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
break;
case CURLOPT_PUT:
data->bits.http_put = va_arg(param, long)?TRUE:FALSE;
if(data->bits.http_put)
data->httpreq = HTTPREQ_PUT;
break;
case CURLOPT_MUTE:
data->bits.mute = va_arg(param, long)?TRUE:FALSE;
break;
case CURLOPT_TIMECONDITION:
data->timecondition = va_arg(param, long);
break;
case CURLOPT_TIMEVALUE:
data->timevalue = va_arg(param, long);
break;
case CURLOPT_SSLVERSION:
data->ssl.version = va_arg(param, long);
break;
@@ -381,7 +386,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
case CURLOPT_COOKIEFILE:
cookiefile = (char *)va_arg(param, void *);
if(cookiefile) {
data->cookies = cookie_init(cookiefile);
data->cookies = Curl_cookie_init(cookiefile);
}
break;
case CURLOPT_WRITEHEADER:
@@ -405,10 +410,14 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
break;
case CURLOPT_CUSTOMREQUEST:
data->customrequest = va_arg(param, char *);
if(data->customrequest)
data->httpreq = HTTPREQ_CUSTOM;
break;
case CURLOPT_HTTPPOST:
data->httppost = va_arg(param, struct HttpPost *);
data->bits.http_formpost = data->httppost?1:0;
if(data->bits.http_formpost)
data->httpreq = HTTPREQ_POST_FORM;
break;
case CURLOPT_INFILE:
data->in = va_arg(param, FILE *);
@@ -533,50 +542,11 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
return CURLE_OK;
}
/*
* Read everything until a newline.
*/
int GetLine(int sockfd, char *buf, struct UrlData *data)
{
int nread;
int read_rc=1;
char *ptr;
ptr=buf;
/* get us a full line, terminated with a newline */
for(nread=0;
(nread<BUFSIZE) && read_rc;
nread++, ptr++) {
#ifdef USE_SSLEAY
if (data->ssl.use) {
read_rc = SSL_read(data->ssl.handle, ptr, 1);
}
else {
#endif
read_rc = sread(sockfd, ptr, 1);
#ifdef USE_SSLEAY
}
#endif /* USE_SSLEAY */
if (*ptr == '\n')
break;
}
*ptr=0; /* zero terminate */
if(data->bits.verbose) {
fputs("< ", data->err);
fwrite(buf, 1, nread, data->err);
fputs("\n", data->err);
}
return nread;
}
#ifndef WIN32
#if !defined(WIN32)||defined(__CYGWIN32__)
#ifndef RETSIGTYPE
#define RETSIGTYPE void
#endif
static
RETSIGTYPE alarmfunc(int signal)
{
/* this is for "-ansi -Wall -pedantic" to stop complaining! (rabe) */
@@ -585,75 +555,23 @@ RETSIGTYPE alarmfunc(int signal)
}
#endif
CURLcode curl_write(CURLconnect *c_conn, char *buf, size_t amount,
size_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
struct UrlData *data;
size_t bytes_written;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
data = conn->data;
#ifdef USE_SSLEAY
if (data->ssl.use) {
bytes_written = SSL_write(data->ssl.handle, buf, amount);
}
else {
#endif
#ifdef KRB4
if(conn->sec_complete)
bytes_written = sec_write(conn, conn->writesockfd, buf, amount);
else
#endif
bytes_written = swrite(conn->writesockfd, buf, amount);
#ifdef USE_SSLEAY
}
#endif /* USE_SSLEAY */
*n = bytes_written;
return CURLE_OK;
}
CURLcode curl_read(CURLconnect *c_conn, char *buf, size_t buffersize,
size_t *n)
{
struct connectdata *conn = (struct connectdata *)c_conn;
struct UrlData *data;
size_t nread;
if(!n || !conn || (conn->handle != STRUCT_CONNECT))
return CURLE_FAILED_INIT;
data = conn->data;
#ifdef USE_SSLEAY
if (data->ssl.use) {
nread = SSL_read (data->ssl.handle, buf, buffersize);
}
else {
#endif
#ifdef KRB4
if(conn->sec_complete)
nread = sec_read(conn, conn->sockfd, buf, buffersize);
else
#endif
nread = sread (conn->sockfd, buf, buffersize);
#ifdef USE_SSLEAY
}
#endif /* USE_SSLEAY */
*n = nread;
return CURLE_OK;
}
CURLcode curl_disconnect(CURLconnect *c_connect)
{
struct connectdata *conn = c_connect;
struct UrlData *data = conn->data;
if(data->proto.generic)
free(data->proto.generic);
data->proto.generic=NULL; /* it is gone */
#ifdef ENABLE_IPV6
if(conn->res) /* host name info */
freeaddrinfo(conn->res);
#else
if(conn->hostent_buf) /* host name info */
free(conn->hostent_buf);
#endif
if(conn->path) /* the URL path part */
free(conn->path);
@@ -674,10 +592,18 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
char resumerange[40]="";
struct UrlData *data = curl;
struct connectdata *conn;
char endbracket;
#ifdef HAVE_SIGACTION
struct sigaction sigact;
#endif
int urllen;
#ifdef ENABLE_IPV6
struct addrinfo *ai;
#endif
/*************************************************************
* Check input data
*************************************************************/
if(!data || (data->handle != STRUCT_OPEN))
return CURLE_BAD_FUNCTION_ARGUMENT; /* TBD: make error codes */
@@ -685,6 +611,9 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
if(!data->url)
return CURLE_URL_MALFORMAT;
/*************************************************************
* Allocate and initiate a connection struct
*************************************************************/
conn = (struct connectdata *)malloc(sizeof(struct connectdata));
if(!conn) {
*in_connect = NULL; /* clear the pointer */
@@ -703,6 +632,9 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
buf = data->buffer; /* this is our buffer */
/*************************************************************
* Set signal handler
*************************************************************/
#ifdef HAVE_SIGACTION
sigaction(SIGALRM, NULL, &sigact);
sigact.sa_handler = alarmfunc;
@@ -719,9 +651,11 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
#endif
/* We need to allocate memory to store the path in. We get the size of the
full URL to be sure, and we need to make it at least 256 bytes since
other parts of the code will rely on this fact */
/***********************************************************
* We need to allocate memory to store the path in. We get the size of the
* full URL to be sure, and we need to make it at least 256 bytes since
* other parts of the code will rely on this fact
***********************************************************/
#define LEAST_PATH_ALLOC 256
urllen=strlen(data->url);
if(urllen < LEAST_PATH_ALLOC)
@@ -731,25 +665,30 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
if(NULL == conn->path)
return CURLE_OUT_OF_MEMORY; /* really bad error */
/* Parse <url> */
/* We need to parse the url, even when using the proxy, because
* we will need the hostname and port in case we are trying
* to SSL connect through the proxy -- and we don't know if we
* will need to use SSL until we parse the url ...
*/
/*************************************************************
* Parse the URL.
*
* We need to parse the url even when using the proxy, because we will need
* the hostname and port in case we are trying to SSL connect through the
* proxy -- and we don't know if we will need to use SSL until we parse the
* url ...
************************************************************/
if((2 == sscanf(data->url, "%64[^:]://%[^\n]",
conn->proto,
conn->path)) && strequal(conn->proto, "file")) {
/* we deal with file://<host>/<path> differently since it
supports no hostname other than "localhost" and "127.0.0.1",
which is unique among the protocols specified in RFC 1738 */
/*
* we deal with file://<host>/<path> differently since it supports no
* hostname other than "localhost" and "127.0.0.1", which is unique among
* the URL protocols specified in RFC 1738
*/
if (strnequal(conn->path, "localhost/", 10) ||
strnequal(conn->path, "127.0.0.1/", 10))
/* ... since coincidentally both host strings are of equal length
otherwise, <host>/ is quietly ommitted */
/* If there's another host name than the one we support, <host>/ is
* quietly ommitted */
strcpy(conn->path, &conn->path[10]);
strcpy(conn->proto, "file");
strcpy(conn->proto, "file"); /* store protocol string lowercase */
}
else {
/* Set default host and default path */
@@ -760,12 +699,24 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
"%64[^\n:]://%256[^\n/]%[^\n]",
conn->proto, conn->gname, conn->path)) {
/* badly formatted, let's try the browser-style _without_ 'http://' */
/*
* The URL was badly formatted, let's try the browser-style _without_
* protocol specified like 'http://'.
*/
if((1 > sscanf(data->url, "%256[^\n/]%[^\n]",
conn->gname, conn->path)) ) {
/*
* We couldn't even get this format.
*/
failf(data, "<url> malformed");
return CURLE_URL_MALFORMAT;
}
/*
* Since there was no protocol part specified, we guess what protocol it
* is based on the first letters of the server name.
*/
if(strnequal(conn->gname, "FTP", 3)) {
strcpy(conn->proto, "ftp");
}
@@ -789,6 +740,9 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
}
/*************************************************************
* Take care of user and password authentication stuff
*************************************************************/
if(data->bits.user_passwd && !data->bits.use_netrc) {
data->user[0] =0;
@@ -798,7 +752,7 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
/* the name is given, get user+password */
sscanf(data->userpwd, "%127[^:]:%127[^\n]",
data->user, data->passwd);
}
}
else
/* no name given, get the password only */
sscanf(data->userpwd+1, "%127[^\n]", data->passwd);
@@ -812,6 +766,9 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
}
/*************************************************************
* Take care of proxy authentication stuff
*************************************************************/
if(data->bits.proxy_user_passwd) {
data->proxyuser[0] =0;
data->proxypasswd[0]=0;
@@ -837,37 +794,43 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
/*************************************************************
* Set a few convenience pointers
*************************************************************/
conn->name = conn->gname;
conn->ppath = conn->path;
data->hostname = conn->name;
/*************************************************************
* Detect what (if any) proxy to use
*************************************************************/
if(!data->bits.httpproxy) {
/* If proxy was not specified, we check for default proxy environment
variables, to enable i.e Lynx compliance:
http_proxy=http://some.server.dom:port/
https_proxy=http://some.server.dom:port/
ftp_proxy=http://some.server.dom:port/
gopher_proxy=http://some.server.dom:port/
no_proxy=domain1.dom,host.domain2.dom
(a comma-separated list of hosts which should
not be proxied, or an asterisk to override
all proxy variables)
all_proxy=http://some.server.dom:port/
(seems to exist for the CERN www lib. Probably
the first to check for.)
For compatibility, the all-uppercase versions of these variables are
checked if the lowercase versions don't exist.
*/
* variables, to enable i.e Lynx compliance:
*
* http_proxy=http://some.server.dom:port/
* https_proxy=http://some.server.dom:port/
* ftp_proxy=http://some.server.dom:port/
* gopher_proxy=http://some.server.dom:port/
* no_proxy=domain1.dom,host.domain2.dom
* (a comma-separated list of hosts which should
* not be proxied, or an asterisk to override
* all proxy variables)
* all_proxy=http://some.server.dom:port/
* (seems to exist for the CERN www lib. Probably
* the first to check for.)
*
* For compatibility, the all-uppercase versions of these variables are
* checked if the lowercase versions don't exist.
*/
char *no_proxy=NULL;
char *proxy=NULL;
char proxy_env[128];
no_proxy=GetEnv("no_proxy");
no_proxy=curl_getenv("no_proxy");
if(!no_proxy)
no_proxy=GetEnv("NO_PROXY");
no_proxy=curl_getenv("NO_PROXY");
if(!no_proxy || !strequal("*", no_proxy)) {
/* NO_PROXY wasn't specified or it wasn't just an asterisk */
@@ -899,22 +862,22 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
strcpy(envp, "_proxy");
/* read the protocol proxy: */
prox=GetEnv(proxy_env);
prox=curl_getenv(proxy_env);
if(!prox) {
/* There was no lowercase variable, try the uppercase version: */
for(envp = proxy_env; *envp; envp++)
*envp = toupper(*envp);
prox=GetEnv(proxy_env);
prox=curl_getenv(proxy_env);
}
if(prox && *prox) { /* don't count "" strings */
proxy = prox; /* use this */
}
else {
proxy = GetEnv("all_proxy"); /* default proxy to use */
proxy = curl_getenv("all_proxy"); /* default proxy to use */
if(!proxy)
proxy=GetEnv("ALL_PROXY");
proxy=curl_getenv("ALL_PROXY");
}
if(proxy && *proxy) {
@@ -929,13 +892,16 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
free(no_proxy);
} /* if not using proxy */
/*************************************************************
* No protocol but proxy usage needs attention
*************************************************************/
if((conn->protocol&PROT_MISSING) && data->bits.httpproxy ) {
/* We're guessing prefixes here and since we're told to use a proxy, we
need to add the protocol prefix to the URL string before we continue!
*/
char *reurl;
reurl = maprintf("%s://%s", conn->proto, data->url);
reurl = aprintf("%s://%s", conn->proto, data->url);
if(!reurl)
return CURLE_OUT_OF_MEMORY;
@@ -948,13 +914,15 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
conn->protocol &= ~PROT_MISSING; /* switch that one off again */
}
/* RESUME on a HTTP page is a tricky business. First, let's just check that
'range' isn't used, then set the range parameter and leave the resume as
it is to inform about this situation for later use. We will then
"attempt" to resume, and if we're talking to a HTTP/1.1 (or later)
server, we will get the document resumed. If we talk to a HTTP/1.0
server, we just fail since we can't rewind the file writing from within
this function. */
/************************************************************
* RESUME on a HTTP page is a tricky business. First, let's just check that
* 'range' isn't used, then set the range parameter and leave the resume as
* it is to inform about this situation for later use. We will then
* "attempt" to resume, and if we're talking to a HTTP/1.1 (or later)
* server, we will get the document resumed. If we talk to a HTTP/1.0
* server, we just fail since we can't rewind the file writing from within
* this function.
***********************************************************/
if(data->resume_from) {
if(!data->bits.set_range) {
/* if it already was in use, we just skip this */
@@ -965,28 +933,28 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
}
/*************************************************************
* Set timeout if that is being used
*************************************************************/
if(data->timeout) {
/* We set the timeout on the connection/resolving phase first, separately
from the download/upload part to allow a maximum time on everything */
* from the download/upload part to allow a maximum time on everything */
myalarm(data->timeout); /* this sends a signal when the timeout fires
off, and that will abort system calls */
}
/*
* Hmm, if we are using a proxy, then we can skip the GOPHER and the
* FTP steps, although we cannot skip the HTTPS step (since the proxy
* works differently, depending on whether its SSL or not).
*/
/*************************************************************
* Setup internals depending on protocol
*************************************************************/
if (strequal(conn->proto, "HTTP")) {
if(!data->port)
data->port = PORT_HTTP;
data->remote_port = PORT_HTTP;
conn->protocol |= PROT_HTTP;
conn->curl_do = http;
conn->curl_done = http_done;
conn->curl_close = http_close;
conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close;
}
else if (strequal(conn->proto, "HTTPS")) {
#ifdef USE_SSLEAY
@@ -996,10 +964,10 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
conn->protocol |= PROT_HTTP;
conn->protocol |= PROT_HTTPS;
conn->curl_do = http;
conn->curl_done = http_done;
conn->curl_connect = http_connect;
conn->curl_close = http_close;
conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done;
conn->curl_connect = Curl_http_connect;
conn->curl_close = Curl_http_close;
#else /* USE_SSLEAY */
failf(data, "libcurl was built with SSL disabled, https: not supported!");
@@ -1017,9 +985,9 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
conn->ppath = conn->path;
}
conn->protocol |= PROT_GOPHER;
conn->curl_do = http;
conn->curl_done = http_done;
conn->curl_close = http_close;
conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close;
}
else if(strequal(conn->proto, "FTP")) {
char *type;
@@ -1032,20 +1000,20 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
!data->bits.tunnel_thru_httpproxy) {
/* Unless we have asked to tunnel ftp operations through the proxy, we
switch and use HTTP operations only */
conn->curl_do = http;
conn->curl_done = http_done;
conn->curl_close = http_close;
conn->curl_do = Curl_http;
conn->curl_done = Curl_http_done;
conn->curl_close = Curl_http_close;
}
else {
conn->curl_do = ftp;
conn->curl_done = ftp_done;
conn->curl_connect = ftp_connect;
conn->curl_do = Curl_ftp;
conn->curl_done = Curl_ftp_done;
conn->curl_connect = Curl_ftp_connect;
}
conn->ppath++; /* don't include the initial slash */
/* FTP URLs support an extension like ";type=<typecode>" that
we'll try to get now! */
* we'll try to get now! */
type=strstr(conn->ppath, ";type=");
if(!type) {
type=strstr(conn->gname, ";type=");
@@ -1076,8 +1044,8 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
data->port = PORT_TELNET;
data->remote_port = PORT_TELNET;
conn->curl_do = telnet;
conn->curl_done = telnet_done;
conn->curl_do = Curl_telnet;
conn->curl_done = Curl_telnet_done;
}
else if (strequal(conn->proto, "DICT")) {
@@ -1085,16 +1053,16 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
if(!data->port)
data->port = PORT_DICT;
data->remote_port = PORT_DICT;
conn->curl_do = dict;
conn->curl_done = dict_done;
conn->curl_do = Curl_dict;
conn->curl_done = Curl_dict_done;
}
else if (strequal(conn->proto, "LDAP")) {
conn->protocol |= PROT_LDAP;
if(!data->port)
data->port = PORT_LDAP;
data->remote_port = PORT_LDAP;
conn->curl_do = ldap;
conn->curl_done = ldap_done;
conn->curl_do = Curl_ldap;
conn->curl_done = Curl_ldap_done;
}
else if (strequal(conn->proto, "FILE")) {
conn->protocol |= PROT_FILE;
@@ -1102,38 +1070,42 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
conn->curl_do = file;
/* no done() function */
result = Transfer(conn, -1, -1, FALSE, NULL, /* no download */
result = Curl_Transfer(conn, -1, -1, FALSE, NULL, /* no download */
-1, NULL); /* no upload */
return CURLE_OK;
}
else {
/* We fell through all checks and thus we don't support the specified
protocol */
failf(data, "Unsupported protocol: %s", conn->proto);
return CURLE_UNSUPPORTED_PROTOCOL;
}
/*************************************************************
* .netrc scanning coming up
*************************************************************/
if(data->bits.use_netrc) {
if(ParseNetrc(data->hostname, data->user, data->passwd)) {
if(Curl_parsenetrc(data->hostname, data->user, data->passwd)) {
infof(data, "Couldn't find host %s in the .netrc file, using defaults",
data->hostname);
}
else
data->bits.user_passwd = 1; /* enable user+password */
/* weather we failed or not, we don't know which fields that were filled
in anyway */
if(!data->user[0])
strcpy(data->user, CURL_DEFAULT_USER);
if(!data->passwd[0])
strcpy(data->passwd, CURL_DEFAULT_PASSWORD);
if(conn->protocol&PROT_HTTP) {
data->bits.user_passwd = 1; /* enable user+password */
}
}
else if(!(data->bits.user_passwd) &&
(conn->protocol & (PROT_FTP|PROT_HTTP)) ) {
/* This is a FTP or HTTP URL, and we haven't got the user+password in
the extra parameter, we will now try to extract the possible
user+password pair in a string like:
ftp://user:password@ftp.my.site:8021/README */
* the extra parameter, we will now try to extract the possible
* user+password pair in a string like:
* ftp://user:password@ftp.my.site:8021/README */
char *ptr=NULL; /* assign to remove possible warnings */
if((ptr=strchr(conn->name, '@'))) {
/* there's a user+password given here, to the left of the @ */
@@ -1185,24 +1157,66 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
}
/*************************************************************
* Figure out the remote port number
*
* No matter if we use a proxy or not, we have to figure out the remote
* port number of various reasons.
*
* To be able to detect port number flawlessly, we must not confuse them
* IPv6-specified addresses in the [0::1] style.
*************************************************************/
if((1 == sscanf(conn->name, "[%*39[0-9a-fA-F:]%c", &endbracket)) &&
(']' == endbracket)) {
/* this is a IPv6-style specified IP-address */
#ifndef ENABLE_IPV6
failf(data, "You haven't enabled IPv6 support");
return CURLE_URL_MALFORMAT;
#else
tmp = strchr(conn->name, ']');
tmp++; /* pass the ending bracket */
if(':' != *tmp)
tmp = NULL; /* no port number available */
#endif
}
else {
/* traditional IPv4-style port-extracting */
tmp = strchr(conn->name, ':');
}
if (tmp) {
*tmp++ = '\0'; /* cut off the name there */
data->remote_port = atoi(tmp);
}
/*************************************************************
* Resolve the name of the server or proxy
*************************************************************/
if(!data->bits.httpproxy) {
/* If not connecting via a proxy, extract the port from the URL, if it is
* there, thus overriding any defaults that might have been set above. */
tmp = strchr(conn->name, ':');
if (tmp) {
*tmp++ = '\0';
data->port = atoi(tmp);
}
data->remote_port = data->port; /* it is the same port */
data->port = data->remote_port; /* it is the same port */
/* Connect to target host right on */
conn->hp = GetHost(data, conn->name, &conn->hostent_buf);
if(!conn->hp) {
#ifdef ENABLE_IPV6
conn->res = Curl_getaddrinfo(data, conn->name, data->port);
if(!conn->res)
#else
conn->hp = Curl_gethost(data, conn->name, &conn->hostent_buf);
if(!conn->hp)
#endif
{
failf(data, "Couldn't resolve host '%s'", conn->name);
return CURLE_COULDNT_RESOLVE_HOST;
}
}
else {
#ifdef ENABLE_IPV6
failf(data, "proxy yet to be supported");
return CURLE_OUT_OF_MEMORY;
#else
char *prox_portno;
char *endofprot;
@@ -1218,14 +1232,6 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
return CURLE_OUT_OF_MEMORY;
}
/* we use proxy all right, but we wanna know the remote port for SSL
reasons */
tmp = strchr(conn->name, ':');
if (tmp) {
*tmp++ = '\0'; /* cut off the name there */
data->remote_port = atoi(tmp);
}
/* Daniel Dec 10, 1998:
We do the proxy host string parsing here. We want the host name and the
port name. Accept a protocol:// prefix, even though it should just be
@@ -1252,16 +1258,18 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
/* connect to proxy */
conn->hp = GetHost(data, proxyptr, &conn->hostent_buf);
conn->hp = Curl_gethost(data, proxyptr, &conn->hostent_buf);
if(!conn->hp) {
failf(data, "Couldn't resolve proxy '%s'", proxyptr);
return CURLE_COULDNT_RESOLVE_PROXY;
}
free(proxydup); /* free the duplicate pointer and not the modified */
#endif
}
pgrsTime(data, TIMER_NAMELOOKUP);
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
#ifndef ENABLE_IPV6
data->firstsocket = socket(AF_INET, SOCK_STREAM, 0);
memset((char *) &conn->serv_addr, '\0', sizeof(conn->serv_addr));
@@ -1269,21 +1277,23 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
conn->hp->h_addr, conn->hp->h_length);
conn->serv_addr.sin_family = conn->hp->h_addrtype;
conn->serv_addr.sin_port = htons(data->port);
#endif
#ifndef WIN32
#if !defined(WIN32)||defined(__CYGWIN32__)
/* We don't generally like checking for OS-versions, we should make this
HAVE_XXXX based, although at the moment I don't have a decent test for
this! */
/* sck 8/31/2000 add support for specifing device to bind socket to */
/* I am using this, but it may not work everywhere, only tested on
RedHat 6.2 */
#ifdef HAVE_INET_NTOA
#ifndef INADDR_NONE
#define INADDR_NONE (unsigned long) ~0
#endif
#ifndef ENABLE_IPV6
/*************************************************************
* Select device to bind socket to
*************************************************************/
if (data->device && (strlen(data->device)<255)) {
struct sockaddr_in sa;
struct hostent *h=NULL;
@@ -1292,12 +1302,12 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
char myhost[256] = "";
unsigned long in;
if(if2ip(data->device, myhost, sizeof(myhost))) {
h = GetHost(data, myhost, &hostdataptr);
if(Curl_if2ip(data->device, myhost, sizeof(myhost))) {
h = Curl_gethost(data, myhost, &hostdataptr);
}
else {
if(strlen(data->device)>1) {
h = GetHost(data, data->device, &hostdataptr);
h = Curl_gethost(data, data->device, &hostdataptr);
}
if(h) {
/* we know data->device is shorter than the myhost array */
@@ -1307,7 +1317,7 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
if(! *myhost) {
/* need to fix this
h=GetHost(data,
h=Curl_gethost(data,
getmyhost(*myhost,sizeof(myhost)),
hostent_buf,
sizeof(hostent_buf));
@@ -1384,12 +1394,36 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
if(hostdataptr)
free(hostdataptr); /* allocated by GetHost() */
free(hostdataptr); /* allocated by Curl_gethost() */
} /* end of device selection support */
#endif /* end of HAVE_INET_NTOA */
#endif /* end of not WIN32 */
#endif /*ENABLE_IPV6*/
/*************************************************************
* Connect to server/proxy
*************************************************************/
#ifdef ENABLE_IPV6
data->firstsocket = -1;
for (ai = conn->res; ai; ai = ai->ai_next) {
data->firstsocket = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (data->firstsocket < 0)
continue;
if (connect(data->firstsocket, ai->ai_addr, ai->ai_addrlen) < 0) {
close(data->firstsocket);
data->firstsocket = -1;
continue;
}
break;
}
if (data->firstsocket < 0) {
failf(data, strerror(errno));
return CURLE_COULDNT_CONNECT;
}
#else
if (connect(data->firstsocket,
(struct sockaddr *) &(conn->serv_addr),
sizeof(conn->serv_addr)
@@ -1438,45 +1472,79 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect)
}
return CURLE_COULDNT_CONNECT;
}
#endif
/*************************************************************
* Proxy authentication
*************************************************************/
if(data->bits.proxy_user_passwd) {
char *authorization;
snprintf(data->buffer, BUFSIZE, "%s:%s",
data->proxyuser, data->proxypasswd);
if(base64_encode(data->buffer, strlen(data->buffer),
&authorization) >= 0) {
if(Curl_base64_encode(data->buffer, strlen(data->buffer),
&authorization) >= 0) {
data->ptr_proxyuserpwd =
maprintf("Proxy-authorization: Basic %s\015\012", authorization);
aprintf("Proxy-authorization: Basic %s\015\012", authorization);
free(authorization);
}
}
/*************************************************************
* Send user-agent to HTTP proxies even if the target protocol
* isn't HTTP.
*************************************************************/
if((conn->protocol&PROT_HTTP) || data->bits.httpproxy) {
if(data->useragent) {
data->ptr_uagent = maprintf("User-Agent: %s\015\012", data->useragent);
data->ptr_uagent =
aprintf("User-Agent: %s\015\012", data->useragent);
}
}
if(conn->curl_connect) {
/* is there a connect() procedure? */
conn->now = tvnow(); /* set this here for timeout purposes in the
connect procedure, it is later set again for the
progress meter purpose */
/* set start time here for timeout purposes in the
* connect procedure, it is later set again for the
* progress meter purpose */
conn->now = Curl_tvnow();
/* Call the protocol-specific connect function */
result = conn->curl_connect(conn);
if(result != CURLE_OK)
return result; /* pass back errors */
}
pgrsTime(data, TIMER_CONNECT); /* we're connected */
Curl_pgrsTime(data, TIMER_CONNECT); /* we're connected */
conn->now = tvnow(); /* time this *after* the connect is done */
conn->now = Curl_tvnow(); /* time this *after* the connect is done */
conn->bytecount = 0;
/* Figure out the ip-number and the first host name it shows: */
/* Figure out the ip-number and display the first host name it shows: */
#ifdef ENABLE_IPV6
{
char hbuf[NI_MAXHOST];
#ifdef NI_WITHSCOPEID
const int niflags = NI_NUMERICHOST | NI_WITHSCOPEID;
#else
const int niflags = NI_NUMERICHOST;
#endif
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, hbuf, sizeof(hbuf), NULL, 0,
niflags)) {
snprintf(hbuf, sizeof(hbuf), "?");
}
if (ai->ai_canonname) {
infof(data, "Connected to %s (%s)\n", ai->ai_canonname, hbuf);
} else {
infof(data, "Connected to %s\n", hbuf);
}
}
#else
{
struct in_addr in;
(void) memcpy(&in.s_addr, *conn->hp->h_addr_list, sizeof (in.s_addr));
infof(data, "Connected to %s (%s)\n", conn->hp->h_name, inet_ntoa(in));
}
#endif
#ifdef __EMX__
/* 20000330 mgs
@@ -1508,8 +1576,13 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
if(conn) {
if(conn->path)
free(conn->path);
#ifdef ENABLE_IPV6
if(conn->res)
freeaddrinfo(conn->res);
#else
if(conn->hostent_buf)
free(conn->hostent_buf);
#endif
free(conn);
*in_connect=NULL;
}
@@ -1560,7 +1633,7 @@ CURLcode curl_done(CURLconnect *c_connect)
else
result = CURLE_OK;
pgrsDone(data); /* done with the operation */
Curl_pgrsDone(data); /* done with the operation */
conn->state = CONN_DONE;
@@ -1575,7 +1648,13 @@ CURLcode curl_do(CURLconnect *in_conn)
if(!conn || (conn->handle!= STRUCT_CONNECT)) {
return CURLE_BAD_FUNCTION_ARGUMENT;
}
if(conn->state != CONN_INIT) {
switch(conn->state) {
case CONN_INIT:
case CONN_DONE:
/* these two states are OK */
break;
default:
/* anything else is bad */
return CURLE_BAD_CALLING_ORDER;
}

View File

@@ -22,6 +22,7 @@
*
* $Id$
*****************************************************************************/
int GetLine(int sockfd, char *buf, struct UrlData *data);
/* empty */
#endif

View File

@@ -82,8 +82,8 @@
/* Download buffer size, keep it fairly big for speed reasons */
#define BUFSIZE (1024*50)
/* Upload buffer size, keep it smallish to get faster progress meter
updates. This should probably become dynamic and adjust to the upload
/* Defaul upload buffer size, keep it smallish to get faster progress meter
updates. This is just default, it is dynamic and adjusts to the upload
speed. */
#define UPLOAD_BUFSIZE (1024*2)
@@ -91,10 +91,14 @@
of need. */
#define HEADERSIZE 256
/* Just a convenience macro to get the larger value out of two given */
#ifndef MAX
#define MAX(x,y) ((x)>(y)?(x):(y))
#endif
/* Type of handle. All publicly returned 'handles' in the curl interface
have a handle first in the struct that describes what kind of handle it
is. Used to detect bad handle usage. */
typedef enum {
STRUCT_NONE,
STRUCT_OPEN,
@@ -102,6 +106,8 @@ typedef enum {
STRUCT_LAST
} Handle;
/* Connecting to a remote server using the curl interface is moving through
a state machine, this type is used to store the current state */
typedef enum {
CONN_NONE, /* illegal state */
CONN_INIT, /* curl_connect() has been called */
@@ -112,6 +118,7 @@ typedef enum {
} ConnState;
#ifdef KRB4
/* Types needed for krb4-ftp connections */
struct krb4buffer {
void *data;
size_t size;
@@ -152,16 +159,20 @@ struct connectdata {
#define PROT_LDAP (1<<7)
#define PROT_FILE (1<<8)
#ifdef ENABLE_IPV6
struct addrinfo *res;
#else
char *hostent_buf; /* pointer to allocated memory for name info */
struct hostent *hp;
struct sockaddr_in serv_addr;
char proto[64];
char gname[256];
char *name;
char *path; /* formerly staticly this size: URL_MAX_LENGTH */
#endif
char proto[64]; /* store the protocol string in this buffer */
char gname[257]; /* store the hostname in this buffer */
char *name; /* host name pointer to fool around with */
char *path; /* allocated buffer to store the URL's path part in */
char *ppath;
long bytecount;
struct timeval now;
struct timeval now; /* current time */
long upload_bufsize; /* adjust as you see fit, never bigger than BUFSIZE
never smaller than UPLOAD_BUFSIZE */
@@ -248,9 +259,9 @@ struct Progress {
struct HTTP {
struct FormData *sendit;
int postsize;
char *p_pragma;
char *p_accept;
long readbytecount;
char *p_pragma; /* Pragma: string */
char *p_accept; /* Accept: string */
long readbytecount;
long writebytecount;
/* For FORM posting */
@@ -264,14 +275,32 @@ struct HTTP {
***************************************************************************/
struct FTP {
long *bytecountp;
char *user;
char *passwd;
char *user; /* user name string */
char *passwd; /* password string */
char *urlpath; /* the originally given path part of the URL */
char *dir; /* decoded directory */
char *file; /* decoded file */
};
typedef enum {
HTTPREQ_NONE, /* first in list */
HTTPREQ_GET,
HTTPREQ_POST,
HTTPREQ_POST_FORM, /* we make a difference internally */
HTTPREQ_PUT,
HTTPREQ_CUSTOM,
HTTPREQ_LAST /* last in list */
} Curl_HttpReq;
/* This struct is for boolean settings that define how to behave during
this session. */
struct Configbits {
/* these four request types mirror the httpreq field */
bool http_formpost;
bool http_post;
bool http_put;
bool http_get;
bool get_filetime;
bool tunnel_thru_httpproxy;
bool ftp_append;
@@ -281,10 +310,7 @@ struct Configbits {
bool hide_progress;
bool http_fail_on_error;
bool http_follow_location;
bool http_formpost;
bool http_include_header;
bool http_post;
bool http_put;
bool http_set_referer;
bool http_auto_referer; /* set "correct" referer when following location: */
bool httpproxy;
@@ -299,7 +325,6 @@ struct Configbits {
bool verbose;
bool this_is_a_follow; /* this is a followed Location: request */
bool krb4; /* kerberos4 connection requested */
bool proxystringalloc; /* the http proxy string is malloc()'ed */
bool rangestringalloc; /* the range string is malloc()'ed */
bool urlstringalloc; /* the URL string is malloc()'ed */
@@ -313,6 +338,7 @@ typedef enum {
CURLI_LAST
} CurlInterface;
/* struct for data related to SSL and SSL connections */
struct ssldata {
bool use; /* use ssl encrypted communications TRUE/FALSE */
long version; /* what version the client wants to use */
@@ -468,8 +494,10 @@ struct UrlData {
struct curl_slist *quote; /* before the transfer */
struct curl_slist *postquote; /* after the transfer */
TimeCond timecondition;
time_t timevalue;
TimeCond timecondition; /* kind of comparison */
time_t timevalue; /* what time to compare with */
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
char *customrequest; /* http/ftp request to use */
@@ -482,7 +510,7 @@ struct UrlData {
completion */
#endif
struct Progress progress;
struct Progress progress; /* for all the progress meter data */
#define MAX_CURL_USER_LENGTH 128
#define MAX_CURL_PASSWORD_LENGTH 128
@@ -492,6 +520,7 @@ struct UrlData {
* host (which location-following otherwise could lead to)
*/
/* buffers to store authentication data in */
char user[MAX_CURL_USER_LENGTH];
char passwd[MAX_CURL_PASSWORD_LENGTH];
char proxyuser[MAX_CURL_USER_LENGTH];
@@ -506,7 +535,7 @@ struct UrlData {
char *ptr_cookie; /* free later if not NULL! */
char *ptr_host; /* free later if not NULL */
char *krb4_level;
char *krb4_level; /* what security level */
#ifdef KRB4
FILE *cmdchannel;
#endif

View File

@@ -33,9 +33,6 @@ char *curl_version(void)
{
static char version[200];
char *ptr;
#if defined(USE_SSLEAY)
static char sub[2];
#endif
strcpy(version, LIBCURL_NAME " " LIBCURL_VERSION );
ptr=strchr(version, '\0');
@@ -47,23 +44,35 @@ char *curl_version(void)
(SSLEAY_VERSION_NUMBER>>20)&0xff,
(SSLEAY_VERSION_NUMBER>>12)&0xf);
#else
if(SSLEAY_VERSION_NUMBER&0x0f) {
sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;
{
char sub[2];
if(SSLEAY_VERSION_NUMBER&0x0f) {
sub[0]=(SSLEAY_VERSION_NUMBER&0x0f) + 'a' -1;
}
else
sub[0]=0;
sprintf(ptr, " (SSL %x.%x.%x%s)",
(SSLEAY_VERSION_NUMBER>>12)&0xff,
(SSLEAY_VERSION_NUMBER>>8)&0xf,
(SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
}
else
sub[0]=0;
sprintf(ptr, " (SSL %x.%x.%x%s)",
(SSLEAY_VERSION_NUMBER>>12)&0xff,
(SSLEAY_VERSION_NUMBER>>8)&0xf,
(SSLEAY_VERSION_NUMBER>>4)&0xf, sub);
#endif
ptr=strchr(ptr, '\0');
#endif
#if defined(KRB4) || defined(ENABLE_IPV6)
strcat(ptr, " (");
ptr+=2;
#ifdef KRB4
sprintf(ptr, " (krb4 enabled)");
sprintf(ptr, "krb4 ");
ptr += strlen(ptr);
#endif
#ifdef ENABLE_IPV6
sprintf(ptr, "ipv6 ");
ptr += strlen(ptr);
#endif
sprintf(ptr, "enabled)");
ptr += strlen(ptr);
#endif

87
maketgz
View File

@@ -58,29 +58,10 @@ findprog()
############################################################################
#
# If we have autoconf we can just as well update configure.in to contain our
# brand new version number:
# Enforce a rerun of configure (updates the VERSION)
#
#if { findprog autoconf >/dev/null 2>/dev/null; } then
# echo "- No autoconf found, we leave configure as it is"
#else
# # Replace version number in configure.in file:
#
# CONF="configure.in"
#
# sed 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE(curl,"'$version'")/g' $CONF >$CONF.new
#
# # Save old file
# cp -p $CONF $CONF.old
#
# # Make new configure.in
# mv $CONF.new $CONF
#
# # Update the configure script
# echo "Runs autoconf"
# autoconf
#fi
./config.status --recheck
############################################################################
#
@@ -97,65 +78,7 @@ fi
############################################################################
#
# Now run make first to make the file dates decent and make sure that it
# compiles just before release!
# Now run make dist
#
make
# get current dir
dir=`pwd`
# Get basename
orig=`basename $dir`
# Get the left part of the dash (-)
new=`echo $orig | cut -d- -f1`
# Build new directory name
n=$new-$version;
# Tell the world what we're doing
echo "Copying files into distribution archive";
if [ -r $n ]; then
echo "Directory already exists!"
exit
fi
# Create the new dir
mkdir $n
# Copy all relevant files, with path and permissions!
tar -cf - `cat FILES` | (cd $n; tar -xBpf -)
# Create the distribution root Makefile from Makefile.dist
cp -p Makefile.dist $n/Makefile
############################################################################
#
# Replace @SHELL@ with /bin/sh in the Makefile.in files!
#
echo "Replace @SHELL@ with /bin/sh in the Makefile.in files"
temp=/tmp/curl$$
for file in Makefile.in lib/Makefile.in src/Makefile.in; do
in="$n/$file"
sed "s:@SHELL@:/bin/sh:g" $in >$temp
cp $temp $in
done
rm -rf $temp
# Tell the world what we're doing
echo "creates $n.tar.gz";
# Make a tar archive of it all
tar -cvf $n.tar $n
# gzip the archive
gzip $n.tar
# Make it world readable
chmod a+r $n.tar.gz ;
# Delete the temp dir
rm -rf $n
make dist

View File

@@ -26,13 +26,17 @@ while(<STDIN>) {
if($function =~ /free\(0x([0-9a-f]*)/) {
$addr = $1;
if($sizeataddr{$addr} <= 0) {
if($sizeataddr{$addr} == 0) {
print "FREE ERROR: No memory allocated: $line\n";
}
elsif(-1 == $sizeataddr{$addr}) {
print "FREE ERROR: Memory freed twice: $line\n";
print "FREE ERROR: Previously freed at: ".$getmem{$addr}."\n";
}
else {
$totalmem -= $sizeataddr{$addr};
$sizeataddr{$addr}=0;
$getmem{$addr}=""; # forget after a good free()
$sizeataddr{$addr}=-1; # set -1 to mark as freed
$getmem{$addr}="$source:$linenum";
}
}
elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {

View File

@@ -0,0 +1 @@
SUBDIRS = RPM

View File

@@ -0,0 +1,2 @@
EXTRA_DIST = README curl-ssl.spec.in curl.spec.in make_curl_rpm

View File

@@ -1,98 +0,0 @@
%define ver 7.4.2
%define rel 1
%define prefix /usr
Summary: get a file from a FTP, GOPHER or HTTP server.
Name: curl-ssl
Version: %ver
Release: %rel
Copyright: MPL
Group: Utilities/Console
Source: curl-%{version}.tar.gz
URL: http://curl.haxx.se
BuildPrereq: openssl
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
Packager: Fill In As You Wish
Docdir: %{prefix}/doc
%description
curl-ssl is a client to get documents/files from servers, using
any of the supported protocols. The command is designed to
work without user interaction or any kind of interactivity.
curl-ssl offers a busload of useful tricks like proxy support,
user authentication, ftp upload, HTTP post, file transfer
resume and more.
Note: this version is compiled with SSL (https:) support.
Authors:
Daniel Stenberg <daniel@haxx.se>
%prep
%setup -n %{name}-%{version}
%build
# Needed for snapshot releases.
if [ ! -f configure ]; then
CONF="./autogen.sh"
else
CONF="./configure"
fi
#
# Configuring the package
#
CFLAGS="${RPM_OPT_FLAGS}" ${CONF} \
--prefix=%{prefix} \
--with-ssl
[ "$SMP" != "" ] && JSMP = '"MAKE=make -k -j $SMP"'
make ${JSMP} CFLAGS="-DUSE_SSLEAY -I/usr/include/openssl";
%install
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
make prefix=${RPM_BUILD_ROOT}%{prefix} install-strip
#
# Generating file lists and store them in file-lists
# Starting with the directory listings
#
find ${RPM_BUILD_ROOT}%{prefix}/{bin,lib,man} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
#
# Then, the file listings
#
echo "%defattr (-, root, root)" >> file-lists
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
%clean
(cd ..; rm -rf curl-7.4.2 ${RPM_BUILD_ROOT})
%files -f file-lists
%defattr (-, root, root)
%doc BUGS
%doc CHANGES
%doc CONTRIBUTE
%doc FAQ
%doc FEATURES
%doc FILES
%doc INSTALL
%doc LEGAL
%doc MPL-1.0.txt
%doc README
%doc README.curl
%doc README.libcurl
%doc RESOURCES
%doc TODO
%doc %{name}-ssl.spec.in
%doc %{name}.spec.in

View File

@@ -0,0 +1,78 @@
%define name curl-ssl
%define tarball curl
%define version @VERSION@
%define release 1
%define prefix /usr
%define builddir $RPM_BUILD_DIR/%{tarball}-%{version}
Summary: get a file from a FTP, GOPHER or HTTP server.
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: MPL
Vendor: Daniel Stenberg <Daniel.Stenberg@haxx.se>
Packager: Loic Dachary <loic@senga.org>
Group: Utilities/Console
Source: %{tarball}-%{version}.tar.gz
URL: http://curl.haxx.se/
BuildRoot: /tmp/%{tarball}-%{version}-root
Requires: openssl >= 0.9.5
%description
curl is a client to get documents/files from servers, using any of the
supported protocols. The command is designed to work without user
interaction or any kind of interactivity.
curl offers a busload of useful tricks like proxy support, user
authentication, ftp upload, HTTP post, file transfer resume and more.
%package devel
Summary: The includes, libs, and man pages to develop with libcurl
Group: Development/Libraries
Requires: openssl-devel >= 0.9.5
%description devel
libcurl is the core engine of curl; this packages contains all the libs,
headers, and manual pages to develop applications using libcurl.
%prep
rm -rf %{builddir}
%setup -n %{tarball}-%{version}
%build
%configure --prefix=%{prefix} --with-ssl
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install-strip
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/curl
%attr(0644,root,root) %{_mandir}/man1/*
%{_libdir}/libcurl.so*
%doc CHANGES LEGAL MITX.txt MPL-1.1.txt README docs/BUGS
%doc docs/CONTRIBUTE docs/FAQ docs/FEATURES docs/INSTALL docs/INTERNALS
%doc docs/LIBCURL docs/MANUAL docs/README* docs/RESOURCES docs/TODO
%doc docs/TheArtOfHttpScripting
%files devel
%defattr(-,root,root)
%attr(0644,root,root) %{_mandir}/man3/*
%attr(0644,root,root) %{_includedir}/curl/*
%{_libdir}/libcurl.a
%{_libdir}/libcurl.la
%doc docs/examples/*

View File

@@ -1,96 +0,0 @@
%define ver 7.4.2
%define rel 1
%define prefix /usr
Summary: get a file from a FTP, GOPHER or HTTP server.
Name: curl
Version: %ver
Release: %rel
Copyright: MPL
Group: Utilities/Console
Source: %{name}-%{version}.tar.gz
URL: http://curl.haxx.se
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
Packager: Fill In As You Wish
Docdir: %{prefix}/doc
%description
curl is a client to get documents/files from servers, using
any of the supported protocols. The command is designed to
work without user interaction or any kind of interactivity.
curl offers a busload of useful tricks like proxy support,
user authentication, ftp upload, HTTP post, file transfer
resume and more.
Note: this version is compiled without SSL (https:) support.
Authors:
Daniel Stenberg <daniel@haxx.se>
%prep
%setup -n %{name}-%{version}
%build
# Needed for snapshot releases.
if [ ! -f configure ]; then
CONF="./autogen.sh"
else
CONF="./configure"
fi
#
# Configuring the package
#
CFLAGS="${RPM_OPT_FLAGS}" ${CONF} \
--prefix=%{prefix}
[ "$SMP" != "" ] && JSMP = '"MAKE=make -k -j $SMP"'
make ${JSMP};
%install
[ -d ${RPM_BUILD_ROOT} ] && rm -rf ${RPM_BUILD_ROOT}
make prefix=${RPM_BUILD_ROOT}%{prefix} install-strip
#
# Generating file lists and store them in file-lists
# Starting with the directory listings
#
find ${RPM_BUILD_ROOT}%{prefix}/{bin,lib,man} -type d | sed "s#^${RPM_BUILD_ROOT}#\%attr (-\,root\,root) \%dir #" > file-lists
#
# Then, the file listings
#
echo "%defattr (-, root, root)" >> file-lists
find ${RPM_BUILD_ROOT}%{prefix} -type f | sed -e "s#^${RPM_BUILD_ROOT}##g" >> file-lists
%clean
(cd ..; rm -rf %{name}-%{version} ${RPM_BUILD_ROOT})
%files -f file-lists
%defattr (-, root, root)
%doc BUGS
%doc CHANGES
%doc CONTRIBUTE
%doc FAQ
%doc FEATURES
%doc FILES
%doc INSTALL
%doc LEGAL
%doc MPL-1.0.txt
%doc README
%doc README.curl
%doc README.libcurl
%doc RESOURCES
%doc TODO
%doc %{name}-ssl.spec.in
%doc %{name}.spec.in

View File

@@ -0,0 +1,84 @@
%define name curl
%define version @VERSION@
%define release 1
%define prefix /usr
%define builddir $RPM_BUILD_DIR/%{name}-%{version}
Summary: get a file from a FTP, GOPHER or HTTP server.
Name: %{name}
Version: %{version}
Release: %{release}
Copyright: MPL
Vendor: Daniel Stenberg <Daniel.Stenberg@haxx.se>
Packager: Loic Dachary <loic@senga.org>
Group: Utilities/Console
Source: %{name}-%{version}.tar.gz
URL: http://curl.haxx.se/
BuildRoot: /tmp/%{name}-%{version}-root
%description
curl is a client to get documents/files from servers, using any of the
supported protocols. The command is designed to work without user
interaction or any kind of interactivity.
curl offers a busload of useful tricks like proxy support, user
authentication, ftp upload, HTTP post, file transfer resume and more.
Note: this version is compiled without SSL (https:) support.
%package devel
Summary: The includes, libs, and man pages to develop with libcurl
Group: Development/Libraries
%description devel
libcurl is the core engine of curl; this packages contains all the libs,
headers, and manual pages to develop applications using libcurl.
%prep
rm -rf %{builddir}
%setup
%build
%configure --without-ssl --prefix=%{prefix}
make
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install-strip
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%defattr(-,root,root)
%attr(0755,root,root) %{_bindir}/curl
%attr(0644,root,root) %{_mandir}/man1/*
%{prefix}/lib/libcurl.so*
%doc CHANGES LEGAL MITX.txt MPL-1.1.txt README docs/BUGS
%doc docs/CONTRIBUTE docs/FAQ docs/FEATURES docs/INSTALL docs/INTERNALS
%doc docs/LIBCURL docs/MANUAL docs/README* docs/RESOURCES docs/TODO
%doc docs/TheArtOfHttpScripting
%files devel
%defattr(-,root,root)
%attr(0644,root,root) %{_mandir}/man3/*
%attr(0644,root,root) %{_includedir}/curl/*
%{prefix}/lib/libcurl.a
%{prefix}/lib/libcurl.la
%doc docs/examples/*
%changelog
* Sun Jan 7 2001 Loic Dachary <loic@senga.org>
- use _mandir instead of prefix to locate man pages because
_mandir is not always prefix/man/man?.

1
packages/Makefile.am Normal file
View File

@@ -0,0 +1 @@
SUBDIRS = Win32 Linux

View File

@@ -0,0 +1 @@
EXTRA_DIST = README

View File

@@ -10,17 +10,24 @@ INCLUDES = -I$(top_srcdir)/include
bin_PROGRAMS = curl #memtest
noinst_HEADERS = setup.h \
config-win32.h \
urlglob.h \
version.h \
writeout.h
#memtest_SOURCES = memtest.c
#memtest_LDADD = $(top_srcdir)/lib/libcurl.la
curl_SOURCES = main.c hugehelp.c urlglob.c writeout.c
curl_LDADD = $(top_srcdir)/lib/libcurl.la
curl_DEPENDENCIES = $(top_srcdir)/lib/libcurl.la
curl_LDADD = ../lib/libcurl.la
curl_DEPENDENCIES = ../lib/libcurl.la
BUILT_SOURCES = hugehelp.c
CLEANFILES = hugehelp.c
NROFF=@NROFF@
EXTRA_DIST = mkhelp.pl Makefile.vc6
EXTRA_DIST = mkhelp.pl config-win32.h \
Makefile.vc6 Makefile.b32 Makefile.m32
AUTOMAKE_OPTIONS = foreign no-dependencies

View File

@@ -17,7 +17,7 @@ LINKR = link.exe /incremental:no /libpath:"../lib"
## Debug
CCD = cl.exe /MDd /Gm /ZI /Od /D "_DEBUG" /GZ
LINKD = link.exe /incremental:yes /debug
LINKD = link.exe /incremental:yes /debug /libpath:"../lib"
CFLAGS = /I "../include" /nologo /W3 /GX /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
LFLAGS = /nologo /out:$(PROGRAM_NAME) /subsystem:console /machine:I386

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

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