Compare commits

...

157 Commits

Author SHA1 Message Date
Daniel Stenberg
61c4342736 7.2 cleanup commit 2000-08-30 11:54:57 +00:00
Daniel Stenberg
216b198494 7.2 2000-08-30 11:53:39 +00:00
Daniel Stenberg
6e3a6e79e5 7.2 commit 2000-08-30 11:50:16 +00:00
Daniel Stenberg
2cf44fb374 renamed to acinclude.m4 to get included by aclocal automatically 2000-08-30 06:09:06 +00:00
Daniel Stenberg
dab9658b3e Added Albert to the list contributors. The question is why I hadn't done
that a long time ago...!
2000-08-24 19:19:38 +00:00
Daniel Stenberg
3f9b9dfdee added acinclude.m4 2000-08-24 19:17:30 +00:00
Daniel Stenberg
76229d3da1 largefile.m4 was turned into acinclude.m4 2000-08-24 19:16:26 +00:00
Daniel Stenberg
6562caf6a2 --data-binary and family ;-) 2000-08-24 17:56:20 +00:00
Daniel Stenberg
d49eba2aed Jan Schmidt supplied an update 2000-08-24 17:55:48 +00:00
Daniel Stenberg
bb7929ec50 Inreased buffer size for the Linux gethostbyname_r() test 2000-08-24 17:12:46 +00:00
Daniel Stenberg
a1c0a5d0f2 Added CURLOPT_POSTFIELDSIZE 2000-08-24 16:27:04 +00:00
Daniel Stenberg
1be0bf56a6 new binary post details 2000-08-24 14:28:48 +00:00
Daniel Stenberg
53c2798886 moved include setup.h 2000-08-24 14:28:11 +00:00
Daniel Stenberg
7271ebf23e include config.h first 2000-08-24 14:27:51 +00:00
Daniel Stenberg
b6e18f2f66 #include "setup.h" moved first of all includes 2000-08-24 14:26:33 +00:00
Daniel Stenberg
400ca043c7 inet_ntoa_r() usage made more portable 2000-08-24 14:26:06 +00:00
Daniel Stenberg
d4ffc5ef32 removed the AC_TRY_RUN complaints 2000-08-24 13:05:24 +00:00
Daniel Stenberg
1b1f143cd6 hostname and large file support added 2000-08-24 12:33:16 +00:00
Daniel Stenberg
31b8eea041 Bjorn Reese helped me update the license section 2000-08-23 07:27:00 +00:00
Daniel Stenberg
903f4c16cc Fixed name problems, updated FAQ, -d post problem found 2000-08-23 07:25:50 +00:00
Daniel Stenberg
1998aee2a2 Albert's fixes 2000-08-23 07:25:21 +00:00
Daniel Stenberg
d4731b7050 Albert Chin-A-Young's fixes 2000-08-23 07:23:42 +00:00
Daniel Stenberg
8d2c24265d 7.1.1 commit 2000-08-21 21:57:06 +00:00
Daniel Stenberg
e559a7b872 7.1.1 cleanup commit 2000-08-21 21:56:41 +00:00
Daniel Stenberg
af352740db increased the buffer size used for name lookups 2000-08-18 15:09:50 +00:00
Daniel Stenberg
4e35b4387c Fred Noz fixed the gethostbyaddr_() call 2000-08-17 21:08:09 +00:00
Daniel Stenberg
a8f99e7924 the gethostbyname_r() usage was improved by Fred Noz 2000-08-17 21:07:22 +00:00
Daniel Stenberg
f8e916db46 removed the vprintf check, we have our own internal anyway
gethostbyname_r arg-number checks no longer made if there isn't any
gethostbyname_r function!
aborts the configure if socket() is absent
2000-08-17 16:33:02 +00:00
Daniel Stenberg
e2a63bee59 removed HAVE_VPRINTF dependence 2000-08-17 15:40:26 +00:00
Daniel Stenberg
4496e8ab8c removed the HAVE_VPRINTF check 2000-08-17 15:39:50 +00:00
Daniel Stenberg
c3318b49fd major update 2000-08-17 14:06:42 +00:00
Daniel Stenberg
bfb169062b Added another config to the autoconf bug effect 2000-08-17 11:42:59 +00:00
Daniel Stenberg
2b53a24c4f the latest writeout bugfix 2000-08-15 21:57:47 +00:00
Daniel Stenberg
89e960f118 made Writeout() capable of getting called repeatedly 2000-08-15 21:54:38 +00:00
Daniel Stenberg
7d1ef9646d minor corrections 2000-08-14 06:31:59 +00:00
Daniel Stenberg
e7ce27a22c Linux name resolving problem fixed with larger name-buffer 2000-08-11 18:08:50 +00:00
Daniel Stenberg
ad692ba1f3 Added TheArtOfHttpScripting 2000-08-11 17:06:31 +00:00
Daniel Stenberg
c1283c5881 tutorial kind of document 2000-08-11 17:03:44 +00:00
Daniel Stenberg
349a3aaf5b Made it possible to replace the Content-Type: and Content-Length: headers
curl issues when doing a regular HTTP post. This should not be taken light-
heartedly though. Replacing them might get you into trouble!
2000-08-11 06:39:53 +00:00
Daniel Stenberg
8fd44dd648 allow zero length user names for http 2000-08-08 13:46:26 +00:00
Daniel Stenberg
0d7cce1f08 updated with the latest thread-safe function stuff 2000-08-04 11:32:50 +00:00
Daniel Stenberg
b174aeaac9 brand new gethostbyname_r() and gethostbyaddr_r() checks that now detects
the AIX-styles as well.
I added --disable-thread to allow a user to disable all testing for
thread-safe functions being present and thus go with the good old style
functions. This might become handy if (when?) I add a bug in the threaded
code, like the AIX code I have now but can't test!
2000-08-04 11:30:23 +00:00
Daniel Stenberg
a2f045451f moved an include file further up to make AIX 3 more happy 2000-08-04 11:27:57 +00:00
Daniel Stenberg
02f994a715 Fixed to use the new HAVE_GETHOSTBYxxxx_R_x defines, now trying to support
the AIX-style as well. The AIX-stuff is *NOT* verified to work.
2000-08-04 11:27:17 +00:00
Daniel Stenberg
f0ced0110f corrected to use the libtool libraries instead of the forced-static ones 2000-08-02 08:08:09 +00:00
Daniel Stenberg
e9640b6831 updated 2000-08-02 07:17:56 +00:00
Daniel Stenberg
fe4580eee1 moved the #define strequal() since they're now true functions in libcurl 2000-08-02 07:16:57 +00:00
Daniel Stenberg
1f32da93d7 Added the strequal() prototypes here 2000-08-02 07:16:26 +00:00
Daniel Stenberg
e5c792d4e6 mr Khristophorov added support for lame web servers sending bad range
headers...
2000-08-02 07:15:41 +00:00
Daniel Stenberg
c3c7739811 big last-beta (?) cleanup commit 2000-07-31 22:42:34 +00:00
Daniel Stenberg
513ac758da The installed header files were moved from this to include/curl/Makefile.am 2000-07-31 22:41:27 +00:00
Daniel Stenberg
0a57b8cd60 added to enable include file install 2000-07-31 22:40:52 +00:00
Daniel Stenberg
4c32b6c201 generated from the newly edited getdate.y that now supports a thread-safe
localtime() call
2000-07-31 21:32:46 +00:00
Daniel Stenberg
a79b541bd2 made urlfree static, added (void) in front of one of the SSL calls. I did
these changes when trying to run lclint on the curl code.
2000-07-31 21:31:27 +00:00
Daniel Stenberg
1cf13c825f Replacing one of the internal headers with one that has no contents will now
completely disable that header to get sent.
2000-07-31 21:30:19 +00:00
Daniel Stenberg
9d5c6df788 added localtime_r() 2000-07-29 22:21:10 +00:00
Daniel Stenberg
c1ab16dabb for install and more 2000-07-29 15:34:32 +00:00
Daniel Stenberg
6f3a2cafff libtool stuff added 2000-07-29 12:12:34 +00:00
Daniel Stenberg
6b1a5f2200 Added two libtool files, is ltmain.sh really necessary? 2000-07-28 07:58:04 +00:00
Daniel Stenberg
0a998a29ff updated my email 2000-07-28 07:57:27 +00:00
Daniel Stenberg
433b73192c Added [:port] to the -x description for --help 2000-07-28 07:56:50 +00:00
Daniel Stenberg
215c75135b clear the httproxy bit on cleanup if the allocproxy bit was set 2000-07-28 07:56:06 +00:00
Daniel Stenberg
f50fd062e9 corrected the Host: header's port number 2000-07-28 07:55:21 +00:00
Daniel Stenberg
3d8f377561 ASCII FTP download
-F improvements
FTP response timeouts
HTTP user+password to same host only
libtool
2000-07-26 09:37:54 +00:00
Daniel Stenberg
9ec6e9f254 another day, another contributor 2000-07-26 09:34:40 +00:00
Daniel Stenberg
b8159cae5c removed libtool, added pointer to the sourceforge task list 2000-07-26 09:34:09 +00:00
Daniel Stenberg
5785a81bbf Added docs/Makefile* 2000-07-26 09:31:36 +00:00
Daniel Stenberg
f71a1485f3 libtool adjustments 2000-07-26 09:28:29 +00:00
Daniel Stenberg
e76515fabd they're generated, they don't belong here 2000-07-25 22:15:00 +00:00
Daniel Stenberg
471edc0b9e Added Torsten Foertsch's changes to the -F description and his name to the
list of contributors.
2000-07-25 21:19:35 +00:00
Daniel Stenberg
293cae68bf uses the new curl_close function to clean up the http-specific auth_host 2000-07-25 21:17:45 +00:00
Daniel Stenberg
1156252f92 Added http_close() 2000-07-25 21:16:51 +00:00
Daniel Stenberg
29eda80f96 uses auth_host to only send user+password to that particular site, usable if
Location: following takes "us" to other servers that should not get the
user and password
2000-07-25 21:16:32 +00:00
Daniel Stenberg
29bfaaa190 set a bit when a Location: is followed to allow code to act differently
on those occations
2000-07-25 21:15:01 +00:00
Daniel Stenberg
18853542a1 curl_close is a new function pointer that can be set to a protocol-specific
function to get called in the curl_close() function for cleanup
auth_host is added to store the original (first) host name used
2000-07-25 21:14:12 +00:00
Daniel Stenberg
5b7a5046e6 Torsten Foertsch's improvements 2000-07-25 12:21:22 +00:00
Daniel Stenberg
0cb4814105 tiny adjustments to set the start-time before the curl_connect() is called to
allow the connect function to better deal with timeouts, as was just added
to ftp
2000-07-25 12:13:57 +00:00
Daniel Stenberg
76f3498636 The "get ftp command response" function now uses select() on the socket and
thus enables timeout if the server doesn't respond within the proper time.
2000-07-25 12:12:29 +00:00
Daniel Stenberg
f836400094 A range of things done yesterday 2000-07-25 07:39:42 +00:00
Daniel Stenberg
841f370a96 Added CURLOPT_PROXYPORT 2000-07-25 07:38:08 +00:00
Daniel Stenberg
c8262b2be6 Added CURLOPT_PROXYPORT, also added some more clarifications about the
CURLOPT_PROXY option.
2000-07-25 07:36:50 +00:00
Daniel Stenberg
0a8d0395e1 Auto referer and a minor netrc fix 2000-07-25 07:35:51 +00:00
Daniel Stenberg
6bdfe18b67 Added some logic that now prevents multiple conflicting HTTP request types
to get specified with the options.
2000-07-25 07:34:04 +00:00
Daniel Stenberg
78686a5487 Added proxyport 2000-07-25 07:32:22 +00:00
Daniel Stenberg
bb3fa8855c Added CURLOPT_PROXYPORT support
Added a missing free() in curl_disconnect()
Made (https) connect errors abort better and earlier
2000-07-25 07:31:35 +00:00
Daniel Stenberg
caf8c01e85 re-added the check for BOTH nsl and socket libs 2000-07-25 07:29:32 +00:00
Daniel Stenberg
e999182758 The Host: header now includes the port number if not default HTTP 2000-07-25 07:28:28 +00:00
Daniel Stenberg
d9c41a0ffd Code 250 is okay as well as the previous 226-code after a successful file
transfer
2000-07-25 07:26:29 +00:00
Daniel Stenberg
1ef3600a07 haxx.nu => haxx.se 2000-06-20 15:31:26 +00:00
Daniel Stenberg
e33ac6b3be FTP bug fix
new referer magic tricks!
2000-06-20 11:55:38 +00:00
Daniel Stenberg
f22717fe6c Added auto and free referer fields to the UrlData struct 2000-06-20 11:23:31 +00:00
Daniel Stenberg
1c6eccbf84 Added AUTOREFERER 2000-06-20 09:28:36 +00:00
Daniel Stenberg
f30ffef477 autoreferer added, switches off POST on location: following 2000-06-20 09:28:09 +00:00
Daniel Stenberg
72158ad2cf Rich Gray fixed the PORT command line with the missing \r! 2000-06-20 07:45:53 +00:00
Daniel Stenberg
ddd3ca4e5a progress meter/bar changes 2000-06-16 13:29:41 +00:00
Daniel Stenberg
d6b3b05e2e removed the CURLOPT_PROGRESSMODE option 2000-06-16 13:22:33 +00:00
Daniel Stenberg
b88136fc4c PROGRESSMODE is history 2000-06-16 13:19:30 +00:00
Daniel Stenberg
789b43fc92 pretty big changes when the -# progress bar was moved in here from the
lib/progess.c file, and is now used with the new progress callback function
2000-06-16 13:18:49 +00:00
Daniel Stenberg
6489735491 mode was replaced with callback in the progress struct 2000-06-16 13:17:44 +00:00
Daniel Stenberg
fb9c5650ce progress.mode replaced with progress.callback 2000-06-16 13:17:07 +00:00
Daniel Stenberg
94deff653b removed pgrsMode() 2000-06-16 13:16:33 +00:00
Daniel Stenberg
435f17195e removed lots of #if 0'ed code
removed the "mode" concept
moved all #-stuff to the client
2000-06-16 13:15:36 +00:00
Daniel Stenberg
8e8da82178 Added pgrsStartNow() on the appropriate place 2000-06-16 13:14:27 +00:00
Daniel Stenberg
eb88f3d9b1 when failing to write to a socket, we now bail out better
I also use typecasted size_t now for systems with unsigned such ones
2000-06-15 14:34:43 +00:00
Daniel Stenberg
e9957b87cd removed the last \r\n\r\n bytes
now returns -1 from FormReader() when the last form data has been read!
2000-06-15 14:33:17 +00:00
Daniel Stenberg
f93baee594 POST fix 2000-06-14 17:28:44 +00:00
Daniel Stenberg
ce7e3586da Added #include <string.h> 2000-06-14 17:23:51 +00:00
Daniel Stenberg
94ec5ff44a correct the POST workings. Tim Tassonis reported. 2000-06-14 17:15:07 +00:00
Daniel Stenberg
e54f09a218 the 7.0.6beta fixes 2000-06-14 14:33:54 +00:00
Daniel Stenberg
069347c83d the -W and -g stuff needn't be here by default 2000-06-14 14:29:39 +00:00
Daniel Stenberg
022f1766f9 Added a define in the Mingw32 makefiles to allow parts of the config-win32
files depend on that as well. It turned out Borland has no unistd.h file
either, only mingw32 seems to use that.
2000-06-14 14:28:45 +00:00
Daniel Stenberg
3e20192ff2 several minor fixes as pointed out by Bjrn Stenberg 2000-06-14 14:26:53 +00:00
Daniel Stenberg
ec520ceefd bad HAVE_STRICMP usage found by Bjrn Stenberg 2000-06-14 14:26:20 +00:00
Daniel Stenberg
a374925bb7 added some more text about libcurl using 2000-06-14 14:08:52 +00:00
Daniel Stenberg
d9650164b3 edited the contributor list
changed ftp-ascii to use-ascii and its explanation was fixed
2000-06-14 14:02:43 +00:00
Daniel Stenberg
094b6a8b6a Added #include <fcntl.h> required by the setmode() for win32 2000-06-14 12:52:21 +00:00
Daniel Stenberg
5da5cfa33e new binary stdout approach for win32 systems 2000-06-14 12:50:38 +00:00
Daniel Stenberg
2dbadc6405 Added GETHOSTBYNAME_R_NARGS and GETHOSTBYADDR_R_NARGS 2000-06-14 10:50:18 +00:00
Daniel Stenberg
3b60784f27 updated to be more valid for version 7 workings 2000-06-14 09:16:11 +00:00
Daniel Stenberg
72f7f0183b added a few RFCs to the list 2000-06-14 09:08:31 +00:00
Daniel Stenberg
e22d75cd6e Luong Dinh Dung's comments adjusted 2000-06-13 23:04:44 +00:00
Daniel Stenberg
2488fff451 free-twice problem corrected 2000-06-13 08:11:45 +00:00
Daniel Stenberg
611f50fb76 resources + readme.win32 2000-06-09 12:08:08 +00:00
Daniel Stenberg
eede4c33df edited it to look better when HTML'ified 2000-06-09 07:10:47 +00:00
Daniel Stenberg
32fd2ffab7 Added the docs/README.win32 file 2000-06-09 07:02:20 +00:00
Daniel Stenberg
3586f7eaf0 haxx.nu turns haxx.se 2000-06-09 07:01:23 +00:00
Daniel Stenberg
287ebf730e mucho updated with lots of links to various odd stuff 2000-06-09 07:00:45 +00:00
Daniel Stenberg
77153b4efb Some notes about life with curl in the win32 world 2000-06-09 07:00:21 +00:00
Daniel Stenberg
dbcfd3df79 the recent mocking 2000-06-08 15:20:03 +00:00
Daniel Stenberg
45271fd084 use top_dir instead of ../ 2000-06-08 15:14:17 +00:00
Daniel Stenberg
dbc12876ab Added progress callback info 2000-06-08 15:13:41 +00:00
Daniel Stenberg
aedfcaa168 lower casing getenv and formparse
added the progress function callback and data pointer
added the callback typedefs
2000-06-08 15:13:03 +00:00
Daniel Stenberg
4fd4a6888a added progress callback stuff, changed the callback typedefs to be public 2000-06-08 15:11:39 +00:00
Daniel Stenberg
dd730b09db modified 2000-06-06 16:02:54 +00:00
Daniel Stenberg
c045301128 Added description 2000-06-06 14:54:42 +00:00
Daniel Stenberg
edcd5df1fe edited to look better after the txt2html convertion 2000-06-06 14:13:36 +00:00
Daniel Stenberg
8f03732b25 updated with more examples 2000-06-06 14:09:01 +00:00
Daniel Stenberg
138fe1b934 using the new formparse, the new getenv, using the new headers struct and
clean up the headers better
2000-06-05 08:26:13 +00:00
Daniel Stenberg
d46932369a curl_getenv() is now lowercase 2000-06-05 08:24:37 +00:00
Daniel Stenberg
476e0502ad the curl_formparse() function was turned lowercase 2000-06-05 08:24:18 +00:00
Daniel Stenberg
ecb2b95b1c struct HttpHeader changed to struct curl_slist 2000-06-05 08:23:50 +00:00
Daniel Stenberg
28b0b7316d Added text about how to convert certificates to PEM format 2000-06-05 08:21:28 +00:00
Daniel Stenberg
57623228d2 minor edits 2000-06-02 13:35:16 +00:00
Daniel Stenberg
29470107cd Added many specific questions 2000-06-02 13:32:01 +00:00
Daniel Stenberg
ef34ad2968 Edited, cleaned up 2000-06-02 12:45:23 +00:00
Daniel Stenberg
ebf0fe0df9 updated 2000-06-02 12:06:47 +00:00
Daniel Stenberg
ba17b97e0a curl_formparse() man page 2000-06-02 11:42:56 +00:00
Daniel Stenberg
c8f62fc762 Added description 2000-06-02 11:34:17 +00:00
Daniel Stenberg
e5b72506c9 changed the httppost struct into curl_slist struct 2000-06-02 11:31:53 +00:00
Daniel Stenberg
ef62fc7fe7 added description 2000-06-02 11:31:18 +00:00
Daniel Stenberg
52195a0547 Added description 2000-06-02 11:01:08 +00:00
Daniel Stenberg
e5ba9f058f added description 2000-06-02 10:50:09 +00:00
Daniel Stenberg
2ea0129ed8 man page for this function already in used by the command line tool! 2000-06-02 09:02:51 +00:00
Daniel Stenberg
980ee98ec9 David LeBlanc corrected one of my mistakes 2000-05-31 06:31:31 +00:00
Daniel Stenberg
8d76ad6c8e Adjusted to the GETHOSTBYADDR_R_NARGS style 2000-05-30 22:27:39 +00:00
Daniel Stenberg
784c29c6c5 Added GETHOSTBYADDR_R_NARGS and GETHOSTBYNAME_R_NARGS 2000-05-30 22:26:57 +00:00
Daniel Stenberg
95ddb16768 Added checks for number of parameters to the functions gethostbyname_r()
and gethostbyaddr_r()
2000-05-30 22:26:26 +00:00
111 changed files with 12359 additions and 1922 deletions

909
CHANGES

File diff suppressed because it is too large Load Diff

11
FILES
View File

@@ -12,15 +12,20 @@ docs/FEATURES
docs/INSTALL docs/INSTALL
docs/INTERNALS docs/INTERNALS
docs/README.curl docs/README.curl
docs/README.win32
docs/README.libcurl docs/README.libcurl
docs/RESOURCES docs/RESOURCES
docs/TODO docs/TODO
docs/curl.1 docs/curl.1
docs/Makefile.in
docs/Makefile.am
docs/TheArtOfHttpScripting
docs/*.3 docs/*.3
maketgz maketgz
Makefile.in Makefile.in
Makefile.am Makefile.am
acconfig.h acconfig.h
acinclude.m4
aclocal.m4 aclocal.m4
config.guess config.guess
config.h.in config.h.in
@@ -33,6 +38,8 @@ missing
mkinstalldirs mkinstalldirs
reconf reconf
stamp-h.in stamp-h.in
ltconfig
ltmain.sh
src/*.[ch] src/*.[ch]
src/*in src/*in
src/*am src/*am
@@ -46,5 +53,9 @@ lib/*am
lib/Makefile.vc6 lib/Makefile.vc6
lib/*m32 lib/*m32
include/README include/README
include/Makefile.in
include/Makefile.am
include/curl/*.h include/curl/*.h
include/curl/Makefile.in
include/curl/Makefile.am

6
LEGAL
View File

@@ -14,8 +14,8 @@ Regulation" the following exemptions apply to this software:
Initial Developers of this software are: Initial Developers of this software are:
Daniel Stenberg <Daniel.Stenberg@sth.frontec.se> Daniel Stenberg <daniel@haxx.se>
Rafael Linden Sagula <sagula@inf.ufrgs.br>
Curl is Copyright (C) 1996-2000 Daniel Stenberg
Curl is Copyright (C) 1996-1998 Daniel Stenberg and Rafael Linden Sagula

View File

@@ -4,10 +4,7 @@
AUTOMAKE_OPTIONS = foreign no-dependencies AUTOMAKE_OPTIONS = foreign no-dependencies
man_MANS = docs/curl.1 EXTRA_DIST = curl.spec curl-ssl.spec
EXTRA_DIST = $(man_MANS)
SUBDIRS = lib src
SUBDIRS = docs lib src include

View File

@@ -24,9 +24,9 @@
# #
# ------------------------------------------------------------ # ------------------------------------------------------------
# Main author: # Main author:
# - Daniel Stenberg <Daniel.Stenberg@haxx.nu> # - Daniel Stenberg <daniel@haxx.se>
# #
# http://curl.haxx.nu # http://curl.haxx.se
# #
# $Source$ # $Source$
# $Revision$ # $Revision$

7
README
View File

@@ -11,7 +11,7 @@ README
README.curl document. Find out how to install Curl by reading the INSTALL README.curl document. Find out how to install Curl by reading the INSTALL
document. document.
libcurl is a link-library that Curl is using to do its job. It is readily libcurl is a library that Curl is using to do its job. It is readily
available to be used by your software. Read the README.libcurl document to available to be used by your software. Read the README.libcurl document to
find out how! find out how!
@@ -19,13 +19,12 @@ README
Always try the Curl web site for the latest news: Always try the Curl web site for the latest news:
http://curl.haxx.nu http://curl.haxx.se
The official download mirror sites are: The official download mirror sites are:
Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/ Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/ Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
China -- http://www.pshowing.com/curl/
To download the very latest source off the CVS server do this: To download the very latest source off the CVS server do this:
@@ -36,7 +35,7 @@ README
cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl co . cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl co .
(now, you'll get all the latest sources downloaded into your current (now, you'll get all the latest sources downloaded into your current
directory. Note that this does not create a directory named curl or directory. Note that this does NOT create a directory named curl or
anything) anything)
cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl logout cvs -d :pserver:anonymous@cvs.curl.sourceforge.net:/cvsroot/curl logout

View File

@@ -10,3 +10,26 @@
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#undef 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

75
acinclude.m4 Normal file
View File

@@ -0,0 +1,75 @@
#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
])

489
aclocal.m4 vendored
View File

@@ -10,6 +10,82 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE. 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. # Like AC_CONFIG_HEADER, but automatically create stamp file.
AC_DEFUN(AM_CONFIG_HEADER, AC_DEFUN(AM_CONFIG_HEADER,
@@ -125,3 +201,416 @@ else
fi fi
AC_SUBST($1)]) 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

@@ -117,7 +117,7 @@
#define HAVE_NETDB_H 1 #define HAVE_NETDB_H 1
/* Define if you have the <netinet/in.h> header file. */ /* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1 /*#define HAVE_NETINET_IN_H 1*/
/* Define if you have the <sgtty.h> header file. */ /* Define if you have the <sgtty.h> header file. */
/*#define HAVE_SGTTY_H 1*/ /*#define HAVE_SGTTY_H 1*/
@@ -173,7 +173,7 @@
/************************************************* /*************************************************
* This section is for compiler specific defines.* * This section is for compiler specific defines.*
*************************************************/ *************************************************/
#ifndef VC6 /* VC6 => Microsoft Visual C++ 6 */ #ifdef MINGW32 /* Borland and MS don't have this */
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1

426
config.guess vendored
View File

@@ -1,6 +1,7 @@
#! /bin/sh #! /bin/sh
# Attempt to guess a canonical system name. # Attempt to guess a canonical system name.
# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.
# #
# This file is free software; you can redistribute it and/or modify it # This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by # under the terms of the GNU General Public License as published by
@@ -22,8 +23,7 @@
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>. # Written by Per Bothner <bothner@cygnus.com>.
# The master version of this file is at the FSF in /home/gd/gnu/lib. # Please send patches to <config-patches@gnu.org>.
# Please send patches to the Autoconf mailing list <autoconf@gnu.org>.
# #
# This script attempts to guess a canonical system name similar to # This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and # config.sub. If it succeeds, it prints the system name on stdout, and
@@ -36,6 +36,20 @@
# (but try to keep the structure clean). # (but try to keep the structure clean).
# #
# Use $HOST_CC if defined. $CC may point to a cross-compiler
if test x"$CC_FOR_BUILD" = x; then
if test x"$HOST_CC" != x; then
CC_FOR_BUILD="$HOST_CC"
else
if test x"$CC" != x; then
CC_FOR_BUILD="$CC"
else
CC_FOR_BUILD=cc
fi
fi
fi
# This is needed to find uname on a Pyramid OSx when run in the BSD universe. # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
# (ghazi@noc.rutgers.edu 8/24/94.) # (ghazi@noc.rutgers.edu 8/24/94.)
if (test -f /.attbin/uname) >/dev/null 2>&1 ; then if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
@@ -53,6 +67,43 @@ trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15
# Note: order is significant - the case branches are not exclusive. # Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:NetBSD:*:*)
# Netbsd (nbsd) targets should (where applicable) match one or
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
# compatibility and a consistent mechanism for selecting the
# object file format.
# Determine the machine/vendor (is the vendor relevant).
case "${UNAME_MACHINE}" in
amiga) machine=m68k-cbm ;;
arm32) machine=arm-unknown ;;
atari*) machine=m68k-atari ;;
sun3*) machine=m68k-sun ;;
mac68k) machine=m68k-apple ;;
macppc) machine=powerpc-apple ;;
hp3[0-9][05]) machine=m68k-hp ;;
ibmrt|romp-ibm) machine=romp-ibm ;;
*) machine=${UNAME_MACHINE}-unknown ;;
esac
# The Operating System including object format.
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
os=netbsd
else
os=netbsdelf
fi
# The OS release
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit 0 ;;
alpha:OSF1:*:*) alpha:OSF1:*:*)
if test $UNAME_RELEASE = "V4.0"; then if test $UNAME_RELEASE = "V4.0"; then
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
@@ -62,45 +113,61 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel. # A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r. # 1.2 uses "1.2" for uname -r.
cat <<EOF >$dummy.s cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main .globl main
.align 4
.ent main .ent main
main: main:
.frame \$30,0,\$26,0 .frame \$30,16,\$26,0
.prologue 0 ldgp \$29,0(\$27)
.long 0x47e03d80 # implver $0 .prologue 1
lda \$2,259 .long 0x47e03d80 # implver \$0
.long 0x47e20c21 # amask $2,$1 lda \$2,-1
srl \$1,8,\$2 .long 0x47e20c21 # amask \$2,\$1
sll \$2,2,\$2 lda \$16,\$Lformat
sll \$0,3,\$0 mov \$0,\$17
addl \$1,\$0,\$0 not \$1,\$18
addl \$2,\$0,\$0 jsr \$26,printf
ret \$31,(\$26),1 ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main .end main
EOF EOF
${CC-cc} $dummy.s -o $dummy 2>/dev/null $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then if test "$?" = 0 ; then
./$dummy case `./$dummy` in
case "$?" in 0-0)
7)
UNAME_MACHINE="alpha" UNAME_MACHINE="alpha"
;; ;;
15) 1-0)
UNAME_MACHINE="alphaev5" UNAME_MACHINE="alphaev5"
;; ;;
14) 1-1)
UNAME_MACHINE="alphaev56" UNAME_MACHINE="alphaev56"
;; ;;
10) 1-101)
UNAME_MACHINE="alphapca56" UNAME_MACHINE="alphapca56"
;; ;;
16) 2-303)
UNAME_MACHINE="alphaev6" UNAME_MACHINE="alphaev6"
;; ;;
2-307)
UNAME_MACHINE="alphaev67"
;;
esac esac
fi fi
rm -f $dummy.s $dummy rm -f $dummy.s $dummy
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
exit 0 ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
# of the specific Alpha model?
echo alpha-pc-interix
exit 0 ;; exit 0 ;;
21064:Windows_NT:50:3) 21064:Windows_NT:50:3)
echo alpha-dec-winnt3.5 echo alpha-dec-winnt3.5
@@ -108,9 +175,6 @@ EOF
Amiga*:UNIX_System_V:4.0:*) Amiga*:UNIX_System_V:4.0:*)
echo m68k-cbm-sysv4 echo m68k-cbm-sysv4
exit 0;; exit 0;;
amiga:NetBSD:*:*)
echo m68k-cbm-netbsd${UNAME_RELEASE}
exit 0 ;;
amiga:OpenBSD:*:*) amiga:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -135,16 +199,16 @@ EOF
wgrisc:OpenBSD:*:*) wgrisc:OpenBSD:*:*)
echo mipsel-unknown-openbsd${UNAME_RELEASE} echo mipsel-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:OS/390:*:*)
echo i370-ibm-openedition
exit 0 ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE} echo arm-acorn-riscix${UNAME_RELEASE}
exit 0;; exit 0;;
arm32:NetBSD:*:*)
echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
SR2?01:HI-UX/MPP:*:*) SR2?01:HI-UX/MPP:*:*)
echo hppa1.1-hitachi-hiuxmpp echo hppa1.1-hitachi-hiuxmpp
exit 0;; exit 0;;
Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
# akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
if test "`(/bin/universe) 2>/dev/null`" = att ; then if test "`(/bin/universe) 2>/dev/null`" = att ; then
echo pyramid-pyramid-sysv3 echo pyramid-pyramid-sysv3
@@ -197,21 +261,38 @@ EOF
aushp:SunOS:*:*) aushp:SunOS:*:*)
echo sparc-auspex-sunos${UNAME_RELEASE} echo sparc-auspex-sunos${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
atari*:NetBSD:*:*)
echo m68k-atari-netbsd${UNAME_RELEASE}
exit 0 ;;
atari*:OpenBSD:*:*) atari*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun3*:NetBSD:*:*) # The situation for MiNT is a little confusing. The machine name
echo m68k-sun-netbsd${UNAME_RELEASE} # can be virtually everything (everything which is not
# "atarist" or "atariste" at least should have a processor
# > m68000). The system name ranges from "MiNT" over "FreeMiNT"
# to the lowercase version "mint" (or "freemint"). Finally
# the system name "TOS" denotes a system which is actually not
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
exit 0 ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
echo m68k-milan-mint${UNAME_RELEASE}
exit 0 ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
echo m68k-hades-mint${UNAME_RELEASE}
exit 0 ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
echo m68k-unknown-mint${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
sun3*:OpenBSD:*:*) sun3*:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
mac68k:NetBSD:*:*)
echo m68k-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
mac68k:OpenBSD:*:*) mac68k:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
@@ -224,9 +305,6 @@ EOF
powerpc:machten:*:*) powerpc:machten:*:*)
echo powerpc-apple-machten${UNAME_RELEASE} echo powerpc-apple-machten${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
macppc:NetBSD:*:*)
echo powerpc-apple-netbsd${UNAME_RELEASE}
exit 0 ;;
RISC*:Mach:*:*) RISC*:Mach:*:*)
echo mips-dec-mach_bsd4.3 echo mips-dec-mach_bsd4.3
exit 0 ;; exit 0 ;;
@@ -236,12 +314,13 @@ EOF
VAX*:ULTRIX*:*:*) VAX*:ULTRIX*:*:*)
echo vax-dec-ultrix${UNAME_RELEASE} echo vax-dec-ultrix${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
2020:CLIX:*:*) 2020:CLIX:*:* | 2430:CLIX:*:*)
echo clipper-intergraph-clix${UNAME_RELEASE} echo clipper-intergraph-clix${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
mips:*:*:UMIPS | mips:*:*:RISCos) mips:*:*:UMIPS | mips:*:*:RISCos)
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
#else #else
int main (argc, argv) int argc; char *argv[]; { int main (argc, argv) int argc; char *argv[]; {
@@ -260,7 +339,7 @@ EOF
exit (-1); exit (-1);
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy \ $CC_FOR_BUILD $dummy.c -o $dummy \
&& ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
&& rm $dummy.c $dummy && exit 0 && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
@@ -281,14 +360,17 @@ EOF
AViiON:dgux:*:*) AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures # DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p` UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ then
-o ${TARGET_BINARY_INTERFACE}x = x ] ; then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
[ ${TARGET_BINARY_INTERFACE}x = x ]
then
echo m88k-dg-dgux${UNAME_RELEASE} echo m88k-dg-dgux${UNAME_RELEASE}
else else
echo m88k-dg-dguxbcs${UNAME_RELEASE} echo m88k-dg-dguxbcs${UNAME_RELEASE}
fi fi
else echo i586-dg-dgux${UNAME_RELEASE} else
echo i586-dg-dgux${UNAME_RELEASE}
fi fi
exit 0 ;; exit 0 ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3) M88*:DolphinOS:*:*) # DolphinOS (SVR3)
@@ -326,7 +408,7 @@ EOF
exit(0); exit(0);
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
echo rs6000-ibm-aix3.2.5 echo rs6000-ibm-aix3.2.5
elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
@@ -355,7 +437,7 @@ EOF
ibmrt:4.4BSD:*|romp-ibm:BSD:*) ibmrt:4.4BSD:*|romp-ibm:BSD:*)
echo romp-ibm-bsd4.4 echo romp-ibm-bsd4.4
exit 0 ;; exit 0 ;;
ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
exit 0 ;; # report: romp-ibm BSD 4.3 exit 0 ;; # report: romp-ibm BSD 4.3
*:BOSX:*:*) *:BOSX:*:*)
@@ -374,8 +456,10 @@ EOF
case "${UNAME_MACHINE}" in case "${UNAME_MACHINE}" in
9000/31? ) HP_ARCH=m68000 ;; 9000/31? ) HP_ARCH=m68000 ;;
9000/[34]?? ) HP_ARCH=m68k ;; 9000/[34]?? ) HP_ARCH=m68k ;;
9000/6?? | 9000/7?? | 9000/80[024] | 9000/8?[136790] | 9000/892 ) 9000/[678][0-9][0-9])
sed 's/^ //' << EOF >$dummy.c sed 's/^ //' << EOF >$dummy.c
#define _HPUX_SOURCE
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
@@ -406,7 +490,7 @@ EOF
exit (0); exit (0);
} }
EOF EOF
(${CC-cc} $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy`
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
esac esac
HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
@@ -438,7 +522,7 @@ EOF
exit (0); exit (0);
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
echo unknown-hitachi-hiuxwe2 echo unknown-hitachi-hiuxwe2
exit 0 ;; exit 0 ;;
@@ -448,10 +532,7 @@ EOF
9000/8??:4.3bsd:*:*) 9000/8??:4.3bsd:*:*)
echo hppa1.0-hp-bsd echo hppa1.0-hp-bsd
exit 0 ;; exit 0 ;;
*9??*:MPE*:*:*) *9??*:MPE/iX:*:*)
echo hppa1.0-hp-mpeix
exit 0 ;;
*9??*:MPE*:*:*)
echo hppa1.0-hp-mpeix echo hppa1.0-hp-mpeix
exit 0 ;; exit 0 ;;
hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
@@ -470,6 +551,9 @@ EOF
parisc*:Lites*:*:*) parisc*:Lites*:*:*)
echo hppa1.1-hp-lites echo hppa1.1-hp-lites
exit 0 ;; exit 0 ;;
hppa*:OpenBSD:*:*)
echo hppa-unknown-openbsd
exit 0 ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd echo c1-convex-bsd
exit 0 ;; exit 0 ;;
@@ -500,49 +584,40 @@ EOF
-e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
exit 0 ;; exit 0 ;;
CRAY*TS:*:*:*) CRAY*TS:*:*:*)
echo t90-cray-unicos${UNAME_RELEASE} echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
CRAY*T3E:*:*:*) CRAY*T3E:*:*:*)
echo t3e-cray-unicosmk${UNAME_RELEASE} echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;;
CRAY*SV1:*:*:*)
echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit 0 ;; exit 0 ;;
CRAY-2:*:*:*) CRAY-2:*:*:*)
echo cray2-cray-unicos echo cray2-cray-unicos
exit 0 ;; exit 0 ;;
F300:UNIX_System_V:*:*) F300:UNIX_System_V:*:*)
FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit 0 ;; exit 0 ;;
F301:UNIX_System_V:*:*) F301:UNIX_System_V:*:*)
echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'`
exit 0 ;; exit 0 ;;
hp3[0-9][05]:NetBSD:*:*)
echo m68k-hp-netbsd${UNAME_RELEASE}
exit 0 ;;
hp300:OpenBSD:*:*) hp300:OpenBSD:*:*)
echo m68k-unknown-openbsd${UNAME_RELEASE} echo m68k-unknown-openbsd${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
i?86:BSD/386:*:* | i?86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
sparc*:BSD/OS:*:*) sparc*:BSD/OS:*:*)
echo sparc-unknown-bsdi${UNAME_RELEASE} echo sparc-unknown-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
i?86:BSD/386:*:* | i?86:BSD/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
exit 0 ;;
*:BSD/OS:*:*) *:BSD/OS:*:*)
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:FreeBSD:*:*) *:FreeBSD:*:*)
if test -x /usr/bin/objformat; then
if test "elf" = "`/usr/bin/objformat`"; then
echo ${UNAME_MACHINE}-unknown-freebsdelf`echo ${UNAME_RELEASE}|sed -e 's/[-_].*//'`
exit 0
fi
fi
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit 0 ;; exit 0 ;;
*:NetBSD:*:*)
echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;;
*:OpenBSD:*:*) *:OpenBSD:*:*)
echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
exit 0 ;; exit 0 ;;
@@ -552,6 +627,15 @@ EOF
i*:MINGW*:*) i*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32 echo ${UNAME_MACHINE}-pc-mingw32
exit 0 ;; exit 0 ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
# UNAME_MACHINE based on the output of uname instead of i386?
echo i386-pc-interix
exit 0 ;;
i*:UWIN*:*)
echo ${UNAME_MACHINE}-pc-uwin
exit 0 ;;
p*:CYGWIN*:*) p*:CYGWIN*:*)
echo powerpcle-unknown-cygwin echo powerpcle-unknown-cygwin
exit 0 ;; exit 0 ;;
@@ -562,16 +646,11 @@ EOF
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit 0 ;; exit 0 ;;
*:Linux:*:*) *:Linux:*:*)
# # uname on the ARM produces all sorts of strangeness, and we need to
# # filter it out.
# case "$UNAME_MACHINE" in
# armv*) UNAME_MACHINE=$UNAME_MACHINE ;;
# arm* | sa110*) UNAME_MACHINE="arm" ;;
# esac
# The BFD linker knows what the default object file format is, so # The BFD linker knows what the default object file format is, so
# first see if it will tell us. # first see if it will tell us. cd to the root directory to prevent
ld_help_string=`ld --help 2>&1` # problems with other programs or directories called `ld' in the path.
ld_help_string=`cd /; ld --help 2>&1`
ld_supported_emulations=`echo $ld_help_string \ ld_supported_emulations=`echo $ld_help_string \
| sed -ne '/supported emulations:/!d | sed -ne '/supported emulations:/!d
s/[ ][ ]*/ /g s/[ ][ ]*/ /g
@@ -579,53 +658,124 @@ EOF
s/ .*// s/ .*//
p'` p'`
case "$ld_supported_emulations" in case "$ld_supported_emulations" in
i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; *ia64)
i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; echo "${UNAME_MACHINE}-unknown-linux"
sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; exit 0
armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; ;;
m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; i?86linux)
elf32arm) echo "${UNAME_MACHINE}-unknown-linux-gnu" ; exit 0 ;; echo "${UNAME_MACHINE}-pc-linux-gnuaout"
elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; exit 0
;;
elf_i?86)
echo "${UNAME_MACHINE}-pc-linux"
exit 0
;;
i?86coff)
echo "${UNAME_MACHINE}-pc-linux-gnucoff"
exit 0
;;
sparclinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
armlinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
elf32arm*)
echo "${UNAME_MACHINE}-unknown-linux-gnuoldld"
exit 0
;;
armelf_linux*)
echo "${UNAME_MACHINE}-unknown-linux-gnu"
exit 0
;;
m68klinux)
echo "${UNAME_MACHINE}-unknown-linux-gnuaout"
exit 0
;;
elf32ppc | elf32ppclinux)
# Determine Lib Version
cat >$dummy.c <<EOF
#include <features.h>
#if defined(__GLIBC__)
extern char __libc_version[];
extern char __libc_release[];
#endif
main(argc, argv)
int argc;
char *argv[];
{
#if defined(__GLIBC__)
printf("%s %s\n", __libc_version, __libc_release);
#else
printf("unkown\n");
#endif
return 0;
}
EOF
LIBC=""
$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null
if test "$?" = 0 ; then
./$dummy | grep 1\.99 > /dev/null
if test "$?" = 0 ; then
LIBC="libc1"
fi
fi
rm -f $dummy.c $dummy
echo powerpc-unknown-linux-gnu${LIBC}
exit 0
;;
esac esac
if test "${UNAME_MACHINE}" = "alpha" ; then if test "${UNAME_MACHINE}" = "alpha" ; then
sed 's/^ //' <<EOF >$dummy.s cat <<EOF >$dummy.s
.data
\$Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
.text
.globl main .globl main
.align 4
.ent main .ent main
main: main:
.frame \$30,0,\$26,0 .frame \$30,16,\$26,0
.prologue 0 ldgp \$29,0(\$27)
.long 0x47e03d80 # implver $0 .prologue 1
lda \$2,259 .long 0x47e03d80 # implver \$0
.long 0x47e20c21 # amask $2,$1 lda \$2,-1
srl \$1,8,\$2 .long 0x47e20c21 # amask \$2,\$1
sll \$2,2,\$2 lda \$16,\$Lformat
sll \$0,3,\$0 mov \$0,\$17
addl \$1,\$0,\$0 not \$1,\$18
addl \$2,\$0,\$0 jsr \$26,printf
ret \$31,(\$26),1 ldgp \$29,0(\$26)
mov 0,\$16
jsr \$26,exit
.end main .end main
EOF EOF
LIBC="" LIBC=""
${CC-cc} $dummy.s -o $dummy 2>/dev/null $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
if test "$?" = 0 ; then if test "$?" = 0 ; then
./$dummy case `./$dummy` in
case "$?" in 0-0)
7)
UNAME_MACHINE="alpha" UNAME_MACHINE="alpha"
;; ;;
15) 1-0)
UNAME_MACHINE="alphaev5" UNAME_MACHINE="alphaev5"
;; ;;
14) 1-1)
UNAME_MACHINE="alphaev56" UNAME_MACHINE="alphaev56"
;; ;;
10) 1-101)
UNAME_MACHINE="alphapca56" UNAME_MACHINE="alphapca56"
;; ;;
16) 2-303)
UNAME_MACHINE="alphaev6" UNAME_MACHINE="alphaev6"
;; ;;
2-307)
UNAME_MACHINE="alphaev67"
;;
esac esac
objdump --private-headers $dummy | \ objdump --private-headers $dummy | \
@@ -639,6 +789,7 @@ EOF
elif test "${UNAME_MACHINE}" = "mips" ; then elif test "${UNAME_MACHINE}" = "mips" ; then
cat >$dummy.c <<EOF cat >$dummy.c <<EOF
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
#else #else
int main (argc, argv) int argc; char *argv[]; { int main (argc, argv) int argc; char *argv[]; {
@@ -652,8 +803,10 @@ EOF
return 0; return 0;
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
elif test "${UNAME_MACHINE}" = "s390"; then
echo s390-ibm-linux && exit 0
else else
# Either a pre-BFD a.out linker (linux-gnuoldld) # Either a pre-BFD a.out linker (linux-gnuoldld)
# or one that does not give us useful --help. # or one that does not give us useful --help.
@@ -675,6 +828,7 @@ EOF
cat >$dummy.c <<EOF cat >$dummy.c <<EOF
#include <features.h> #include <features.h>
#ifdef __cplusplus #ifdef __cplusplus
#include <stdio.h> /* for printf() prototype */
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
#else #else
int main (argc, argv) int argc; char *argv[]; { int main (argc, argv) int argc; char *argv[]; {
@@ -695,7 +849,7 @@ EOF
return 0; return 0;
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
fi ;; fi ;;
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions
@@ -712,8 +866,18 @@ EOF
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit 0 ;; exit 0 ;;
i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*)
UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
fi
exit 0 ;;
i?86:*:5:7*)
# Fixed at (any) Pentium or better
UNAME_MACHINE=i586
if [ ${UNAME_SYSTEM} = "UnixWare" ] ; then
echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION}
else else
echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE}
fi fi
@@ -727,19 +891,20 @@ EOF
(/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586 && UNAME_MACHINE=i586
(/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \
&& UNAME_MACHINE=i686
(/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \
&& UNAME_MACHINE=i686
echo ${UNAME_MACHINE}-pc-sco$UNAME_REL echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
else else
echo ${UNAME_MACHINE}-pc-sysv32 echo ${UNAME_MACHINE}-pc-sysv32
fi fi
exit 0 ;; exit 0 ;;
i?86:UnixWare:*:*) i?86:*DOS:*:*)
if /bin/uname -X 2>/dev/null >/dev/null ; then echo ${UNAME_MACHINE}-pc-msdosdjgpp
(/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \
&& UNAME_MACHINE=i586
fi
echo ${UNAME_MACHINE}-unixware-${UNAME_RELEASE}-${UNAME_VERSION}
exit 0 ;; exit 0 ;;
pc:*:*:*) pc:*:*:*)
# Left here for compatibility:
# uname -m prints for DJGPP always 'pc', but it prints nothing about # uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i386. # the processor, so we play safe by assuming i386.
echo i386-pc-msdosdjgpp echo i386-pc-msdosdjgpp
@@ -825,7 +990,7 @@ EOF
news*:NEWS-OS:*:6*) news*:NEWS-OS:*:6*)
echo mips-sony-newsos6 echo mips-sony-newsos6
exit 0 ;; exit 0 ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then if [ -d /usr/nec ]; then
echo mips-nec-sysv${UNAME_RELEASE} echo mips-nec-sysv${UNAME_RELEASE}
else else
@@ -853,6 +1018,27 @@ EOF
*:Rhapsody:*:*) *:Rhapsody:*:*)
echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
exit 0 ;; exit 0 ;;
*:Darwin:*:*)
echo `uname -p`-apple-darwin${UNAME_RELEASE}
exit 0 ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
if test "${UNAME_MACHINE}" = "x86pc"; then
UNAME_MACHINE=pc
fi
echo `uname -p`-${UNAME_MACHINE}-nto-qnx
exit 0 ;;
*:QNX:*:4*)
echo i386-pc-qnx
exit 0 ;;
NSR-W:NONSTOP_KERNEL:*:*)
echo nsr-tandem-nsk${UNAME_RELEASE}
exit 0 ;;
BS2000:POSIX*:*:*)
echo bs2000-siemens-sysv
exit 0 ;;
DS/*:UNIX_System_V:*:*)
echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
exit 0 ;;
esac esac
#echo '(No uname command or uname output not recognized.)' 1>&2 #echo '(No uname command or uname output not recognized.)' 1>&2
@@ -959,7 +1145,7 @@ main ()
} }
EOF EOF
${CC-cc} $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0 $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm $dummy.c $dummy && exit 0
rm -f $dummy.c $dummy rm -f $dummy.c $dummy
# Apollos put the system type in the environment. # Apollos put the system type in the environment.

View File

@@ -10,12 +10,6 @@
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
#undef const #undef const
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define as the return type of signal handlers (int or void). */ /* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE #undef RETSIGTYPE
@@ -31,6 +25,30 @@
/* Define cpu-machine-OS */ /* Define cpu-machine-OS */
#undef 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
/* The number of bytes in a long double. */ /* The number of bytes in a long double. */
#undef SIZEOF_LONG_DOUBLE #undef SIZEOF_LONG_DOUBLE
@@ -76,6 +94,9 @@
/* Define if you have the inet_ntoa_r function. */ /* Define if you have the inet_ntoa_r function. */
#undef HAVE_INET_NTOA_R #undef HAVE_INET_NTOA_R
/* Define if you have the localtime_r function. */
#undef HAVE_LOCALTIME_R
/* Define if you have the perror function. */ /* Define if you have the perror function. */
#undef HAVE_PERROR #undef HAVE_PERROR
@@ -148,6 +169,9 @@
/* Define if you have the <netdb.h> header file. */ /* Define if you have the <netdb.h> header file. */
#undef HAVE_NETDB_H #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. */ /* Define if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H #undef HAVE_NETINET_IN_H
@@ -250,3 +274,15 @@
/* Version number of package */ /* Version number of package */
#undef VERSION #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

373
config.sub vendored
View File

@@ -1,6 +1,8 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script, version 1.1. # Configuration validation subroutine script, version 1.1.
# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
# Free Software Foundation, Inc.
#
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can. # can handle that machine. It does not imply ALL GNU software can.
@@ -25,6 +27,9 @@
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
# Written by Per Bothner <bothner@cygnus.com>.
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1. # If it is invalid, we print an error message on stderr and exit with code 1.
@@ -68,7 +73,7 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
linux-gnu*) nto-qnx* | linux-gnu*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
@@ -98,11 +103,21 @@ case $os in
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
;;
-scout)
;;
-wrs)
os=-vxworks
basic_machine=$1
;;
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
-sco5) -sco5)
os=sco3.2v5 os=-sco3.2v5
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-sco4) -sco4)
@@ -121,6 +136,9 @@ case $os in
os=-sco3.2v2 os=-sco3.2v2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-udk*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
-isc) -isc)
os=-isc2.2 os=-isc2.2
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -143,23 +161,36 @@ case $os in
-psos*) -psos*)
os=-psos os=-psos
;; ;;
-mint | -mint[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
esac esac
# Decode aliases for certain CPU-COMPANY combinations. # Decode aliases for certain CPU-COMPANY combinations.
case $basic_machine in case $basic_machine in
# Recognize the basic CPU types without company name. # Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \
| arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \
| 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 \ | 580 | i960 | h8300 \
| hppa2.0w \ | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \
| alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \
| i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ | hppa64 \
| mips64 | mipsel | mips64el | mips64orion | mips64orionel \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \
| mipstx39 | mipstx39el | armv[34][lb] \ | alphaev6[78] \
| sparc | sparclet | sparclite | sparc64 | v850) | we32k | ns16k | clipper | i370 | sh | powerpc | powerpcle \
| 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \
| mips64orion | mips64orionel | mipstx39 | mipstx39el \
| mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \
| mips64vr5000 | miprs64vr5000el | mcore \
| sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \
| thumb | d10v | fr30 | avr)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | z8k | v70 | h8500 | w65 | pj | pjl)
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
@@ -172,28 +203,49 @@ case $basic_machine in
exit 1 exit 1
;; ;;
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ # FIXME: clean up the formatting here.
vax-* | tahoe-* | i[34567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \
| m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \
| mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \
| power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \
| xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* \ | xmp-* | ymp-* \
| hppa2.0w-* \ | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \
| alpha-* | alphaev5-* | alphaev56-* | we32k-* | cydra-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \
| ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ | hppa2.0n-* | hppa64-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \
| alphaev6[78]-* \
| we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \
| clipper-* | orion-* \
| sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \
| sparc64-* | mips64-* | mipsel-* | armv[34][lb]-*\ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \
| mips64el-* | mips64orion-* | mips64orionel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \
| mipstx39-* | mipstx39el-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \
| f301-* | armv*-*) | mipstx39-* | mipstx39el-* | mcore-* \
| f301-* | armv*-* | s390-* | sv1-* | t3e-* \
| m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \
| thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \
| bs2000-*)
;; ;;
# Recognize the various machine names and aliases which stand # Recognize the various machine names and aliases which stand
# for a CPU type and a company and sometimes even an OS. # for a CPU type and a company and sometimes even an OS.
386bsd)
basic_machine=i386-unknown
os=-bsd
;;
3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
basic_machine=m68000-att basic_machine=m68000-att
;; ;;
3b*) 3b*)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
a29khif)
basic_machine=a29k-amd
os=-udi
;;
adobe68k)
basic_machine=m68010-adobe
os=-scout
;;
alliant | fx80) alliant | fx80)
basic_machine=fx80-alliant basic_machine=fx80-alliant
;; ;;
@@ -223,6 +275,10 @@ case $basic_machine in
basic_machine=m68k-apollo basic_machine=m68k-apollo
os=-sysv os=-sysv
;; ;;
apollo68bsd)
basic_machine=m68k-apollo
os=-bsd
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
@@ -299,6 +355,10 @@ case $basic_machine in
encore | umax | mmax) encore | umax | mmax)
basic_machine=ns32k-encore basic_machine=ns32k-encore
;; ;;
es1800 | OSE68k | ose68k | ose | OSE)
basic_machine=m68k-ericsson
os=-ose
;;
fx2800) fx2800)
basic_machine=i860-alliant basic_machine=i860-alliant
;; ;;
@@ -317,6 +377,14 @@ case $basic_machine in
basic_machine=h8300-hitachi basic_machine=h8300-hitachi
os=-hms os=-hms
;; ;;
h8300xray)
basic_machine=h8300-hitachi
os=-xray
;;
h8500hms)
basic_machine=h8500-hitachi
os=-hms
;;
harris) harris)
basic_machine=m88k-harris basic_machine=m88k-harris
os=-sysv3 os=-sysv3
@@ -332,13 +400,30 @@ case $basic_machine in
basic_machine=m68k-hp basic_machine=m68k-hp
os=-hpux os=-hpux
;; ;;
hp3k9[0-9][0-9] | hp9[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k2[0-9][0-9] | hp9k31[0-9]) hp9k2[0-9][0-9] | hp9k31[0-9])
basic_machine=m68000-hp basic_machine=m68000-hp
;; ;;
hp9k3[2-9][0-9]) hp9k3[2-9][0-9])
basic_machine=m68k-hp basic_machine=m68k-hp
;; ;;
hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) hp9k6[0-9][0-9] | hp6[0-9][0-9])
basic_machine=hppa1.0-hp
;;
hp9k7[0-79][0-9] | hp7[0-79][0-9])
basic_machine=hppa1.1-hp
;;
hp9k78[0-9] | hp78[0-9])
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
# FIXME: really hppa2.0-hp
basic_machine=hppa1.1-hp
;;
hp9k8[0-9][13679] | hp8[0-9][13679])
basic_machine=hppa1.1-hp basic_machine=hppa1.1-hp
;; ;;
hp9k8[0-9][0-9] | hp8[0-9][0-9]) hp9k8[0-9][0-9] | hp8[0-9][0-9])
@@ -347,17 +432,16 @@ case $basic_machine in
hppa-next) hppa-next)
os=-nextstep3 os=-nextstep3
;; ;;
hp3k9[0-9][0-9] | hp9[0-9][0-9]) hppaosf)
basic_machine=hppa1.0-hp basic_machine=hppa1.1-hp
os=-mpeix os=-osf
;; ;;
hp3k9[0-9][0-9] | hp9[0-9][0-9]) hppro)
basic_machine=hppa1.0-hp basic_machine=hppa1.1-hp
os=-mpeix os=-proelf
;; ;;
i370-ibm* | ibm*) i370-ibm* | ibm*)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs
;; ;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2? # I'm not sure what "Sysv32" means. Should this be sysv3.2?
i[34567]86v32) i[34567]86v32)
@@ -376,6 +460,22 @@ case $basic_machine in
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-solaris2 os=-solaris2
;; ;;
i386mach)
basic_machine=i386-mach
os=-mach
;;
i386-vsta | vsta)
basic_machine=i386-unknown
os=-vsta
;;
i386-go32 | go32)
basic_machine=i386-unknown
os=-go32
;;
i386-mingw32 | mingw32)
basic_machine=i386-unknown
os=-mingw32
;;
iris | iris4d) iris | iris4d)
basic_machine=mips-sgi basic_machine=mips-sgi
case $os in case $os in
@@ -404,6 +504,10 @@ case $basic_machine in
miniframe) miniframe)
basic_machine=m68000-convergent basic_machine=m68000-convergent
;; ;;
*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
basic_machine=m68k-atari
os=-mint
;;
mipsel*-linux*) mipsel*-linux*)
basic_machine=mipsel-unknown basic_machine=mipsel-unknown
os=-linux-gnu os=-linux-gnu
@@ -418,12 +522,32 @@ case $basic_machine in
mips3*) mips3*)
basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
;; ;;
mmix*)
basic_machine=mmix-knuth
os=-mmixware
;;
monitor)
basic_machine=m68k-rom68k
os=-coff
;;
msdos)
basic_machine=i386-unknown
os=-msdos
;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
ncr3000) ncr3000)
basic_machine=i486-ncr basic_machine=i486-ncr
os=-sysv4 os=-sysv4
;; ;;
netbsd386)
basic_machine=i386-unknown
os=-netbsd
;;
netwinder) netwinder)
basic_machine=armv4l-corel basic_machine=armv4l-rebel
os=-linux os=-linux
;; ;;
news | news700 | news800 | news900) news | news700 | news800 | news900)
@@ -438,6 +562,10 @@ case $basic_machine in
basic_machine=mips-sony basic_machine=mips-sony
os=-newsos os=-newsos
;; ;;
necv70)
basic_machine=v70-nec
os=-sysv
;;
next | m*-next ) next | m*-next )
basic_machine=m68k-next basic_machine=m68k-next
case $os in case $os in
@@ -463,9 +591,28 @@ case $basic_machine in
basic_machine=i960-intel basic_machine=i960-intel
os=-nindy os=-nindy
;; ;;
mon960)
basic_machine=i960-intel
os=-mon960
;;
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
op50n-* | op60c-*)
basic_machine=hppa1.1-oki
os=-proelf
;;
OSE68000 | ose68000)
basic_machine=m68000-ericsson
os=-ose
;;
os68k)
basic_machine=m68k-none
os=-os68k
;;
pa-hitachi) pa-hitachi)
basic_machine=hppa1.1-hitachi basic_machine=hppa1.1-hitachi
os=-hiuxwe2 os=-hiuxwe2
@@ -483,19 +630,19 @@ case $basic_machine in
pc532 | pc532-*) pc532 | pc532-*)
basic_machine=ns32k-pc532 basic_machine=ns32k-pc532
;; ;;
pentium | p5 | k5 | nexen) pentium | p5 | k5 | k6 | nexen)
basic_machine=i586-pc basic_machine=i586-pc
;; ;;
pentiumpro | p6 | k6 | 6x86) pentiumpro | p6 | 6x86)
basic_machine=i686-pc basic_machine=i686-pc
;; ;;
pentiumii | pentium2) pentiumii | pentium2)
basic_machine=i786-pc basic_machine=i786-pc
;; ;;
pentium-* | p5-* | k5-* | nexen-*) pentium-* | p5-* | k5-* | k6-* | nexen-*)
basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumpro-* | p6-* | k6-* | 6x86-*) pentiumpro-* | p6-* | 6x86-*)
basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
pentiumii-* | pentium2-*) pentiumii-* | pentium2-*)
@@ -519,12 +666,20 @@ case $basic_machine in
ps2) ps2)
basic_machine=i386-ibm basic_machine=i386-ibm
;; ;;
rom68k)
basic_machine=m68k-rom68k
os=-coff
;;
rm[46]00) rm[46]00)
basic_machine=mips-siemens basic_machine=mips-siemens
;; ;;
rtpc | rtpc-*) rtpc | rtpc-*)
basic_machine=romp-ibm basic_machine=romp-ibm
;; ;;
sa29200)
basic_machine=a29k-amd
os=-udi
;;
sequent) sequent)
basic_machine=i386-sequent basic_machine=i386-sequent
;; ;;
@@ -532,6 +687,10 @@ case $basic_machine in
basic_machine=sh-hitachi basic_machine=sh-hitachi
os=-hms os=-hms
;; ;;
sparclite-wrs)
basic_machine=sparclite-wrs
os=-vxworks
;;
sps7) sps7)
basic_machine=m68k-bull basic_machine=m68k-bull
os=-sysv2 os=-sysv2
@@ -539,6 +698,13 @@ case $basic_machine in
spur) spur)
basic_machine=spur-unknown basic_machine=spur-unknown
;; ;;
st2000)
basic_machine=m68k-tandem
;;
stratus)
basic_machine=i860-stratus
os=-sysv4
;;
sun2) sun2)
basic_machine=m68000-sun basic_machine=m68000-sun
;; ;;
@@ -579,10 +745,18 @@ case $basic_machine in
sun386 | sun386i | roadrunner) sun386 | sun386i | roadrunner)
basic_machine=i386-sun basic_machine=i386-sun
;; ;;
sv1)
basic_machine=sv1-cray
os=-unicos
;;
symmetry) symmetry)
basic_machine=i386-sequent basic_machine=i386-sequent
os=-dynix os=-dynix
;; ;;
t3e)
basic_machine=t3e-cray
os=-unicos
;;
tx39) tx39)
basic_machine=mipstx39-unknown basic_machine=mipstx39-unknown
;; ;;
@@ -600,6 +774,10 @@ case $basic_machine in
basic_machine=a29k-nyu basic_machine=a29k-nyu
os=-sym1 os=-sym1
;; ;;
v810 | necv810)
basic_machine=v810-nec
os=-none
;;
vaxv) vaxv)
basic_machine=vax-dec basic_machine=vax-dec
os=-sysv os=-sysv
@@ -623,6 +801,14 @@ case $basic_machine in
basic_machine=a29k-wrs basic_machine=a29k-wrs
os=-vxworks os=-vxworks
;; ;;
w65*)
basic_machine=w65-wdc
os=-none
;;
w89k-*)
basic_machine=hppa1.1-winbond
os=-proelf
;;
xmp) xmp)
basic_machine=xmp-cray basic_machine=xmp-cray
os=-unicos os=-unicos
@@ -630,6 +816,10 @@ case $basic_machine in
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
z8k-*-coff)
basic_machine=z8k-unknown
os=-sim
;;
none) none)
basic_machine=none-none basic_machine=none-none
os=-none os=-none
@@ -637,6 +827,15 @@ case $basic_machine in
# Here we handle the default manufacturer of certain CPU types. It is in # Here we handle the default manufacturer of certain CPU types. It is in
# some cases the only manufacturer, in others, it is the most popular. # some cases the only manufacturer, in others, it is the most popular.
w89k)
basic_machine=hppa1.1-winbond
;;
op50n)
basic_machine=hppa1.1-oki
;;
op60c)
basic_machine=hppa1.1-oki
;;
mips) mips)
if [ x$os = x-linux-gnu ]; then if [ x$os = x-linux-gnu ]; then
basic_machine=mips-unknown basic_machine=mips-unknown
@@ -659,7 +858,7 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sparc) sparc | sparcv9)
basic_machine=sparc-sun basic_machine=sparc-sun
;; ;;
cydra) cydra)
@@ -671,6 +870,16 @@ case $basic_machine in
orion105) orion105)
basic_machine=clipper-highlevel basic_machine=clipper-highlevel
;; ;;
mac | mpw | mac-mpw)
basic_machine=m68k-apple
;;
pmac | pmac-mpw)
basic_machine=powerpc-apple
;;
c4x*)
basic_machine=c4x-none
os=-coff
;;
*) *)
echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
exit 1 exit 1
@@ -724,14 +933,34 @@ case $os in
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
| -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -uxpv* | -beos* | -rhapsody* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
| -openstep* | -mpeix* | -oskit*) | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*)
case $basic_machine in
x86-* | i[34567]86-*)
;;
*)
os=-nto$os
;;
esac
;;
-nto*)
os=-nto-qnx
;;
-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
| -windows* | -osx | -abug | -netware* | -os9* | -beos* \
| -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
;;
-mac*)
os=`echo $os | sed -e 's|mac|macos|'`
;;
-linux*) -linux*)
os=`echo $os | sed -e 's|linux|linux-gnu|'` os=`echo $os | sed -e 's|linux|linux-gnu|'`
;; ;;
@@ -741,6 +970,12 @@ case $os in
-sunos6*) -sunos6*)
os=`echo $os | sed -e 's|sunos6|solaris3|'` os=`echo $os | sed -e 's|sunos6|solaris3|'`
;; ;;
-opened*)
os=-openedition
;;
-wince*)
os=-wince
;;
-osfrose*) -osfrose*)
os=-osfrose os=-osfrose
;; ;;
@@ -756,12 +991,18 @@ case $os in
-acis*) -acis*)
os=-aos os=-aos
;; ;;
-386bsd)
os=-bsd
;;
-ctix* | -uts*) -ctix* | -uts*)
os=-sysv os=-sysv
;; ;;
-ns2 ) -ns2 )
os=-nextstep2 os=-nextstep2
;; ;;
-nsk)
os=-nsk
;;
# Preserve the version number of sinix5. # Preserve the version number of sinix5.
-sinix5.*) -sinix5.*)
os=`echo $os | sed -e 's|sinix|sysv|'` os=`echo $os | sed -e 's|sinix|sysv|'`
@@ -787,9 +1028,18 @@ case $os in
# This must come after -sysvr4. # This must come after -sysvr4.
-sysv*) -sysv*)
;; ;;
-ose*)
os=-ose
;;
-es1800*)
os=-ose
;;
-xenix) -xenix)
os=-xenix os=-xenix
;; ;;
-*mint | -*MiNT)
os=-mint
;;
-none) -none)
;; ;;
*) *)
@@ -815,7 +1065,7 @@ case $basic_machine in
*-acorn) *-acorn)
os=-riscix1.2 os=-riscix1.2
;; ;;
arm*-corel) arm*-rebel)
os=-linux os=-linux
;; ;;
arm*-semi) arm*-semi)
@@ -839,6 +1089,15 @@ case $basic_machine in
# default. # default.
# os=-sunos4 # os=-sunos4
;; ;;
m68*-cisco)
os=-aout
;;
mips*-cisco)
os=-elf
;;
mips*-*)
os=-elf
;;
*-tti) # must be before sparc entry or we get the wrong os. *-tti) # must be before sparc entry or we get the wrong os.
os=-sysv3 os=-sysv3
;; ;;
@@ -851,6 +1110,15 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-wec)
os=-proelf
;;
*-winbond)
os=-proelf
;;
*-oki)
os=-proelf
;;
*-hp) *-hp)
os=-hpux os=-hpux
;; ;;
@@ -914,6 +1182,18 @@ case $basic_machine in
f301-fujitsu) f301-fujitsu)
os=-uxpv os=-uxpv
;; ;;
*-rom68k)
os=-coff
;;
*-*bug)
os=-coff
;;
*-apple)
os=-macos
;;
*-atari*)
os=-mint
;;
*) *)
os=-none os=-none
;; ;;
@@ -935,10 +1215,10 @@ case $basic_machine in
-aix*) -aix*)
vendor=ibm vendor=ibm
;; ;;
-hpux*) -beos*)
vendor=hp vendor=be
;; ;;
-mpeix*) -hpux*)
vendor=hp vendor=hp
;; ;;
-mpeix*) -mpeix*)
@@ -959,7 +1239,7 @@ case $basic_machine in
-genix*) -genix*)
vendor=ns vendor=ns
;; ;;
-mvs*) -mvs* | -opened*)
vendor=ibm vendor=ibm
;; ;;
-ptx*) -ptx*)
@@ -971,6 +1251,15 @@ case $basic_machine in
-aux*) -aux*)
vendor=apple vendor=apple
;; ;;
-hms*)
vendor=hitachi
;;
-mpw* | -macos*)
vendor=apple
;;
-*mint | -*MiNT)
vendor=atari
;;
esac esac
basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
;; ;;

View File

@@ -2,16 +2,28 @@ dnl $Id$
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(lib/urldata.h) AC_INIT(lib/urldata.h)
AM_CONFIG_HEADER(config.h src/config.h) AM_CONFIG_HEADER(config.h src/config.h)
AM_INIT_AUTOMAKE(curl,"7.0.1beta") AM_INIT_AUTOMAKE(curl,"7.2")
AM_PROG_LIBTOOL
dnl
dnl Detect the canonical host and target build environment
dnl
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
dnl Checks for programs. dnl Checks for programs.
AC_PROG_CC AC_PROG_CC
dnl Check for AIX weirdos
AC_AIX
dnl check for how to do large files
AC_SYS_LARGEFILE
dnl The install stuff has already been taken care of by the automake stuff dnl The install stuff has already been taken care of by the automake stuff
dnl AC_PROG_INSTALL dnl AC_PROG_INSTALL
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
dnl Check for AIX weirdos
AC_AIX
dnl ********************************************************************** dnl **********************************************************************
dnl Checks for libraries. dnl Checks for libraries.
@@ -20,9 +32,37 @@ dnl **********************************************************************
dnl nsl lib? dnl nsl lib?
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname))
dnl At least one system has been identified to require BOTH nsl and
dnl socket libs to link properly.
if test "$ac_cv_lib_nsl_gethostbyname" = "$ac_cv_func_gethostbyname"; then
AC_MSG_CHECKING([trying both nsl and socket libs])
my_ac_save_LIBS=$LIBS
LIBS="-lnsl -lsocket $LIBS"
AC_TRY_LINK( ,
[gethostbyname();],
my_ac_link_result=success,
my_ac_link_result=failure )
if test "$my_ac_link_result" = "failure"; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
dnl restore LIBS
LIBS=$my_ac_save_LIBS
else
AC_MSG_RESULT([yes])
fi
fi
dnl resolve lib? dnl resolve lib?
AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp)) AC_CHECK_FUNC(strcasecmp, , AC_CHECK_LIB(resolve, strcasecmp))
if test "$ac_cv_lib_resolve_strcasecmp" = "$ac_cv_func_strcasecmp"; then
AC_CHECK_LIB(resolve, strcasecmp,
[LIBS="-lresolve $LIBS"],
,
-lnsl)
fi
dnl socket lib? dnl socket lib?
AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect)) AC_CHECK_FUNC(connect, , AC_CHECK_LIB(socket, connect))
@@ -112,6 +152,218 @@ dnl fi
dnl z lib? dnl z lib?
dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread)) dnl AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
dnl Default is to try the thread-safe versions of a few functions
OPT_THREAD=on
AC_ARG_ENABLE(thread,dnl
[ --disable-thread tell configure to not look for thread-safe functions],
OPT_THREAD=off
)
if test X"$OPT_THREAD" = Xoff
then
AC_MSG_WARN(libcurl will not get built using thread-safe functions)
AC_DEFINE(DISABLED_THREADSAFE, 1, \
Set to explicitly specify we don't want to use thread-safe functions)
else
dnl check for number of arguments to gethostbyname_r. it might take
dnl either 3, 5, or 6 arguments.
AC_CHECK_FUNCS(gethostbyname_r,[
AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
AC_TRY_RUN([
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
int
main () {
struct hostent h;
struct hostent_data hdata;
char *name = "localhost";
int rc;
memset(&h, 0, sizeof(struct hostent));
memset(&hdata, 0, sizeof(struct hostent_data));
rc = gethostbyname_r(name, &h, &hdata);
exit (rc != 0 ? 1 : 0); }],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
ac_cv_gethostbyname_args=3],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments)
AC_TRY_RUN([
#define _REENTRANT
#include <string.h>
#include <sys/types.h>
#include <netdb.h>
int
main () {
struct hostent h;
struct hostent_data hdata;
char *name = "localhost";
int rc;
memset(&h, 0, sizeof(struct hostent));
memset(&hdata, 0, sizeof(struct hostent_data));
rc = gethostbyname_r(name, &h, &hdata);
exit (rc != 0 ? 1 : 0); }],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
AC_DEFINE(NEED_REENTRANT)
ac_cv_gethostbyname_args=3],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments)
AC_TRY_RUN([
#include <sys/types.h>
#include <netdb.h>
int
main () {
struct hostent *hp;
struct hostent h;
char *name = "localhost";
char buffer[8192];
int h_errno;
hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
exit (hp == NULL ? 1 : 0); }],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
ac_cv_gethostbyname_args=5],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments)
AC_TRY_RUN([
#include <sys/types.h>
#include <netdb.h>
int
main () {
struct hostent h;
struct hostent *hp;
char *name = "localhost";
char buf[8192];
int rc;
int h_errno;
rc = gethostbyname_r(name, &h, buf, 8192, &hp, &h_errno);
exit (rc != 0 ? 1 : 0); }],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
ac_cv_gethostbyname_args=6],[
AC_MSG_RESULT(no)
have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"],
[ac_cv_gethostbyname_args=0])],
[ac_cv_gethostbyname_args=0])],
[ac_cv_gethostbyname_args=0])],
[ac_cv_gethostbyname_args=0])])
dnl check for number of arguments to gethostbyaddr_r. it might take
dnl either 5, 7, or 8 arguments.
AC_CHECK_FUNCS(gethostbyaddr_r,[
AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <netdb.h>],[
char * address;
int length;
int type;
struct hostent h;
struct hostent_data hdata;
int rc;
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
ac_cv_gethostbyaddr_args=5],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
AC_TRY_COMPILE([
#define _REENTRANT
#include <sys/types.h>
#include <netdb.h>],[
char * address;
int length;
int type;
struct hostent h;
struct hostent_data hdata;
int rc;
rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
AC_DEFINE(NEED_REENTRANT)
ac_cv_gethostbyaddr_args=5],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <netdb.h>],[
char * address;
int length;
int type;
struct hostent h;
char buffer[10];
int buflen;
int h_errnop;
struct hostent * hp;
hp = gethostbyaddr_r(address, length, type, &h,
buffer, buflen, &h_errnop);],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
ac_cv_gethostbyaddr_args=7],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <netdb.h>],[
char * address;
int length;
int type;
struct hostent h;
char buffer[10];
int buflen;
int h_errnop;
struct hostent * hp;
int rc;
rc = gethostbyaddr_r(address, length, type, &h,
buffer, buflen, &hp, &h_errnop);],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8)
ac_cv_gethostbyaddr_args=8],[
AC_MSG_RESULT(no)
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])])
dnl determine if function definition for inet_ntoa_r exists.
AC_CHECK_FUNCS(inet_ntoa_r,[
AC_MSG_CHECKING(whether inet_ntoa_r is declared)
AC_EGREP_CPP(inet_ntoa_r,[
#include <arpa/inet.h>],[
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared)
AC_EGREP_CPP(inet_ntoa_r,[
#define _REENTRANT
#include <arpa/inet.h>],[
AC_DEFINE(HAVE_INET_NTOA_R_DECL)
AC_DEFINE(NEED_REENTRANT)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))])])
dnl check for a few thread-safe functions
AC_CHECK_FUNCS(localtime_r,[
AC_MSG_CHECKING(whether localtime_r is declared)
AC_EGREP_CPP(localtime_r,[
#include <time.h>],[
AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared)
AC_EGREP_CPP(localtime_r,[
#define _REENTRANT
#include <time.h>],[
AC_DEFINE(NEED_REENTRANT)
AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))])])
fi
dnl ********************************************************************** dnl **********************************************************************
dnl Back to "normal" configuring dnl Back to "normal" configuring
dnl ********************************************************************** dnl **********************************************************************
@@ -125,6 +377,7 @@ AC_CHECK_HEADERS( \
arpa/inet.h \ arpa/inet.h \
net/if.h \ net/if.h \
netinet/in.h \ netinet/in.h \
netinet/if_ether.h \
netdb.h \ netdb.h \
sys/select.h \ sys/select.h \
sys/socket.h \ sys/socket.h \
@@ -167,7 +420,7 @@ AC_DEFINE_UNQUOTED(OS, "${host}")
dnl Checks for library functions. dnl Checks for library functions.
dnl AC_PROG_GCC_TRADITIONAL dnl AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_FUNC_VPRINTF dnl AC_FUNC_VPRINTF
AC_CHECK_FUNCS( socket \ AC_CHECK_FUNCS( socket \
select \ select \
strdup \ strdup \
@@ -178,14 +431,11 @@ AC_CHECK_FUNCS( socket \
stricmp \ stricmp \
strcmpi \ strcmpi \
gethostname \ gethostname \
gethostbyname_r \
gethostbyaddr \ gethostbyaddr \
gethostbyaddr_r \
getservbyname \ getservbyname \
gettimeofday \ gettimeofday \
inet_addr \ inet_addr \
inet_ntoa \ inet_ntoa \
inet_ntoa_r \
tcsetattr \ tcsetattr \
tcgetattr \ tcgetattr \
perror \ perror \
@@ -196,6 +446,10 @@ AC_CHECK_FUNCS( socket \
RAND_screen RAND_screen
) )
if test "$ac_cv_func_select" != "yes"; then
AC_MSG_ERROR(Can't work without an existing socket() function)
fi
AC_PATH_PROG( PERL, perl, , AC_PATH_PROG( PERL, perl, ,
$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin ) $PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
AC_SUBST(PERL) AC_SUBST(PERL)
@@ -204,7 +458,6 @@ AC_PATH_PROGS( NROFF, gnroff nroff, ,
$PATH:/usr/bin/:/usr/local/bin ) $PATH:/usr/bin/:/usr/local/bin )
AC_SUBST(NROFF) AC_SUBST(NROFF)
AC_PROG_RANLIB
AC_PROG_YACC AC_PROG_YACC
dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib, dnl AC_PATH_PROG( RANLIB, ranlib, /usr/bin/ranlib,
@@ -212,6 +465,11 @@ dnl $PATH:/usr/bin/:/usr/local/bin )
dnl AC_SUBST(RANLIB) dnl AC_SUBST(RANLIB)
AC_OUTPUT( Makefile \ AC_OUTPUT( Makefile \
curl.spec \
curl-ssl.spec \
docs/Makefile \
include/Makefile \
include/curl/Makefile \
src/Makefile \ src/Makefile \
lib/Makefile ) lib/Makefile )
dnl perl/checklinks.pl \ dnl perl/checklinks.pl \

View File

@@ -1,54 +0,0 @@
%define name curl-ssl
%define tarball curl
%define version 6.5.2
%define release 1
%define prefix /usr/local
%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.nu>
Packager: Troy Engel <tengel@sonic.net>
Group: Utilities/Console
Source: %{tarball}-%{version}.tar.gz
URL: http://curl.haxx.nu/
BuildRoot: /tmp/%{tarball}-%{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 with SSL (https:) support.
%prep
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%setup -n %{tarball}-%{version}
%build
CFLAGS=$RPM_OPT_FLAGS ./configure --prefix=$RPM_BUILD_ROOT%{prefix}
make
%install
make install-strip
install -m 0644 curl.1 $RPM_BUILD_ROOT%{prefix}/man/man1
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%files
%defattr(-,root,root)
%attr(0755,root,root) %{prefix}/bin/curl
%attr(0644,root,root) %{prefix}/man/man1/curl.1
%doc BUGS CHANGES CONTRIBUTE FAQ FEATURES FILES INSTALL LEGAL MPL-1.0.txt README* RESOURCES TODO

View File

@@ -9,7 +9,7 @@ Release: %rel
Copyright: MPL Copyright: MPL
Group: Utilities/Console Group: Utilities/Console
Source: @PACKAGE@-%{version}.tar.gz Source: @PACKAGE@-%{version}.tar.gz
URL: http://@PACKAGE@.haxx.nu URL: http://@PACKAGE@.haxx.se
BuildPrereq: openssl BuildPrereq: openssl
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
Packager: Fill In As You Wish Packager: Fill In As You Wish
@@ -27,7 +27,7 @@ resume and more.
Note: this version is compiled with SSL (https:) support. Note: this version is compiled with SSL (https:) support.
Authors: Authors:
Daniel Stenberg <Daniel.Stenberg@haxx.nu> Daniel Stenberg <daniel@haxx.se>
%prep %prep

View File

@@ -1,54 +0,0 @@
%define name curl
%define version 6.5.2
%define release 1
%define prefix /usr/local
%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.nu>
Packager: Troy Engel <tengel@sonic.net>
Group: Utilities/Console
Source: %{name}-%{version}.tar.gz
URL: http://curl.haxx.nu/
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.
%prep
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%setup
%build
export CFLAGS=$RPM_OPT_FLAGS
./configure --prefix=$RPM_BUILD_ROOT%{prefix} --without-ssl
make
%install
make install-strip
install -m 0644 curl.1 $RPM_BUILD_ROOT%{prefix}/man/man1
%clean
rm -rf $RPM_BUILD_ROOT
rm -rf %{builddir}
%files
%defattr(-,root,root)
%attr(0755,root,root) %{prefix}/bin/curl
%attr(0644,root,root) %{prefix}/man/man1/curl.1
%doc BUGS CHANGES CONTRIBUTE FAQ FEATURES FILES INSTALL LEGAL MPL-1.0.txt README* RESOURCES TODO

View File

@@ -9,7 +9,7 @@ Release: %rel
Copyright: MPL Copyright: MPL
Group: Utilities/Console Group: Utilities/Console
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
URL: http://@PACKAGE@.haxx.nu URL: http://@PACKAGE@.haxx.se
BuildRoot: /tmp/%{name}-%{version}-%{rel}-root BuildRoot: /tmp/%{name}-%{version}-%{rel}-root
Packager: Fill In As You Wish Packager: Fill In As You Wish
Docdir: %{prefix}/doc Docdir: %{prefix}/doc
@@ -26,7 +26,7 @@ resume and more.
Note: this version is compiled without SSL (https:) support. Note: this version is compiled without SSL (https:) support.
Authors: Authors:
Daniel Stenberg <Daniel.Stenberg@haxx.nu> Daniel Stenberg <daniel@haxx.se>
%prep %prep

View File

@@ -8,31 +8,41 @@ CONTRIBUTE
To Think About When Contributing Source Code To Think About When Contributing Source Code
This document is intended to offer some guidelines that can be useful to This document is intended to offer some guidelines that can be useful to keep
keep in mind when you decide to write a contribution to the project. This in mind when you decide to write a contribution to the project. This concerns
concerns new features as well as corrections to existing flaws or bugs. new features as well as corrections to existing flaws or bugs.
The License Issue
When contributing with code, you agree to put your changes and new code under
the same license curl and libcurl is already using. Curl uses the MozPL, the
Mozilla Public License, which is *NOT* compatible with the well known GPL,
GNU Public License. We can never re-use sources from a GPL program in curl.
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. Such "separate parts" can not be GPL either.
Naming Naming
Try using a non-confusing naming scheme for your new functions and variable Try using a non-confusing naming scheme for your new functions and variable
names. It doesn't necessarily have to mean that you should use the same as names. It doesn't necessarily have to mean that you should use the same as in
in other places of the code, just that the names should be logical, other places of the code, just that the names should be logical,
understandable and be named according to what they're used for. understandable and be named according to what they're used for.
Indenting Indenting
Please try using the same indenting levels and bracing method as all the Please try using the same indenting levels and bracing method as all the
other code already does. It makes the source code a lot easier to follow if other code already does. It makes the source code a lot easier to follow if
all of it is written using the same style. I don't ask you to like it, I all of it is written using the same style. I don't ask you to like it, I just
just ask you to follow the tradition! ;-) ask you to follow the tradition! ;-)
Commenting Commenting
Comment your source code extensively. I don't see myself as a very good Comment your source code extensively. I don't see myself as a very good
source commenter, but I try to become one. Commented code is quality code source commenter, but I try to become one. Commented code is quality code and
and enables future modifications much more. Uncommented code much more risk enables future modifications much more. Uncommented code much more risk being
being completely replaced when someone wants to extend things, since other completely replaced when someone wants to extend things, since other persons'
persons' source code can get quite hard to read. source code can get quite hard to read.
General Style General Style
@@ -41,10 +51,10 @@ General Style
Non-clobbering All Over Non-clobbering All Over
When you write new functionality or fix bugs, it is important that you When you write new functionality or fix bugs, it is important that you don't
don't fiddle all over the source files and functions. Remember that it is fiddle all over the source files and functions. Remember that it is likely
likely that other people have done changes in the same source files as you that other people have done changes in the same source files as you have and
have and possibly even in the same functions. If you bring completely new possibly even in the same functions. If you bring completely new
functionality, try writing it in a new source file. If you fix bugs, try to functionality, try writing it in a new source file. If you fix bugs, try to
fix one bug at a time and send them as separate patches. fix one bug at a time and send them as separate patches.
@@ -61,10 +71,10 @@ Separate Patches Doing Different Things
Document Document
Writing docs is dead boring and one of the big problems with many open Writing docs is dead boring and one of the big problems with many open source
source projects. Someone's gotta do it. It makes it a lot easier if you projects. Someone's gotta do it. It makes it a lot easier if you submit a
submit a small description of your fix or your new features with every small description of your fix or your new features with every contribution so
contribution so that it can be swiftly added to the package documentation. that it can be swiftly added to the package documentation.
Write Access to CVS Repository Write Access to CVS Repository

457
docs/FAQ
View File

@@ -1,3 +1,4 @@
Updated: August 22, 2000 (http://curl.haxx.se/docs/faq.shtml)
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
@@ -6,8 +7,274 @@
FAQ FAQ
Problems connecting to SSL servers. 1. Philosophy
=================================== 1.1 What is cURL?
1.2 What is libcurl?
1.3 What is cURL not?
1.4 When will you make curl do XXXX ?
2. Install Related Problems
2.1 configure doesn't find OpenSSL even when it is installed
2.1.1. native linker doesn't find openssl
2.1.2. only the libssl lib is missing
2.2 Does curl work/build with other SSL libraries?
2.3 Where can I find a copy of LIBEAY32.DLL?
2.4 Does cURL support Socks (RFC 1928) ?
3. Usage Problems
3.1 curl: (1) SSL is disabled, https: not supported
3.2 How do I tell curl to resume a transfer?
3.3 Why doesn't my posting using -F work?
3.4 How do I tell curl to run custom FTP commands?
3.5 How can I disable the Pragma: nocache header?
3.6 Does curl support javascript, ASP, XML, XHTML or HTML version Y?
3.7 Can I use curl to delete/rename a file through FTP?
3.8 How do I tell curl to follow HTTP redirects?
4. Running Problems
4.1 Problems connecting to SSL servers.
4.2 Why do I get problems when I use & 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?
4.5.1 "400 Bad Request"
4.5.2 "401 Unauthorized"
4.5.3 "403 Forbidden"
4.5.4 "404 Not Found"
4.5.5 "405 Method Not Allowed"
4.6 Can you tell me what error code 142 means?
5. libcurl Issues
5.1 Is libcurl thread safe?
6. License Issues
6.1 I have a GPL program, can I use the libcurl library?
6.2 I have a closed-source program, can I use the libcurl library?
6.3 I have a BSD licensed program, can I use the libcurl library?
6.4 I have a program that uses LGPL libraries, can I use libcurl?
6.5 Can I modify curl/libcurl for my program and keep the changes secret?
6.6 Can you please change the curl/libcurl license to XXXX?
==============================================================================
1. Philosophy
1.1 What is cURL?
cURL (or simply just 'curl') is a command line tool for getting or sending
files using URL syntax. The name is a play on 'Client for URLs', originally
with URL spelled in uppercase to make it obvious it deals with URLs.
Curl supports a range of common internet protocols, currently including
HTTP, HTTPS, FTP, GOPHER, LDAP, DICT and FILE.
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.
Any application is free to use libcurl, even commercial or closed-source
ones. Just make sure changes to the lib itself is made public.
1.3 What is cURL not?
Curl is *not*, I repeat, *not* a wget clone even though that is a very
common misconception. Never, during curl's development, have I intended curl
to replace wget or compete on its market. Curl is targeted at single-shot
file transfers.
Curl is not a web site mirroring program. If you wanna use curl to mirror
something: fine, go ahead and write a script that wraps around curl to make
it reality (like curlmirror.pl does).
Curl is not an ftp site mirroring program. Sure, get and send ftp with curl
but if you want systematic and sequential behaviour you should write a
script (or write a new program that interfaces libcurl) and do it.
Curl is not a PHP tool, even though it works perfectly well when used from
or with PHP.
Curl is not a single-OS program. Curl exists, compiles, builds and runs
under a long range of operating systems, including all modern Unixes,
Windows, Amiga, BeOS, OS/2, OS X, QNX etc.
1.4 When will you make curl do XXXX ?
I love suggestions of what to change in order to make curl and libcurl
better. I do however believe in a few rules when it comes to the future of
curl:
* It is to remain a command line tool. If you want GUIs or fancy scripting
capabilities, you're free to write another tool that uses libcurl and that
offers this. There's no point in having one single tool that does every
imaginable thing. That's also one of the great advantages of having the
core of curl as a library: libcurl.
* I do not add things to curl that other small and available tools already
do very fine at the side. Curl's output is fine to pipe into another
program or redirect to another file for the next program to interpret.
* I focus on protocol related issues and improvements. If you wanna do more
magic with the supported protocols than curl currently does, changes are
big I will agree. If you wanna add more protocols, I may very well
agree.
* If you want me to make all the work while you wait for me to implement it
for you, that is not a very friendly attitude. I spend a considerable time
already on maintaining and developing curl. In order to get more out of
me, I trust you will offer some of your time and efforts in return.
* If you write the code, chances are bigger that it will get into curl
faster.
2. Install Related Problems
2.1. configure doesn't find OpenSSL even when it is installed
This may be because of several reasons.
2.1.1. native linker doesn't find openssl
Affected platforms:
Solaris (native cc compiler)
HPUX (native cc compiler)
SGI IRIX (native cc compiler)
When configuring curl, I specify --with-ssl. OpenSSL is installed in
/usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find
CRYPTO_lock in -lcrypto
Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER
-lcrypto, so ld can't find the library. This is due to a bug in the GNU
autoconf tool.
Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of
./configure places the -L/usr/local/ssl/lib early enough in the command
line to make things work
Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
2.1.2. only the libssl lib is missing
If all include files and the libcrypto lib is present, with only the
libssl being missing according to configure, this is mostly likely because
a few functions are left out from the libssl.
If the function names missing include RSA or RSAREF you can be certain
that this is because libssl requires the RSA and RSASEF libs to build.
See the INSTALL file section that explains how to add those libs to
configure. Make sure that you remove the config.cache file before you
rerun configure with the new flags.
2.2. Does curl work/build with other SSL libraries?
Curl has been written to use OpenSSL, although I doubt there would be much
problems using a different library. I just don't know any other free one and
that has limited my possibilities to develop against anything else.
If anyone does "port" curl to use a commercial SSL library, I am of course
very interested in getting the patch!
2.3. Where can I find a copy of LIBEAY32.DLL?
That is an OpenSSL binary built for Windows.
Curl uses OpenSSL to do the SSL stuff. The LIBEAY32.DLL is what curl needs
on a windows machine to do https://. Check out the curl web page to find
accurate and up-to-date pointers to recent OpenSSL DDLs and other binary
packages.
2.4. Does cURL support Socks (RFC 1928) ?
No. Nobody has wanted it that badly yet. I would appriciate patches that
brings this functionality.
3. Usage problems
3.1. curl: (1) SSL is disabled, https: not supported
If you get this output when trying to get anything from a https:// server,
it means that the configure script couldn't find all libs and include files
it requires for SSL to work. If the configure script fails to find them,
curl is simply built without SSL support.
To get the https:// support into a curl that was previously built but that
reports that https:// is not supported, you should dig through the document
and logs and check out why the configure script doesn't find the SSL libs
and/or include files.
Also, check out the other paragraph in this FAQ labeled "configure doesn't
find OpenSSL even when it is installed".
3.2. How do I tell curl to resume a transfer?
Curl supports resume both ways on FTP, download ways on HTTP.
Try the -c and -C options.
3.3. Why doesn't my posting using -F work?
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
use the -F type. In all the most common cases, you should use -d which then
causes a posting with the type 'application/x-www-form-urlencoded'.
I have described this in some detail in the README.curl file, and if you
don't understand it the first time, read it again before you post questions
about this to the mailing list. I would also suggest that you read through
the mailing list archives for old postings and questions regarding this.
3.4. How do I tell curl to run custom FTP commands?
You can tell curl to perform optional commands both before and/or after a
file transfer. Study the -Q/--quote option.
Since curl is used for file transfers, you don't use curl to just perform
ftp commands without transfering anything. Therefore you must always specify
a URL to transfer to/from even when doing custom FTP commands.
3.5. How can I disable the Pragma: nocache header?
You can change all internally generated headers by adding a replacement with
the -H/--header option. By adding a header with empty contents you safely
disable that one. Use -H "Pragma:" to disable that specific header.
3.6. Does curl support javascript, ASP, XML, XHTML or HTML version Y?
To curl, all contents are alike. It doesn't matter how the page was
generated. It may be ASP, PHP, perl, shell-script, SSI or plain
HTML-files. There's no difference to curl and it doesn't even know what kind
of language that generated the page.
Javascript is slightly different since that is code embedded in the HTML
that is sent for the client to interpret and curl has no javascript
interpreter.
3.7. Can I use curl to delete/rename a file through FTP?
Yes. You specify custom ftp commands with -Q/--quote.
One example would be to delete a file after you have downloaded it:
curl -O ftp://download.com/coolfile -Q '-DELE coolfile'
3.8 How do I tell curl to follow HTTP redirects?
Curl does not follow so-called redirects by default. The Location: header
that informs the client about this is only interpreted if you're using the
-L/--location option. As in:
curl -L http://redirector.com
4. Running Problems
4.1. Problems connecting to SSL servers.
It took a very long time before I could sort out why curl had problems It took a very long time before I could sort out why curl had problems
to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. to connect to certain SSL servers when using SSLeay or OpenSSL v0.9+.
@@ -22,64 +289,170 @@ Problems connecting to SSL servers.
I have also seen examples where the remote server didn't like the SSLv2 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. request and instead you had to force curl to use SSLv3 with -3/--sslv3.
Does curl support resume? 4.2. Why do I get problems when I use & in the URL?
=========================
Yes. Both ways on FTP, download ways on HTTP. In general unix shells, the & letter is treated special and when used it
runs the specified command in the background. To safely send the & as a part
of a URL, you should qoute the entire URL by using single (') or double (")
quotes around it.
Is libcurl thread safe? An example that would invoke a remote CGI that uses &-letters could be:
=======================
Yes, as far as curl's own code goes. It does use system calls that often curl 'http://www.altavista.com/cgi-bin/query?text=yes&q=curl'
aren't thread safe in most environments, such as gethostbyname().
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
a URL specified to curl you must quote them.
An example that downloads two URLs (sequentially) would do:
curl '{curl,www}.haxx.se'
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
at the server, the HTTP protocol defines how the server should respond and
that means that headers and a "page" will be returned. That's simply how
HTTP works.
By using the --fail option you can tell curl explicitly to not get any data
if the HTTP return code doesn't say success.
4.5 Why do I get return code XXX from a HTTP server?
RFC2616 clearly explains the return codes. I'll make a short transcript
here. Go read the RFC for exact details:
4.5.1 "400 Bad Request"
The request could not be understood by the server due to malformed
syntax. The client SHOULD NOT repeat the request without modifications.
4.5.2 "401 Unauthorized"
The request requires user authentication.
4.5.3 "403 Forbidden"
The server understood the request, but is refusing to fulfill it.
Authorization will not help and the request SHOULD NOT be repeated.
4.5.4 "404 Not Found"
The server has not found anything matching the Request-URI. No indication
is given of whether the condition is temporary or permanent.
4.5.5 "405 Method Not Allowed"
The method specified in the Request-Line is not allowed for the resource
identified by the Request-URI. The response MUST include an Allow header
containing a list of valid methods for the requested resource.
4.6. Can you tell me what error code 142 means?
All error codes that are larger than the highest documented error code means
that curl has existed due to a timeout. There is currentl no nice way for
curl to abort from such a condition and that's why it gets this undocumented
error. This is planned to change in a future release.
4.7. How do I keep usernames and passwords secret in Curl command lines?
I see this problem as two parts:
The first part is to avoid having clear-text passwords in the command line
so that they don't appear in 'ps' outputs and similar. That is easily
avoided by using the "-K" option tho tell curl to read parameters from a
file or stdin to which you can pass the secret info.
To keep the passwords in your account secret from the rest of the world is
not a task that curl addresses. You could of course encrypt them somehow to
at least hide them from being read by human eyes, but that is not what
anyone would call security.
5. libcurl Issues
5.1. Is libcurl thread safe?
As version seven is slowly marching in as the libcurl version to use, we
have made a serious attempt to address all places in the code where we could
forsee problems for multi-threaded programs. If your system has them, curl
will attempt to use threadsafe functions instead of non-safe ones.
I am very interested in once and for all getting some kind of report or 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, README file from those who have used libcurl in a threaded environment,
since I haven't and I get this question more and more frequently! since I haven't and I get this question more and more frequently!
Why doesn't my posting using -F work? 6. License Issues
=====================================
You can't simply use -F or -d at your choice. The web server that will Curl and libcurl are released under the MPL, the Mozilla Public License. To
receive your post assumes one of the formats. If the form you're trying to get a really good answer to this or other licensing questions, you should
"fake" sets the type to 'multipart/form-data', than and only then you must study the MPL license and the license you are about to use and check for
use the -F type. In all the most common cases, you should use -d which then clashes yourself. This is a brief summary for the cases we get the most
causes a posting with the type 'application/x-www-form-urlencoded'. questions. (Parts of this section was enhanced by Bjorn Reese.)
Does curl support custom FTP commands? 6.1. I have a GPL program, can I use the libcurl library?
======================================
Yes it does, you can tell curl to perform optional commands both before No, unfortunately you cannot distribute the (lib)curl code with your code.
and/or after a file transfer. Study the -Q/--quote option. According to both the Free Software Foundation and the Mozilla
Organization, MPL and GPL are not compatible, because GPL requires of
other licenses that they do "not impose any further restrictions on the
recipients' exercise of the rights granted herein" [GPL paragraph 6] (One
could argue about which license that actually imposes restrictions, but
that'll be left for you to ponder about.)
Since curl is used for file transfers, you don't use curl to just perform However, you have two alternative options:
ftp commands without transfering anything. Therefore you must always specify
a URL to transfer to/from even when doing custom FTP commands.
Does curl work with other SSL libraries? 1) Nothing prevents you from distributing your program separately from
======================================== curl and libcurl, and request that the user receives it separately.
The incompability issues between MPL and GPL only applies to the
distribution.
Curl has been written to use OpenSSL, although I doubt there would be much 2) Add the following exception to your distribution (you must have the
problems using a different library. I just don't know any other free one and consent of all the copyright holders of the source code in your
that has limited my possibilities to develop against anything else. project in order to do this)
If anyone does "port" curl to use a commercial SSL library, I am of course As a special exception, you have permission to link this program
very interested in getting the patch! with the curl library and distribute executables, as long as you
follow the requirements of the GNU GPL in regard to all of the
software in the executable aside from curl.
configre doesn't find OpenSSL even when it is installed This exception must be added to your GPL covered source code files
======================================================= immediately after the notification mentioned in the appendix of GPL.
The wording was originally suggested by the Free Software Foundation
in relationship with the Qt library. We have changed the wording to
apply to curl.
Platforms: Solaris (native cc compiler) and HPUX (native cc compiler) 6.2. I have a closed-source program, can I use the libcurl library?
When configuring curl, I specify --with-ssl. OpenSSL is installed in Yes, libcurl does not put any restrictions on the program that uses the
/usr/local/ssl Configure reports SSL in /usr/local/ssl, but fails to find library. If you end up doing changes to the library, only those changes
CRYPTO_lock in -lcrypto must be made available, not the ones to your program.
Cause: The cc for this test places the -L/usr/local/ssl/lib AFTER -lcrypto, 6.3. I have a BSD licensed program, can I use the libcurl library?
so ld can't find the library. This is due to a bug in the GNU autoconf tool.
Workaround: Specifying "LDFLAGS=-L/usr/local/ssl/lib" in front of ./configure Yes, libcurl does not put any restrictions on the program that uses the
places the -L/usr/local/ssl/lib early enough in the command line to make library. If you end up doing changes to the library, only those changes
things work must be made available, not the ones to your program.
Submitted by: Bob Allison <allisonb@users.sourceforge.net> 6.4. I have a program that uses LGPL libraries, can I use libcurl?
Yes you can. LGPL libraries don't spread to other libraries the same way
GPL ones do.
However, when you read paragraph (3) of the LGPL license, you'll see that
anyone - at will - may at any time convert that LGPL program into GPL. And
GPL programs can't be distributed together with MPL programs, neither with
(lib)curl source code and not as a binary.
6.5. Can I modify curl/libcurl for my program and keep the changes secret?
No, you're not allowed to do that.
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.

View File

@@ -31,7 +31,7 @@ HTTP
- custom HTTP request - custom HTTP request
- cookie get/send - cookie get/send
- understands the netscape cookie file - understands the netscape cookie file
- custom headers (that can replace internally generated headers) - custom headers (that can replace/remove internally generated headers)
- custom user-agent string - custom user-agent string
- custom referer string - custom referer string
- range - range
@@ -57,7 +57,7 @@ FTP
- upload via http-proxy as HTTP PUT - upload via http-proxy as HTTP PUT
- download resume - download resume
- upload resume - upload resume
- QUOT commands (before and/or after the transfer) - custom ftp commands (before and/or after the transfer)
- simple "range" support - simple "range" support
- via http-proxy - via http-proxy

View File

@@ -19,15 +19,18 @@ Windows vs Unix
the Windows way. The four most notable details are: the Windows way. The four most notable details are:
1. Different function names for close(), read(), write() 1. Different function names for close(), read(), write()
2. Windows requires a couple of init calls 2. Windows requires a couple of init calls for the socket stuff
3. The file descriptors for network communication and file operations are 3. The file descriptors for network communication and file operations are
not easily interchangable as in unix not easily interchangable as in unix
4. When writing data to stdout, Windows makes end-of-lines the DOS way, thus 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 destroying binary data, although you do want that conversion if it is
text coming through... (sigh) text coming through... (sigh)
In curl, (1) and (2) are done with defines and macros, so that the source In curl, (1) is made with defines and macros, so that the source looks the
looks the same at all places except for the header file that defines them. 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. (3) is simply avoided by not trying any funny tricks on file descriptors.
@@ -44,19 +47,26 @@ Windows vs Unix
Library Library
======= =======
There is a few entry points to the library, namely each publicly defined As described elsewhere, libcurl is meant to get two different "layers" of
interface. At the present point only the high-level, the "easy", interface
has been fully implemented and thus documented. We assume the easy-interface
in this description, the low-level interface will be documented when fully
implemented.
There are plenty of entry points to the library, namely each publicly defined
function that libcurl offers to applications. All of those functions are function that libcurl offers to applications. All of those functions are
rather small and easy-to-follow, accept the one single and do-it-all named rather small and easy-to-follow. All the ones prefixed with 'curl_easy' are
curl_urlget() (entry point in lib/url.c). put in the lib/easy.c file.
curl_urlget() takes a variable amount of arguments, and they must all be curl_easy_setopt() takes a three arguments, where the option stuff must be
passed in pairs, the parameter-ID and the parameter-value. The list of passed in pairs, the parameter-ID and the parameter-value. The list of
arguments must be ended with a end-of-arguments parameter-ID. options is documented in the man page.
The function then continues to analyze the URL, get the different components curl_easy_perform() does a whole lot of things.
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 The function analyzes the URL, get the different components and connects to
names. 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.
When connected, the proper function is called. The functions are named after When connected, the proper function is called. The functions are named after
the protocols they handle. ftp(), http(), dict(), etc. They all reside in the protocols they handle. ftp(), http(), dict(), etc. They all reside in
@@ -70,12 +80,16 @@ Library
supplied clones in lib/mprintf.c. supplied clones in lib/mprintf.c.
While transfering, the progress functions in lib/progress.c are called at a While transfering, the progress functions in lib/progress.c are called at a
frequent interval. The speedcheck functions in lib/speedcheck.c are also used frequent interval (or at the user's choice, a specified callback might get
to verify that the transfer is as fast as required. called). The speedcheck functions in lib/speedcheck.c are also used to verify
that the transfer is as fast as required.
When the operation is done, the writeout() function in lib/writeout.c may be When the operation is done, the writeout() function in lib/writeout.c may be
called to report about the operation as specified previously in the arguments called to report about the operation as specified previously in the arguments
to curl_urlget(). to curl_easy_setopt().
When completed curl_easy_cleanup() should be called to free up used
resources.
HTTP(S) HTTP(S)
@@ -88,12 +102,16 @@ Library
(lib/cookie.c). (lib/cookie.c).
HTTPS uses in almost every means the same procedure as HTTP, with only two HTTPS uses in almost every means the same procedure as HTTP, with only two
exceptions: the connect procedure is different and the function used exceptions: the connect procedure is different and the function used to read
or write from the socket is different, although the latter fact is hidden in
the source by the use of curl_read() for reading and curl_write() for writing
data to the remote server.
FTP FTP
The if2ip() function can be used for getting the IP number of a specified The if2ip() function can be used for getting the IP number of a specified
network interface, and it resides in lib/if2ip.c network interface, and it resides in lib/if2ip.c. It is only used for the FTP
PORT command.
TELNET TELNET
@@ -113,11 +131,12 @@ Library
is found in lib/escape.c. is found in lib/escape.c.
While transfering data in Transfer() a few functions might get While transfering data in Transfer() a few functions might get
used. get_date() in lib/getdate.c is for HTTP date comparisons. used. curl_getdate() in lib/getdate.c is for HTTP date comparisons (and
more).
lib/getenv.c is for reading environment variables in a neat platform lib/getenv.c offers curl_getenv() which is for reading environment variables
independent way. That's used in the client, but also in lib/url.c when in a neat platform independent way. That's used in the client, but also in
checking the PROXY variables. lib/url.c when checking the PROXY variables.
lib/netrc.c keeps the .netrc parser lib/netrc.c keeps the .netrc parser
@@ -135,6 +154,7 @@ Client
functions used for the multiple-URL support. functions used for the multiple-URL support.
The client mostly mess around to setup its config struct properly, then it The client mostly mess around to setup its config struct properly, then it
calls the curl_urlget() function in the library and when it gets back control calls the curl_easy_*() functions of the library and when it gets back
it checks status and exits. control after the curl_easy_perform() it cleans up the library, checks status
and exits.

21
docs/Makefile.am Normal file
View File

@@ -0,0 +1,21 @@
#
# $Id$
#
AUTOMAKE_OPTIONS = foreign no-dependencies
man_MANS = \
curl.1 \
curl_easy_cleanup.3 \
curl_easy_init.3 \
curl_easy_perform.3 \
curl_easy_setopt.3 \
curl_formparse.3 \
curl_getdate.3 \
curl_getenv.3 \
curl_slist_append.3 \
curl_slist_free_all.3 \
curl_version.3
EXTRA_DIST = $(man_MANS)

View File

@@ -3,7 +3,7 @@ LATEST VERSION
You always find news about what's going on as well as the latest versions You always find news about what's going on as well as the latest versions
from the curl web pages, located at: from the curl web pages, located at:
http://curl.haxx.nu http://curl.haxx.se
SIMPLE USAGE SIMPLE USAGE
@@ -178,7 +178,7 @@ DETAILED INFORMATION
Store the HTTP headers in a separate file: Store the HTTP headers in a separate file:
curl --dump-header headers.txt curl.haxx.nu curl --dump-header headers.txt curl.haxx.se
Note that headers stored in a separate file can be very useful at a later Note that headers stored in a separate file can be very useful at a later
time if you want curl to use cookies sent by the server. More about that in time if you want curl to use cookies sent by the server. More about that in
@@ -534,6 +534,26 @@ HTTPS
Otherwise, curl will first attempt to use v3 and then v2. Otherwise, curl will first attempt to use v3 and then v2.
To use OpenSSL to convert your favourite browser's certificate into a PEM
formatted one that curl can use, do something like this (assuming netscape,
but IE is likely to work similarly):
You start with hitting the 'security' menu button in netscape.
Select 'certificates->yours' and then pick a certificate in the list
Press the 'export' button
enter your PIN code for the certs
select a proper place to save it
Run the 'openssl' application to convert the certificate. If you cd to the
openssl installation, you can do it like:
# ./apps/openssl pkcs12 -certfile [file you saved] -out [PEMfile]
RESUMING FILE TRANSFERS RESUMING FILE TRANSFERS
To continue a file transfer where it was previously aborted, curl supports To continue a file transfer where it was previously aborted, curl supports
@@ -656,7 +676,7 @@ NETRC
A very simple .netrc file could look something like: A very simple .netrc file could look something like:
machine curl.haxx.nu login iamdaniel password mysecret machine curl.haxx.se login iamdaniel password mysecret
CUSTOM OUTPUT CUSTOM OUTPUT

View File

@@ -31,7 +31,7 @@ The Easy Interface
When using the easy interface, you init your easy-session and get a handle, When using the easy interface, you init your easy-session and get a handle,
which you use as input to the following interface functions you use. which you use as input to the following interface functions you use.
You continue be setting all the options you want in the upcoming transfer, You continue by setting all the options you want in the upcoming transfer,
most important among them is the URL itself. You might want to set some most important among them is the URL itself. You might want to set some
callbacks as well that will be called from the library when data is available callbacks as well that will be called from the library when data is available
etc. etc.
@@ -39,13 +39,23 @@ The Easy Interface
When all is setup, you tell libcurl to perform the transfer. It will then do When all is setup, you tell libcurl to perform the transfer. It will then do
the entire operation and won't return until it is done or failed. the entire operation and won't return until it is done or failed.
After the performance is made, you cleanup the easy-session's handle and After the transfer has been made, you cleanup the easy-session's handle and
libcurl is entire off the hook! libcurl is entirely off the hook!
See the separate man pages for the libcurl functions for details:
curl_easy_init() curl_easy_init()
curl_easy_setopt() curl_easy_setopt()
curl_easy_perform() curl_easy_perform()
curl_easy_cleanup() curl_easy_cleanup()
While the above four functions are the main functions to use in the easy
interface, there is a series of helpful functions to use. They are:
curl_version() - displays the libcurl version
curl_getdate() - converts a date string to time_t
curl_getenv() - portable environment variable reader
curl_formparse() - helps building a HTTP form POST
curl_slist_append() - builds a linked list
curl_slist_free_all() - frees a whole curl_slist
Read the separate man pages for these functions for details!

19
docs/README.win32 Normal file
View File

@@ -0,0 +1,19 @@
_ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
| (__| |_| | _ <| |___
\___|\___/|_| \_\_____|
README.win32
Read the README file first.
Curl has been compiled, built and run on all sorts of Windows and win32
systems. While not being the main develop target, a fair share of curl users
are win32-based.
Some documentation in this archive will be tricky to read for Windows
people, as they come in unix-style man pages. You can either download a
freely available nroff binary for win32 (*pointers appriciated*), convert
the files into plain-text on your neighbor's unix machine or run over to the
curl web site and view them as plain HTML.

View File

@@ -6,10 +6,12 @@
This document has been introduced in order to let you find documents that This document has been introduced in order to let you find documents that
specify standards used by curl, software that extends curl and web pages with specify standards used by curl, software that extends curl, web pages with
"competing" utilities. "competing" utilities and information pages that describe some of the tools
that we use to build/compile/develop curl.
Standards Standards
---------
RFC 959 - Defines how FTP works RFC 959 - Defines how FTP works
@@ -42,38 +44,64 @@ Standards
RFC 2229 - "A Dictionary Server Protocol" RFC 2229 - "A Dictionary Server Protocol"
RFC 2255 - Newer LDAP URL syntax document.
RFC 2231 - "MIME Parameter Value and Encoded Word Extensions: RFC 2231 - "MIME Parameter Value and Encoded Word Extensions:
Character Sets, Languages, and Continuations" Character Sets, Languages, and Continuations"
RFC 2388 - "Returning Values from Forms: multipart/form-data" RFC 2388 - "Returning Values from Forms: multipart/form-data"
Use this as an addition to the 1867 Use this as an addition to the 1867
RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics" RFC 2396 - "Uniform Resource Identifiers: Generic Syntax and Semantics" This
This one obsoletes 1738, but since 1738 is often mentioned I've left it one obsoletes 1738, but since 1738 is often mentioned I've left
in this list. it in this list.
RFC 2428 - "FTP Extensions for IPv6 and NATs" RFC 2428 - "FTP Extensions for IPv6 and NATs"
This should be considered when introducing IPv6 awareness.
RFC 2616 - HTTP 1.1 RFC 2616 - HTTP 1.1, the latest
RFC 2617 - HTTP Authentication RFC 2617 - HTTP Authentication
Compilers RFC 2718 - "Guidelines for new URL Schemes"
MingW32 - http://www.xraylith.wisc.edu/~khan/software/gnu-win32/index.html RFC 2732 - "Format for Literal IPv6 Addresses in URL's"
Compilers
---------
MingW32 - http://www.mingw.org
gcc - http://www.gnu.org/software/gcc/gcc.html
Software Software
--------
OpenSSL - http://www.openssl.org OpenSSL - http://www.openssl.org
OpenLDAP - http://www.openldap.org OpenLDAP - http://www.openldap.org
zlib - http://www.cdrom.com/pub/infozip/zlib/ zlib - http://www.cdrom.com/pub/infozip/zlib/
Competitors Similar Tools
-------------
wget - http://www.gnu.org/software/wget/wget.html
wget - ftp://prep.ai.mit.edu/pub/gnu/
snarf - http://www.xach.com/snarf/ snarf - http://www.xach.com/snarf/
lynx - http://lynx.browser.org/ (well at least when -dump is used)
swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
fetch - ?
lynx - http://lynx.browser.org/ (well at least when -dump is used)
swebget - http://www.uni-hildesheim.de/~smol0075/swebget/
Related Software
----------------
ftpparse - http://cr.yp.to/ftpparse.html parses FTP LIST responses
autoconf - http://www.gnu.org/software/autoconf/autoconf.html
automake - http://www.gnu.org/software/automake/automake.html
bison - http://www.gnu.org/software/bison/bison.html
gzip - http://www.gnu.org/software/gzip/gzip.html
tar - http://www.gnu.org/software/tar/tar.html
libtool - http://www.gnu.org/software/libtool/libtool.html

View File

@@ -6,41 +6,27 @@
TODO TODO
For version 7. Stuff I palnned to have included in curl for version
seven. Let's do a serious attempt to include most of this.
Document the easy-interface completely
Make sure the low-level interface works. highlevel.c should basically be
possible to write using that interface.
Document the low-level interface
Add asynchronous name resolving, as this enables full timeout support for
fork() systems.
Make sure you can set the progress callback
Add libtool stuff
Move non-URL related functions that are used by both the lib and the curl
application to a separate "portability lib".
Add support for other languages than C (not important)
Improve the -K config file parser.
For the future For the future
Ok, this is what I wanna do with Curl. Please tell me what you think, and Ok, this is what I wanna do with Curl. Please tell me what you think, and
please don't hesitate to contribute and send me patches that improve this please don't hesitate to contribute and send me patches that improve this
product! (Yes, you may add things not mentioned here, these are just a product! (Yes, you may add things not mentioned here, these are just a
few teasers...) few teasers...)
* rtsp:// support -- "Real Time Streaming Protocol" * Make sure the low-level interface works. highlevel.c should basically be
possible to write using that interface. Document the low-level interface
RFC 2326 * Add asynchronous name resolving, as this enables full timeout support for
fork() systems.
* Move non-URL related functions that are used by both the lib and the curl
application to a separate "portability lib".
* Add support for other languages than C (not important)
* Improve the -K config file parser.
* rtsp:// support -- "Real Time Streaming Protocol" (RFC 2326)
* "Content-Encoding: compress/gzip/zlib" * "Content-Encoding: compress/gzip/zlib"
@@ -106,9 +92,6 @@ For the future
RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT RFC 2428 "FTP Extensions for IPv6 and NATs" will be interesting. PORT
should be replaced with EPRT for IPv6, and EPSV instead of PASV. should be replaced with EPRT for IPv6, and EPSV instead of PASV.
* An automatic RPM package maker
Please, write me a script that makes it. It'd make my day.
* SSL for more protocols, like SSL-FTP... * SSL for more protocols, like SSL-FTP...
(http://search.ietf.org/internet-drafts/draft-murray-auth-ftp-ssl-05.txt) (http://search.ietf.org/internet-drafts/draft-murray-auth-ftp-ssl-05.txt)
@@ -117,3 +100,5 @@ For the future
* Make curl capable of verifying the server's certificate when connecting * Make curl capable of verifying the server's certificate when connecting
with HTTPS://. with HTTPS://.
* Kerberos-FTP

345
docs/TheArtOfHttpScripting Normal file
View File

@@ -0,0 +1,345 @@
Author: Daniel Stenberg <daniel@haxx.se>
Date: August 7, 2000
Version: 0.2
The Art Of Scripting HTTP Requests Using Curl
=============================================
This document will assume that you're familiar with HTML and general
networking.
The possibility to write scripts is essential to make a good computer
system. Unix' capability to be extended by shell scripts and various tools to
run various automated commands and scripts is one reason why it has succeeded
so well.
The increasing amount of applications moving to the web has made "HTTP
Scripting" more frequently requested and wanted. To be able to automatically
extract information from the web, to fake users, to post or upload data to
web servers are all important tasks today.
Curl is a command line tool for doing all sorts of URL manipulations and
transfers, but this particular document will focus on how to use it when
doing HTTP requests for fun and profit. I'll assume that you know how to
invoke 'curl --help' or 'curl --manual' to get basic information about it.
Curl is not written to do everything for you. It makes the requests, it gets
the data, it sends data and it retrieves the information. You probably need
to glue everything together using some kind of script language or repeated
manual invokes.
1. The HTTP Protocol
HTTP is the protocol used to fetch data from web servers. It is a very simple
protocol that is built upon TCP/IP. The protocol also allow information to
get sent to the server from the client using a few different methods, as will
be shown here.
HTTP is plain ASCII text lines being sent by the client to a server to
request a particular action, and then the server replies a few text lines
before the actual requested content is sent to the client.
Using curl's option -v will display what kind of commands curl sends to the
server, as well as a few other informational texts. -v is the single most
useful option when it comes to debug or even understand the curl<->server
interaction.
2. URL
The Uniform Resource Locator format is how you specify the address of a
particular resource on the internet. You know these, you've seen URLs like
http://curl.haxx.se or https://yourbank.com a million times.
3. GET a page
The simplest and most common request/operation made using HTTP is to get a
URL. The URL could itself refer to a web page, an image or a file. The client
issues a GET request to the server and receives the document it asked for.
If you isse the command line
curl http://curl.haxx.se
you get a web page returned in your terminal window. The entire HTML document
that that URL holds.
All HTTP replies contain a set of headers that are normally hidden, use
curl's -i option to display them as well as the rest of the document. You can
also ask the remote server for ONLY the headers by using the -I option.
4. Forms
Forms are the general way a web site can present a HTML page with fields for
the user to enter data in, and then press some kind of 'OK' or 'submit'
button to get that data sent to the server. The server then typically uses
the posted data to decide how to act. Like using the entered words to search
in a database, or to add the info in a bug track system, display the entered
address on a map or using the info as a login-prompt verifying that the user
is allowed to see what it is about to see.
Of course there has to be some kind of program in the server end to receive
the data you send. You cannot just invent something out of the air.
4.1 GET
A GET-form uses the method GET, as specified in HTML like:
<form method="GET" action="junk.cgi">
<input type=text name="birthyear">
<input type=submit name=press value="OK">
</form>
In your favourite browser, this form will appear with a text box to fill in
and a press-button labeled "OK". If you fill in '1905' and press the OK
button, your browser will then create a new URL to get for you. The URL will
get "junk.cgi?birthyear=1905&press=OK" appended to the path part of the
previous URL.
If the original form was seen on the page "www.hotmail.com/when/birth.html",
the second page you'll get will become
"www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK".
Most search engines work this way.
To make curl do the GET form post for you, just enter the expected created
URL:
curl "www.hotmail.com/when/junk.cgi?birthyear=1905&press=OK"
4.2 POST
The GET method makes all input field names get displayed in the URL field of
your browser. That's generally a good thing when you want to be able to
bookmark that page with your given data, but it is an obvious disadvantage
if you entered secret information in one of the fields or if there are a
large amount of fields creating a very long and unreadable URL.
The HTTP protocol then offers the POST method. This way the client sends the
data separated from the URL and thus you won't see any of it in the URL
address field.
The form would look very similar to the previous one:
<form method="POST" action="junk.cgi">
<input type=text name="birthyear">
<input type=submit name=press value="OK">
</form>
And to use curl to post this form with the same data filled in as before, we
could do it like:
curl -d "birthyear=1905&press=OK" www.hotmail.com/when/junk.cgi
This kind of POST will use the Content-Type
application/x-www-form-urlencoded and is the most widly used POST kind.
4.3 FILE UPLOAD POST
Back in late 1995 they defined a new to post data over HTTP. It was
documented in the RFC 1867, why this method sometimes are refered to as
a rfc1867-posting.
This method is mainly designed to better support file uploads. A form that
allows a user to upload a file could be written like this in HTML:
<form method="POST" enctype='multipart/form-data' action="upload.cgi">
<input type=file name=upload>
<input type=submit name=press value="OK">
</form>
This clearly shows that the Content-Type about to be sent is
multipart/form-data.
To post to a form like this with curl, you enter a command line like:
curl -F upload=@localfilename -F press=OK [URL]
4.4 HIDDEN FIELDS
A very common way for HTML based application to pass state information
between pages is to add hidden fields to the forms. Hidden fields are
already filled in, they aren't displayed to the user and they get passed
along just as all the other fields.
A similar example form with one visible field, one hidden field and one
submit button could look like:
<form method="POST" action="foobar.cgi">
<input type=text name="birthyear">
<input type=text name="person" value="daniel">
<input type=submit name="press" value="OK">
</form>
To post this with curl, you won't have to think about if the fields are
hidden or not. To curl they're all the same:
curl -d "birthyear=1905&press=OK&person=daniel" [URL]
5. PUT
The perhaps best way to upload data to a HTTP server is to use PUT. Then
again, this of course requires that someone put a program or script on the
server end that knows how to receive a HTTP PUT stream.
Put a file to a HTTP server with curl:
curl -t uploadfile www.uploadhttp.com/receive.cgi
6. AUTHENTICATION
Authentication is the ability to tell the server your username and password
so that it can verify that you're allowed to do the request you're doing. The
basic authentication used in HTTP is *plain* *text* based, which means it
sends username and password only slightly obfuscated, but still fully
readable by anyone that sniffs on the network between you and the remote
server.
To tell curl to use a user and password for authentication:
curl -u name:password www.secrets.com
Sometimes your HTTP access is only available through the use of a HTTP
proxy. This seems to be especially common at various companies. A HTTP proxy
may require its own user and password to allow the client to get through to
the internet. To specify those with curl, run something like:
curl -U proxyuser:proxypassword curl.haxx.se
If you use any one these user+password options but leave out the password
part, curl will prompt for the password interactively.
Do note that when a program is run, its parameters are possible to see when
listing the running processes of the system. Thus, other users may be able to
watch your passwords if you pass them as plain command line options.
7. REFERER
A HTTP request has the ability to feature a 'referer' field, which can be
used to tell which URL that causes the client to get this particular
resource. Some programs/scripts check the referer field of requests to verify
that this wasn't arriving from an external site or unknown page. While this
is a stupid way to check something so easily forged, many scripts still do
it. Using curl, you can put anything you want in the referer-field and thus
more easily being able to fool the server into serving your request.
Use curl to set the referer field with:
curl -e http://curl.haxx.se daniel.haxx.se
8. USER AGENT
Very similar to the referer field, all HTTP requests may set the User-Agent
field. It names what user agent (client) that is being used. Many
applications use this information to decide how to display pages. Silly web
programmers try to make different pages for users of different browsers to
make them look the best possible for their particular browsers. They usually
also do different kinds of javascript, vbscript etc.
At times, you will see that getting a page with curl will not return the same
page that you see when getting the page with your browser. Then you know it
is time to set the User Agent field to fool the server into thinking you're
one of those browsers.
To make curl look like Internet Explorer on a Windows 2000 box:
curl -A "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL]
Or why not look like you're using Netscape 4.73 on a Linux (PIII) box:
curl -A "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]
9. REDIRECTS
When a resource is requested from a server, the reply from the server may
include a hint about where the browser should go next to find this page, or a
new page keeping newly generated output. The header that tells the browser
to redirect is Location:.
Curl does not follow Location: headers by default, but will simply display
such pages in the same manner it display all HTTP replies. It does however
feature an option that will make it attempt to follow the Location: pointers.
To tell curl to follow a Location:
curl -L www.sitethatredirects.com
If you use curl to POST to a site that immediately redirects you to another
page, you can safely use -L and -d/-F together. Curl will only use POST in
the first request, and then revert to GET in the following operations.
10. COOKIES
The way the web browsers do "client side state control" is by using
cookies. Cookies are just names with associated contents. The cookies are
sent to the client by the server. The server tells the client for what path
and host name it wants the cookie sent back, and it also sends an expiration
date and a few more properties.
When a client communicates with a server with a name and path as previously
specified in a received cookie, the client sends back the cookies and their
contents to the server, unless of course they are expired.
Many applications and server use this method to connect a series of request
into a single logical session. To be able to use curl in such occations, we
must be able to record and send back cookies in the way that the web
application expects them. The same way browsers deal with them.
The simplest way to send a few cookies to the server when getting a page with
curl is to add them on the command line like:
curl -b "name=Daniel" www.cookiesite.com
Cookies are sent as common HTTP headers. This is practical as it allows curl
to record cookies simply by recording headers. Record cookies with curl by
using the -D option like:
curl -D headers_and_cookies www.cookiesite.com
Curl has a full blown cookie parsing engine built-in that comes to use if you
want to reconnect to a server and use cookies that were stored from a
previous connection (or handicrafted manually to fool the server into
believing you had a previous connection). To use previously stored cookies,
you run curl like:
curl -b stored_cookies_in_file www.cookiesite.com
11. HTTPS
There are a few ways to do secure HTTP transfers. The by far most common
protocol for doing this is what is generally known as HTTPS, HTTP over
SSL. SSL encrypts all the data that is send and received over the network and
thus makes it harder for attackers to spy on sensitive information.
SSL (or TLS as the latest version of the standard is called) offers a
truckload of advanced features to allow all those encryptions and key
infrastructure mechanisms ecnrypted HTTP requires.
Curl supports enscrypted fetches thanks to the freely available OpenSSL
libraries. To get a pafe from a https server, simply run curl like:
curl https://that.secure.server.com
11.1 CERTIFICATES
In the HTTPS world, you use certificates to validate that you are the one
you you claim to be, as an addition to normal passwords. Curl supports
client-side certificates. All certificates are locked with a PIN-code, why
you need to enter the unlock-code before the certificate can be used by
curl. The PIN-code can be specified on the command line or if not, entered
interactively when curl queries for it. Use a certificate with curl on a
https server like:
curl -E mycert.pem https://that.secure.server.com
12. REFERENCES
RFC 2616 is a must to read if you want in-depth understanding of the HTTP
protocol.
RFC 2396 explains the URL syntax
RFC 2109 defines how cookies are supposed to work.
http://www.openssl.org is the home of the OpenSSL project
http://curl.haxx.se is the home of the cURL project

View File

@@ -2,7 +2,7 @@
.\" nroff -man curl.1 .\" nroff -man curl.1
.\" Written by Daniel Stenberg .\" Written by Daniel Stenberg
.\" .\"
.TH curl 1 "22 May 2000" "Curl 7.0" "Curl Manual" .TH curl 1 "24 August 2000" "Curl 7.2" "Curl Manual"
.SH NAME .SH NAME
curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or curl \- get a URL with FTP, TELNET, LDAP, GOPHER, DICT, FILE, HTTP or
HTTPS syntax. HTTPS syntax.
@@ -67,10 +67,10 @@ format.
that the file specified with -b/--cookie is only used as input. No cookies that the file specified with -b/--cookie is only used as input. No cookies
will be stored in the file. To store cookies, save the HTTP headers to a file will be stored in the file. To store cookies, save the HTTP headers to a file
using -D/--dump-header! using -D/--dump-header!
.IP "-B/--ftp-ascii" .IP "-B/--use-ascii"
(FTP/LDAP)
Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can
also be enforced by using an URL that ends with ";type=A". also be enforced by using an URL that ends with ";type=A". This option causes
data sent to stdout to be in text mode for win32 systems.
.IP "-c/--continue" .IP "-c/--continue"
Continue/Resume a previous file transfer. This instructs curl to Continue/Resume a previous file transfer. This instructs curl to
continue appending data on the file where it was previously left, continue appending data on the file where it was previously left,
@@ -88,16 +88,26 @@ If used with uploads, the ftp server command SIZE will not be used by
curl. Upload resume is for FTP only. curl. Upload resume is for FTP only.
HTTP resume is only possible with HTTP/1.1 or later servers. HTTP resume is only possible with HTTP/1.1 or later servers.
.IP "-d/--data <data>" .IP "-d/--data <data>"
(HTTP) (HTTP) Sends the specified data in a POST request to the HTTP server. Note
Sends the specified data in a POST request to the HTTP server. Note that the data is sent exactly as specified with no extra processing (with all
that the data is sent exactly as specified with no extra processing. newlines cut off). The data is expected to be "url-encoded". This will cause
The data is expected to be "url-encoded". This will cause curl to curl to pass the data to the server using the content-type
pass the data to the server using the content-type
application/x-www-form-urlencoded. Compare to -F. application/x-www-form-urlencoded. Compare to -F.
If you start the data with the letter @, the rest should be a file name to If you start the data with the letter @, the rest should be a file name to
read the data from, or - if you want curl to read the data from stdin. read the data from, or - if you want curl to read the data from stdin.
The contents of the file must already be url-encoded. The contents of the file must already be url-encoded.
To post data purely binary, you should instead use the --data-binary option.
-d/--data is the same as --data-ascii.
.IP "--data-ascii <data>"
(HTTP) This is an alias for the -d/--data option.
.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
want to post a binary file without the strip-newlines feature of the
--data-ascii option, this is for you.
.IP "-D/--dump-header <file>" .IP "-D/--dump-header <file>"
(HTTP/FTP) (HTTP/FTP)
Write the HTTP headers to this file. Write the FTP file info to this Write the HTTP headers to this file. Write the FTP file info to this
@@ -107,10 +117,12 @@ This option is handy to use when you want to store the cookies that a HTTP
site sends to you. The cookies could then be read in a second curl invoke by site sends to you. The cookies could then be read in a second curl invoke by
using the -b/--cookie option! using the -b/--cookie option!
.IP "-e/--referer <URL>" .IP "-e/--referer <URL>"
(HTTP) (HTTP) Sends the "Referer Page" information to the HTTP server. This can also
Sends the "Referer Page" information to the HTTP server. Some badly be set with the -H/--header flag of course. When used with
done CGIs fail if it's not set. This can also be set with the -H/--header .I -L/--location
flag of course. you can append ";auto" to the referer URL to make curl automatically set the
previous URL when it follows a Location: header. The ";auto" string can be
used alone, even if you don't set an initial referer.
.IP "-E/--cert <certificate[:password]>" .IP "-E/--cert <certificate[:password]>"
(HTTPS) (HTTPS)
Tells curl to use the specified certificate file when getting a file Tells curl to use the specified certificate file when getting a file
@@ -127,30 +139,35 @@ document, it returns a HTML document stating so (which often also
describes why and more). This flag will prevent curl from describes why and more). This flag will prevent curl from
outputting that and fail silently instead. outputting that and fail silently instead.
.IP "-F/--form <name=content>" .IP "-F/--form <name=content>"
(HTTP) (HTTP) This lets curl emulate a filled in form in which a user has pressed the
This lets curl emulate a filled in form in which a user has pressed submit button. This causes curl to POST data using the content-type
the submit button. This causes curl to POST data using the multipart/form-data according to RFC1867. This enables uploading of binary
content-type multipart/form-data according to RFC1867. This enables files etc. To force the 'content' part to be be a file, prefix the file name
uploading of binary files etc. To force the 'content' part to be with an @ sign. To just get the content part from a file, prefix the file name
read from a file, prefix the file name with an @ sign. Example, to with the letter <. The difference between @ and < is then that @ makes a file
send your password file to the server, where 'password' is the get attached in the post as a file upload, while the < makes a text field and
name of the form-field to which /etc/passwd will be the input: just get the contents for that text field from a file.
Example, to send your password file to the server, where
'password' is the name of the form-field to which /etc/passwd will be the
input:
.B curl .B curl
-F password=@/etc/passwd www.mypasswords.com -F password=@/etc/passwd www.mypasswords.com
To read the file's content from stdin insted of a file, use - where the file To read the file's content from stdin insted of a file, use - where the file
name should've been. name should've been. This goes for both @ and < constructs.
.IP "-h/--help" .IP "-h/--help"
Usage help. Usage help.
.IP "-H/--header <header>" .IP "-H/--header <header>"
(HTTP) (HTTP) Extra header to use when getting a web page. You may specify any number
Extra header to use when getting a web page. You may specify any number of of extra headers. Note that if you should add a custom header that has the
extra headers. Note that if you should add a custom header that has the same same name as one of the internal ones curl would use, your externally set
name as one of the internal ones curl would use, your externally set header header will be used instead of the internal one. This allows you to make even
will be used instead of the internal one. This allows you to make even
trickier stuff than curl would normally do. You should not replace internally trickier stuff than curl would normally do. You should not replace internally
set headers without knowing perfectly well what you're doing. set headers without knowing perfectly well what you're doing. Replacing an
internal header with one without content on the right side of the colon will
prevent that header from appearing.
.IP "-i/--include" .IP "-i/--include"
(HTTP) (HTTP)
Include the HTTP-header in the output. The HTTP-header includes things Include the HTTP-header in the output. The HTTP-header includes things
@@ -175,16 +192,16 @@ Especially useful if you want to machine-parse the contents of an FTP
directory since the normal directory view doesn't use a standard look directory since the normal directory view doesn't use a standard look
or format. or format.
.IP "-L/--location" .IP "-L/--location"
(HTTP/HTTPS) (HTTP/HTTPS) If the server reports that the requested page has a different
If the server reports that the requested page has a different location location (indicated with the header line Location:) this flag will let curl
(indicated with the header line Location:) this flag will let curl attempt to reattempt the get on the new place. If used together with -i or -I,
attempt to reattempt the get on the new place. If used together with headers from all requested pages will be shown. If this flag is used when
-i or -I, headers from all requested pages will be shown. making a HTTP POST, curl will automatically switch to GET after the initial
POST has been done.
.IP "-m/--max-time <seconds>" .IP "-m/--max-time <seconds>"
Maximum time in seconds that you allow the whole operation to take. Maximum time in seconds that you allow the whole operation to take. This is
This is useful for preventing your batch jobs from hanging for hours useful for preventing your batch jobs from hanging for hours due to slow
due to slow networks or links going down. networks or links going down. This doesn't work fully in win32 systems.
This doesn't work properly in win32 systems.
.IP "-M/--manual" .IP "-M/--manual"
Manual. Display the huge help text. Manual. Display the huge help text.
.IP "-n/--netrc" .IP "-n/--netrc"
@@ -193,7 +210,7 @@ Makes curl scan the
file in the user's home directory for login name and password. This is file in the user's home directory for login name and password. This is
typically used for ftp on unix. If used with http, curl will enable user typically used for ftp on unix. If used with http, curl will enable user
authentication. See authentication. See
.BR netrc(5) .BR netrc(4)
for details on the file format. Curl will not complain if that file for details on the file format. Curl will not complain if that file
hasn't the right permissions (it should not be world nor group hasn't the right permissions (it should not be world nor group
readable). The environment variable "HOME" is used to find the home readable). The environment variable "HOME" is used to find the home
@@ -409,7 +426,9 @@ date, or one that has been modified before that time. The date expression can
be all sorts of date strings or if it doesn't match any internal ones, it be all sorts of date strings or if it doesn't match any internal ones, it
tries to get the time from a given file name instead! See the tries to get the time from a given file name instead! See the
.BR "GNU date(1)" .BR "GNU date(1)"
man page for date expression details. or
.BR "curl_getdate(3)"
man pages for date expression details.
Start the date expression with a dash (-) to make it request for a document Start the date expression with a dash (-) to make it request for a document
that is older than the given date/time, default is a document that is newer that is older than the given date/time, default is a document that is newer
@@ -546,18 +565,18 @@ There will appear more error codes here in future releases. The existing ones
are meant to never change. are meant to never change.
.SH BUGS .SH BUGS
If you do find any (or have other suggestions), mail Daniel Stenberg If you do find any (or have other suggestions), mail Daniel Stenberg
<Daniel.Stenberg@haxx.nu>. <Daniel.Stenberg@haxx.se>.
.SH AUTHORS / CONTRIBUTORS .SH AUTHORS / CONTRIBUTORS
- Daniel Stenberg <Daniel.Stenberg@haxx.nu> - Daniel Stenberg <Daniel.Stenberg@haxx.se>
- Rafael Sagula <sagula@inf.ufrgs.br> - Rafael Sagula <sagula@inf.ufrgs.br>
- Sampo Kellomaki <sampo@iki.fi> - Sampo Kellomaki <sampo@iki.fi>
- Linas Vepstas <linas@linas.org> - Linas Vepstas <linas@linas.org>
- Bjorn Reese <breese@mail1.stofanet.dk> - Bjorn Reese <breese@mail1.stofanet.dk>
- Johan Anderson <johan@homemail.com> - Johan Anderson <johan@homemail.com>
- Kjell Ericson <Kjell.Ericson@haxx,nu> - Kjell Ericson <Kjell.Ericson@haxx.se>
- Troy Engel <tengel@sonic.net> - Troy Engel <tengel@sonic.net>
- Ryan Nelson <ryan@inch.com> - Ryan Nelson <ryan@inch.com>
- Bjorn Stenberg <Bjorn.Stenberg@haxx.nu> - Bj<EFBFBD>rn Stenberg <Bjorn.Stenberg@haxx.se>
- Angus Mackay <amackay@gus.ml.org> - Angus Mackay <amackay@gus.ml.org>
- Eric Young <eay@cryptsoft.com> - Eric Young <eay@cryptsoft.com>
- Simon Dick <simond@totally.irrelevant.org> - Simon Dick <simond@totally.irrelevant.org>
@@ -575,9 +594,9 @@ If you do find any (or have other suggestions), mail Daniel Stenberg
- Ralph Beckmann <rabe@uni-paderborn.de> - Ralph Beckmann <rabe@uni-paderborn.de>
- T. Yamada <tai@imasy.or.jp> - T. Yamada <tai@imasy.or.jp>
- Lars J. Aas <larsa@sim.no> - Lars J. Aas <larsa@sim.no>
- J<>rn Hartroth <Joern.Hartroth@telekom.de> - J<>rn Hartroth <Joern.Hartroth@computer.org>
- Matthew Clarke <clamat@van.maves.ca> - Matthew Clarke <clamat@van.maves.ca>
- Linus Nielsen <Linus.Nielsen@haxx.nu> - Linus Nielsen <Linus.Nielsen@haxx.se>
- Felix von Leitner <felix@convergence.de> - Felix von Leitner <felix@convergence.de>
- Dan Zitter <dzitter@zitter.net> - Dan Zitter <dzitter@zitter.net>
- Jongki Suwandi <Jongki.Suwandi@eng.sun.com> - Jongki Suwandi <Jongki.Suwandi@eng.sun.com>
@@ -591,9 +610,15 @@ If you do find any (or have other suggestions), mail Daniel Stenberg
- Paul Marquis <pmarquis@iname.com> - Paul Marquis <pmarquis@iname.com>
- David LeBlanc <dleblanc@qnx.com> - David LeBlanc <dleblanc@qnx.com>
- Rich Gray at Plus Technologies - Rich Gray at Plus Technologies
- Luong Dinh Dung <u8luong@lhsystems.hu>
- Torsten Foertsch <torsten.foertsch@gmx.net>
- Kristian K<>hntopp <kris@koehntopp.de>
- Fred Noz <FNoz@siac.com>
- Caolan McNamara <caolan@csn.ul.ie>
- Albert Chin-A-Young <china@thewrittenword.com>
.SH WWW .SH WWW
http://curl.haxx.nu http://curl.haxx.se
.SH FTP .SH FTP
ftp://ftp.sunet.se/pub/www/utilities/curl/ ftp://ftp.sunet.se/pub/www/utilities/curl/
.SH "SEE ALSO" .SH "SEE ALSO"

View File

@@ -1,6 +1,6 @@
.\" You can view this file with: .\" You can view this file with:
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by Daniel.Stenberg@haxx.nu .\" Written by daniel@haxx.se
.\" .\"
.TH curl_easy_cleanup 3 "22 May 2000" "Curl 7.0" "libcurl Manual" .TH curl_easy_cleanup 3 "22 May 2000" "Curl 7.0" "libcurl Manual"
.SH NAME .SH NAME

View File

@@ -1,6 +1,6 @@
.\" You can view this file with: .\" You can view this file with:
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by Daniel.Stenberg@haxx.nu .\" Written by daniel@haxx.se
.\" .\"
.TH curl_easy_init 3 "22 May 2000" "Curl 7.0" "libcurl Manual" .TH curl_easy_init 3 "22 May 2000" "Curl 7.0" "libcurl Manual"
.SH NAME .SH NAME

View File

@@ -1,6 +1,6 @@
.\" You can view this file with: .\" You can view this file with:
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by Daniel.Stenberg@haxx.nu .\" Written by daniel@haxx.se
.\" .\"
.TH curl_easy_perform 3 "26 May 2000" "Curl 7.0" "libcurl Manual" .TH curl_easy_perform 3 "26 May 2000" "Curl 7.0" "libcurl Manual"
.SH NAME .SH NAME

View File

@@ -1,8 +1,8 @@
.\" You can view this file with: .\" You can view this file with:
.\" nroff -man [file] .\" nroff -man [file]
.\" Written by Daniel.Stenberg@haxx.nu .\" Written by daniel@haxx.se
.\" .\"
.TH curl_easy_setopt 3 "22 May 2000" "Curl 7.0" "libcurl Manual" .TH curl_easy_setopt 3 "24 August 2000" "Curl 7.2" "libcurl Manual"
.SH NAME .SH NAME
curl_easy_setopt - Set curl easy-session options curl_easy_setopt - Set curl easy-session options
.SH SYNOPSIS .SH SYNOPSIS
@@ -19,6 +19,8 @@ options are set with the
followed by a parameter. That parameter can be a long, a function pointer or followed by a parameter. That parameter can be a long, a function pointer or
an object pointer, all depending on what the option in question expects. Read an object pointer, all depending on what the option in question expects. Read
this manual carefully as bad input values may cause libcurl to behave badly! this manual carefully as bad input values may cause libcurl to behave badly!
You can only set one option in each function call. A typical application uses
many calls in the setup phase.
The The
.I "handle" .I "handle"
@@ -26,6 +28,7 @@ is the return code from the
.I "curl_easy_init" .I "curl_easy_init"
call. call.
.SH OPTIONS .SH OPTIONS
These options are in a bit of random order, but you'll figure it out!
.TP 0.8i .TP 0.8i
.B CURLOPT_FILE .B CURLOPT_FILE
Data pointer to pass instead of FILE * to the file write function. Note that Data pointer to pass instead of FILE * to the file write function. Note that
@@ -76,7 +79,13 @@ terminated string. NOTE: this option is currently required!
.B CURLOPT_PROXY .B CURLOPT_PROXY
If you need libcurl to use a http proxy to access the outside world, set the If you need libcurl to use a http proxy to access the outside world, set the
proxy string with this option. The parameter should be a char * to a zero proxy string with this option. The parameter should be a char * to a zero
terminated string. terminated string. To specify port number in this string, append":[port]" to
the end of the host name. The proxy string may be prefixed with
"[protocol]://" since any such prefix will be ignored.
.TP
.B CURLOPT_PROXYPORT
Set this long with this option to set the proxy port to use unless it is
specified in the proxy string CURLOPT_PROXY.
.TP .TP
.B CURLOPT_VERBOSE .B CURLOPT_VERBOSE
Set the parameter to non-zero to get the library to display a lot of verbose Set the parameter to non-zero to get the library to display a lot of verbose
@@ -110,7 +119,7 @@ CURLOPT_INFILE and CURLOPT_INFILESIZE are also interesting for uploads.
A non-zero parameter tells the library to do a regular HTTP post. This is a A non-zero parameter tells the library to do a regular HTTP post. This is a
normal application/x-www-form-urlencoded kind, which is the most commonly used normal application/x-www-form-urlencoded kind, which is the most commonly used
one by HTML forms. See the CURLOPT_POSTFIELDS option for how to specify the one by HTML forms. See the CURLOPT_POSTFIELDS option for how to specify the
data to post. data to post and CURLOPT_POSTFIELDSIZE in how to set the data size.
.TP .TP
.B CURLOPT_FTPLISTONLY .B CURLOPT_FTPLISTONLY
A non-zero parameter tells the library to just list the names of an ftp A non-zero parameter tells the library to just list the names of an ftp
@@ -136,11 +145,13 @@ server sends as part of a HTTP header. NOTE that this means that the library
will resend the same request on the new location and follow new Location: will resend the same request on the new location and follow new Location:
headers all the way until no more such headers are returned. headers all the way until no more such headers are returned.
.TP .TP
.B CURLOPT_FTPASCII .B CURLOPT_TRANSFERTEXT
A non-zero parameter tells the library to use ASCII mode for ftp transfers, A non-zero parameter tells the library to use ASCII mode for ftp transfers,
instead of the default binary transfer. This will only be useable when instead of the default binary transfer. For LDAP transfers it gets the data in
transfering text data between system with different views on certain plain text instead of HTML and for win32 systems it does not set the stdout to
characters, such as newlines or similar. binary mode. This option can be useable when transfering text data between
system with different views on certain characters, such as newlines or
similar.
.TP .TP
.B CURLOPT_PUT .B CURLOPT_PUT
A non-zero parameter tells the library to use HTTP PUT a file. The file to put A non-zero parameter tells the library to use HTTP PUT a file. The file to put
@@ -179,6 +190,12 @@ few minutes risk aborting perfectly normal operations.
Pass a char * as parameter, which should be the full data to post in a HTTP Pass a char * as parameter, which should be the full data to post in a HTTP
post operation. See also the CURLOPT_POST. post operation. See also the CURLOPT_POST.
.TP .TP
.B CURLOPT_POSTFIELDSIZE
If you want to post data to the server without letting libcurl do a strlen()
to measure the data size, this option must be used. Also, when this option is
used, you can post fully binary data which otherwise is likely to fail. If
this size is set to zero, the library will use strlen() to get the data size.
.TP
.B CURLOPT_REFERER .B CURLOPT_REFERER
Pass a pointer to a zero terminated string as parameter. It will be used to Pass a pointer to a zero terminated string as parameter. It will be used to
set the referer: header in the http request sent to the remote server. This set the referer: header in the http request sent to the remote server. This
@@ -218,12 +235,20 @@ set a cookie in the http request. The format of the string should be
.B CURLOPT_HTTPHEADER .B CURLOPT_HTTPHEADER
Pass a pointer to a linked list of HTTP headers to pass to the server in your Pass a pointer to a linked list of HTTP headers to pass to the server in your
HTTP request. The linked list should be a fully valid list of 'struct HTTP request. The linked list should be a fully valid list of 'struct
HttpHeader' structs properly filled in. TBD! curl_slist' structs properly filled in. Use
.I curl_slist_append(3)
to create the list and
.I curl_slist_free_all(3)
to clean up an entire list.
.TP .TP
.B CURLOPT_HTTPPOST .B CURLOPT_HTTPPOST
Pass a pointer to a linked list of HTTP post data to pass to the server in Tells libcurl you want a multipart/formdata HTTP POST to be made and you
your http request. The linked list should be a fully valid list of 'struct instruct what data to pass on to the server. Pass a pointer to a linked list
HttpPost' structs properly filled in. TBD! of HTTP post structs as parameter. The linked list should be a fully valid
list of 'struct HttpPost' structs properly filled in. The best and most
elegant way to do this, is to use
.I curl_formparse(3)
as documented.
.TP .TP
.B CURLOPT_SSLCERT .B CURLOPT_SSLCERT
Pass a pointer to a zero terminated string as parameter. The string should be Pass a pointer to a zero terminated string as parameter. The string should be
@@ -240,12 +265,17 @@ TBD.
.B CURLOPT_QUOTE .B CURLOPT_QUOTE
Pass a pointer to a linked list of FTP commands to pass to the server prior to Pass a pointer to a linked list of FTP commands to pass to the server prior to
your ftp request. The linked list should be a fully valid list of 'struct your ftp request. The linked list should be a fully valid list of 'struct
curl_slist' structs properly filled in. TBD! curl_slist' structs properly filled in. Use
.I curl_slist_append(3)
to append strings (commands) to the list, and clear the entire list afterwards
with
.I curl_slist_free_all(3)
.TP .TP
.B CURLOPT_POSTQUOTE .B CURLOPT_POSTQUOTE
Pass a pointer to a linked list of FTP commands to pass to the server after Pass a pointer to a linked list of FTP commands to pass to the server after
your ftp transfer request. The linked list should be a fully valid list of your ftp transfer request. The linked list should be a fully valid list of
'struct curl_slist' structs properly filled in. TBD! struct curl_slist structs properly filled in as described for
.I "CURLOPT_QUOTE"
.TP .TP
.B CURLOPT_WRITEHEADER .B CURLOPT_WRITEHEADER
Pass a FILE * to be used to write the header part of the received data to. Pass a FILE * to be used to write the header part of the received data to.
@@ -280,15 +310,28 @@ your server supports the command first.
Pass a FILE * as parameter. This is the stream to use instead of stderr Pass a FILE * as parameter. This is the stream to use instead of stderr
internally when reporting errors. internally when reporting errors.
.TP .TP
.B CURLOPT_PROGRESSMODE
This is currently unsupported, and is likely to be removed in future
versions. TBD
.TP
.B CURLOPT_WRITEINFO .B CURLOPT_WRITEINFO
Pass a pointer to a zero terminated string as parameter. It will be used to Pass a pointer to a zero terminated string as parameter. It will be used to
report information after a successful request. This string may contain report information after a successful request. This string may contain
variables that will be substituted by their contents when output. Described variables that will be substituted by their contents when output. Described
elsewhere. elsewhere.
.TP
.B CURLOPT_PROGRESSFUNCTION
Function pointer that should match the
.BI curl_progress_callback
prototype found in
.I <curl/curl.h>
This function gets called by libcurl instead of its internal
equivalent. Unknown/unused argument values will be set to zero (like if you
only download data, the upload size will remain 0). Returning a non-zero value
from this callback will cause libcurl to abort the transfer and return
CURLE_ABORTED_BY_CALLBACK.
.TP
.B CURLOPT_PROGRESSDATA
Pass a pointer that will be untouched by libcurl and passed as the first
argument in the progress callback set with
.I CURLOPT_PROGRESSFUNCTION
.
.PP .PP
.SH RETURN VALUE .SH RETURN VALUE
0 means the option was set properly, non-zero means an error as 0 means the option was set properly, non-zero means an error as

62
docs/curl_formparse.3 Normal file
View File

@@ -0,0 +1,62 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_formparse 3 "6 June 2000" "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 "struct HttpPost ** "lastitem ");"
.ad
.SH DESCRIPTION
curl_formparse() is used to append sections when building a multipart/formdata
HTTP POST. Append one section at a time until you've added all the sections
you want included and then you pass the
.I firstitem
pointer as parameter to CURLOPT_HTTPPOST.
.I lastitem
is set after each call and on repeated invokes it should be left as set to
allow repeated invokes to find the end of the list in a faster way.
.I string
must be a zero terminated string following the following syntax.
.SH "FORM PARSE STRINGS"
The
.I string
parameter must be using one of the following patterns. Note that the []
letters should not be included in the real-life string.
.TP 0.8i
.B [name]=[contents]
Add a form field named 'name' with the contents 'contents'. This is the
typcial contents of the HTML tag <input type=text>.
.TP
.B [name]=@[filename]
Add a form field named 'name' with the contents as read from the local file
named 'filename'. This is the typcial contents of the HTML tag <input
type=file>.
.TP
.B [name]=@[filename1,filename2,...]
Add a form field named 'name' with the contents as read from the local files
named 'filename1' and 'filename2'. This is identical to the upper, except that
you get the contents of several files in one section.
.TP
.B [name]=@[filename];[content-type]
Whenever you specify a file to read from, you can optionally specify the
content-type as well. The content-type is passed to the server together with
the contents of the file. curl_formparse() will guess content-type for a
number of well-known extensions and otherwise it will set it to binary. You
can override the internal decision by using this option.
.TP
.B [name]=@[filename1,filename2,...];[content-type]
When you specify several files to read the contents from, you can set the
content-type for all of them in the same way as with a single file.
.PP
.SH RETURN VALUE
Returns non-zero if an error occurs.
.SH "SEE ALSO"
.BR curl_easy_setopt "(3) "
.SH BUGS
Surely there are some, you tell me!

80
docs/curl_getdate.3 Normal file
View File

@@ -0,0 +1,80 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_getdate 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_getdate - Convert an date in a ASCII string to number of seconds since
January 1, 1970
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "time_t curl_getdate(char *" datestring ", time_t *"now" );
.ad
.SH DESCRIPTION
This function returns the number of seconds since January 1st 1970, for the
date and time that the
.I datestring
parameter specifies. The
.I now
parameter is there and should hold the current time to allow the datestring to
specify relative dates/times. Read further in the date string parser section
below.
.SH PARSING DATES AND TIMES
A "date" is a string, possibly empty, containing many items separated by
whitespace. The whitespace may be omitted when no ambiguity arises. The
empty string means the beginning of today (i.e., midnight). Order of the
items is immaterial. A date string may contain many flavors of items:
.TP 0.8i
.B calendar date items
This can be specified in a number of different ways. Including 1970-09-17, 70-9-17, 70-09-17, 9/17/72, 24 September 1972, 24 Sept 72, 24 Sep 72, Sep 24, 1972, 24-sep-72, 24sep72.
The year can also be omitted, for example: 9/17 or "sep 17".
.TP
.B time of the day items
This string specifies the time on a given day. Syntax supported includes:
18:19:0, 18:19, 6:19pm, 18:19-0500 (for specifying the time zone as well).
.TP
.B time zone items
Specifies international time zone. There are a few acronyms supported, but in
general you should instead use the specific realtive time compared to
UTC. Supported formats include: -1200, MST, +0100.
.TP
.B day of the week items
Specifies a day of the week. If this is mentioned alone it means that day of
the week in the future.
Days of the week may be spelled out in full: `Sunday', `Monday', etc or they
may be abbreviated to their first three letters, optionally followed by a
period. The special abbreviations `Tues' for `Tuesday', `Wednes' for
`Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed.
A number may precede a day of the week item to move forward supplementary
weeks. It is best used in expression like `third monday'. In this context,
`last DAY' or `next DAY' is also acceptable; they move one week before or
after the day that DAY by itself would represent.
.TP
.B relative items
A relative item adjusts a date (or the current date if none) forward or
backward. Example syntax includes: "1 year", "1 year ago", "2 days", "4
weeks".
The string `tomorrow' is worth one day in the future (equivalent to `day'),
the string `yesterday' is worth one day in the past (equivalent to `day ago').
.TP
.B pure numbers
If the decimal number is of the form YYYYMMDD and no other calendar date item
appears before it in the date string, then YYYY is read as the year, MM as the
month number and DD as the day of the month, for the specified calendar date.
.PP
.SH RETURN VALUE
This function returns zero when it fails to parse the date string. Otherwise
it returns the number of seconds as described.
.SH AUTHORS
Originally written by Steven M. Bellovin <smb@research.att.com> while at the
University of North Carolina at Chapel Hill. Later tweaked by a couple of
people on Usenet. Completely overhauled by Rich $alz <rsalz@bbn.com> and Jim
Berets <jberets@bbn.com> in August, 1990.
.SH "SEE ALSO"
.BR
.SH BUGS
Surely there are some, you tell me!

32
docs/curl_getenv.3 Normal file
View File

@@ -0,0 +1,32 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_getenv 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_getenv - return value for environment name
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "char *curl_getenv(char *" name ");
.ad
.SH DESCRIPTION
curl_getenv() is a portable wrapper for the getenv() function, meant to
emulate its behaviour and provide an identical interface for all operating
systems libcurl builds on (including win32).
.SH RETURN VALUE
If successful, curl_getenv() returns a pointer to the value of the specified
environment. The memory it refers to is malloc()ed why the application must
free() this when the data has completed to serve its purpose. When
.I curl_getenv()
fails to find the specified name, it returns a null pointer.
.SH NOTE
Under unix operating systems, there isn't any point in returning an allocated
memory, although other systems won't work properly if this isn't done. The
unix implementation thus have to suffer slightly from the drawbacks of other
systems.
.SH "SEE ALSO"
.BR getenv "(3C), "
.SH BUGS
Surely there are some, you tell me!

29
docs/curl_slist_append.3 Normal file
View File

@@ -0,0 +1,29 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_slist_append 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_slist_append - add a string to an slist
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "struct curl_slist *curl_slist_append(struct curl_slit *" list,
.BI "char * "string ");"
.ad
.SH DESCRIPTION
curl_slist_append() appends a specified string to a linked list of
strings. The existing
.I list
should be passed as the first argument while the new list is returned from
this function. The specified
.I string
has been appended when this function returns.
.SH RETURN VALUE
A null pointer is returned if anything went wrong, otherwise the new list
pointer is returned.
.SH "SEE ALSO"
.BR curl_slist_free_all "(3), "
.SH BUGS
Surely there are some, you tell me!

View File

@@ -0,0 +1,22 @@
.\" You can view this file with:
.\" nroff -man [file]
.\" Written by daniel@haxx.se
.\"
.TH curl_slist_free_all 3 "2 June 2000" "Curl 7.0" "libcurl Manual"
.SH NAME
curl_slist_free_all - free an entire curl_slist list
.SH SYNOPSIS
.B #include <curl/curl.h>
.sp
.BI "void curl_slist_free_all(struct curl_slit *" list);
.ad
.SH DESCRIPTION
curl_slist_free_all() removes all traces of a previously built curl_slist
linked list.
.SH RETURN VALUE
Nothing.
.SH "SEE ALSO"
.BR curl_slist_append "(3), "
.SH BUGS
Surely there are some, you tell me!

27
docs/curl_version.3 Normal file
View File

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

5
include/Makefile.am Normal file
View File

@@ -0,0 +1,5 @@
SUBDIRS = curl
EXTRA_DIST = README
AUTOMAKE_OPTIONS = foreign no-dependencies

7
include/curl/Makefile.am Normal file
View File

@@ -0,0 +1,7 @@
pkginclude_HEADERS = \
curl.h \
easy.h \
mprintf.h \
stdcheaders.h \
types.h
pkgincludedir= $(includedir)/curl

View File

@@ -67,12 +67,6 @@
#include <curl/types.h> #include <curl/types.h>
struct HttpHeader {
struct HttpHeader *next; /* next entry in the list */
char *header; /* pointer to allocated line without newline */
};
struct HttpPost { struct HttpPost {
struct HttpPost *next; /* next entry in the list */ struct HttpPost *next; /* next entry in the list */
char *name; /* pointer to allocated name */ char *name; /* pointer to allocated name */
@@ -82,8 +76,25 @@ struct HttpPost {
link should link to following files */ link should link to following files */
long flags; /* as defined below */ long flags; /* as defined below */
#define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */ #define HTTPPOST_FILENAME (1<<0) /* specified content is a file name */
#define HTTPPOST_READFILE (1<<1) /* specified content is a file name */
}; };
typedef int (*curl_progress_callback)(void *clientp,
size_t dltotal,
size_t dlnow,
size_t ultotal,
size_t ulnow);
typedef size_t (*curl_write_callback)(char *buffer,
size_t size,
size_t nitems,
FILE *outstream);
typedef size_t (*curl_read_callback)(char *buffer,
size_t size,
size_t nitems,
FILE *instream);
/* All possible error codes from this version of urlget(). Future versions /* All possible error codes from this version of urlget(). Future versions
may return other values, stay prepared. */ may return other values, stay prepared. */
@@ -311,10 +322,11 @@ typedef enum {
/* HTTP request, for odd commands like DELETE, TRACE and others */ /* HTTP request, for odd commands like DELETE, TRACE and others */
T(STDERR, OBJECTPOINT, 37), T(STDERR, OBJECTPOINT, 37),
/* Progress mode sets alternative progress mode displays, the only #if 0
one defined today is 1 which makes the #-style progress bar. */ /* Progress mode set alternative progress mode displays. Alternative
ones should now be made by the client, not the lib! */
T(PROGRESSMODE, LONG, 38), T(PROGRESSMODE, LONG, 38),
#endif
/* send linked-list of post-transfer QUOTE commands */ /* send linked-list of post-transfer QUOTE commands */
T(POSTQUOTE, OBJECTPOINT, 39), T(POSTQUOTE, OBJECTPOINT, 39),
@@ -335,10 +347,33 @@ typedef enum {
T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */ T(FTPAPPEND, LONG, 50), /* Append instead of overwrite on upload! */
T(NETRC, LONG, 51), /* read user+password from .netrc */ T(NETRC, LONG, 51), /* read user+password from .netrc */
T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */ T(FOLLOWLOCATION, LONG, 52), /* use Location: Luke! */
/* This FTPASCII name is now obsolete, to be removed, use the TRANSFERTEXT
instead. It goes for more protocols than just ftp... */
T(FTPASCII, LONG, 53), /* use TYPE A for transfer */ T(FTPASCII, LONG, 53), /* use TYPE A for transfer */
T(TRANSFERTEXT, LONG, 53), /* transfer data in text/ASCII format */
T(PUT, LONG, 54), /* PUT the input file */ T(PUT, LONG, 54), /* PUT the input file */
T(MUTE, LONG, 55), /* force NOPROGRESS */ T(MUTE, LONG, 55), /* force NOPROGRESS */
/* Function that will be called instead of the internal progress display
* function. This function should be defined as the curl_progress_callback
* prototype defines. */
T(PROGRESSFUNCTION, FUNCTIONPOINT, 56),
/* Data passed to the progress callback */
T(PROGRESSDATA, OBJECTPOINT, 57),
/* We want the referer field set automatically when following locations */
T(AUTOREFERER, LONG, 58),
/* Port of the proxy, can be set in the proxy string as well with:
"[host]:[port]" */
T(PROXYPORT, LONG, 59),
/* size of the POST input data, if strlen() is not good to use */
T(POSTFIELDSIZE, LONG, 60),
CURLOPT_LASTENTRY /* the last unusued */ CURLOPT_LASTENTRY /* the last unusued */
} CURLoption; } CURLoption;
@@ -363,26 +398,32 @@ typedef char bool;
#endif /* (rabe) */ #endif /* (rabe) */
#endif #endif
#if 0
/* At last, I stand here in front of you today and can officially proclaim /* These functions are in the libcurl, they're here for portable reasons and
this function prototype as history... 17th of May, 2000 */ they are used by the 'curl' client. They really should be moved to some kind
UrgError curl_urlget(UrgTag, ...); of "portability library" since it has nothing to do with file transfers and
#endif might be usable to other programs...
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);
/* external form function */ /* external form function */
int curl_FormParse(char *string, int curl_formparse(char *string,
struct HttpPost **httppost, struct HttpPost **httppost,
struct HttpPost **last_post); struct HttpPost **last_post);
/* Unix and Win32 getenv function call */ /* Unix and Win32 getenv function call, this returns a malloc()'ed string that
char *curl_GetEnv(char *variable); MUST be free()ed after usage is complete. */
char *curl_getenv(char *variable);
/* returns ascii string of the libcurl version */ /* returns ascii string of the libcurl version */
char *curl_version(void); char *curl_version(void);
/* This is the version number */ /* This is the version number */
#define LIBCURL_VERSION "7.0.1beta" #define LIBCURL_VERSION "7.2"
#define LIBCURL_VERSION_NUM 0x070001 #define LIBCURL_VERSION_NUM 0x070200
/* linked-list structure for the CURLOPT_QUOTE option */ /* linked-list structure for the CURLOPT_QUOTE option */
struct curl_slist { struct curl_slist {

View File

@@ -4,14 +4,14 @@
AUTOMAKE_OPTIONS = foreign no-dependencies AUTOMAKE_OPTIONS = foreign no-dependencies
noinst_LIBRARIES = libcurl.a lib_LTLIBRARIES = libcurl.la
# Some flags needed when trying to cause warnings ;-) # Some flags needed when trying to cause warnings ;-)
CFLAGS = -g -Wall #-pedantic # CFLAGS = -g -Wall #-pedantic
INCLUDES = -I$(top_srcdir)/include INCLUDES = -I$(top_srcdir)/include
libcurl_a_SOURCES = \ libcurl_la_SOURCES = \
arpa_telnet.h file.c getpass.h netrc.h timeval.c \ arpa_telnet.h file.c getpass.h netrc.h timeval.c \
base64.c file.h hostip.c progress.c timeval.h \ base64.c file.h hostip.c progress.c timeval.h \
base64.h formdata.c hostip.h progress.h \ base64.h formdata.c hostip.h progress.h \

View File

@@ -63,9 +63,14 @@ PRE_UNINSTALL = :
POST_UNINSTALL = : POST_UNINSTALL = :
host_alias = @host_alias@ host_alias = @host_alias@
host_triplet = @host@ host_triplet = @host@
AS = @AS@
CC = @CC@ CC = @CC@
DLLTOOL = @DLLTOOL@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
NROFF = @NROFF@ NROFF = @NROFF@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@ PACKAGE = @PACKAGE@
PERL = @PERL@ PERL = @PERL@
RANLIB = @RANLIB@ RANLIB = @RANLIB@
@@ -74,35 +79,37 @@ YACC = @YACC@
AUTOMAKE_OPTIONS = foreign no-dependencies AUTOMAKE_OPTIONS = foreign no-dependencies
noinst_LIBRARIES = libcurl.a lib_LTLIBRARIES = libcurl.la
# Some flags needed when trying to cause warnings ;-) # Some flags needed when trying to cause warnings ;-)
CFLAGS = -g -Wall #-pedantic # CFLAGS = -g -Wall #-pedantic
INCLUDES = -I$(top_srcdir)/include INCLUDES = -I$(top_srcdir)/include
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 ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h getpass.c netrc.c telnet.h writeout.c writeout.h highlevel.c strequal.c strequal.h easy.c libcurl_la_SOURCES = arpa_telnet.h file.c getpass.h netrc.h timeval.c base64.c file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h progress.h cookie.c formdata.h http.c sendf.c cookie.h ftp.c http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h dict.h getdate.c if2ip.h speedcheck.h urldata.h 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 writeout.c writeout.h highlevel.c strequal.c strequal.h easy.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h ../src/config.h CONFIG_HEADER = ../config.h ../src/config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES) LTLIBRARIES = $(lib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I../src DEFS = @DEFS@ -I. -I$(srcdir) -I.. -I../src
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
libcurl_a_LIBADD = libcurl_la_LDFLAGS =
libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \ libcurl_la_LIBADD =
formdata.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \ libcurl_la_OBJECTS = file.lo timeval.lo base64.lo hostip.lo progress.lo \
speedcheck.o getdate.o download.o ldap.o ssluse.o version.o getenv.o \ formdata.lo cookie.lo http.lo sendf.lo ftp.lo url.lo dict.lo if2ip.lo \
escape.o mprintf.o telnet.o getpass.o netrc.o writeout.o highlevel.o \ speedcheck.lo getdate.lo download.lo ldap.lo ssluse.lo version.lo \
strequal.o easy.o getenv.lo escape.lo mprintf.lo telnet.lo getpass.lo netrc.lo \
AR = ar writeout.lo highlevel.lo strequal.lo easy.lo
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_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) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = Makefile.am Makefile.in
@@ -110,28 +117,44 @@ DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar TAR = gtar
GZIP_ENV = --best GZIP_ENV = --best
SOURCES = $(libcurl_a_SOURCES) SOURCES = $(libcurl_la_SOURCES)
OBJECTS = $(libcurl_a_OBJECTS) OBJECTS = $(libcurl_la_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .S .c .o .s .SUFFIXES: .S .c .lo .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \ cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES: mostlyclean-libLTLIBRARIES:
clean-noinstLIBRARIES: clean-libLTLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-noinstLIBRARIES: distclean-libLTLIBRARIES:
maintainer-clean-noinstLIBRARIES: 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: .c.o:
$(COMPILE) -c $< $(COMPILE) -c $<
@@ -152,10 +175,27 @@ distclean-compile:
maintainer-clean-compile: maintainer-clean-compile:
libcurl.a: $(libcurl_a_OBJECTS) $(libcurl_a_DEPENDENCIES) .c.lo:
-rm -f libcurl.a $(LIBTOOL) --mode=compile $(COMPILE) -c $<
$(AR) cru libcurl.a $(libcurl_a_OBJECTS) $(libcurl_a_LIBADD)
$(RANLIB) libcurl.a .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 tags: TAGS
@@ -209,7 +249,7 @@ check-am: all-am
check: check-am check: check-am
installcheck-am: installcheck-am:
installcheck: installcheck-am installcheck: installcheck-am
install-exec-am: install-exec-am: install-libLTLIBRARIES
install-exec: install-exec-am install-exec: install-exec-am
install-data-am: install-data-am:
@@ -218,13 +258,14 @@ install-data: install-data-am
install-am: all-am install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am install: install-am
uninstall-am: uninstall-am: uninstall-libLTLIBRARIES
uninstall: uninstall-am uninstall: uninstall-am
all-am: Makefile $(LIBRARIES) all-am: Makefile $(LTLIBRARIES)
all-redirect: all-am all-redirect: all-am
install-strip: install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs: installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir)
mostlyclean-generic: mostlyclean-generic:
@@ -236,33 +277,39 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]* -rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic: maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
mostlyclean-tags mostlyclean-generic mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-tags clean-generic \ clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
mostlyclean-am clean-generic mostlyclean-am
clean: clean-am clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \ distclean-am: distclean-libLTLIBRARIES distclean-compile \
distclean-tags distclean-generic clean-am distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \ maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
maintainer-clean-compile maintainer-clean-tags \ maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-generic distclean-am maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;" @echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild." @echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \ .PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \ clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \ uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
maintainer-clean-compile tags mostlyclean-tags distclean-tags \ 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 \ clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \ check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \ install-data-am install-data install-am install uninstall-am uninstall \

View File

@@ -15,7 +15,7 @@ OPENSSL_PATH = ../../openssl-0.9.5a
## Nothing more to do below this line! ## Nothing more to do below this line!
INCLUDES = -I. -I.. -I../include INCLUDES = -I. -I.. -I../include
CFLAGS = -g -O2 CFLAGS = -g -O2 -DMINGW32
ifdef SSL ifdef SSL
INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl" INCLUDES += -I"$(OPENSSL_PATH)/outinc" -I"$(OPENSSL_PATH)/outinc/openssl"
CFLAGS += -DUSE_SSLEAY CFLAGS += -DUSE_SSLEAY
@@ -29,14 +29,14 @@ base64.h getenv.h mprintf.c setup.h url.c download.c getpass.c \
mprintf.h ssluse.c url.h download.h hostip.c netrc.c ssluse.h \ mprintf.h ssluse.c url.h download.h hostip.c netrc.c ssluse.h \
urldata.h formdata.c hostip.h netrc.h stdcheaders.h formdata.h \ urldata.h formdata.c hostip.h netrc.h stdcheaders.h formdata.h \
if2ip.c progress.c sendf.c sendf.h speedcheck.c speedcheck.h \ if2ip.c progress.c sendf.c sendf.h speedcheck.c speedcheck.h \
ftp.c ftp.h getpass.c getpass.h version.c timeval.c timeval.h cookie.c \ ftp.c ftp.h getpass.h version.c timeval.c timeval.h cookie.c \
cookie.h escape.c escape.h getdate.c getdate.h dict.h dict.c http.c \ cookie.h escape.c escape.h getdate.c getdate.h dict.h dict.c http.c \
http.h telnet.c telnet.h file.c file.h ldap.c ldap.h writeout.c writeout.h \ http.h telnet.c telnet.h file.c file.h ldap.c ldap.h writeout.c writeout.h \
highlevel.c strequal.c strequal.h easy.c highlevel.c strequal.c strequal.h easy.c
libcurl_a_OBJECTS = base64.o getenv.o mprintf.o url.o download.o \ libcurl_a_OBJECTS = base64.o getenv.o mprintf.o url.o download.o \
getpass.o ssluse.o hostip.o netrc.o formdata.o if2ip.o progress.o \ getpass.o ssluse.o hostip.o netrc.o formdata.o if2ip.o progress.o \
sendf.o speedcheck.o ftp.o getpass.o version.o timeval.o \ sendf.o speedcheck.o ftp.o version.o timeval.o \
cookie.o escape.o getdate.o dict.o http.o telnet.o file.o ldap.o writeout.o \ cookie.o escape.o getdate.o dict.o http.o telnet.o file.o ldap.o writeout.o \
highlevel.o strequal.o easy.o highlevel.o strequal.o easy.o

View File

@@ -54,7 +54,10 @@ RELEASE_OBJS= \
urlr.obj \ urlr.obj \
filer.obj \ filer.obj \
writeoutr.obj \ writeoutr.obj \
versionr.obj versionr.obj \
easyr.obj \
highlevelr.obj \
strequalr.obj
DEBUG_OBJS= \ DEBUG_OBJS= \
base64d.obj \ base64d.obj \
@@ -82,7 +85,10 @@ DEBUG_OBJS= \
urld.obj \ urld.obj \
filed.obj \ filed.obj \
writeoutd.obj \ writeoutd.obj \
versiond.obj versiond.obj \
easyd.obj \
highleveld.obj \
strequald.obj
RELEASE_SSL_OBJS= \ RELEASE_SSL_OBJS= \
base64rs.obj \ base64rs.obj \
@@ -110,7 +116,10 @@ RELEASE_SSL_OBJS= \
urlrs.obj \ urlrs.obj \
filers.obj \ filers.obj \
writeouts.obj \ writeouts.obj \
versionrs.obj versionrs.obj \
easyrs.obj \
highlevelrs.obj \
strequalrs.obj
LINK_OBJS= \ LINK_OBJS= \
base64.obj \ base64.obj \
@@ -138,7 +147,10 @@ LINK_OBJS= \
url.obj \ url.obj \
file.obj \ file.obj \
writeout.obj \ writeout.obj \
version.obj version.obj \
easy.obj \
highlevel.obj \
strequal.obj
all : release all : release
@@ -205,6 +217,12 @@ writeoutr.obj: writeout.c
$(CCR) $(CFLAGS) writeout.c $(CCR) $(CFLAGS) writeout.c
versionr.obj: version.c versionr.obj: version.c
$(CCR) $(CFLAGS) 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
## Debug ## Debug
base64d.obj: base64.c base64d.obj: base64.c
@@ -259,6 +277,12 @@ writeoutd.obj: writeout.c
$(CCR) $(CFLAGS) writeout.c $(CCR) $(CFLAGS) writeout.c
versiond.obj: version.c versiond.obj: version.c
$(CCD) $(CFLAGS) version.c $(CCD) $(CFLAGS) version.c
easyd.obj: easy.c
$(CCR) $(CFLAGS) easy.c
highleveld.obj: highlevel.c
$(CCR) $(CFLAGS) highlevel.c
strequald.obj: strequal.c
$(CCR) $(CFLAGS) strequal.c
## Release SSL ## Release SSL
@@ -314,6 +338,12 @@ writeoutrs.obj: writeout.c
$(CCR) $(CFLAGS) writeout.c $(CCR) $(CFLAGS) writeout.c
versionrs.obj: version.c versionrs.obj: version.c
$(CCRS) $(CFLAGS) version.c $(CCRS) $(CFLAGS) version.c
easyrs.obj: easy.c
$(CCR) $(CFLAGS) easy.c
highlevelrs.obj: highlevel.c
$(CCR) $(CFLAGS) highlevel.c
strequalrs.obj: strequal.c
$(CCR) $(CFLAGS) strequal.c
clean: clean:
-@erase *.obj -@erase *.obj

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -55,12 +55,13 @@ Example set of cookies:
13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure 13-Jun-1988 03:04:55 GMT; domain=.fidelity.com; path=/; secure
****/ ****/
#include "setup.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "cookie.h" #include "cookie.h"
#include "setup.h"
#include "getdate.h" #include "getdate.h"
#include "strequal.h" #include "strequal.h"

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -49,8 +51,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
#include <time.h> #include <time.h>

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,12 +38,12 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "setup.h"
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
#include <sys/types.h> #include <sys/types.h>
#endif #endif

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -49,7 +51,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#include "strequal.h" #include "strequal.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -49,8 +51,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
#include <time.h> #include <time.h>
@@ -60,13 +60,17 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -49,6 +49,8 @@
*/ */
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -56,7 +58,6 @@
#include <time.h> #include <time.h>
#include "setup.h"
#include <curl/curl.h> #include <curl/curl.h>
#include "formdata.h" #include "formdata.h"
@@ -102,7 +103,7 @@ static void GetStr(char **string,
* *
***************************************************************************/ ***************************************************************************/
int curl_FormParse(char *input, int curl_formparse(char *input,
struct HttpPost **httppost, struct HttpPost **httppost,
struct HttpPost **last_post) struct HttpPost **last_post)
{ {
@@ -119,7 +120,7 @@ int FormParse(char *input,
/* nextarg MUST be a string in the format 'name=contents' and we'll /* nextarg MUST be a string in the format 'name=contents' and we'll
build a linked list with the info */ build a linked list with the info */
char name[256]; char name[256];
char contents[1024]=""; char contents[4096]="";
char major[128]; char major[128];
char minor[128]; char minor[128];
long flags = 0; long flags = 0;
@@ -132,7 +133,7 @@ int FormParse(char *input,
struct HttpPost *subpost; /* a sub-node */ struct HttpPost *subpost; /* a sub-node */
unsigned int i; unsigned int i;
if(1 <= sscanf(input, "%255[^ =] = %1023[^\n]", name, contents)) { if(1 <= sscanf(input, "%255[^ =] = %4095[^\n]", name, contents)) {
/* the input was using the correct format */ /* the input was using the correct format */
contp = contents; contp = contents;
@@ -281,8 +282,14 @@ int FormParse(char *input,
if(post) { if(post) {
memset(post, 0, sizeof(struct HttpPost)); memset(post, 0, sizeof(struct HttpPost));
GetStr(&post->name, name); /* get the name */ GetStr(&post->name, name); /* get the name */
if( contp[0]=='<' ) {
GetStr(&post->contents, contp+1); /* get the contents */
post->flags = HTTPPOST_READFILE;
}
else {
GetStr(&post->contents, contp); /* get the contents */ GetStr(&post->contents, contp); /* get the contents */
post->flags = 0; post->flags = 0;
}
/* make the previous point to this */ /* make the previous point to this */
if(*last_post) if(*last_post)
@@ -318,6 +325,7 @@ static int AddFormData(struct FormData **formp,
newform->line = (char *)malloc(length+1); newform->line = (char *)malloc(length+1);
memcpy(newform->line, line, length+1); memcpy(newform->line, line, length+1);
newform->length = length; newform->length = length;
newform->line[length]=0; /* zero terminate for easier debugging */
if(*formp) { if(*formp) {
(*formp)->next = newform; (*formp)->next = newform;
@@ -333,7 +341,7 @@ static int AddFormData(struct FormData **formp,
static int AddFormDataf(struct FormData **formp, static int AddFormDataf(struct FormData **formp,
char *fmt, ...) char *fmt, ...)
{ {
char s[1024]; char s[4096];
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
vsprintf(s, fmt, ap); vsprintf(s, fmt, ap);
@@ -453,15 +461,14 @@ struct FormData *getFormData(struct HttpPost *post,
if(file->contenttype && if(file->contenttype &&
!strnequal("text/", file->contenttype, 5)) { !strnequal("text/", file->contenttype, 5)) {
/* this is not a text content, mention our binary encoding */ /* this is not a text content, mention our binary encoding */
size += AddFormDataf(&form, size += AddFormData(&form, "\r\nContent-Transfer-Encoding: binary", 0);
"\r\nContent-Transfer-Encoding: binary");
} }
size += AddFormDataf(&form, size += AddFormData(&form, "\r\n\r\n", 0);
"\r\n\r\n");
if(post->flags & HTTPPOST_FILENAME) { if((post->flags & HTTPPOST_FILENAME) ||
(post->flags & HTTPPOST_READFILE)) {
/* we should include the contents from the specified file */ /* we should include the contents from the specified file */
FILE *fileread; FILE *fileread;
char buffer[1024]; char buffer[1024];
@@ -478,15 +485,12 @@ struct FormData *getFormData(struct HttpPost *post,
} }
if(fileread != stdin) if(fileread != stdin)
fclose(fileread); fclose(fileread);
} else {
size += AddFormData(&form, "[File wasn't found by client]", 0);
} }
else { } else {
size += AddFormDataf(&form, "[File wasn't found by client]");
}
}
else {
/* include the contents we got */ /* include the contents we got */
size += AddFormDataf(&form, size += AddFormData(&form, post->contents, 0);
post->contents);
} }
} while((file = file->more)); /* for each specified file for this field */ } while((file = file->more)); /* for each specified file for this field */
@@ -518,11 +522,19 @@ int FormInit(struct Form *form, struct FormData *formdata )
if(!formdata) if(!formdata)
return 1; /* error */ return 1; /* error */
/* First, make sure that we'll send a nice terminating sequence at the end #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 * of the post. We *DONT* add this string to the size of the data since this
* is actually AFTER the data. */ * is actually AFTER the data. */
AddFormDataf(&formdata, "\r\n\r\n"); AddFormDataf(&lastnode, "\r\n\r\n");
#endif
form->data = formdata; form->data = formdata;
form->sent = 0; form->sent = 0;
@@ -544,7 +556,7 @@ int FormReader(char *buffer,
wantedsize = size * nitems; wantedsize = size * nitems;
if(!form->data) if(!form->data)
return 0; /* nothing, error, empty */ return -1; /* nothing, error, empty */
do { do {

View File

@@ -31,17 +31,17 @@
* Linas Vepstas <linas@linas.org> * Linas Vepstas <linas@linas.org>
* Bjorn Reese <breese@imada.ou.dk> * Bjorn Reese <breese@imada.ou.dk>
* Johan Anderson <johan@homemail.com> * Johan Anderson <johan@homemail.com>
* Kjell Ericson <Kjell.Ericson@haxx.nu> * Kjell Ericson <Kjell.Ericson@haxx.se>
* Troy Engel <tengel@palladium.net> * Troy Engel <tengel@palladium.net>
* Ryan Nelson <ryan@inch.com> * Ryan Nelson <ryan@inch.com>
* Bjorn Stenberg <Bjorn.Stenberg@haxx.nu> * Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
* Angus Mackay <amackay@gus.ml.org> * Angus Mackay <amackay@gus.ml.org>
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -52,7 +52,10 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* $Log$ * $Log$
* Revision 1.2 2000-01-10 23:36:14 bagder * Revision 1.3 2000-06-20 15:31:26 bagder
* haxx.nu => haxx.se
*
* Revision 1.2 2000/01/10 23:36:14 bagder
* syncing with local edit * syncing with local edit
* *
* Revision 1.4 1999/09/06 06:59:40 dast * Revision 1.4 1999/09/06 06:59:40 dast

237
lib/ftp.c
View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,14 +38,14 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include "setup.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@@ -60,22 +60,22 @@
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include <sys/utsname.h> #include <sys/utsname.h>
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif #endif
#endif
#if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__)
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef HAVE_INET_NTOA_R
#include "inet_ntoa_r.h"
#endif
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
@@ -209,40 +209,93 @@ static CURLcode AllowServerConnect(struct UrlData *data,
isdigit((int)line[2]) && (' ' == line[3])) isdigit((int)line[2]) && (' ' == line[3]))
int GetLastResponse(int sockfd, char *buf, int GetLastResponse(int sockfd, char *buf,
struct UrlData *data) struct connectdata *conn)
{ {
int nread; int nread;
int read_rc=1; int keepon=TRUE;
char *ptr; char *ptr;
int timeout = 3600; /* in seconds */
struct timeval interval;
fd_set rkeepfd;
fd_set readfd;
struct UrlData *data = conn->data;
#define SELECT_OK 0
#define SELECT_ERROR 1
#define SELECT_TIMEOUT 2
int error = SELECT_OK;
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 */
if(timeout <=0 ) {
failf(data, "Transfer aborted due to timeout");
return -SELECT_TIMEOUT; /* already too little time */
}
}
FD_ZERO (&readfd); /* clear it */
FD_SET (sockfd, &readfd); /* read socket */
/* get this in a backup variable to be able to restore it on each lap in the
select() loop */
rkeepfd = readfd;
do { do {
ptr=buf; ptr=buf;
/* get us a full line, terminated with a newline */ /* get us a full line, terminated with a newline */
for(nread=0; nread=0;
(nread<BUFSIZE) && read_rc; keepon=TRUE;
nread++, ptr++) { while((nread<BUFSIZE) && (keepon && !error)) {
readfd = rkeepfd; /* set every lap */
interval.tv_sec = timeout;
interval.tv_usec = 0;
switch (select (sockfd+1, &readfd, NULL, NULL, &interval)) {
case -1: /* select() error, stop reading */
error = SELECT_ERROR;
failf(data, "Transfer aborted due to select() error");
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 #ifdef USE_SSLEAY
if (data->use_ssl) { if (data->use_ssl) {
read_rc = SSL_read(data->ssl, ptr, 1); keepon = SSL_read(data->ssl, ptr, 1);
} }
else { else {
#endif #endif
read_rc = sread(sockfd, ptr, 1); keepon = sread(sockfd, ptr, 1);
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
} }
#endif /* USE_SSLEAY */ #endif /* USE_SSLEAY */
if (*ptr == '\n')
break; if ((*ptr == '\n') || (*ptr == '\r'))
keepon = FALSE;
}
if(keepon) {
nread++;
ptr++;
}
} }
*ptr=0; /* zero terminate */ *ptr=0; /* zero terminate */
if(data->bits.verbose) { if(data->bits.verbose && buf[0]) {
fputs("< ", data->err); fputs("< ", data->err);
fwrite(buf, 1, nread, data->err); fwrite(buf, 1, nread, data->err);
fputs("\n", data->err); fputs("\n", data->err);
} }
} while(read_rc && } while(!error &&
(nread<4 || !lastline(buf)) ); (nread<4 || !lastline(buf)) );
if(error)
return -error;
return nread; return nread;
} }
@@ -315,11 +368,13 @@ static char *URLfix(char *string)
CURLcode ftp_connect(struct connectdata *conn) CURLcode ftp_connect(struct connectdata *conn)
{ {
/* this is FTP and no proxy */ /* this is FTP and no proxy */
size_t nread; int nread;
struct UrlData *data=conn->data; struct UrlData *data=conn->data;
char *buf = data->buffer; /* this is our buffer */ char *buf = data->buffer; /* this is our buffer */
struct FTP *ftp; struct FTP *ftp;
myalarm(0); /* switch off the alarm stuff */
ftp = (struct FTP *)malloc(sizeof(struct FTP)); ftp = (struct FTP *)malloc(sizeof(struct FTP));
if(!ftp) if(!ftp)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
@@ -333,7 +388,9 @@ CURLcode ftp_connect(struct connectdata *conn)
ftp->passwd = data->passwd; ftp->passwd = data->passwd;
/* The first thing we do is wait for the "220*" line: */ /* The first thing we do is wait for the "220*" line: */
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "220", 3)) { if(strncmp(buf, "220", 3)) {
failf(data, "This doesn't seem like a nice ftp-server response"); failf(data, "This doesn't seem like a nice ftp-server response");
return CURLE_FTP_WEIRD_SERVER_REPLY; return CURLE_FTP_WEIRD_SERVER_REPLY;
@@ -343,7 +400,9 @@ CURLcode ftp_connect(struct connectdata *conn)
sendf(data->firstsocket, data, "USER %s\r\n", ftp->user); sendf(data->firstsocket, data, "USER %s\r\n", ftp->user);
/* wait for feedback */ /* wait for feedback */
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(!strncmp(buf, "530", 3)) { if(!strncmp(buf, "530", 3)) {
/* 530 User ... access denied /* 530 User ... access denied
@@ -355,7 +414,9 @@ CURLcode ftp_connect(struct connectdata *conn)
/* 331 Password required for ... /* 331 Password required for ...
(the server requires to send the user's password too) */ (the server requires to send the user's password too) */
sendf(data->firstsocket, data, "PASS %s\r\n", ftp->passwd); sendf(data->firstsocket, data, "PASS %s\r\n", ftp->passwd);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(!strncmp(buf, "530", 3)) { if(!strncmp(buf, "530", 3)) {
/* 530 Login incorrect. /* 530 Login incorrect.
@@ -421,10 +482,12 @@ CURLcode ftp_done(struct connectdata *conn)
/* now let's see what the server says about the transfer we /* now let's see what the server says about the transfer we
just performed: */ just performed: */
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
/* 226 Transfer complete */ /* 226 Transfer complete, 250 Requested file action okay, completed. */
if(strncmp(buf, "226", 3)) { if(!strncmp(buf, "226", 3) && !strncmp(buf, "250", 3)) {
failf(data, "%s", buf+4); failf(data, "%s", buf+4);
return CURLE_FTP_WRITE_ERROR; return CURLE_FTP_WRITE_ERROR;
} }
@@ -438,7 +501,9 @@ CURLcode ftp_done(struct connectdata *conn)
if (qitem->data) { if (qitem->data) {
sendf(data->firstsocket, data, "%s\r\n", qitem->data); sendf(data->firstsocket, data, "%s\r\n", qitem->data);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if (buf[0] != '2') { if (buf[0] != '2') {
failf(data, "QUOT string not accepted: %s", failf(data, "QUOT string not accepted: %s",
@@ -473,7 +538,7 @@ CURLcode _ftp(struct connectdata *conn)
/* for the ftp PORT mode */ /* for the ftp PORT mode */
int portsock=-1; int portsock=-1;
struct sockaddr_in serv_addr; struct sockaddr_in serv_addr;
char hostent_buf[512]; char hostent_buf[8192];
#if defined (HAVE_INET_NTOA_R) #if defined (HAVE_INET_NTOA_R)
char ntoa_buf[64]; char ntoa_buf[64];
#endif #endif
@@ -493,7 +558,9 @@ CURLcode _ftp(struct connectdata *conn)
if (qitem->data) { if (qitem->data) {
sendf(data->firstsocket, data, "%s\r\n", qitem->data); sendf(data->firstsocket, data, "%s\r\n", qitem->data);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if (buf[0] != '2') { if (buf[0] != '2') {
failf(data, "QUOT string not accepted: %s", failf(data, "QUOT string not accepted: %s",
@@ -514,7 +581,9 @@ CURLcode _ftp(struct connectdata *conn)
int filesize; int filesize;
sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file); sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "213", 3)) { if(strncmp(buf, "213", 3)) {
failf(data, "Couldn't get file size: %s", buf+4); failf(data, "Couldn't get file size: %s", buf+4);
@@ -611,19 +680,24 @@ CURLcode _ftp(struct connectdata *conn)
unsigned short ip[5]; unsigned short ip[5];
(void) memcpy(&in.s_addr, *h->h_addr_list, sizeof (in.s_addr)); (void) memcpy(&in.s_addr, *h->h_addr_list, sizeof (in.s_addr));
#if defined (HAVE_INET_NTOA_R) #if defined (HAVE_INET_NTOA_R)
sscanf( inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)), "%hu.%hu.%hu.%hu", /* ignore the return code from inet_ntoa_r() as it is int or
char * depending on system */
inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf));
sscanf( ntoa_buf, "%hu.%hu.%hu.%hu",
&ip[0], &ip[1], &ip[2], &ip[3]); &ip[0], &ip[1], &ip[2], &ip[3]);
#else #else
sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu", sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu",
&ip[0], &ip[1], &ip[2], &ip[3]); &ip[0], &ip[1], &ip[2], &ip[3]);
#endif #endif
sendf(data->firstsocket, data, "PORT %d,%d,%d,%d,%d,%d\n", sendf(data->firstsocket, data, "PORT %d,%d,%d,%d,%d,%d\r\n",
ip[0], ip[1], ip[2], ip[3], ip[0], ip[1], ip[2], ip[3],
porttouse >> 8, porttouse >> 8,
porttouse & 255); porttouse & 255);
} }
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "200", 3)) { if(strncmp(buf, "200", 3)) {
failf(data, "Server does not grok PORT, try without it!"); failf(data, "Server does not grok PORT, try without it!");
@@ -634,7 +708,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "PASV\r\n"); sendf(data->firstsocket, data, "PASV\r\n");
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "227", 3)) { if(strncmp(buf, "227", 3)) {
failf(data, "Odd return code after PASV"); failf(data, "Odd return code after PASV");
@@ -692,20 +768,49 @@ CURLcode _ftp(struct connectdata *conn)
#if defined(HAVE_INET_ADDR) #if defined(HAVE_INET_ADDR)
unsigned long address; unsigned long address;
#if defined(HAVE_GETHOSTBYADDR_R) # if defined(HAVE_GETHOSTBYADDR_R)
int h_errnop; int h_errnop;
#endif # endif
address = inet_addr(newhost); address = inet_addr(newhost);
#if defined(HAVE_GETHOSTBYADDR_R) # ifdef HAVE_GETHOSTBYADDR_R
# ifdef HAVE_GETHOSTBYADDR_R_5
/* AIX, Digital Unix style:
extern int gethostbyaddr_r(char *addr, size_t len, int type,
struct hostent *htent, struct hostent_data *ht_data); */
/* Fred Noz helped me try this out, now it at least compiles! */
if(gethostbyaddr_r((char *) &address,
sizeof(address), AF_INET,
(struct hostent *)hostent_buf,
hostent_buf + sizeof(*answer)))
answer=NULL;
# endif
# ifdef HAVE_GETHOSTBYADDR_R_7
/* Solaris and IRIX */
answer = gethostbyaddr_r((char *) &address, sizeof(address), AF_INET, answer = gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
(struct hostent *)hostent_buf, (struct hostent *)hostent_buf,
hostent_buf + sizeof(*answer), hostent_buf + sizeof(*answer),
sizeof(hostent_buf) - sizeof(*answer), sizeof(hostent_buf) - sizeof(*answer),
&h_errnop); &h_errnop);
#else # endif
# ifdef HAVE_GETHOSTBYADDR_R_8
/* Linux style */
if(gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
(struct hostent *)hostent_buf,
hostent_buf + sizeof(*answer),
sizeof(hostent_buf) - sizeof(*answer),
&answer,
&h_errnop))
answer=NULL; /* error */
# endif
# else
answer = gethostbyaddr((char *) &address, sizeof(address), AF_INET); answer = gethostbyaddr((char *) &address, sizeof(address), AF_INET);
#endif # endif
#else #else
answer = NULL; answer = NULL;
#endif #endif
@@ -713,7 +818,7 @@ CURLcode _ftp(struct connectdata *conn)
infof(data, "Connecting to %s (%s) port %u\n", infof(data, "Connecting to %s (%s) port %u\n",
answer?answer->h_name:newhost, answer?answer->h_name:newhost,
#if defined(HAVE_INET_NTOA_R) #if defined(HAVE_INET_NTOA_R)
ip_addr = inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)), inet_ntoa_r(in, ip_addr=ntoa_buf, sizeof(ntoa_buf)),
#else #else
ip_addr = inet_ntoa(in), ip_addr = inet_ntoa(in),
#endif #endif
@@ -750,7 +855,9 @@ CURLcode _ftp(struct connectdata *conn)
if(ftp->dir && ftp->dir[0]) { if(ftp->dir && ftp->dir[0]) {
sendf(data->firstsocket, data, "CWD %s\r\n", ftp->dir); sendf(data->firstsocket, data, "CWD %s\r\n", ftp->dir);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "250", 3)) { if(strncmp(buf, "250", 3)) {
failf(data, "Couldn't change to directory %s", ftp->dir); failf(data, "Couldn't change to directory %s", ftp->dir);
@@ -764,7 +871,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "TYPE %s\r\n", sendf(data->firstsocket, data, "TYPE %s\r\n",
(data->bits.ftp_ascii)?"A":"I"); (data->bits.ftp_ascii)?"A":"I");
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "200", 3)) { if(strncmp(buf, "200", 3)) {
failf(data, "Couldn't set %s mode", failf(data, "Couldn't set %s mode",
@@ -793,7 +902,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file); sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "213", 3)) { if(strncmp(buf, "213", 3)) {
failf(data, "Couldn't get file size: %s", buf+4); failf(data, "Couldn't get file size: %s", buf+4);
@@ -814,7 +925,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from); sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "350", 3)) { if(strncmp(buf, "350", 3)) {
failf(data, "Couldn't use REST: %s", buf+4); failf(data, "Couldn't use REST: %s", buf+4);
@@ -866,7 +979,9 @@ CURLcode _ftp(struct connectdata *conn)
else else
sendf(data->firstsocket, data, "STOR %s\r\n", ftp->file); sendf(data->firstsocket, data, "STOR %s\r\n", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(atoi(buf)>=400) { if(atoi(buf)>=400) {
failf(data, "Failed FTP upload:%s", buf+3); failf(data, "Failed FTP upload:%s", buf+3);
@@ -950,7 +1065,9 @@ CURLcode _ftp(struct connectdata *conn)
/* Set type to ASCII */ /* Set type to ASCII */
sendf(data->firstsocket, data, "TYPE A\r\n"); sendf(data->firstsocket, data, "TYPE A\r\n");
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "200", 3)) { if(strncmp(buf, "200", 3)) {
failf(data, "Couldn't set ascii mode"); failf(data, "Couldn't set ascii mode");
@@ -970,7 +1087,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "TYPE %s\r\n", sendf(data->firstsocket, data, "TYPE %s\r\n",
(data->bits.ftp_list_only)?"A":"I"); (data->bits.ftp_list_only)?"A":"I");
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "200", 3)) { if(strncmp(buf, "200", 3)) {
failf(data, "Couldn't set %s mode", failf(data, "Couldn't set %s mode",
@@ -989,7 +1108,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file); sendf(data->firstsocket, data, "SIZE %s\r\n", ftp->file);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "213", 3)) { if(strncmp(buf, "213", 3)) {
infof(data, "server doesn't support SIZE: %s", buf+4); infof(data, "server doesn't support SIZE: %s", buf+4);
@@ -1031,7 +1152,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from); sendf(data->firstsocket, data, "REST %d\r\n", data->resume_from);
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(strncmp(buf, "350", 3)) { if(strncmp(buf, "350", 3)) {
failf(data, "Couldn't use REST: %s", buf+4); failf(data, "Couldn't use REST: %s", buf+4);
@@ -1042,7 +1165,9 @@ CURLcode _ftp(struct connectdata *conn)
sendf(data->firstsocket, data, "RETR %s\r\n", ftp->file); sendf(data->firstsocket, data, "RETR %s\r\n", ftp->file);
} }
nread = GetLastResponse(data->firstsocket, buf, data); nread = GetLastResponse(data->firstsocket, buf, conn);
if(nread < 0)
return CURLE_OPERATION_TIMEOUTED;
if(!strncmp(buf, "150", 3) || !strncmp(buf, "125", 3)) { if(!strncmp(buf, "150", 3) || !strncmp(buf, "125", 3)) {
@@ -1065,12 +1190,16 @@ CURLcode _ftp(struct connectdata *conn)
int size=-1; /* default unknown size */ int size=-1; /* default unknown size */
if(!dirlist && (-1 == downloadsize)) { if(!dirlist &&
!data->bits.ftp_ascii &&
(-1 == downloadsize)) {
/* /*
* It seems directory listings either don't show the size or very * It seems directory listings either don't show the size or very
* often uses size 0 anyway. * often uses size 0 anyway. ASCII transfers may very well turn out
* Example D above makes this parsing a little tricky * that the transfered amount of data is not the same as this line
*/ * tells, why using this number in those cases only confuses us.
*
* Example D above makes this parsing a little tricky */
char *bytes; char *bytes;
bytes=strstr(buf, " bytes"); bytes=strstr(buf, " bytes");
if(bytes--) { if(bytes--) {

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -33,10 +33,20 @@
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include "config.h"
# ifdef HAVE_ALLOCA_H # ifdef HAVE_ALLOCA_H
# include <alloca.h> # include <alloca.h>
# endif # endif
# ifdef NEED_REENTRANT
# define _REENTRANT /* Necessary to use in Solaris, since the silly guys at
Sun made the localtime_r() prototype dependent on it
(or _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS) */
# endif
# ifdef HAVE_TIME_H
# include <time.h>
# endif
#endif #endif
/* Since the code of getdate.y is not included in the Emacs executable /* Since the code of getdate.y is not included in the Emacs executable
@@ -212,7 +222,7 @@ static int yyRelSeconds;
static int yyRelYear; static int yyRelYear;
#line 195 "getdate.y" #line 205 "getdate.y"
typedef union { typedef union {
int Number; int Number;
enum _MERIDIAN Meridian; enum _MERIDIAN Meridian;
@@ -295,11 +305,11 @@ static const short yyrhs[] = { -1,
#if YYDEBUG != 0 #if YYDEBUG != 0
static const short yyrline[] = { 0, static const short yyrline[] = { 0,
211, 212, 215, 218, 221, 224, 227, 230, 233, 239, 221, 222, 225, 228, 231, 234, 237, 240, 243, 249,
245, 254, 260, 272, 275, 278, 284, 288, 292, 298, 255, 264, 270, 282, 285, 288, 294, 298, 302, 308,
302, 320, 326, 332, 336, 341, 345, 352, 360, 363, 312, 330, 336, 342, 346, 351, 355, 362, 370, 373,
366, 369, 372, 375, 378, 381, 384, 387, 390, 393, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403,
396, 399, 402, 405, 408, 411, 414, 419, 452, 456 406, 409, 412, 415, 418, 421, 424, 429, 462, 466
}; };
#endif #endif
@@ -380,7 +390,7 @@ static const short yycheck[] = { 0,
56 56
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/local/share/bison.simple" #line 3 "/opt/TWWfsw/bison/share/bison.simple"
/* This file comes from bison-1.28. */ /* This file comes from bison-1.28. */
/* Skeleton output parser for bison, /* Skeleton output parser for bison,
@@ -594,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#endif #endif
#endif #endif
#line 217 "/usr/local/share/bison.simple" #line 217 "/opt/TWWfsw/bison/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed /* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *. into yyparse. The argument should have type void *.
@@ -923,37 +933,37 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 3: case 3:
#line 215 "getdate.y" #line 225 "getdate.y"
{ {
yyHaveTime++; yyHaveTime++;
; ;
break;} break;}
case 4: case 4:
#line 218 "getdate.y" #line 228 "getdate.y"
{ {
yyHaveZone++; yyHaveZone++;
; ;
break;} break;}
case 5: case 5:
#line 221 "getdate.y" #line 231 "getdate.y"
{ {
yyHaveDate++; yyHaveDate++;
; ;
break;} break;}
case 6: case 6:
#line 224 "getdate.y" #line 234 "getdate.y"
{ {
yyHaveDay++; yyHaveDay++;
; ;
break;} break;}
case 7: case 7:
#line 227 "getdate.y" #line 237 "getdate.y"
{ {
yyHaveRel++; yyHaveRel++;
; ;
break;} break;}
case 9: case 9:
#line 233 "getdate.y" #line 243 "getdate.y"
{ {
yyHour = yyvsp[-1].Number; yyHour = yyvsp[-1].Number;
yyMinutes = 0; yyMinutes = 0;
@@ -962,7 +972,7 @@ case 9:
; ;
break;} break;}
case 10: case 10:
#line 239 "getdate.y" #line 249 "getdate.y"
{ {
yyHour = yyvsp[-3].Number; yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number; yyMinutes = yyvsp[-1].Number;
@@ -971,7 +981,7 @@ case 10:
; ;
break;} break;}
case 11: case 11:
#line 245 "getdate.y" #line 255 "getdate.y"
{ {
yyHour = yyvsp[-3].Number; yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number; yyMinutes = yyvsp[-1].Number;
@@ -983,7 +993,7 @@ case 11:
; ;
break;} break;}
case 12: case 12:
#line 254 "getdate.y" #line 264 "getdate.y"
{ {
yyHour = yyvsp[-5].Number; yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number; yyMinutes = yyvsp[-3].Number;
@@ -992,7 +1002,7 @@ case 12:
; ;
break;} break;}
case 13: case 13:
#line 260 "getdate.y" #line 270 "getdate.y"
{ {
yyHour = yyvsp[-5].Number; yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number; yyMinutes = yyvsp[-3].Number;
@@ -1005,53 +1015,53 @@ case 13:
; ;
break;} break;}
case 14: case 14:
#line 272 "getdate.y" #line 282 "getdate.y"
{ {
yyTimezone = yyvsp[0].Number; yyTimezone = yyvsp[0].Number;
; ;
break;} break;}
case 15: case 15:
#line 275 "getdate.y" #line 285 "getdate.y"
{ {
yyTimezone = yyvsp[0].Number - 60; yyTimezone = yyvsp[0].Number - 60;
; ;
break;} break;}
case 16: case 16:
#line 279 "getdate.y" #line 289 "getdate.y"
{ {
yyTimezone = yyvsp[-1].Number - 60; yyTimezone = yyvsp[-1].Number - 60;
; ;
break;} break;}
case 17: case 17:
#line 284 "getdate.y" #line 294 "getdate.y"
{ {
yyDayOrdinal = 1; yyDayOrdinal = 1;
yyDayNumber = yyvsp[0].Number; yyDayNumber = yyvsp[0].Number;
; ;
break;} break;}
case 18: case 18:
#line 288 "getdate.y" #line 298 "getdate.y"
{ {
yyDayOrdinal = 1; yyDayOrdinal = 1;
yyDayNumber = yyvsp[-1].Number; yyDayNumber = yyvsp[-1].Number;
; ;
break;} break;}
case 19: case 19:
#line 292 "getdate.y" #line 302 "getdate.y"
{ {
yyDayOrdinal = yyvsp[-1].Number; yyDayOrdinal = yyvsp[-1].Number;
yyDayNumber = yyvsp[0].Number; yyDayNumber = yyvsp[0].Number;
; ;
break;} break;}
case 20: case 20:
#line 298 "getdate.y" #line 308 "getdate.y"
{ {
yyMonth = yyvsp[-2].Number; yyMonth = yyvsp[-2].Number;
yyDay = yyvsp[0].Number; yyDay = yyvsp[0].Number;
; ;
break;} break;}
case 21: case 21:
#line 302 "getdate.y" #line 312 "getdate.y"
{ {
/* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY.
The goal in recognizing YYYY/MM/DD is solely to support legacy The goal in recognizing YYYY/MM/DD is solely to support legacy
@@ -1072,7 +1082,7 @@ case 21:
; ;
break;} break;}
case 22: case 22:
#line 320 "getdate.y" #line 330 "getdate.y"
{ {
/* ISO 8601 format. yyyy-mm-dd. */ /* ISO 8601 format. yyyy-mm-dd. */
yyYear = yyvsp[-2].Number; yyYear = yyvsp[-2].Number;
@@ -1081,7 +1091,7 @@ case 22:
; ;
break;} break;}
case 23: case 23:
#line 326 "getdate.y" #line 336 "getdate.y"
{ {
/* e.g. 17-JUN-1992. */ /* e.g. 17-JUN-1992. */
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@@ -1090,14 +1100,14 @@ case 23:
; ;
break;} break;}
case 24: case 24:
#line 332 "getdate.y" #line 342 "getdate.y"
{ {
yyMonth = yyvsp[-1].Number; yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[0].Number; yyDay = yyvsp[0].Number;
; ;
break;} break;}
case 25: case 25:
#line 336 "getdate.y" #line 346 "getdate.y"
{ {
yyMonth = yyvsp[-3].Number; yyMonth = yyvsp[-3].Number;
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@@ -1105,14 +1115,14 @@ case 25:
; ;
break;} break;}
case 26: case 26:
#line 341 "getdate.y" #line 351 "getdate.y"
{ {
yyMonth = yyvsp[0].Number; yyMonth = yyvsp[0].Number;
yyDay = yyvsp[-1].Number; yyDay = yyvsp[-1].Number;
; ;
break;} break;}
case 27: case 27:
#line 345 "getdate.y" #line 355 "getdate.y"
{ {
yyMonth = yyvsp[-1].Number; yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@@ -1120,7 +1130,7 @@ case 27:
; ;
break;} break;}
case 28: case 28:
#line 352 "getdate.y" #line 362 "getdate.y"
{ {
yyRelSeconds = -yyRelSeconds; yyRelSeconds = -yyRelSeconds;
yyRelMinutes = -yyRelMinutes; yyRelMinutes = -yyRelMinutes;
@@ -1131,115 +1141,115 @@ case 28:
; ;
break;} break;}
case 30: case 30:
#line 363 "getdate.y" #line 373 "getdate.y"
{ {
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number; yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 31: case 31:
#line 366 "getdate.y" #line 376 "getdate.y"
{ {
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number; yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 32: case 32:
#line 369 "getdate.y" #line 379 "getdate.y"
{ {
yyRelYear += yyvsp[0].Number; yyRelYear += yyvsp[0].Number;
; ;
break;} break;}
case 33: case 33:
#line 372 "getdate.y" #line 382 "getdate.y"
{ {
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 34: case 34:
#line 375 "getdate.y" #line 385 "getdate.y"
{ {
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 35: case 35:
#line 378 "getdate.y" #line 388 "getdate.y"
{ {
yyRelMonth += yyvsp[0].Number; yyRelMonth += yyvsp[0].Number;
; ;
break;} break;}
case 36: case 36:
#line 381 "getdate.y" #line 391 "getdate.y"
{ {
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number; yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 37: case 37:
#line 384 "getdate.y" #line 394 "getdate.y"
{ {
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number; yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 38: case 38:
#line 387 "getdate.y" #line 397 "getdate.y"
{ {
yyRelDay += yyvsp[0].Number; yyRelDay += yyvsp[0].Number;
; ;
break;} break;}
case 39: case 39:
#line 390 "getdate.y" #line 400 "getdate.y"
{ {
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number; yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 40: case 40:
#line 393 "getdate.y" #line 403 "getdate.y"
{ {
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number; yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 41: case 41:
#line 396 "getdate.y" #line 406 "getdate.y"
{ {
yyRelHour += yyvsp[0].Number; yyRelHour += yyvsp[0].Number;
; ;
break;} break;}
case 42: case 42:
#line 399 "getdate.y" #line 409 "getdate.y"
{ {
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number; yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 43: case 43:
#line 402 "getdate.y" #line 412 "getdate.y"
{ {
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number; yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 44: case 44:
#line 405 "getdate.y" #line 415 "getdate.y"
{ {
yyRelMinutes += yyvsp[0].Number; yyRelMinutes += yyvsp[0].Number;
; ;
break;} break;}
case 45: case 45:
#line 408 "getdate.y" #line 418 "getdate.y"
{ {
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 46: case 46:
#line 411 "getdate.y" #line 421 "getdate.y"
{ {
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 47: case 47:
#line 414 "getdate.y" #line 424 "getdate.y"
{ {
yyRelSeconds += yyvsp[0].Number; yyRelSeconds += yyvsp[0].Number;
; ;
break;} break;}
case 48: case 48:
#line 420 "getdate.y" #line 430 "getdate.y"
{ {
if (yyHaveTime && yyHaveDate && !yyHaveRel) if (yyHaveTime && yyHaveDate && !yyHaveRel)
yyYear = yyvsp[0].Number; yyYear = yyvsp[0].Number;
@@ -1272,20 +1282,20 @@ case 48:
; ;
break;} break;}
case 49: case 49:
#line 453 "getdate.y" #line 463 "getdate.y"
{ {
yyval.Meridian = MER24; yyval.Meridian = MER24;
; ;
break;} break;}
case 50: case 50:
#line 457 "getdate.y" #line 467 "getdate.y"
{ {
yyval.Meridian = yyvsp[0].Meridian; yyval.Meridian = yyvsp[0].Meridian;
; ;
break;} break;}
} }
/* the action file gets copied in in place of this dollarsign */ /* the action file gets copied in in place of this dollarsign */
#line 543 "/usr/local/share/bison.simple" #line 543 "/opt/TWWfsw/bison/share/bison.simple"
yyvsp -= yylen; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
@@ -1505,7 +1515,7 @@ yyerrhandle:
} }
return 1; return 1;
} }
#line 462 "getdate.y" #line 472 "getdate.y"
/* Include this file down here because bison inserts code above which /* Include this file down here because bison inserts code above which
@@ -1965,10 +1975,16 @@ curl_getdate (const char *p, const time_t *now)
{ {
struct tm tm, tm0, *tmp; struct tm tm, tm0, *tmp;
time_t Start; time_t Start;
#ifdef HAVE_LOCALTIME_R
struct tm keeptime;
#endif
yyInput = p; yyInput = p;
Start = now ? *now : time ((time_t *) NULL); Start = now ? *now : time ((time_t *) NULL);
#ifdef HAVE_LOCALTIME_R
tmp = localtime_r(&Start, &keeptime);
#else
tmp = localtime (&Start); tmp = localtime (&Start);
#endif
if (!tmp) if (!tmp)
return -1; return -1;
yyYear = tmp->tm_year + TM_YEAR_ORIGIN; yyYear = tmp->tm_year + TM_YEAR_ORIGIN;

View File

@@ -9,10 +9,20 @@
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include <config.h> # include "config.h"
# ifdef HAVE_ALLOCA_H # ifdef HAVE_ALLOCA_H
# include <alloca.h> # include <alloca.h>
# endif # endif
# ifdef NEED_REENTRANT
# define _REENTRANT /* Necessary to use in Solaris, since the silly guys at
Sun made the localtime_r() prototype dependent on it
(or _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS) */
# endif
# ifdef HAVE_TIME_H
# include <time.h>
# endif
#endif #endif
/* Since the code of getdate.y is not included in the Emacs executable /* Since the code of getdate.y is not included in the Emacs executable
@@ -918,10 +928,16 @@ curl_getdate (const char *p, const time_t *now)
{ {
struct tm tm, tm0, *tmp; struct tm tm, tm0, *tmp;
time_t Start; time_t Start;
#ifdef HAVE_LOCALTIME_R
struct tm keeptime;
#endif
yyInput = p; yyInput = p;
Start = now ? *now : time ((time_t *) NULL); Start = now ? *now : time ((time_t *) NULL);
#ifdef HAVE_LOCALTIME_R
tmp = localtime_r(&Start, &keeptime);
#else
tmp = localtime (&Start); tmp = localtime (&Start);
#endif
if (!tmp) if (!tmp)
return -1; return -1;
yyYear = tmp->tm_year + TM_YEAR_ORIGIN; yyYear = tmp->tm_year + TM_YEAR_ORIGIN;

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -60,7 +60,7 @@ char *GetEnv(char *variable)
return env?strdup(env):NULL; return env?strdup(env):NULL;
} }
char *curl_GetEnv(char *v) char *curl_getenv(char *v)
{ {
return GetEnv(v); return GetEnv(v);
} }

View File

@@ -30,17 +30,17 @@
* Linas Vepstas <linas@linas.org> * Linas Vepstas <linas@linas.org>
* Bjorn Reese <breese@imada.ou.dk> * Bjorn Reese <breese@imada.ou.dk>
* Johan Anderson <johan@homemail.com> * Johan Anderson <johan@homemail.com>
* Kjell Ericson <Kjell.Ericson@haxx.nu> * Kjell Ericson <Kjell.Ericson@haxx.se>
* Troy Engel <tengel@palladium.net> * Troy Engel <tengel@palladium.net>
* Ryan Nelson <ryan@inch.com> * Ryan Nelson <ryan@inch.com>
* Bjorn Stenberg <Bjorn.Stenberg@haxx.nu> * Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
* Angus Mackay <amackay@gus.ml.org> * Angus Mackay <amackay@gus.ml.org>
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -51,7 +51,10 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* $Log$ * $Log$
* Revision 1.2 2000-01-10 23:36:14 bagder * Revision 1.3 2000-06-20 15:31:26 bagder
* haxx.nu => haxx.se
*
* Revision 1.2 2000/01/10 23:36:14 bagder
* syncing with local edit * syncing with local edit
* *
* Revision 1.3 1999/09/06 06:59:40 dast * Revision 1.3 1999/09/06 06:59:40 dast

View File

@@ -31,7 +31,7 @@
* Angus Mackay <amackay@gus.ml.org> * Angus Mackay <amackay@gus.ml.org>
* *
* Contributor(s): * Contributor(s):
* Daniel Stenberg <Daniel.Stenberg@haxx.nu> * Daniel Stenberg <daniel@haxx.se>
*/ */
#ifndef WIN32 #ifndef WIN32

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -49,7 +51,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#include "strequal.h" #include "strequal.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
@@ -84,9 +85,6 @@
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#ifndef HAVE_VPRINTF
#error "We can't compile without vprintf() support!"
#endif
#ifndef HAVE_SELECT #ifndef HAVE_SELECT
#error "We can't compile without select() support!" #error "We can't compile without select() support!"
#endif #endif
@@ -115,7 +113,7 @@
#include <curl/mprintf.h> #include <curl/mprintf.h>
CURLcode CURLcode
_Transfer (struct connectdata *c_conn) _Transfer(struct connectdata *c_conn)
{ {
size_t nread; /* number of bytes read */ size_t nread; /* number of bytes read */
int bytecount = 0; /* total number of bytes read */ int bytecount = 0; /* total number of bytes read */
@@ -375,13 +373,18 @@ _Transfer (struct connectdata *c_conn)
if (strnequal("Content-Length", p, 14) && if (strnequal("Content-Length", p, 14) &&
sscanf (p+14, ": %ld", &contentlength)) sscanf (p+14, ": %ld", &contentlength))
conn->size = contentlength; conn->size = contentlength;
else if (strnequal("Content-Range", p, 13) && else if (strnequal("Content-Range", p, 13)) {
sscanf (p+13, ": bytes %d-", &offset)) { if (sscanf (p+13, ": bytes %d-", &offset) ||
sscanf (p+13, ": bytes: %d-", &offset)) {
/* This second format was added August 1st by Igor
Khristophorov since Sun's webserver JavaWebServer/1.1.1
obviously sends the header this way! :-( */
if (data->resume_from == offset) { if (data->resume_from == offset) {
/* we asked for a resume and we got it */ /* we asked for a resume and we got it */
content_range = TRUE; content_range = TRUE;
} }
} }
}
else if(data->cookies && else if(data->cookies &&
strnequal("Set-Cookie: ", p, 11)) { strnequal("Set-Cookie: ", p, 11)) {
cookie_add(data->cookies, TRUE, &p[12]); cookie_add(data->cookies, TRUE, &p[12]);
@@ -440,7 +443,7 @@ _Transfer (struct connectdata *c_conn)
/* This is not an 'else if' since it may be a rest from the header /* This is not an 'else if' since it may be a rest from the header
parsing, where the beginning of the buffer is headers and the end parsing, where the beginning of the buffer is headers and the end
is non-headers. */ is non-headers. */
if (str && !header && (nread > 0)) { if (str && !header && ((signed int)nread > 0)) {
if(0 == bodywrites) { if(0 == bodywrites) {
/* These checks are only made the first time we are about to /* These checks are only made the first time we are about to
@@ -490,7 +493,7 @@ _Transfer (struct connectdata *c_conn)
if(data->maxdownload && if(data->maxdownload &&
(bytecount + nread > data->maxdownload)) { (bytecount + nread > data->maxdownload)) {
nread = data->maxdownload - bytecount; nread = data->maxdownload - bytecount;
if(nread < 0 ) /* this should be unusual */ if((signed int)nread < 0 ) /* this should be unusual */
nread = 0; nread = 0;
keepon &= ~KEEP_READ; /* we're done reading */ keepon &= ~KEEP_READ; /* we're done reading */
} }
@@ -512,21 +515,22 @@ _Transfer (struct connectdata *c_conn)
char scratch[BUFSIZE * 2]; char scratch[BUFSIZE * 2];
int i, si; int i, si;
int bytes_written; size_t bytes_written;
if(data->crlf) if(data->crlf)
buf = data->buffer; /* put it back on the buffer */ buf = data->buffer; /* put it back on the buffer */
nread = data->fread(buf, 1, BUFSIZE, data->in); nread = data->fread(buf, 1, BUFSIZE, data->in);
writebytecount += nread;
pgrsSetUploadCounter(data, (double)writebytecount); /* the signed int typecase of nread of for systems that has
unsigned size_t */
if (nread<=0) { if ((signed int)nread<=0) {
/* done */ /* done */
keepon &= ~KEEP_WRITE; /* we're done writing */ keepon &= ~KEEP_WRITE; /* we're done writing */
break; break;
} }
writebytecount += nread;
pgrsSetUploadCounter(data, (double)writebytecount);
/* convert LF to CRLF if so asked */ /* convert LF to CRLF if so asked */
if (data->crlf) { if (data->crlf) {
@@ -596,6 +600,8 @@ CURLcode curl_transfer(CURL *curl)
struct UrlData *data = curl; struct UrlData *data = curl;
struct connectdata *c_connect; struct connectdata *c_connect;
pgrsStartNow(data);
do { do {
res = curl_connect(curl, (CURLconnect **)&c_connect); res = curl_connect(curl, (CURLconnect **)&c_connect);
if(res == CURLE_OK) { if(res == CURLE_OK) {
@@ -611,6 +617,24 @@ CURLcode curl_transfer(CURL *curl)
char prot[16]; char prot[16];
char path[URL_MAX_LENGTH]; char path[URL_MAX_LENGTH];
/* mark the next request as a followed location: */
data->bits.this_is_a_follow = TRUE;
if(data->bits.http_auto_referer) {
/* We are asked to automatically set the previous URL as the
referer when we get the next URL. We pick the ->url field,
which may or may not be 100% correct */
if(data->free_referer) {
/* If we already have an allocated referer, free this first */
free(data->referer);
}
data->referer = strdup(data->url);
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 if(2 != sscanf(data->newurl, "%15[^:]://%" URL_MAX_LENGTH_TXT
"s", prot, path)) { "s", prot, path)) {
/*** /***
@@ -678,6 +702,11 @@ CURLcode curl_transfer(CURL *curl)
data->url = data->newurl; data->url = data->newurl;
data->newurl = NULL; /* don't show! */ data->newurl = NULL; /* don't show! */
/* 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); infof(data, "Follows Location: to new URL: '%s'\n", data->url);
curl_disconnect(c_connect); curl_disconnect(c_connect);
@@ -700,67 +729,3 @@ CURLcode curl_transfer(CURL *curl)
return res; return res;
} }
#if 0
CURLcode curl_urlget(UrgTag tag, ...)
{
va_list arg;
func_T param_func = (func_T)0;
long param_long = 0;
void *param_obj = NULL;
CURLcode res;
struct UrlData *data;
/* this is for the lame win32 socket crap */
if(curl_init())
return CURLE_FAILED_INIT;
/* We use curl_open() with undefined URL so far */
res = curl_open(&data, NULL);
if(res != CURLE_OK)
return CURLE_FAILED_INIT;
/* data is now filled with good-looking zeroes */
va_start(arg, tag);
while(tag != URGTAG_DONE) {
/* PORTING NOTE:
Object pointers can't necessarily be casted to function pointers and
therefore we need to know what type it is and read the correct type
at once. This should also correct problems with different sizes of
the types.
*/
if(tag < URGTYPE_OBJECTPOINT) {
/* This is a LONG type */
param_long = va_arg(arg, long);
curl_setopt(data, tag, param_long);
}
else if(tag < URGTYPE_FUNCTIONPOINT) {
/* This is a object pointer type */
param_obj = va_arg(arg, void *);
curl_setopt(data, tag, param_obj);
}
else {
param_func = va_arg(arg, func_T );
curl_setopt(data, tag, param_func);
}
/* printf("tag: %d\n", tag); */
tag = va_arg(arg, UrgTag);
}
va_end(arg);
pgrsMode(data, data->progress.mode);
pgrsStartNow(data);
/********* Now, connect to the remote site **********/
res = curl_transfer(data);
curl_close(data);
return res;
}
#endif

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,10 +38,13 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <errno.h>
#include "setup.h" #define _REENTRANT
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
@@ -52,8 +55,12 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
@@ -62,7 +69,7 @@
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#ifdef HAVE_INET_NTOA_R #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h" #include "inet_ntoa_r.h"
#endif #endif
@@ -101,6 +108,7 @@ struct hostent *GetHost(struct UrlData *data,
{ {
struct hostent *h = NULL; struct hostent *h = NULL;
unsigned long in; unsigned long in;
int ret;
if ( (in=inet_addr(hostname)) != INADDR_NONE ) { if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
struct in_addr *addrentry; struct in_addr *addrentry;
@@ -113,21 +121,52 @@ struct hostent *GetHost(struct UrlData *data,
h->h_addr_list[1] = NULL; h->h_addr_list[1] = NULL;
h->h_addrtype = AF_INET; h->h_addrtype = AF_INET;
h->h_length = sizeof(*addrentry); h->h_length = sizeof(*addrentry);
h->h_name = (char*)(h->h_addr_list + h->h_length); h->h_name = *(h->h_addr_list) + h->h_length;
/* bad one h->h_name = (char*)(h->h_addr_list + h->h_length); */
MakeIP(ntohl(in),h->h_name,buf_size - (long)(h->h_name) + (long)buf); MakeIP(ntohl(in),h->h_name,buf_size - (long)(h->h_name) + (long)buf);
#if defined(HAVE_GETHOSTBYNAME_R)
} }
#if defined(HAVE_GETHOSTBYNAME_R)
else { else {
int h_errnop; int h_errnop;
memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */ memset(buf,0,buf_size); /* workaround for gethostbyname_r bug in qnx nto */
#ifdef HAVE_GETHOSTBYNAME_R_5
/* Solaris, IRIX and more */
if ((h = gethostbyname_r(hostname, if ((h = gethostbyname_r(hostname,
(struct hostent *)buf,buf + (struct hostent *)buf,
sizeof(struct hostent),buf_size - buf + sizeof(struct hostent),
sizeof(struct hostent),&h_errnop)) == NULL ) { buf_size - sizeof(struct hostent),
&h_errnop)) == NULL )
#endif
#ifdef HAVE_GETHOSTBYNAME_R_6
/* Linux */
if( gethostbyname_r(hostname,
(struct hostent *)buf,
buf + sizeof(struct hostent),
buf_size - sizeof(struct hostent),
&h, /* DIFFERENCE */
&h_errnop))
#endif
#ifdef HAVE_GETHOSTBYNAME_R_3
/* AIX, Digital Unix, HPUX 10, more? */
/* August 4th, 2000. I don't have any such system around so I write this
blindly in hope it might work or that someone else will help me fix
this. August 22nd, 2000: Albert Chin-A-Young brought an updated version
that should work! */
ret = gethostbyname_r(hostname,
(struct hostent *)buf,
(struct hostent_data *)(buf + sizeof(struct hostent)));
/* result expected in h */
h = (struct hostent*)buf;
h_errnop= errno; /* we don't deal with this, but set it anyway */
if(ret)
#endif
{
infof(data, "gethostbyname_r(2) failed for %s\n", hostname); infof(data, "gethostbyname_r(2) failed for %s\n", hostname);
} }
#else #else
}
else { else {
if ((h = gethostbyname(hostname)) == NULL ) { if ((h = gethostbyname(hostname)) == NULL ) {
infof(data, "gethostbyname(2) failed for %s\n", hostname); infof(data, "gethostbyname(2) failed for %s\n", hostname);

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -49,7 +51,12 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#ifdef NEED_REENTRANT
#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun
made the localtime_r() prototype dependent on it (or
_POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */
#endif
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
@@ -59,8 +66,17 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#ifdef HAVE_TIME_H
#ifdef TIME_WITH_SYS_TIME
#include <time.h>
#endif
#endif
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
@@ -107,11 +123,11 @@
*/ */
bool static checkheaders(struct UrlData *data, char *thisheader) bool static checkheaders(struct UrlData *data, char *thisheader)
{ {
struct HttpHeader *head; struct curl_slist *head;
size_t thislen = strlen(thisheader); size_t thislen = strlen(thisheader);
for(head = data->headers; head; head=head->next) { for(head = data->headers; head; head=head->next) {
if(strnequal(head->header, thisheader, thislen)) { if(strnequal(head->data, thisheader, thislen)) {
return TRUE; return TRUE;
} }
} }
@@ -176,8 +192,24 @@ CURLcode http_connect(struct connectdata *conn)
} }
} }
if(data->bits.user_passwd && !data->bits.this_is_a_follow) {
/* Authorization: is requested, this is not a followed location, get the
original host name */
data->auth_host = strdup(data->hostname);
}
return CURLE_OK; return CURLE_OK;
} }
/* called from curl_close() when this struct is about to get wasted, free
protocol-specific resources */
CURLcode 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 http_done(struct connectdata *conn)
{ {
struct UrlData *data; struct UrlData *data;
@@ -209,7 +241,7 @@ CURLcode http(struct connectdata *conn)
{ {
struct UrlData *data=conn->data; struct UrlData *data=conn->data;
char *buf = data->buffer; /* this is a short cut to the buffer */ char *buf = data->buffer; /* this is a short cut to the buffer */
CURLcode result; CURLcode result=CURLE_OK;
struct HTTP *http; struct HTTP *http;
struct Cookie *co=NULL; /* no cookies from start */ struct Cookie *co=NULL; /* no cookies from start */
char *ppath = conn->ppath; /* three previous function arguments */ char *ppath = conn->ppath; /* three previous function arguments */
@@ -238,11 +270,18 @@ CURLcode http(struct connectdata *conn)
if((data->bits.user_passwd) && !checkheaders(data, "Authorization:")) { if((data->bits.user_passwd) && !checkheaders(data, "Authorization:")) {
char authorization[512]; char authorization[512];
/* To prevent the user+password to get sent to other than the original
host due to a location-follow, we do some weirdo checks here */
if(!data->bits.this_is_a_follow ||
!data->auth_host ||
strequal(data->auth_host, data->hostname)) {
sprintf(data->buffer, "%s:%s", data->user, data->passwd); sprintf(data->buffer, "%s:%s", data->user, data->passwd);
base64Encode(data->buffer, authorization); base64Encode(data->buffer, authorization);
data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012", data->ptr_userpwd = maprintf( "Authorization: Basic %s\015\012",
authorization); authorization);
} }
}
if((data->bits.set_range) && !checkheaders(data, "Range:")) { if((data->bits.set_range) && !checkheaders(data, "Range:")) {
data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range); data->ptr_rangeline = maprintf("Range: bytes=%s\015\012", data->range);
} }
@@ -269,9 +308,9 @@ CURLcode http(struct connectdata *conn)
http->sendit = getFormData(data->httppost, &http->postsize); http->sendit = getFormData(data->httppost, &http->postsize);
} }
if(!checkheaders(data, "Host:")) if(!checkheaders(data, "Host:")) {
data->ptr_host = maprintf("Host: %s\r\n", host); data->ptr_host = maprintf("Host: %s:%d\r\n", host, data->remote_port);
}
if(!checkheaders(data, "Pragma:")) if(!checkheaders(data, "Pragma:"))
http->p_pragma = "Pragma: no-cache\r\n"; http->p_pragma = "Pragma: no-cache\r\n";
@@ -280,6 +319,7 @@ CURLcode http(struct connectdata *conn)
http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n"; http->p_accept = "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*\r\n";
do { do {
struct curl_slist *headers=data->headers;
sendf(data->firstsocket, data, sendf(data->firstsocket, data,
"%s " /* GET/HEAD/POST/PUT */ "%s " /* GET/HEAD/POST/PUT */
"%s HTTP/1.0\r\n" /* path */ "%s HTTP/1.0\r\n" /* path */
@@ -336,7 +376,17 @@ CURLcode http(struct connectdata *conn)
if(data->timecondition) { if(data->timecondition) {
struct tm *thistime; struct tm *thistime;
#ifdef HAVE_LOCALTIME_R
/* thread-safe version */
struct tm keeptime;
thistime = (struct tm *)localtime_r(&data->timevalue, &keeptime);
#else
thistime = localtime(&data->timevalue); thistime = localtime(&data->timevalue);
#endif
if(NULL == thistime) {
failf(data, "localtime() failed!");
return CURLE_OUT_OF_MEMORY;
}
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
/* format: "Tue, 15 Nov 1994 12:45:26 GMT" */ /* format: "Tue, 15 Nov 1994 12:45:26 GMT" */
@@ -362,25 +412,27 @@ CURLcode http(struct connectdata *conn)
} }
} }
while(data->headers) { while(headers) {
char *ptr = strchr(headers->data, ':');
if(ptr) {
/* we require a colon for this to be a true header */
ptr++; /* pass the colon */
while(*ptr && isspace(*ptr))
ptr++;
if(*ptr) {
/* only send this if the contents was non-blank */
sendf(data->firstsocket, data, sendf(data->firstsocket, data,
"%s\015\012", "%s\015\012",
data->headers->header); headers->data);
data->headers = data->headers->next; }
}
headers = headers->next;
} }
if(data->bits.http_post || data->bits.http_formpost) { if(data->bits.http_formpost) {
if(data->bits.http_post) {
/* this is the simple x-www-form-urlencoded style */
sendf(data->firstsocket, data,
"Content-Length: %d\015\012"
"Content-Type: application/x-www-form-urlencoded\r\n\r\n"
"%s\015\012",
strlen(data->postfields),
data->postfields );
}
else {
if(FormInit(&http->form, http->sendit)) { if(FormInit(&http->form, http->sendit)) {
failf(data, "Internal HTTP POST error!\n"); failf(data, "Internal HTTP POST error!\n");
return CURLE_HTTP_POST_ERROR; return CURLE_HTTP_POST_ERROR;
@@ -410,7 +462,6 @@ CURLcode http(struct connectdata *conn)
return result; return result;
} }
} }
}
else if(data->bits.http_put) { else if(data->bits.http_put) {
/* Let's PUT the data to the server! */ /* Let's PUT the data to the server! */
@@ -434,6 +485,33 @@ CURLcode http(struct connectdata *conn)
} }
else { else {
if(data->bits.http_post) {
/* this is the simple POST, using x-www-form-urlencoded style */
if(!checkheaders(data, "Content-Length:"))
/* we allow replacing this header, although it isn't very wise to
actually set your own */
sendf(data->firstsocket, data,
"Content-Length: %d\r\n",
(data->postfieldsize?data->postfieldsize:
strlen(data->postfields)) );
if(!checkheaders(data, "Content-Type:"))
sendf(data->firstsocket, data,
"Content-Type: application/x-www-form-urlencoded\r\n");
/* and here comes the actual data */
if(data->postfieldsize) {
ssend(data->firstsocket, data, "\r\n", 2);
ssend(data->firstsocket, data, data->postfields, data->postfieldsize);
ssend(data->firstsocket, data, "\r\n", 2);
}
sendf(data->firstsocket, data,
"\r\n"
"%s\r\n",
data->postfields );
}
else
sendf(data->firstsocket, data, "\r\n"); sendf(data->firstsocket, data, "\r\n");
/* HTTP GET/HEAD download: */ /* HTTP GET/HEAD download: */

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -41,8 +41,11 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
/* protocol-specific functions set up to be called by the main engine */
CURLcode http(struct connectdata *conn); CURLcode http(struct connectdata *conn);
CURLcode http_done(struct connectdata *conn); CURLcode http_done(struct connectdata *conn);
CURLcode http_connect(struct connectdata *conn); CURLcode http_connect(struct connectdata *conn);
CURLcode http_close(struct connectdata *conn);
#endif #endif

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,11 +38,12 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "setup.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
@@ -50,12 +51,24 @@
#if ! defined(WIN32) && ! defined(__BEOS__) #if ! defined(WIN32) && ! defined(__BEOS__)
#ifdef NEED_REENTRANT
#define _REENTRANT
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include <netinet/in.h>
#ifdef HAVE_SYS_TIME_H
/* This must be before net/if.h for AIX 3.2 to enjoy life */
#include <sys/time.h>
#endif
#ifdef HAVE_NET_IF_H #ifdef HAVE_NET_IF_H
#include <net/if.h> #include <net/if.h>
#endif #endif
@@ -66,15 +79,11 @@
#include <netdb.h> #include <netdb.h>
#endif #endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKIO_H #ifdef HAVE_SYS_SOCKIO_H
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
#ifdef HAVE_INET_NTOA_R #if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
#include "inet_ntoa_r.h" #include "inet_ntoa_r.h"
#endif #endif

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -26,7 +26,7 @@
* Contributor(s): * Contributor(s):
* Bj<42>rn Reese <breese@mail1.stofanet.dk> * Bj<42>rn Reese <breese@mail1.stofanet.dk>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -48,8 +50,6 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <errno.h> #include <errno.h>
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) #if defined(WIN32) && !defined(__GNUC__)
#else #else
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H

View File

@@ -27,7 +27,7 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://www.fts.frontec.se/~dast/curl/ * http://www.fts.frontec.se/~dast/curl/
* *

View File

@@ -28,17 +28,17 @@
* Linas Vepstas <linas@linas.org> * Linas Vepstas <linas@linas.org>
* Bjorn Reese <breese@imada.ou.dk> * Bjorn Reese <breese@imada.ou.dk>
* Johan Anderson <johan@homemail.com> * Johan Anderson <johan@homemail.com>
* Kjell Ericson <Kjell.Ericson@haxx.nu> * Kjell Ericson <Kjell.Ericson@haxx.se>
* Troy Engel <tengel@palladium.net> * Troy Engel <tengel@palladium.net>
* Ryan Nelson <ryan@inch.com> * Ryan Nelson <ryan@inch.com>
* Bjorn Stenberg <Bjorn.Stenberg@haxx.nu> * Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
* Angus Mackay <amackay@gus.ml.org> * Angus Mackay <amackay@gus.ml.org>
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -50,11 +50,12 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "setup.h"
#include "getenv.h" #include "getenv.h"
#include "strequal.h" #include "strequal.h"

View File

@@ -30,17 +30,17 @@
* Linas Vepstas <linas@linas.org> * Linas Vepstas <linas@linas.org>
* Bjorn Reese <breese@imada.ou.dk> * Bjorn Reese <breese@imada.ou.dk>
* Johan Anderson <johan@homemail.com> * Johan Anderson <johan@homemail.com>
* Kjell Ericson <Kjell.Ericson@haxx.nu> * Kjell Ericson <Kjell.Ericson@haxx.se>
* Troy Engel <tengel@palladium.net> * Troy Engel <tengel@palladium.net>
* Ryan Nelson <ryan@inch.com> * Ryan Nelson <ryan@inch.com>
* Bjorn Stenberg <Bjorn.Stenberg@haxx.nu> * Bjorn Stenberg <Bjorn.Stenberg@haxx.se>
* Angus Mackay <amackay@gus.ml.org> * Angus Mackay <amackay@gus.ml.org>
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -51,7 +51,10 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* $Log$ * $Log$
* Revision 1.2 2000-01-10 23:36:15 bagder * Revision 1.3 2000-06-20 15:31:26 bagder
* haxx.nu => haxx.se
*
* Revision 1.2 2000/01/10 23:36:15 bagder
* syncing with local edit * syncing with local edit
* *
* Revision 1.3 1999/09/06 06:59:41 dast * Revision 1.3 1999/09/06 06:59:41 dast

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,9 +38,10 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include <string.h>
#include "setup.h" #include "setup.h"
#include <string.h>
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#if defined(__MINGW32__) #if defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
@@ -57,6 +58,7 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h"
#include "progress.h" #include "progress.h"
@@ -97,7 +99,6 @@ char *max5data(double bytes, char *max5)
New proposed interface, 9th of February 2000: New proposed interface, 9th of February 2000:
pgrsStartNow() - sets start time pgrsStartNow() - sets start time
pgrsMode(type) - kind of display
pgrsSetDownloadSize(x) - known expected download size pgrsSetDownloadSize(x) - known expected download size
pgrsSetUploadSize(x) - known expected upload size pgrsSetUploadSize(x) - known expected upload size
pgrsSetDownloadCounter() - amount of data currently downloaded pgrsSetDownloadCounter() - amount of data currently downloaded
@@ -106,7 +107,7 @@ char *max5data(double bytes, char *max5)
pgrsDone() - transfer complete pgrsDone() - transfer complete
*/ */
#if 1
void pgrsDone(struct UrlData *data) void pgrsDone(struct UrlData *data)
{ {
if(!(data->progress.flags & PGRS_HIDE)) { if(!(data->progress.flags & PGRS_HIDE)) {
@@ -115,16 +116,6 @@ void pgrsDone(struct UrlData *data)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
} }
void pgrsMode(struct UrlData *data, int mode)
{
/* mode should include a hidden mode as well */
if(data->bits.hide_progress || data->bits.mute)
data->progress.flags |= PGRS_HIDE; /* don't show anything */
else {
data->progress.mode = mode; /* store type */
}
}
void pgrsTime(struct UrlData *data, timerid timer) void pgrsTime(struct UrlData *data, timerid timer)
{ {
@@ -190,6 +181,7 @@ void pgrsSetUploadSize(struct UrlData *data, double size)
int pgrsUpdate(struct UrlData *data) int pgrsUpdate(struct UrlData *data)
{ {
struct timeval now; struct timeval now;
int result;
char max5[6][6]; char max5[6][6];
double dlpercen=0; double dlpercen=0;
@@ -222,7 +214,7 @@ int pgrsUpdate(struct UrlData *data)
this is were lots of the calculations are being made that will be used this is were lots of the calculations are being made that will be used
even when not displayed! */ even when not displayed! */
else if(!(data->progress.flags & PGRS_HEADERS_OUT)) { else if(!(data->progress.flags & PGRS_HEADERS_OUT)) {
if ( data->progress.mode == CURL_PROGRESS_STATS ) { if (!data->progress.callback) {
fprintf(data->err, fprintf(data->err,
" %% Total %% Received %% Xferd Average Speed Time Curr.\n" " %% Total %% Received %% Xferd Average Speed Time Curr.\n"
" Dload Upload Total Current Left Speed\n"); " Dload Upload Total Current Left Speed\n");
@@ -262,11 +254,14 @@ int pgrsUpdate(struct UrlData *data)
if(data->progress.flags & PGRS_HIDE) if(data->progress.flags & PGRS_HIDE)
return 0; return 0;
else if(data->fprogress) { else if(data->fprogress) {
return data->fprogress(data->progress_client, result= data->fprogress(data->progress_client,
data->progress.size_dl, data->progress.size_dl,
data->progress.downloaded, data->progress.downloaded,
data->progress.size_ul, data->progress.size_ul,
data->progress.uploaded); data->progress.uploaded);
if(result)
failf(data, "Callback aborted");
return result;
} }
/* Figure out the estimated time of arrival for the upload */ /* Figure out the estimated time of arrival for the upload */
@@ -334,231 +329,5 @@ int pgrsUpdate(struct UrlData *data)
max5data(data->progress.current_speed, max5[5]) /* current speed */ max5data(data->progress.current_speed, max5[5]) /* current speed */
); );
#if 0
case CURL_PROGRESS_BAR:
/* original progress bar code by Lars Aas */
if (progressmax == -1) {
int prevblock = prev / 1024;
int thisblock = point / 1024;
while ( thisblock > prevblock ) {
fprintf( data->err, "#" );
prevblock++;
}
prev = point;
}
else {
char line[256];
char outline[256];
char format[40];
float frac = (float) point / (float) progressmax;
float percent = frac * 100.0f;
int barwidth = width - 7;
int num = (int) (((float)barwidth) * frac);
int i = 0;
for ( i = 0; i < num; i++ ) {
line[i] = '#';
}
line[i] = '\0';
sprintf( format, "%%-%ds %%5.1f%%%%", barwidth );
sprintf( outline, format, line, percent );
fprintf( data->err, "\r%s", outline );
}
prev = point;
break;
#endif
return 0; return 0;
} }
#endif
#if 0
/* --- start of (the former) progress routines --- */
int progressmax=-1;
static int prev = 0;
static int width = 0;
void ProgressInit(struct UrlData *data, int max/*, int options, int moremax*/)
{
#ifdef __EMX__
/* 20000318 mgs */
int scr_size [2];
#endif
char *colp;
if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
return;
prev = 0;
/* TODO: get terminal width through ansi escapes or something similar.
try to update width when xterm is resized... - 19990617 larsa */
#ifndef __EMX__
/* 20000318 mgs
* OS/2 users most likely won't have this env var set, and besides that
* we're using our own way to determine screen width */
colp = curl_GetEnv("COLUMNS");
if (colp != NULL) {
width = atoi(colp);
free(colp);
}
else
width = 79;
#else
/* 20000318 mgs
* We use this emx library call to get the screen width, and subtract
* one from what we got in order to avoid a problem with the cursor
* advancing to the next line if we print a string that is as long as
* the screen is wide. */
_scrsize(scr_size);
width = scr_size[0] - 1;
#endif
progressmax = max;
if(-1 == max)
return;
if(progressmax <= LEAST_SIZE_PROGRESS) {
progressmax = -1; /* disable */
return;
}
if ( data->progressmode == CURL_PROGRESS_STATS )
fprintf(data->err,
" %% Received Total Speed Estimated Time Left Curr.Speed\n");
}
void ProgressShow(struct UrlData *data,
int point, struct timeval start, struct timeval now, bool force)
{
switch ( data->progressmode ) {
case CURL_PROGRESS_STATS:
{
static long lastshow;
double percen;
double spent;
double speed;
#define CURR_TIME 5
static int speeder[ CURR_TIME ];
static int speeder_c=0;
int nowindex = speeder_c% CURR_TIME;
int checkindex;
int count;
if(!force && (point != progressmax) && (lastshow == tvlong(now)))
return; /* never update this more than once a second if the end isn't
reached */
spent = tvdiff (now, start);
speed = point/(spent!=0.0?spent:1.0);
if(!speed)
speed=1;
/* point is where we are right now */
speeder[ nowindex ] = point;
speeder_c++; /* increase */
count = ((speeder_c>=CURR_TIME)?CURR_TIME:speeder_c) - 1;
checkindex = (speeder_c>=CURR_TIME)?speeder_c%CURR_TIME:0;
/* find out the average speed the last CURR_TIME seconds */
data->current_speed = (speeder[nowindex]-speeder[checkindex])/(count?count:1);
#if 0
printf("NOW %d(%d) THEN %d(%d) DIFF %lf COUNT %d\n",
speeder[nowindex], nowindex,
speeder[checkindex], checkindex,
data->current_speed, count);
#endif
if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
return;
if(-1 != progressmax) {
char left[20];
char estim[20];
char timespent[20];
int estimate = progressmax/(int) speed;
time2str(left,estimate-(int) spent);
time2str(estim,estimate);
time2str(timespent,spent);
percen=(double)point/progressmax;
percen=percen*100;
fprintf(stderr, "\r%3d %10d %10d %6.0lf %s %s %s %6.0lf ",
(int)percen, point, progressmax,
speed, estim, timespent, left, data->current_speed);
}
else
fprintf(data->err,
"\r%d bytes received in %.3lf seconds (%.0lf bytes/sec)",
point, spent, speed);
lastshow = now.tv_sec;
break;
}
case CURL_PROGRESS_BAR: /* 19990617 larsa */
{
if (point == prev) break;
if (progressmax == -1) {
int prevblock = prev / 1024;
int thisblock = point / 1024;
while ( thisblock > prevblock ) {
fprintf( data->err, "#" );
prevblock++;
}
prev = point;
} else {
char line[256];
char outline[256];
char format[40];
float frac = (float) point / (float) progressmax;
float percent = frac * 100.0f;
int barwidth = width - 7;
int num = (int) (((float)barwidth) * frac);
int i = 0;
for ( i = 0; i < num; i++ ) {
line[i] = '#';
}
line[i] = '\0';
sprintf( format, "%%-%ds %%5.1f%%%%", barwidth );
sprintf( outline, format, line, percent );
fprintf( data->err, "\r%s", outline );
}
prev = point;
break;
}
default: /* 19990617 larsa */
{
int prevblock = prev / 1024;
int thisblock = point / 1024;
if (prev == point) break;
while ( thisblock > prevblock ) {
fprintf( data->err, "#" );
prevblock++;
}
prev = point;
break;
}
}
}
void ProgressEnd(struct UrlData *data)
{
if(data->conf&(CONF_NOPROGRESS|CONF_MUTE))
return;
fputs("\n", data->err);
}
/* --- end of progress routines --- */
#endif

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -53,7 +53,6 @@ typedef enum {
} timerid; } timerid;
void pgrsDone(struct UrlData *data); void pgrsDone(struct UrlData *data);
void pgrsMode(struct UrlData *data, int mode);
void pgrsStartNow(struct UrlData *data); void pgrsStartNow(struct UrlData *data);
void pgrsSetDownloadSize(struct UrlData *data, double size); void pgrsSetDownloadSize(struct UrlData *data, double size);
void pgrsSetUploadSize(struct UrlData *data, double size); void pgrsSetUploadSize(struct UrlData *data, double size);

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,12 +38,12 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include "setup.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
@@ -84,7 +84,6 @@ void failf(struct UrlData *data, char *fmt, ...)
} }
/* sendf() sends the formated data to the server */ /* sendf() sends the formated data to the server */
int sendf(int fd, struct UrlData *data, char *fmt, ...) int sendf(int fd, struct UrlData *data, char *fmt, ...)
{ {
size_t bytes_written; size_t bytes_written;
@@ -110,6 +109,25 @@ int sendf(int fd, struct UrlData *data, char *fmt, ...)
return(bytes_written); return(bytes_written);
} }
/* ssend() sends plain (binary) data to the server */
size_t ssend(int fd, struct UrlData *data, void *mem, size_t len)
{
size_t bytes_written;
if(data->bits.verbose)
fprintf(data->err, "> [binary output]\n");
#ifndef USE_SSLEAY
bytes_written = swrite(fd, mem, len);
#else
if (data->use_ssl) {
bytes_written = SSL_write(data->ssl, mem, len);
} else {
bytes_written = swrite(fd, mem, len);
}
#endif /* USE_SSLEAY */
return bytes_written;
}

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -40,7 +40,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
int sendf(int fd, struct UrlData *, char *fmt, ...); size_t sendf(int fd, struct UrlData *, char *fmt, ...);
size_t ssend(int fd, struct UrlData *, void *fmt, size_t len);
void infof(struct UrlData *, char *fmt, ...); void infof(struct UrlData *, char *fmt, ...);
void failf(struct UrlData *, char *fmt, ...); void failf(struct UrlData *, char *fmt, ...);

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -40,7 +40,7 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include <stdio.h>
#if !defined(WIN32) && defined(_WIN32) #if !defined(WIN32) && defined(_WIN32)
/* This _might_ be a good Borland fix. Please report whether this works or /* This _might_ be a good Borland fix. Please report whether this works or
@@ -57,6 +57,7 @@
#endif #endif
#endif #endif
#include <stdio.h>
#ifndef OS #ifndef OS
#ifdef WIN32 #ifdef WIN32
#define OS "win32" #define OS "win32"

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#if defined(__MINGW32__) #if defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -43,7 +43,7 @@
* Linas Vepstas <linas@linas.org> and Sampo Kellomaki <sampo@iki.fi> * Linas Vepstas <linas@linas.org> and Sampo Kellomaki <sampo@iki.fi>
*/ */
#include "setup.h"
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -40,6 +40,8 @@
#include "setup.h" #include "setup.h"
#include <string.h>
int strequal(const char *first, const char *second) int strequal(const char *first, const char *second)
{ {
#if defined(HAVE_STRCASECMP) #if defined(HAVE_STRCASECMP)
@@ -47,7 +49,7 @@ int strequal(const char *first, const char *second)
#elif defined(HAVE_STRCMPI) #elif defined(HAVE_STRCMPI)
return !strcmpi(first, second); return !strcmpi(first, second);
#elif defined(HAVE_STRICMP) #elif defined(HAVE_STRICMP)
return !strcmpi(first, second); return !stricmp(first, second);
#else #else
while (*first && *second) { while (*first && *second) {
if (toupper(*first) != toupper(*second)) { if (toupper(*first) != toupper(*second)) {

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,7 +38,7 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
* *
* This implementation of the TELNET protocol is written by * This implementation of the TELNET protocol is written by
* Linus Nielsen <Linus.Nielsen@haxx.nu>, * Linus Nielsen <Linus.Nielsen@haxx.se>,
* with some code snippets stolen from the BSD Telnet client. * with some code snippets stolen from the BSD Telnet client.
* *
* The negotiation is performed according to RFC 1143 (D. Bernstein, * The negotiation is performed according to RFC 1143 (D. Bernstein,
@@ -46,6 +46,8 @@
* *
****************************************************************************/ ****************************************************************************/
#include "setup.h"
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -57,8 +59,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
#include <time.h> #include <time.h>

View File

@@ -27,9 +27,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -40,6 +40,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <time.h> #include <time.h>
#include <winsock.h> #include <winsock.h>
@@ -47,7 +49,6 @@
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include "setup.h"
#ifndef HAVE_GETTIMEOFDAY #ifndef HAVE_GETTIMEOFDAY
#if !defined(_WINSOCKAPI_) && !defined(__MINGW32__) #if !defined(_WINSOCKAPI_) && !defined(__MINGW32__)

161
lib/url.c
View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -39,6 +39,9 @@
****************************************************************************/ ****************************************************************************/
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@@ -49,7 +52,6 @@
#include <errno.h> #include <errno.h>
#include "setup.h"
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
@@ -83,9 +85,6 @@
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#ifndef HAVE_VPRINTF
#error "We can't compile without vprintf() support!"
#endif
#ifndef HAVE_SELECT #ifndef HAVE_SELECT
#error "We can't compile without select() support!" #error "We can't compile without select() support!"
#endif #endif
@@ -96,7 +95,6 @@
#endif #endif
#include "urldata.h" #include "urldata.h"
#include <curl/curl.h>
#include "netrc.h" #include "netrc.h"
#include "formdata.h" #include "formdata.h"
@@ -143,12 +141,12 @@ void curl_free(void)
{ {
} }
void urlfree(struct UrlData *data, bool totally) void static urlfree(struct UrlData *data, bool totally)
{ {
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
if (data->use_ssl) { if (data->use_ssl) {
if(data->ssl) { if(data->ssl) {
SSL_shutdown(data->ssl); (void)SSL_shutdown(data->ssl);
SSL_set_connect_state(data->ssl); SSL_set_connect_state(data->ssl);
SSL_free (data->ssl); SSL_free (data->ssl);
@@ -173,11 +171,15 @@ void urlfree(struct UrlData *data, bool totally)
} }
if(data->bits.proxystringalloc) { if(data->bits.proxystringalloc) {
data->bits.proxystringalloc=0; data->bits.proxystringalloc=FALSE;;
free(data->proxy); free(data->proxy);
data->proxy=NULL; data->proxy=NULL;
}
/* Since we allocated the string the previous round, it means that we
"discovered" the proxy in the environment variables and thus we must
switch off that knowledge again... */
data->bits.httpproxy=FALSE;
}
if(data->ptr_proxyuserpwd) { if(data->ptr_proxyuserpwd) {
free(data->ptr_proxyuserpwd); free(data->ptr_proxyuserpwd);
@@ -219,6 +221,9 @@ void urlfree(struct UrlData *data, bool totally)
if(data->headerbuff) if(data->headerbuff)
free(data->headerbuff); free(data->headerbuff);
if(data->free_referer)
free(data->referer);
cookie_cleanup(data->cookies); cookie_cleanup(data->cookies);
free(data); free(data);
@@ -234,14 +239,12 @@ CURLcode curl_close(CURL *curl)
void *protocol = data->proto.generic; void *protocol = data->proto.generic;
/* total session cleanup */ /* total session cleanup (frees 'data' as well!)*/
urlfree(data, TRUE); urlfree(data, TRUE);
if(protocol) if(protocol)
free(protocol); free(protocol);
free(data);
return CURLE_OK; return CURLE_OK;
} }
@@ -388,7 +391,7 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
data->bits.ftp_use_port = data->ftpport?1:0; data->bits.ftp_use_port = data->ftpport?1:0;
break; break;
case CURLOPT_HTTPHEADER: case CURLOPT_HTTPHEADER:
data->headers = va_arg(param, struct HttpHeader *); data->headers = va_arg(param, struct curl_slist *);
break; break;
case CURLOPT_CUSTOMREQUEST: case CURLOPT_CUSTOMREQUEST:
data->customrequest = va_arg(param, char *); data->customrequest = va_arg(param, char *);
@@ -420,22 +423,23 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
case CURLOPT_POSTFIELDS: case CURLOPT_POSTFIELDS:
data->postfields = va_arg(param, char *); data->postfields = va_arg(param, char *);
break; break;
case CURLOPT_PROGRESSMODE: case CURLOPT_POSTFIELDSIZE:
data->progress.mode = va_arg(param, long); data->postfieldsize = va_arg(param, long);
break; break;
case CURLOPT_REFERER: case CURLOPT_REFERER:
data->referer = va_arg(param, char *); data->referer = va_arg(param, char *);
data->bits.http_set_referer = (data->referer && *data->referer)?1:0; data->bits.http_set_referer = (data->referer && *data->referer)?1:0;
break; break;
case CURLOPT_AUTOREFERER:
data->bits.http_auto_referer = va_arg(param, long)?1:0;
break;
case CURLOPT_PROXY: case CURLOPT_PROXY:
data->proxy = va_arg(param, char *); data->proxy = va_arg(param, char *);
data->bits.httpproxy = data->proxy?1:0; data->bits.httpproxy = data->proxy?1:0;
break; break;
#if 0 case CURLOPT_PROXYPORT:
case CURLOPT_FLAGS: data->proxyport = va_arg(param, long);
conf_to_internal(data, va_arg(param, long));
break; break;
#endif
case CURLOPT_TIMEOUT: case CURLOPT_TIMEOUT:
data->timeout = va_arg(param, long); data->timeout = va_arg(param, long);
break; break;
@@ -449,6 +453,13 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
case CURLOPT_POSTQUOTE: case CURLOPT_POSTQUOTE:
data->postquote = va_arg(param, struct curl_slist *); data->postquote = va_arg(param, struct curl_slist *);
break; break;
case CURLOPT_PROGRESSFUNCTION:
data->fprogress = va_arg(param, curl_progress_callback);
data->progress.callback = TRUE; /* no longer internal */
break;
case CURLOPT_PROGRESSDATA:
data->progress_client = va_arg(param, void *);
break;
case CURLOPT_PROXYUSERPWD: case CURLOPT_PROXYUSERPWD:
data->proxyuserpwd = va_arg(param, char *); data->proxyuserpwd = va_arg(param, char *);
data->bits.proxy_user_passwd = data->proxyuserpwd?1:0; data->bits.proxy_user_passwd = data->proxyuserpwd?1:0;
@@ -464,13 +475,13 @@ CURLcode curl_setopt(CURL *curl, CURLoption option, ...)
data->err = va_arg(param, FILE *); data->err = va_arg(param, FILE *);
break; break;
case CURLOPT_WRITEFUNCTION: case CURLOPT_WRITEFUNCTION:
data->fwrite = va_arg(param, write_callback); data->fwrite = va_arg(param, curl_write_callback);
break; break;
case CURLOPT_WRITEINFO: case CURLOPT_WRITEINFO:
data->writeinfo = va_arg(param, char *); data->writeinfo = va_arg(param, char *);
break; break;
case CURLOPT_READFUNCTION: case CURLOPT_READFUNCTION:
data->fread = va_arg(param, read_callback); data->fread = va_arg(param, curl_read_callback);
break; break;
case CURLOPT_SSLCERT: case CURLOPT_SSLCERT:
data->cert = va_arg(param, char *); data->cert = va_arg(param, char *);
@@ -600,6 +611,8 @@ CURLcode curl_disconnect(CURLconnect *c_connect)
struct UrlData *data = conn->data; struct UrlData *data = conn->data;
free(conn); /* free the connection oriented data */
/* clean up the sockets and SSL stuff from the previous "round" */ /* clean up the sockets and SSL stuff from the previous "round" */
urlfree(data, FALSE); urlfree(data, FALSE);
@@ -633,9 +646,11 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
struct UrlData *data = curl; struct UrlData *data = curl;
struct connectdata *conn; struct connectdata *conn;
/* I believe the longest possible name in a DNS is set to 255 letters, FQDN /* I believe the longest possible name in a DNS is set to 255 letters, FQDN.
so this should be safe: */ Although the buffer required for storing all possible aliases and IP
char hostent_buf[512]; numbers is according to Stevens' Unix Network Programming 2nd editor,
p. 304: 8192 bytes. Let's go with that! */
char hostent_buf[8192];
if(!data || (data->handle != STRUCT_OPEN)) if(!data || (data->handle != STRUCT_OPEN))
return CURLE_BAD_FUNCTION_ARGUMENT; /* TBD: make error codes */ return CURLE_BAD_FUNCTION_ARGUMENT; /* TBD: make error codes */
@@ -684,7 +699,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
} }
else { else {
/* Set default host and default path */ /* Set default host and default path */
strcpy(conn->gname, "curl.haxx.nu"); strcpy(conn->gname, "curl.haxx.se");
strcpy(conn->path, "/"); strcpy(conn->path, "/");
if (2 > sscanf(data->url, if (2 > sscanf(data->url,
@@ -722,37 +737,42 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
if(data->bits.user_passwd && !data->bits.use_netrc) { if(data->bits.user_passwd && !data->bits.use_netrc) {
if(':' != *data->userpwd) { data->user[0] =0;
if((1 <= sscanf(data->userpwd, "%127[^:]:%127s", data->passwd[0]=0;
data->user, data->passwd))) {
if(*data->userpwd != ':') {
/* the name is given, get user+password */
sscanf(data->userpwd, "%127[^:]:%127[^@]",
data->user, data->passwd);
}
else
/* no name given, get the password only */
sscanf(data->userpwd+1, "%127[^@]", data->passwd);
/* check for password, if no ask for one */ /* check for password, if no ask for one */
if( !data->passwd[0] ) if( !data->passwd[0] ) {
{
strncpy(data->passwd, getpass("password: "), sizeof(data->passwd)); strncpy(data->passwd, getpass("password: "), sizeof(data->passwd));
} }
} }
}
if(!data->user[0]) {
failf(data, "USER malformat: user name can't be zero length");
return CURLE_MALFORMAT_USER;
}
}
if(data->bits.proxy_user_passwd) { if(data->bits.proxy_user_passwd) {
if(':' != *data->proxyuserpwd) { data->proxyuser[0] =0;
if((1 <= sscanf(data->proxyuserpwd, "%127[^:]:%127s", data->proxypasswd[0]=0;
data->proxyuser, data->proxypasswd))) {
if(*data->proxyuserpwd != ':') {
/* the name is given, get user+password */
sscanf(data->proxyuserpwd, "%127[^:]:%127[^@]",
data->proxyuser, data->proxypasswd);
}
else
/* no name given, get the password only */
sscanf(data->proxyuserpwd+1, "%127[^@]", data->proxypasswd);
/* check for password, if no ask for one */ /* check for password, if no ask for one */
if( !data->proxypasswd[0] ) if( !data->proxypasswd[0] ) {
{
strncpy(data->proxypasswd, getpass("proxy password: "), sizeof(data->proxypasswd)); strncpy(data->proxypasswd, getpass("proxy password: "), sizeof(data->proxypasswd));
} }
}
}
if(!data->proxyuser[0]) {
failf(data, " Proxy USER malformat: user name can't be zero length");
return CURLE_MALFORMAT_USER;
}
} }
conn->name = conn->gname; conn->name = conn->gname;
@@ -886,6 +906,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
conn->protocol |= PROT_HTTP; conn->protocol |= PROT_HTTP;
conn->curl_do = http; conn->curl_do = http;
conn->curl_done = http_done; conn->curl_done = http_done;
conn->curl_close = http_close;
} }
else if (strequal(conn->proto, "HTTPS")) { else if (strequal(conn->proto, "HTTPS")) {
#ifdef USE_SSLEAY #ifdef USE_SSLEAY
@@ -898,6 +919,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
conn->curl_do = http; conn->curl_do = http;
conn->curl_done = http_done; conn->curl_done = http_done;
conn->curl_connect = http_connect; conn->curl_connect = http_connect;
conn->curl_close = http_close;
#else /* USE_SSLEAY */ #else /* USE_SSLEAY */
failf(data, "SSL is disabled, https: not supported!"); failf(data, "SSL is disabled, https: not supported!");
@@ -917,6 +939,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
conn->protocol |= PROT_GOPHER; conn->protocol |= PROT_GOPHER;
conn->curl_do = http; conn->curl_do = http;
conn->curl_done = http_done; conn->curl_done = http_done;
conn->curl_close = http_close;
} }
else if(strequal(conn->proto, "FTP")) { else if(strequal(conn->proto, "FTP")) {
char *type; char *type;
@@ -928,6 +951,7 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
if(data->bits.httpproxy) { if(data->bits.httpproxy) {
conn->curl_do = http; conn->curl_do = http;
conn->curl_done = http_done; conn->curl_done = http_done;
conn->curl_close = http_close;
} }
else { else {
conn->curl_do = ftp; conn->curl_do = ftp;
@@ -1023,13 +1047,32 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
user+password pair in a string like: user+password pair in a string like:
ftp://user:password@ftp.my.site:8021/README */ ftp://user:password@ftp.my.site:8021/README */
char *ptr=NULL; /* assign to remove possible warnings */ char *ptr=NULL; /* assign to remove possible warnings */
#if 0
if(':' == *conn->name) { if(':' == *conn->name) {
failf(data, "URL malformat: user can't be zero length"); failf(data, "URL malformat: user can't be zero length");
return CURLE_URL_MALFORMAT_USER; return CURLE_URL_MALFORMAT_USER;
} }
if((1 <= sscanf(conn->name, "%127[^:]:%127[^@]", #endif
data->user, data->passwd)) && if(ptr=strchr(conn->name, '@')) {
(ptr=strchr(conn->name, '@'))) { /* there's a user+password given here, to the left of the @ */
data->user[0] =0;
data->passwd[0]=0;
if(*conn->name != ':') {
/* the name is given, get user+password */
sscanf(conn->name, "%127[^:]:%127[^@]",
data->user, data->passwd);
}
else
/* no name given, get the password only */
sscanf(conn->name+1, "%127[^@]", data->passwd);
/* check for password, if no ask for one */
if( !data->passwd[0] ) {
strncpy(data->passwd, getpass("password: "), sizeof(data->passwd));
}
conn->name = ++ptr; conn->name = ++ptr;
data->bits.user_passwd=1; /* enable user+password */ data->bits.user_passwd=1; /* enable user+password */
} }
@@ -1097,6 +1140,11 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
/* now set the local port number */ /* now set the local port number */
data->port = atoi(prox_portno); data->port = atoi(prox_portno);
} }
else if(data->proxyport) {
/* None given in the proxy string, then get the default one if it is
given */
data->port = data->proxyport;
}
/* connect to proxy */ /* connect to proxy */
if(!(conn->hp = GetHost(data, proxyptr, hostent_buf, sizeof(hostent_buf)))) { if(!(conn->hp = GetHost(data, proxyptr, hostent_buf, sizeof(hostent_buf)))) {
@@ -1154,11 +1202,16 @@ CURLcode curl_connect(CURL *curl, CURLconnect **in_connect)
} }
if(conn->curl_connect) { if(conn->curl_connect) {
/* is there a post-connect() procedure? */ /* 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 */
result = conn->curl_connect(conn); result = conn->curl_connect(conn);
if(result != CURLE_OK)
return result; /* pass back errors */
} }
pgrsTime(data, TIMER_CONNECT); pgrsTime(data, TIMER_CONNECT); /* we're connected */
conn->now = tvnow(); /* time this *after* the connect is done */ conn->now = tvnow(); /* time this *after* the connect is done */
conn->bytecount = 0; conn->bytecount = 0;

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$

View File

@@ -26,9 +26,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -64,7 +64,7 @@
#define DICT_DEFINE3 "/LOOKUP:" #define DICT_DEFINE3 "/LOOKUP:"
#define CURL_DEFAULT_USER "anonymous" #define CURL_DEFAULT_USER "anonymous"
#define CURL_DEFAULT_PASSWORD "curl_by_Daniel.Stenberg@haxx.nu" #define CURL_DEFAULT_PASSWORD "curl_by_daniel@haxx.se"
#include "cookie.h" #include "cookie.h"
#include "formdata.h" #include "formdata.h"
@@ -88,11 +88,13 @@
#endif #endif
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include "timeval.h" #include "timeval.h"
#include <curl/curl.h>
/* Download buffer size, keep it fairly big for speed reasons */ /* Download buffer size, keep it fairly big for speed reasons */
#define BUFSIZE (1024*50) #define BUFSIZE (1024*50)
@@ -168,6 +170,11 @@ struct connectdata {
*/ */
CURLcode (*curl_connect)(struct connectdata *connect); CURLcode (*curl_connect)(struct connectdata *connect);
/* This function *MAY* be set to a protocol-dependent function that is run
* in the curl_close() function if protocol-specific cleanups are required.
*/
CURLcode (*curl_close)(struct connectdata *connect);
/**** curl_get() phase fields */ /**** curl_get() phase fields */
/* READ stuff */ /* READ stuff */
@@ -193,7 +200,7 @@ struct Progress {
double current_speed; /* uses the currently fastest transfer */ double current_speed; /* uses the currently fastest transfer */
int mode; /* what kind of progress meter to display */ bool callback; /* set when progress callback is used */
int width; /* screen width at download start */ int width; /* screen width at download start */
int flags; /* see progress.h */ int flags; /* see progress.h */
double timespent; double timespent;
@@ -250,6 +257,7 @@ struct Configbits {
bool http_post; bool http_post;
bool http_put; bool http_put;
bool http_set_referer; bool http_set_referer;
bool http_auto_referer; /* set "correct" referer when following location: */
bool httpproxy; bool httpproxy;
bool mute; bool mute;
bool no_body; bool no_body;
@@ -261,24 +269,9 @@ struct Configbits {
bool use_netrc; bool use_netrc;
bool user_passwd; bool user_passwd;
bool verbose; bool verbose;
bool this_is_a_follow; /* this is a followed Location: request */
}; };
typedef size_t (*progress_callback)(void *clientp,
size_t dltotal,
size_t dlnow,
size_t ultotal,
size_t ulnow);
typedef size_t (*write_callback)(char *buffer,
size_t size,
size_t nitems,
FILE *outstream);
typedef size_t (*read_callback)(char *buffer,
size_t size,
size_t nitems,
FILE *instream);
/* What type of interface that intiated this struct */ /* What type of interface that intiated this struct */
typedef enum { typedef enum {
CURLI_NONE, CURLI_NONE,
@@ -316,6 +309,9 @@ struct UrlData {
/*************** Session - specific items ************/ /*************** Session - specific items ************/
char *proxy; /* if proxy, set it here, set CONF_PROXY to use this */ char *proxy; /* if proxy, set it here, set CONF_PROXY to use this */
char *proxyuserpwd; /* Proxy <user:password>, if used */ char *proxyuserpwd; /* Proxy <user:password>, if used */
long proxyport; /* If non-zero, use this port number by default. If the
proxy string features a ":[port]" that one will override
this. */
/*************** Request - specific items ************/ /*************** Request - specific items ************/
@@ -349,19 +345,25 @@ struct UrlData {
char *range; /* range, if used. See README for detailed specification on char *range; /* range, if used. See README for detailed specification on
this syntax. */ this syntax. */
char *postfields; /* if POST, set the fields' values here */ char *postfields; /* if POST, set the fields' values here */
long postfieldsize; /* if POST, this might have a size to use instead of
strlen(), and then the data *may* be binary (contain
zero bytes) */
bool free_referer; /* set TRUE if 'referer' points to a string we
allocated */
char *referer; char *referer;
char *useragent; /* User-Agent string */ char *useragent; /* User-Agent string */
char *ftpport; /* port to send with the PORT command */ char *ftpport; /* port to send with the PORT command */
/* function that stores the output:*/ /* function that stores the output:*/
write_callback fwrite; curl_write_callback fwrite;
/* function that reads the input:*/ /* function that reads the input:*/
read_callback fread; curl_read_callback fread;
/* function that wants progress information */ /* function that wants progress information */
progress_callback fprogress; curl_progress_callback fprogress;
void *progress_client; /* pointer to pass to the progress callback */ void *progress_client; /* pointer to pass to the progress callback */
long timeout; /* in seconds, 0 means no timeout */ long timeout; /* in seconds, 0 means no timeout */
@@ -390,7 +392,7 @@ struct UrlData {
char *newurl; /* This can only be set if a Location: was in the char *newurl; /* This can only be set if a Location: was in the
document headers */ document headers */
struct HttpHeader *headers; /* linked list of extra headers */ struct curl_slist *headers; /* linked list of extra headers */
struct HttpPost *httppost; /* linked list of POST data */ struct HttpPost *httppost; /* linked list of POST data */
char *cert; /* PEM-formatted certificate */ char *cert; /* PEM-formatted certificate */
@@ -424,6 +426,11 @@ struct UrlData {
#define MAX_CURL_USER_LENGTH 128 #define MAX_CURL_USER_LENGTH 128
#define MAX_CURL_PASSWORD_LENGTH 128 #define MAX_CURL_PASSWORD_LENGTH 128
char *auth_host; /* if set, this is the allocated string to the host name
* to which to send the authorization data to, and no other
* host (which location-following otherwise could lead to)
*/
char user[MAX_CURL_USER_LENGTH]; char user[MAX_CURL_USER_LENGTH];
char passwd[MAX_CURL_PASSWORD_LENGTH]; char passwd[MAX_CURL_PASSWORD_LENGTH];
char proxyuser[MAX_CURL_USER_LENGTH]; char proxyuser[MAX_CURL_USER_LENGTH];

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,10 +38,11 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include "setup.h"
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"

View File

@@ -24,9 +24,9 @@
* *
* ------------------------------------------------------------ * ------------------------------------------------------------
* Main author: * Main author:
* - Daniel Stenberg <Daniel.Stenberg@haxx.nu> * - Daniel Stenberg <daniel@haxx.se>
* *
* http://curl.haxx.nu * http://curl.haxx.se
* *
* $Source$ * $Source$
* $Revision$ * $Revision$
@@ -38,6 +38,8 @@
* ------------------------------------------------------------ * ------------------------------------------------------------
****************************************************************************/ ****************************************************************************/
#include "setup.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@@ -93,9 +95,11 @@ void WriteOut(struct UrlData *data)
else { else {
/* this is meant as a variable to output */ /* this is meant as a variable to output */
char *end; char *end;
char keepit;
int i; int i;
if(('{' == ptr[1]) && (end=strchr(ptr, '}'))) { if(('{' == ptr[1]) && (end=strchr(ptr, '}'))) {
ptr+=2; /* pass the % and the { */ ptr+=2; /* pass the % and the { */
keepit=*end;
*end=0; /* zero terminate */ *end=0; /* zero terminate */
for(i=0; replacements[i].name; i++) { for(i=0; replacements[i].name; i++) {
if(strequal(ptr, replacements[i].name)) { if(strequal(ptr, replacements[i].name)) {
@@ -138,6 +142,7 @@ void WriteOut(struct UrlData *data)
} }
} }
ptr=end+1; /* pass the end */ ptr=end+1; /* pass the end */
*end = keepit;
} }
else { else {
/* illegal syntax, then just output the characters that are used */ /* illegal syntax, then just output the characters that are used */

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