Compare commits

..

1302 Commits

Author SHA1 Message Date
Daniel Stenberg
6e1a986e0f 7.14.1 coming right up 2005-09-01 20:54:00 +00:00
Daniel Stenberg
e0785ade35 softened my opinions, added API benefit - Thanks to Eric Cooper 2005-09-01 15:03:45 +00:00
Daniel Stenberg
0177ed6f03 clarify that the ctxfunc is called on all new connects 2005-09-01 13:41:29 +00:00
Daniel Stenberg
c62635a3b5 added DISTRO-DILEMMA 2005-09-01 08:44:39 +00:00
Daniel Stenberg
0177476fd2 added the URL 2005-09-01 08:43:44 +00:00
Daniel Stenberg
76d7dface7 new 2005-09-01 08:35:59 +00:00
Daniel Stenberg
982ba21460 oops, the GNU GSS patch could clobber the CPPFLAGS variable and it thus
broke krb4 builds!
2005-08-31 21:23:47 +00:00
Daniel Stenberg
6081c60556 ocurl release 2005-08-31 20:51:41 +00:00
Daniel Stenberg
2fe3c22108 use it as 'struct addrinfo' so perhaps it builds on mingw again 2005-08-31 06:04:48 +00:00
Gunter Knauf
75dbb3189a quick hack to make it working again on Win32 - however we should consider to set some defaults depending on the compiler architecture we guess we are since it doesnt work well if we prefer building the msvc makefile with gmake instead of nmake because we found gmake first in path.... 2005-08-30 18:37:08 +00:00
Daniel Stenberg
32330300a9 Kevin Lussier pointed out a problem with curllib.dsp 2005-08-29 21:04:26 +00:00
Daniel Stenberg
64414df27e Use the more correct BUILDING_LIBCURL define instead of CURLLIB_EXPORTS.
Kevin Lussier pointed this out!
2005-08-29 20:56:20 +00:00
Daniel Stenberg
f98ec86798 spell-fix 2005-08-29 15:19:38 +00:00
Daniel Stenberg
87bbd13899 Igor Polyakov fixed a rather nasty problem with the threaded name resolver
for Windows, that could lead to an Access Violation when the multi interface
was used due to an issue with how the resolver thread was and was not
terminated.
2005-08-29 14:23:53 +00:00
Daniel Stenberg
51a4493add Added GNU GSS and separate sections for MIT GSS and Heimdal and added info
about what each single lib may be used for.
2005-08-29 13:58:25 +00:00
Daniel Stenberg
5effe8f336 Simon Josefson brought GNU GSS support 2005-08-29 08:42:45 +00:00
Daniel Stenberg
296eb2bd61 1.3.0 coming just up 2005-08-29 07:03:05 +00:00
Daniel Stenberg
9853acba66 Moved the GnuTLS related TODO items from lib/TODO.gnutls to the proper
docs/TODO
2005-08-29 06:59:44 +00:00
Daniel Stenberg
09cb9c782d 4.14 Redirects work in browser but not with curl! 2005-08-26 13:22:39 +00:00
Daniel Stenberg
575ce905b2 ok, the right term (using RFC2616 lingo) for the -X keyword is method and not
request
2005-08-25 12:19:22 +00:00
Daniel Stenberg
54887af471 "Added in 7.14.1" notes and some minor edits 2005-08-25 07:06:50 +00:00
Daniel Stenberg
573350637e CURLINFO_COOKIELIST is added in 7.14.1 2005-08-25 07:06:15 +00:00
Daniel Stenberg
49a16f7121 Theo Borm's example, as was posted here:
http://curl.haxx.se/mail/lib-2005-08/0163.html
2005-08-24 17:07:27 +00:00
Daniel Stenberg
a4773fcbbb Toby Peterson added CURLOPT_IGNORE_CONTENT_LENGTH to the library, accessible
from the command line tool with --ignore-content-length. This will make it
easier to download files from Apache 1.x (and similar) servers that are
still having problems serving files larger than 2 or 4 GB. When this option
is enabled, curl will simply have to wait for the server to close the
connection to signal end of transfer. I wrote test case 269 that runs a
simple test that this works.
2005-08-24 10:57:28 +00:00
Daniel Stenberg
1e038c4bc6 valgrind version 3 renames the --logfile command line option to --log-file... 2005-08-24 10:49:57 +00:00
Daniel Stenberg
6ba19692a3 fixed #26, GnuTLS CA cert verification 2005-08-24 07:45:14 +00:00
Daniel Stenberg
432dfe2b8f Fixed CA cert verification using GnuTLS with the default bundle, which
previously failed due to GnuTLS not allowing x509 v1 CA certs by default.
2005-08-24 07:40:13 +00:00
Daniel Stenberg
a142372750 known bug #26, pretty fatal for anyone who wants to use proper SSL and GnuTLS 2005-08-23 08:51:38 +00:00
Gunter Knauf
f14195f786 enabled statically linked builds. 2005-08-22 02:39:05 +00:00
Daniel Stenberg
9d54f9a6b7 well hit me, that wasn't possible, use 1:0:0 anyway... 2005-08-21 21:27:19 +00:00
Daniel Stenberg
ebb91191bf modified the version-info, we only added functions 2005-08-21 21:25:42 +00:00
Daniel Stenberg
8742e294d4 increase version info 2005-08-21 21:25:07 +00:00
Daniel Stenberg
8882d1fa1b avoid adding a blank dir to the LD_LIBRARY_PATH when OpenSSL is found in a
default dir
2005-08-21 21:15:07 +00:00
Daniel Stenberg
0c37ab5255 Alfredo Tupone provided a fix for the Windows code in get_iphlpapi_dns_info()
when getting the DNS server etc.
2005-08-21 21:09:44 +00:00
Daniel Stenberg
747a05844d Using CURLOPT_COOKIEFILE serveral times add more files to read from. 2005-08-19 21:38:44 +00:00
Daniel Stenberg
c7b7bf32f8 removed the unreachable code warning from gcc debug builds, even the most
recent gcc versions give far too many false positives for this to be valuable
2005-08-19 15:07:50 +00:00
Daniel Stenberg
710ee3b0e0 Norbert Novotny had problems with FTPS and he helped me work out a patch
that made curl run fine in his end. The key was to make sure we do the
SSL/TLS negotiation immediately after the TCP connect is done and not after
a few other commands have been sent like we did previously. I don't consider
this change necessary to obey the standards, I think this server is pickier
than what the specs allow it to be, but I can't see how this modified
libcurl code can add any problems to those who are interpreting the
standards more liberally.
2005-08-19 14:41:09 +00:00
Daniel Stenberg
7a8993892d one german mirror has died while another one was added, and yet another Texas
one!
2005-08-19 07:33:34 +00:00
Daniel Stenberg
5e16a77fa9 Added new contributors from RELEASE-NOTES. The somewhat different sort order
is due to now using emacs to sort but I'm not in a mood to fix it better just
now.
2005-08-19 07:32:14 +00:00
Daniel Stenberg
ef35519696 removed some inaccurate comments about the TYPE_IN_ADDR_T check 2005-08-19 07:02:24 +00:00
Daniel Stenberg
d5baaf7756 The big POST to HTTPS is probably not a bug.
The CONNECT problem is now bug #25 planned to get fixed in next release.
2005-08-19 06:43:25 +00:00
Gunter Knauf
2a94387fc3 minor Makefile fixes. 2005-08-18 16:39:29 +00:00
Gunter Knauf
6a5c2b0fc3 updated NetWare section. 2005-08-18 16:33:45 +00:00
Daniel Stenberg
fc281d6440 detabified 2005-08-18 08:48:31 +00:00
Daniel Stenberg
e22ac39da4 detabify 2005-08-18 08:47:56 +00:00
Daniel Stenberg
34cadb1e54 Harshal Pradhan's use-after-free bug with ares is now known bug #24 to be
fixed after 7.14.1
2005-08-18 08:18:24 +00:00
Daniel Stenberg
94692b904e it isn't strictly necessary to use it after a perform 2005-08-18 06:14:17 +00:00
Daniel Stenberg
18f3087afd removed issue 20 that was about valgrind complaints on other libs/parts, as
we have a fancier valgrind error parser these days and it seems to work rather
well
2005-08-17 09:43:29 +00:00
Daniel Stenberg
15bc228ae9 the SOCKS situation 2005-08-17 09:41:54 +00:00
Daniel Stenberg
2b7a38d032 removed old info about curl_getdate() just simply isn't true and hasn't been
true since the getdate() parser code rewrite
2005-08-17 09:12:08 +00:00
Daniel Stenberg
90e1a6905a remove the typecast to long from time_t, since we now store it as curl_off_t 2005-08-17 09:11:27 +00:00
Daniel Stenberg
c36af24cbd handles expiry times in cookie files that go beyond 32 bits in size 2005-08-17 09:01:07 +00:00
Daniel Stenberg
a676c18502 - Jeff Pohlmeyer found out that if you ask libcurl to load a cookiefile (with
CURLOPT_COOKIEFILE), add a cookie (with CURLOPT_COOKIELIST), tell it to
  write the result to a given cookie jar and then never actually call
  curl_easy_perform() - the given file(s) to read was never read but the
  output file was written and thus it caused a "funny" result.

- While doing some tests for the bug above, I noticed that Firefox generates
  large numbers (for the expire time) in the cookies.txt file and libcurl
  didn't treat them properly. Now it does.
2005-08-17 08:55:43 +00:00
Gunter Knauf
362912ff83 added curl_mvsnprintf to the export list; I appened to the end cause of the numbering ... 2005-08-16 20:12:58 +00:00
Gunter Knauf
46ff13f243 added curl_mvsnprintf to the export list. 2005-08-16 20:11:25 +00:00
Daniel Stenberg
340a67a6f8 client side fixes 2005-08-16 11:40:43 +00:00
Daniel Stenberg
9294c1e76c typecase the isspace() argument to int 2005-08-16 07:32:50 +00:00
Daniel Stenberg
fd704f8de0 recent changes 2005-08-15 21:48:36 +00:00
Daniel Stenberg
d9ca9154d1 Added more verbose "warning" messages to the curl client for cases where it
fails to open/read files etc to help users diagnose why it doesn't do what
you'd expect it to. Converted lots of old messages to use the new generic
function I wrote for this purpose.
2005-08-15 21:48:28 +00:00
Daniel Stenberg
35110eca73 James Bursa identified a libcurl HTTP bug and a good way to repeat it. If a
site responds with bad HTTP response that doesn't contain any header at all,
only a response body, and the write callback returns 0 to abort the
transfer, it didn't have any real effect but the write callback would be
called once more anyway.
2005-08-13 21:28:46 +00:00
Daniel Stenberg
9ad92b3007 added test 268 that makes curl -d @nonexisting 2005-08-12 22:09:21 +00:00
Daniel Stenberg
2f78c96330 clarify 2005-08-12 21:47:05 +00:00
Daniel Stenberg
639857ceb2 o curl -d @filename when 'filename' was not possible to access no longer
converts the request to a GET, but now instead makes it a POST of no data
o The time condition illegal syntax warning is now inhibited if -s is used.
2005-08-12 21:25:44 +00:00
Daniel Stenberg
162f58c53c -H needs no CRLF or similar added 2005-08-12 20:56:12 +00:00
Daniel Stenberg
84c4d96e71 removed old debug left-over infof() call 2005-08-11 21:41:11 +00:00
Daniel Stenberg
c0d343d56d do a POST with NTLM and add two custom headers 2005-08-11 21:33:40 +00:00
Daniel Stenberg
6d14a80608 Added comment about strtoimax() 2005-08-11 20:42:02 +00:00
Gunter Knauf
f451bb7c49 fix for NetWare crossbuilds to display the right config.h when build on Win32. 2005-08-11 18:02:09 +00:00
Daniel Stenberg
20b17d6b04 the debug callback was called with CURLINFO_TEXT with the data size one
too big
2005-08-10 22:57:14 +00:00
Gunter Knauf
bb2317b63c minor Makefile fix. 2005-08-10 21:45:59 +00:00
Gunter Knauf
189461dc98 minor Makefile fix. 2005-08-10 20:45:49 +00:00
Gunter Knauf
69af552bc1 added some more NetWare targets. 2005-08-10 19:26:33 +00:00
Gunter Knauf
0ae6ff9f72 some minor Makefile fixes for SSL. 2005-08-10 19:19:25 +00:00
Gunter Knauf
8b571fbbb1 make ares compile again for NetWare. 2005-08-10 17:03:53 +00:00
Gunter Knauf
f3fcd409d5 make ares compile again for NetWare. 2005-08-10 16:55:06 +00:00
Gunter Knauf
a47532f88a fixed line endings so it works again with gnu make on Win32. 2005-08-10 16:54:00 +00:00
Daniel Stenberg
6c157a404b Christopher R. Palmer fixed the offsets used for date parsings when the time
zone name of a daylight savings time was used. For example, PDT vs PDS. This
flaw was introduced with the new date parser (11 sep 2004 - 7.12.2).
Fortunately, no web server or cookie string etc should be using such time
zone names thus limiting the effect of this bug.
2005-08-09 21:59:31 +00:00
Daniel Stenberg
4f8a49143d mention two other bugs we should fix before release 2005-08-08 23:09:24 +00:00
Daniel Stenberg
493d6033aa Jon Grubbs filed bug report #1249962 which identified a problem with NTLM on a
HTTP proxy if an FTP URL was given. libcurl now properly switches to pure HTTP
internally when an HTTP proxy is used, even for FTP URLs. The problem would
also occur with other multi-pass auth methods.
2005-08-07 22:59:06 +00:00
Daniel Stenberg
8f219af884 When curl is built with GnuTLS, curl-config didn't include "SSL" when
--features was used
2005-08-07 21:45:59 +00:00
Daniel Stenberg
aeb04136f7 Don't prevent FTPS:// through a http proxy, as we cannot know if it works or
not!
2005-08-07 21:39:44 +00:00
Daniel Stenberg
0b8f57bf06 mention our security related mail alias in the "who do I mail" section 2005-08-07 14:36:55 +00:00
Daniel Stenberg
6508d446e1 Support realloc() on a NULL pointer properly (printf(%p) on a NULL pointer
outputs (nil) and not a 0x0 or similar.
2005-08-04 23:05:36 +00:00
Daniel Stenberg
82cb462bb4 killed trailing whitespace, narrowed a few lines to 80 cols 2005-08-04 08:07:44 +00:00
Daniel Stenberg
9a264bf610 mention that the NOBODY reset thing is added in 7.14.1 2005-08-01 11:56:03 +00:00
Daniel Stenberg
57007e80a9 Moved items from TODO-RELEASE to TODO since they're not really bound to happen
in any specific release.
2005-07-30 23:48:07 +00:00
Daniel Stenberg
b6c876bdb6 clarified the PHP/CURL topic a bit more 2005-07-30 23:37:05 +00:00
Daniel Stenberg
57afae79eb correction and added new mirror 2005-07-30 23:19:42 +00:00
Daniel Stenberg
84c2184909 CURLOPT_COOKIELIST change since it no longer modifies the input string contents 2005-07-30 08:27:51 +00:00
Daniel Stenberg
e358a24a75 reset the numcookies counter too (I missed it in the previous commit) 2005-07-28 21:53:09 +00:00
Daniel Stenberg
9da9d00c62 fixed example since this is how the interface works now 2005-07-28 21:51:20 +00:00
Daniel Stenberg
ec3f269d1f now strdups the cookielist inpointer before passed on, as the cookie function
modifies it
2005-07-28 21:50:34 +00:00
Daniel Stenberg
1c388a52a5 curl standard indent/format 2005-07-28 21:49:58 +00:00
Gisle Vanem
34a827bbfe Needs 'struct_stat'. Increased verbosity. 2005-07-28 13:20:27 +00:00
Daniel Stenberg
726b9e2240 If any of the options CURLOPT_HTTPGET, CURLOPT_POST and CURLOPT_HTTPPOST is
set to 1, CURLOPT_NOBODY will now automatically be set to 0.
2005-07-27 22:29:50 +00:00
Daniel Stenberg
2236ba0d20 Peteris Krumins added CURLOPT_COOKIELIST and CURLINFO_COOKIELIST, which is a
simple interface to extracting and setting cookies in libcurl's internal
"cookie jar". See the new cookie_interface.c example code.
2005-07-27 22:17:14 +00:00
Daniel Stenberg
463c0f7096 disabling HTTP should also nullify this function call 2005-07-27 21:44:43 +00:00
Dan Fandrich
e49a7e361c Fixed --without-gnutls 2005-07-27 18:22:21 +00:00
Dan Fandrich
6e87cf5b30 Fixed some typos in output messages. 2005-07-21 22:18:35 +00:00
Dan Fandrich
5872e8dd7e Properly support the options --without-spnego --without-gssapi --without-krb4 2005-07-20 23:00:27 +00:00
Dan Fandrich
e81d4ac8c8 Add -Wdeclaration-after-statement to gcc to detect accidental C99-style
variable declarations.
2005-07-20 21:58:23 +00:00
Daniel Stenberg
4922904991 Simplified the code within curl_easy_perform() that calls Curl_perform().
Pointed out by Bjorn Reese.
2005-07-17 12:44:11 +00:00
Daniel Stenberg
decae2dcda cURLpp 0.5.1 2005-07-15 06:57:36 +00:00
Daniel Stenberg
16bbd13af7 Diego Casorran patches to make (lib)curl build fine on Amiga again 2005-07-13 18:06:40 +00:00
Daniel Stenberg
ee0666c8df better description for HEADERFUNCTION 2005-07-13 09:46:37 +00:00
Daniel Stenberg
a8a8ae2e92 elaborate a bit on how to deal with chunked-encoded trailers that now are
passed to the app using the header callback
2005-07-13 09:37:22 +00:00
Daniel Stenberg
fd1148a728 converted this back to one name per line to make it easier/better to diff
and merge when new names are added
2005-07-13 07:44:53 +00:00
Daniel Stenberg
74c7b41ee7 mention the Rexx/CURL release 2005-07-12 18:20:31 +00:00
Daniel Stenberg
465e19dbe9 Adrian Schuur added trailer support in the chunked encoding stream. The
trailer is then sent to the normal header callback/stream.
2005-07-12 18:15:34 +00:00
Daniel Stenberg
86660c73e5 mention an old idea 2005-07-08 13:28:16 +00:00
Daniel Stenberg
6d8a208df2 mention the exception only once ;-) 2005-07-07 05:43:04 +00:00
Daniel Stenberg
c3a826fdce correction for the 407 with response-body case 2005-07-05 22:07:34 +00:00
Gisle Vanem
c5d6a42abf Update copyright. 2005-07-05 18:07:55 +00:00
Daniel Stenberg
d49c144297 Gisle Vanem came up with a nice little work-around for bug #1230118. It
seems the Windows (MSVC) libc time functions may return data one hour off if
TZ is not set and automatic DST adjustment is enabled. This made
curl_getdate() return wrong value, and it also concerned internal cookie
expirations etc.
2005-07-05 14:57:41 +00:00
Daniel Stenberg
e7de7d5eb3 mention the strerror_r detection fix in configure 2005-07-04 21:53:02 +00:00
Daniel Stenberg
20005a83d2 Andrew Bushnell provided enough info for me to tell that we badly needed to
fix the CONNECT authentication code with multi-pass auth methods (such as
NTLM) as it didn't previously properly ignore response-bodies - in fact it
stopped reading after all response headers had been received. This could
lead to libcurl sending the next request and reading the body from the first
request as response to the second request. (I also renamed the function,
which wasn't strictly necessary but...)

The best fix would to once and for all make the CONNECT code use the
ordinary request sending/receiving code, treating it as any ordinary request
instead of the special-purpose function we have now. It should make it
better for multi-interface too. And possibly lead to less code...

Added test case 265 for this. It doesn't work as a _really_ good test case
since the test proxy is too stupid, but the test case helps when running the
debugger to verify.
2005-07-03 22:25:15 +00:00
Daniel Stenberg
27926030f9 add more info when this script gets confused, and added getaddrinfo and
freeaddrinfo to the trace output
2005-06-30 14:07:52 +00:00
Daniel Stenberg
701de67b79 use %p to printf pointers since %x doesn't work properly on tru64 for this
(and besides, we should be using the same %-code for all pointers)
2005-06-30 13:30:23 +00:00
Daniel Stenberg
883479f01e enable memory debugging on tru64 with ipv6 support by doing a little different
defining, since the system headers themselves redefine getaddrinfo
2005-06-30 13:28:58 +00:00
Dan Fandrich
b37a0b0512 Detect (or at least infer) glibc-style strerror_r even when cross-compiling. 2005-06-30 04:53:05 +00:00
Daniel Stenberg
5c5d5270d2 new Lua binding 2005-06-28 09:08:52 +00:00
Daniel Stenberg
36461fb2aa clarify that ftp ascii transfers don't do right in current libcurl 2005-06-26 10:08:08 +00:00
Daniel Stenberg
d8dcd5e472 added docs about the new proxy string support 2005-06-23 23:07:07 +00:00
Daniel Stenberg
c51b46c982 David Shaw fixes 2005-06-22 22:31:08 +00:00
Daniel Stenberg
b1b63c1dd1 mention more ARMs 2005-06-22 22:30:52 +00:00
Daniel Stenberg
30c93d66eb verify that the URL decoding is done properly too 2005-06-22 22:24:47 +00:00
Daniel Stenberg
3b60bb7259 David Shaw's fix that unifies proxy string treatment so that a proxy given
with CURLOPT_PROXY can use a http:// prefix and user + password. The user
and password fields are now also URL decoded properly.

Test case 264 added to verify.
2005-06-22 22:24:10 +00:00
Daniel Stenberg
c73f8e835f David Shaw's updated version:
It now properly handles code that uses curl_free() (since not all versions of
curl have it), and also fixes a few problems when detecting libcurl on MinGW,
and a linker problem on OSX Panther.
2005-06-22 06:58:11 +00:00
Daniel Stenberg
93558c4299 mistake 2005-06-20 22:32:45 +00:00
Daniel Stenberg
396cff5779 possible windows memory leak fixed by Gisle 2005-06-19 21:38:45 +00:00
Dominick Meglio
336154e729 Added some checks for the addrinfo structure. 2005-06-19 16:58:40 +00:00
Gisle Vanem
bb0aba34fa Ensure thread handle is closed too. 2005-06-14 14:47:21 +00:00
Daniel Stenberg
1dc0ce9562 4.13 Why is curl -R on Windows one hour off? 2005-06-13 18:33:40 +00:00
Daniel Stenberg
e4aee168b5 recent buildconf fiddling 2005-06-13 11:20:51 +00:00
Daniel Stenberg
2c10c895da run libtoolize in the ares dir as well, and modified the output slightly for
all tools run in the ares dir - now shown like "running ares/[tool]"
2005-06-13 10:49:14 +00:00
Daniel Stenberg
c04fae3096 CURLINFO_FILETIME returns the time for GMT 2005-06-11 22:04:41 +00:00
Daniel Stenberg
a214af0830 make sure the found tool is a regular file (and not a dir or something) 2005-06-09 22:43:13 +00:00
Daniel Stenberg
f21bc46e82 Modified to use 'head -n 1' instead of 'head -1' since some versions of head
complains and claims this is deprecated.
2005-06-09 06:45:54 +00:00
Daniel Stenberg
044327a488 Reverted Tupone Alfredo's patch, as it broke NUMEROUS autobuilds. Let's do the
changes in a slower and more controlled manner...
2005-06-07 23:00:06 +00:00
Daniel Stenberg
c4bbcc83b6 Tupone Alfredo's fixes:
1) findtool does look per tool in PATH and think ./perl is the perl
executable, while is just a local directory (I have . in the PATH)

2) I got several warning for head -1 deprecated in favour of head -n 1

3) ares directory is missing some file (missing is missing :-) ) because
automake and friends is not run.

(Let's hope number 2 doesn't break somewhere "out there", if so we can always
search/replace that back.)
2005-06-06 21:19:04 +00:00
Daniel Stenberg
eb162b73c2 first rough version 2005-06-03 21:38:40 +00:00
Daniel Stenberg
29aafb9cea Andres Garcia's text mode fix for the 'data' part 2005-06-03 14:06:03 +00:00
Daniel Stenberg
40eb7d0d48 FIONBIO is in sys/ioctl.h on AIX 2005-06-03 07:39:18 +00:00
Daniel Stenberg
1dcb2b7e65 sigh, define TRUE if not already 2005-06-02 21:10:21 +00:00
Daniel Stenberg
5470b9aa73 William Ahern:
Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a
  read event can come back from poll() on a valid SOCK_DGRAM socket but
  recv(2) will still block. This patch doesn't ignore EAGAIN in
  read_udp_packets(), though maybe it should. (This patch was edited by Daniel
  Stenberg and a new configure test was added (imported from curl's configure)
  to properly detect what non-blocking socket approach to use.)
2005-06-02 11:58:04 +00:00
Daniel Stenberg
050bd7dd0b William Ahern:
I'm not quite sure how this was happening, but I've been seeing PTR queries
  which seem to return empty responses. At least, they were empty when calling
  ares_expand_name() on the record. Here's a patch which guarantees to
  NUL-terminate the expanded name. The old behavior failed to NUL-terminate if
  len was 0, and this was causing strlen() to run past the end of the buffer
  after calling ares_expand_name() and getting ARES_SUCCESS as the return
  value. If q is not greater than *s then it's equal and *s is always
  allocated with at least one byte.
2005-06-02 11:09:10 +00:00
Daniel Stenberg
f75038634f specify the cares lib before the other libs, to make it build fine with mingw
- inspired by Tupone Alfredo's bug report (and patch) #1212940
2005-06-01 21:30:29 +00:00
Daniel Stenberg
300b4a9158 Todd Kulesza reported a flaw in the proxy option, since a numerical IPv6
address was not possible to use. It is now, but requires it written
RFC2732-style, within brackets - which incidently is how you enter numerical
IPv6 addresses in URLs. Test case 263 added to verify.
2005-05-31 13:03:26 +00:00
Daniel Stenberg
52071f3476 added keywords 2005-05-31 12:57:21 +00:00
Daniel Stenberg
42ddd745f8 recent changes 2005-05-29 22:38:34 +00:00
Daniel Stenberg
a7846189cd Eric Cooper reported about a problem with HTTP servers that responds with
binary zeroes within the headers. They confused libcurl to do wrong so the
downloaded headers become incomplete. The fix is now verified with test case
262.
2005-05-29 22:30:48 +00:00
Daniel Stenberg
4762995d1f avoid the sensitive word as it looks bad in some people's eyes 2005-05-27 11:39:07 +00:00
Daniel Stenberg
e3a530eb61 Andrs Garca fixed a warning appearing on windows 2005-05-27 11:01:41 +00:00
Daniel Stenberg
d1235ff058 provide the proper copyright texts for these 2005-05-26 20:56:25 +00:00
Daniel Stenberg
4370e92dbd set LD_LIBRARY_PATH properly even when the openssl lib dir is found using
pkg-config
2005-05-25 22:14:32 +00:00
Daniel Stenberg
50e9522a06 silense a warning 2005-05-25 22:12:57 +00:00
Daniel Stenberg
b5bb9aa8e3 minor rephrase 2005-05-25 13:07:06 +00:00
Daniel Stenberg
cf2e365f23 output the full usec when --trace-time is used 2005-05-25 12:29:09 +00:00
Daniel Stenberg
72e532cb67 no more time/re-start of sockfilt, no more redirect of stdin/stdout when
talking to sockfilt
2005-05-25 12:27:19 +00:00
Daniel Stenberg
ac5635f77d added function for individual ftp slave kills 2005-05-25 12:26:38 +00:00
Daniel Stenberg
640d67c119 modified output logging, fixed the ftpslave killing 2005-05-25 12:26:20 +00:00
Daniel Stenberg
3e79693e3b utilize the whole usec in the log and don't output to stderr if the logfile
can't be opened
2005-05-25 12:04:52 +00:00
Daniel Stenberg
d55d3c2fd0 nicer raw logging and put code into (nicer) functions 2005-05-25 12:04:24 +00:00
Daniel Stenberg
3aced17c75 don't restart sockfilt after only 5 seconds of inactivity 2005-05-24 21:09:49 +00:00
Daniel Stenberg
bac63914db recent action 2005-05-24 21:02:59 +00:00
Daniel Stenberg
6a63c51f7c Andres Garcia's mode=text patch to make these do fine on Windows 2005-05-24 10:03:13 +00:00
Daniel Stenberg
632cf13767 add test case 261, response code 226 to TYPE 2005-05-24 09:40:58 +00:00
Daniel Stenberg
e7012a515c Now allow TYPE responses to be any 2xx code, and log if it isn't 200. 2005-05-24 09:39:56 +00:00
Daniel Stenberg
6b638af92f removed leftover debug message ("moo moo") 2005-05-22 17:54:11 +00:00
Daniel Stenberg
c654b79c53 added keywords 2005-05-21 22:38:19 +00:00
Daniel Stenberg
bee7b874ea added -nobuildconf 2005-05-20 11:24:55 +00:00
Daniel Stenberg
9c3fc592f7 keywords added 2005-05-20 11:15:24 +00:00
Daniel Stenberg
4eab7a1ebc shorter name 2005-05-20 11:15:15 +00:00
Daniel Stenberg
3d985688e4 sum up 2005-05-20 11:14:44 +00:00
Daniel Stenberg
17ea2631cd Add support for text mode on stdout tests as well, and add the mode=text
to the docs.
2005-05-20 10:40:32 +00:00
Daniel Stenberg
b749910e6c include ctype.h for isdigit() 2005-05-19 09:55:53 +00:00
Daniel Stenberg
eff36caea8 additional fix for the malformed URL fix of yday 2005-05-19 07:21:18 +00:00
Daniel Stenberg
6ff092f140 removed duplicate 2005-05-19 07:12:16 +00:00
Daniel Stenberg
28bb36e53d three fixes since 7.14.0 2005-05-18 20:02:07 +00:00
Daniel Stenberg
4a091bbd8a Bug report #1204435 identified a problem with malformed URLs like
"http://somehost?data" as it added a slash too much in the request ("GET
/?data/"...). Added test case 260 to verify.
2005-05-18 20:01:01 +00:00
Daniel Stenberg
e99a6b813e update 2005-05-18 20:00:50 +00:00
Daniel Stenberg
b9e5302f27 adjusted the strerror_r test more, use _REENTRANT instead of _THREAD_SAFE
when looking for the prototype
2005-05-18 15:15:00 +00:00
Daniel Stenberg
dd7b6aef39 The configure check for strerror_r() failed to detect the proper API at
times, like on my HP-UX 10.20 tests. And then lib/strerror.c badly assumed
the glibc version if the posix define wasn't set (since it _had_ found a
strerror_r).
2005-05-18 13:24:23 +00:00
Daniel Stenberg
910b8b6a69 #15 is now fixed 2005-05-18 10:38:21 +00:00
Daniel Stenberg
c3207e215f clarified for GnuTLS 2005-05-18 10:14:25 +00:00
Daniel Stenberg
f83be11b85 several updates 2005-05-18 10:12:08 +00:00
Daniel Stenberg
45bce1062a ignore resolve too 2005-05-18 10:05:38 +00:00
Daniel Stenberg
8cb344bf3c use less code and prevent compiler warning 2005-05-18 10:01:46 +00:00
Daniel Stenberg
fcc4518cdc removed the separate table with download links, and extended the curl site
list with all current mirrors
2005-05-18 09:26:57 +00:00
Daniel Stenberg
c84839eb91 scan for gmake and make to prefer gmake on systems that have it 2005-05-17 12:07:08 +00:00
Daniel Stenberg
1f878aee69 Made test case 241 precheck that the given name resolves to an ipv6 address,
or the test is skipped. Ideally, we should let this test case go over a few
frequently used IPv6 localhost aliases...
2005-05-17 10:27:11 +00:00
Daniel Stenberg
84fd4686e2 Moved more generic functions to util.[ch]
Added resolve.c to simply resolve a given host name
2005-05-17 10:22:22 +00:00
Daniel Stenberg
ede9fb4fcc check if getsockname() returns failure before using the address it provides 2005-05-17 09:18:17 +00:00
Daniel Stenberg
723aef71e8 reduced typecasts, from two to one 2005-05-17 09:15:21 +00:00
Dominick Meglio
48964a911e More of the same 2005-05-17 04:20:58 +00:00
Dominick Meglio
6a35cb60fd More compiler warning cleanups 2005-05-17 04:18:41 +00:00
Daniel Stenberg
1e51c3a832 bad formatting 2005-05-16 22:30:00 +00:00
Dominick Meglio
205dda2b39 Made ares_free_hostent man page refer to ares_parse_aaaa_reply 2005-05-16 19:23:57 +00:00
Dominick Meglio
1c18d19da0 Cleaned up some compile warnings 2005-05-16 19:14:25 +00:00
Dominick Meglio
645729e943 Added ares_getnameinfo which mimics the getnameinfo API 2005-05-16 18:06:54 +00:00
Daniel Stenberg
f425a25c98 Modified the gmtime_r check to not check for it until the "check for a working
one" is made, and only if that test runs ok we define it as present. Unless
crosscompiling, since then we use the former AC_CHECK_FUNCS method.
2005-05-16 15:09:26 +00:00
Daniel Stenberg
aaace2e802 define GMTIME_R to 0 if not working 2005-05-16 14:53:48 +00:00
Daniel Stenberg
3f16d9fbc9 attempt to detect a bad (as in HPUX 10.20 bad) gmtime_r function 2005-05-16 14:40:10 +00:00
Daniel Stenberg
3afc57bab8 start working on 7.14.1 2005-05-16 13:27:41 +00:00
Daniel Stenberg
55225106b6 Version 7.14.0 2005-05-16 12:58:41 +00:00
Daniel Stenberg
1a31bff9fe return, not exit, on several places 2005-05-16 07:07:00 +00:00
Dominick Meglio
4eaa3329ec Converted some macros to use NS_* so they work on non-IPv6 systems 2005-05-15 16:31:01 +00:00
Dominick Meglio
028d78b993 Forgot to ares_-ize inet_ntop 2005-05-15 04:38:53 +00:00
Daniel Stenberg
944af98be6 fix warning about redefined symbol 2005-05-14 21:15:36 +00:00
Daniel Stenberg
2789b2b0ad replaced the CRLF newlines with plain LF ones 2005-05-14 20:45:49 +00:00
Dominick Meglio
7dded571de Added an inet_ntop function from BIND for systems that do not have it 2005-05-14 18:35:20 +00:00
Gisle Vanem
95fe8372e8 Updated generated dependencies. 2005-05-14 06:04:21 +00:00
Gisle Vanem
ecdcb0ef67 Some patches for (a stricter/smarter) gcc 4.0 and
warnings like:
  'x' may be used uninitialized in this function.
2005-05-14 06:00:40 +00:00
Gisle Vanem
6a04a03eb5 'ssize_t' seems to be a gcc 4.x built-in. 2005-05-14 05:59:26 +00:00
Gisle Vanem
0c96056a94 Change for systems with >1 ways of setting (non-)blocking
mode. (djgpp/Watt-32 has 3 ways). Should rewrite this using
"#elif ..", but maybe there is still broken cpp around?
2005-05-14 05:58:52 +00:00
Daniel Stenberg
f518a5e231 updated 2005-05-13 23:00:06 +00:00
Daniel Stenberg
f581c1062e uses select() instead of poll() even on Mac OS X 10.4 2005-05-13 22:24:50 +00:00
Daniel Stenberg
0b3deceea3 adjusted the configure to always skip the fine-poll() test on Mac OS X (darwin) 2005-05-13 21:19:21 +00:00
Daniel Stenberg
fa4cd8868c remove blank lines 2005-05-12 21:56:26 +00:00
Daniel Stenberg
8c573ca7f3 CURLOPT_SSLVERSION clarified 2005-05-12 21:49:42 +00:00
Daniel Stenberg
5a5cf3a51d -z bad use warning and NTLM proxy auth in reconnect fix 2005-05-12 14:00:27 +00:00
Daniel Stenberg
3f23e8443e oops, found by bug reported in bug report #1200661 2005-05-12 13:44:25 +00:00
Daniel Stenberg
a00f9b093c spell 2005-05-12 12:53:02 +00:00
Daniel Stenberg
5f538ce3f8 typecast to fix warning on 64bit systems 2005-05-12 08:51:30 +00:00
Daniel Stenberg
ebcaa3d579 warn about bad -z syntax 2005-05-12 07:28:03 +00:00
Daniel Stenberg
60e26199a2 MatrixSSL and yaSSL are two free libs we _could_ support 2005-05-11 11:56:04 +00:00
Daniel Stenberg
11defd180c mention the select() error fix as well 2005-05-11 10:23:59 +00:00
Daniel Stenberg
c82c1691ee the new HTTP headers 2005-05-11 09:56:53 +00:00
Daniel Stenberg
364562f209 removed duplicate 2005-05-11 09:56:10 +00:00
Daniel Stenberg
5d9fc28fa7 Modified the default HTTP headers used by libcurl:
A) Normal non-proxy HTTP:

 - no more "Pragma: no-cache" (this only makes sense to proxies)

B) Non-CONNECT HTTP request over proxy:

 - "Pragma: no-cache" is used (like before)
 - "Proxy-Connection: Keep-alive" (for older style 1.0-proxies)

C) CONNECT HTTP request over proxy:

 - "Host: [name]:[port]"
 - "Proxy-Connection: Keep-alive"
2005-05-11 09:52:59 +00:00
Daniel Stenberg
e5ec5c284f prevent NS_IN6ADDRSZ from getting set to zero if the struct doesn't exist 2005-05-11 06:47:09 +00:00
Daniel Stenberg
a90e33ad71 Hm, this doesn't feel right. The error bits returned from Curl_select() can
be returned at times when we want to ignore them. Test case 160 fails on Linux,
so I modify the comparison to check for _only_ the error bit set...
2005-05-10 23:02:37 +00:00
Daniel Stenberg
62ab21ce7d me stupid, errno is not set for mere select()-exceptions 2005-05-10 22:48:26 +00:00
Daniel Stenberg
cc8e8db1e5 include protos to fix warnings 2005-05-10 22:46:24 +00:00
Daniel Stenberg
b19cba2016 If Curl_select() returns with the error bit set, bail out. 2005-05-10 22:44:08 +00:00
Daniel Stenberg
315a9c95d5 prevent 64bit warnings 2005-05-10 11:21:57 +00:00
Daniel Stenberg
e010ac9706 allow the ares/config.h display to fail 2005-05-10 11:19:12 +00:00
Daniel Stenberg
e4c0a85da0 Jeremy Brown's OpenSSL thread-locking example 2005-05-09 21:12:03 +00:00
Daniel Stenberg
d3e4cdd5b0 new counter 2005-05-09 13:57:58 +00:00
Daniel Stenberg
763b812dc7 Jamie Lokier added. And I now recounted the amount better: 437 named as of now. 2005-05-09 13:53:42 +00:00
Daniel Stenberg
3269dfb4ab update the "PORTS" section a little 2005-05-09 13:26:41 +00:00
Daniel Stenberg
e816bd259f add multi-thread details for GnuTLS 2005-05-09 13:13:38 +00:00
Daniel Stenberg
a295408e09 new mirror, added amount of contributors 2005-05-09 12:34:55 +00:00
Daniel Stenberg
42a34c7cd7 Jeff is short for Jeffrey 2005-05-09 11:43:23 +00:00
Daniel Stenberg
9a72751958 updated with the current RELEASE-NOTES names 2005-05-09 11:39:20 +00:00
Daniel Stenberg
314e6fa80b I decided to make this list more complete. I took the 5-year anniversary list
from 2003 and added all names from all release notes in the CVS (there is a
slight gap though). I removed names with only first names (Like "Chris" and
"Ralph") , as that won't make anyone happy and we might list their full names
as well anyway.

This list is now intended to include _all_ people that contribute: big or
small. 389 names at the time of this commit.
2005-05-09 09:11:39 +00:00
Daniel Stenberg
b2b66f749a no need to display src/config.h anymore since it is a duplicate of lib/config.h
but we could use having a look at ares/config.h when that is used
2005-05-09 07:45:30 +00:00
Daniel Stenberg
708ed6fded silence compiler warnings 2005-05-08 22:45:01 +00:00
Daniel Stenberg
5c30fa50d6 fix warnings about unused variables for non-debug builds 2005-05-07 20:41:16 +00:00
Daniel Stenberg
fc33c424d9 fix 2005-05-07 20:28:39 +00:00
Daniel Stenberg
b04d6dd0b1 January 2003. Started working on the distributed curl tests. The autobuilds. 2005-05-07 14:23:32 +00:00
Daniel Stenberg
9c5f79c56a DEBUGF() is a new conveniant macro to add infof() calls (or similar) for
debug builds only. Made the ftp code use it on several places.
2005-05-07 13:57:07 +00:00
Daniel Stenberg
ef5eea689a Added an active disconnected state, to make the code clearer. 2005-05-07 13:52:07 +00:00
Daniel Stenberg
fd191deb49 removed unnecessary logging to ease REAL debuggin 2005-05-07 08:55:37 +00:00
Daniel Stenberg
e1da1ff7d3 one more command line option, fixed the AIX 4.3 enabled IPv6 build (it now
detects a bad Ipv6 situation and disables it automatically)
2005-05-06 23:46:35 +00:00
Daniel Stenberg
2b00ed7ef8 Added two test cases for multipart formpost over a proxy with --anyauth. Our
HTTP test server is a bit limited though, as it never responds to the POST
request until all data has been sent (and received)...
2005-05-06 23:22:33 +00:00
Daniel Stenberg
d960ea959d When a server is clearly running, curl is now invoked to verify that it can
download a file from the server before the server is considered fine to use
for the given test case. This should fix the cases where the server can run
but curl cannot work with it.
2005-05-06 23:21:34 +00:00
Daniel Stenberg
274842ec41 use calloc instead of malloc to save a call to memset() 2005-05-05 06:04:00 +00:00
Daniel Stenberg
c06da7c84a now add --trace-time by default for curl tests 2005-05-04 21:58:47 +00:00
Daniel Stenberg
cea117b509 removed lots of (now) redundant logging 2005-05-04 21:57:07 +00:00
Daniel Stenberg
6078c938b2 modify a value we are allowed to 2005-05-04 21:51:09 +00:00
Daniel Stenberg
9e95dd4821 improved logging (all FTP protocol data, both ways) to possibly help us realize
why sometimes the control connection dies after a RETR has been sent
2005-05-04 21:49:30 +00:00
Daniel Stenberg
0cc8b57d4f towards 7.14.0 - really 2005-05-04 15:11:09 +00:00
Daniel Stenberg
2179e6e797 prevent memory leak when built SSL disabled 2005-05-04 14:52:51 +00:00
Daniel Stenberg
7dde3d1825 *MAN* was this hard to track down. Had I just read the docs properly from the
start... Anyway, fork() + exec() makes _two_ pids (in perl) that we need to
track and kill after use. Thankyouverymuch.
2005-05-03 23:14:43 +00:00
Daniel Stenberg
a0fe950b75 add more info to the log to ease debugging 2005-05-03 23:13:24 +00:00
Daniel Stenberg
44985e8884 improved failf() error messages 2005-05-02 22:53:55 +00:00
Daniel Stenberg
f03366bcbf the new functions and the upcoming ipv6 calls for the next version to become
1.3.0
2005-05-02 22:33:57 +00:00
Daniel Stenberg
d43ea83033 corrected copyright years 2005-05-02 14:33:58 +00:00
Daniel Stenberg
11bdba0007 corrected copyright year 2005-05-02 14:33:07 +00:00
Daniel Stenberg
07e58aaa79 Sort of "fixed" KNOWN_BUGS #4: curl now builds IPv6 enabled on AIX 4.3. At
least it should no longer cause a compiler error. However, it does not have
AI_NUMERICHOST so we cannot getaddrinfo() any numerical addresses with it (we
use that for FTP PORT/EPRT)! So, I modified the configure check that checks if
the getaddrinfo() is working, to use AI_NUMERICHOST since then it'll fail on
AIX 4.3 and it will automatically build with IPv6 support disabled.
2005-05-02 14:06:27 +00:00
Daniel Stenberg
a31ddd363b Now configure checks for struct sockaddr_storage and the ftp code tries
to survive without it if not found. AIX 4.3 targetted adjustment.
2005-05-02 11:56:15 +00:00
Daniel Stenberg
ed9e10f2d8 another <case> converted to sysread 2005-05-02 11:55:17 +00:00
Daniel Stenberg
02ae3c2810 read from the open2 filehandle with sysread, not <handle> 2005-05-02 11:31:15 +00:00
Daniel Stenberg
669ebb5f71 Fixed the FTP server read stuff when waiting for a connect after a PASV/EPSV.
Made the ftp server use the passed in pidfile name, and made runtests.pl
pass it in properly.
2005-05-02 10:22:09 +00:00
Daniel Stenberg
9a3e0e52cb fix the server for the slow response case 2005-05-02 10:03:12 +00:00
Daniel Stenberg
b0f856213d Added --trace-time that when used adds a time stamp to each trace line that
--trace, --trace-ascii and --verbose output. I also made the '>' display
separate each line on the linefeed so that HTTP requests etc look nicer in the
-v output.
2005-05-02 09:38:19 +00:00
Daniel Stenberg
6f4ff1f2bf When starting the ftp server, wait a few seconds to make really sure that
a pidfile for the server appears as otherwise it failed.
2005-05-02 09:08:44 +00:00
Daniel Stenberg
d3eea61f1f Make sure there's no pidfile if we cannot start the initial sockfilt tool -
this happens for some ipv6-enabled hosts on which sockfilt cannot listen
on ipv6.
2005-05-02 09:08:02 +00:00
Daniel Stenberg
d59d81fae8 two bugfixes, one change and one test script modification 2005-05-02 08:40:20 +00:00
Daniel Stenberg
329ca40b6f two bugs, one change 2005-05-02 07:59:47 +00:00
Daniel Stenberg
e71bd416f4 blank a few more environment variables before running a test 2005-05-02 07:54:25 +00:00
Daniel Stenberg
ad66fc6cc2 Made curl recognize the environment variables Lynx (and others?) support for
pointing out the CA cert path/file: SSL_CERT_DIR and SSL_CERT_FILE. If
CURL_CA_BUNDLE is not set, they are checked afterwards.
2005-05-02 07:53:25 +00:00
Daniel Stenberg
d12b44204b Bryan Henderson's fine update of SSL_VERIFYPEER and SSL_VERIFYHOST 2005-05-02 07:28:40 +00:00
Daniel Stenberg
4be2136de4 prevent two compiler warnings on comparisons between signed and unsigned 2005-05-01 23:16:51 +00:00
Daniel Stenberg
c4dbed040b fixed to use fork()+exec() to start test servers 2005-05-01 13:20:53 +00:00
Daniel Stenberg
366b62af2d always use the libcurl-provided *printf() functions 2005-05-01 12:56:09 +00:00
Daniel Stenberg
a6955aa486 util.h added as "source" to make it get added in dist archives 2005-05-01 12:51:27 +00:00
Daniel Stenberg
ad30341fa2 logfile name is const 2005-04-30 23:35:51 +00:00
Daniel Stenberg
23da55a9f1 Moved common code to util.[ch] instead of having it duplicated in sws.c
and sockfilt.c. For good-to-have functions for the servers written in C.
2005-04-30 23:30:55 +00:00
Daniel Stenberg
41e6292e7b there cannot be chunked problem when no_body (HEAD) is true since without
body there is nothing chunked-encoded!
2005-04-30 23:07:38 +00:00
Daniel Stenberg
ae1d6f29d9 singleipconnect() returns a socket descriptor, not a CURLcode (but perhaps
we should make it do that...)
2005-04-30 15:16:39 +00:00
Daniel Stenberg
ccfc1ddbef more fixes 2005-04-29 12:34:53 +00:00
Daniel Stenberg
002de1eae2 Updated with (new and old) default config file search path explanation. 2005-04-28 21:26:30 +00:00
Daniel Stenberg
63621bae81 Set mode text on the section that is written by curl in text mode, to allow
the runtests.pl to check this differently on operating systems that
differentiate on this.
2005-04-28 21:07:07 +00:00
Daniel Stenberg
85f9e6c4b9 basic signal handler for sigint and sigkill 2005-04-28 21:06:17 +00:00
Daniel Stenberg
967ec296c0 fixed the attribute parser to better handle multiple ones, with or without
quotes around the contents
2005-04-28 21:05:40 +00:00
Daniel Stenberg
c6aae9b1d7 moved two functions to ftp.pm, made some more changes on stopping servers
and fixed the textmode attribute thing for windows a bit
2005-04-28 21:04:58 +00:00
Daniel Stenberg
913c370c25 moved in functions from runtests.pl to enable the ftpserver to use the
killslaves function
2005-04-28 21:04:08 +00:00
Daniel Stenberg
e5472bbd21 AF_INET6 for ipv6 addresses! 2005-04-28 14:31:25 +00:00
Daniel Stenberg
957c258c6d no, the kill servers messages need to be verbose, they're too frequent 2005-04-28 14:25:48 +00:00
Daniel Stenberg
abee109cd1 display killed pids to make it easier to see for autobuilds etc 2005-04-28 14:03:08 +00:00
Daniel Stenberg
502e5ae6e1 historic thing we will not use 2005-04-28 13:55:34 +00:00
Daniel Stenberg
b8417be1f2 removed ftpsserver.pl 2005-04-28 13:55:16 +00:00
Daniel Stenberg
9e037431b4 When staring a HTTP server, use the pidfile preferably since it turns out
sometimes the server can start but curl cannot speak to it, and then we must
remember the server (in order to kill it properly) anyway.

Also, make sure to kill all servers on exit everywhere.
2005-04-28 13:54:48 +00:00
Daniel Stenberg
f71b3676bb ignore more generated files 2005-04-28 11:22:18 +00:00
Daniel Stenberg
50fe7b5e35 remove unused ftps-server code and fixed two warnings 2005-04-28 08:23:25 +00:00
Daniel Stenberg
9fb253388b if diff -u makes zero output, try diff -c instead 2005-04-28 08:20:33 +00:00
Daniel Stenberg
8cf1786296 kill slave processes when they fail 2005-04-28 07:36:55 +00:00
Daniel Stenberg
51b17b299c 1. no longer ask the server for the HTTPS pid, as it returns the HTTP pid
(problem identified by Dan F)
2. initial text mode fix for file checks, to allow better text file testing
on windows (with regard to line endings)
3. fixed to use the proper ftpserver pidfile to find pid
2005-04-28 06:50:42 +00:00
Daniel Stenberg
78882e4642 Paul Moore made curl check for the .curlrc file (_curlrc on windows) on two
more places. First, CURL_HOME is a new environment variable that is used
instead of HOME if it is set, to point out where the default config file
lives. If there's no config file in the dir pointed out by one of the
environment variables, the Windows version will instead check the same
directory the executable curl is located in.
2005-04-27 21:24:58 +00:00
Daniel Stenberg
8465a367a4 listen(..., 1) as 0 doesn't work on Tru64! 2005-04-27 12:28:04 +00:00
Daniel Stenberg
3bcfe678ab display listening port in log 2005-04-27 12:27:23 +00:00
Daniel Stenberg
d5403f3a5b show what error codes we test for too, and show 10 test case numbers 2005-04-27 10:12:41 +00:00
Daniel Stenberg
26abb48533 keyword update 2005-04-27 09:59:47 +00:00
Daniel Stenberg
177848ed27 detect SSL library properly and display it on startup 2005-04-27 09:59:29 +00:00
Daniel Stenberg
656a2e93d7 fixing 2005-04-26 21:47:31 +00:00
Daniel Stenberg
6b1220b61d Cory Nelson's work on nuking compiler warnings when building on x64 with
VS2005.
2005-04-26 13:08:49 +00:00
Daniel Stenberg
9d7330d879 Since Windows doesn't have/use the POSIX prototype for send() and recv(), we
typecast the third argument in the macros to avoid compiler warnings.
2005-04-26 13:08:18 +00:00
Daniel Stenberg
26a5954fa0 adding a bunch of comments for each #endif 2005-04-26 10:55:52 +00:00
Daniel Stenberg
01165e08e0 Fred New reported a bug where we used Basic auth and user name and password in
.netrc, and when following a Location: the subsequent requests didn't properly
use the auth as found in the netrc file. Added test case 257 to verify my fix.
2005-04-25 21:39:48 +00:00
Daniel Stenberg
6e1633a6c5 be specific about what max_fd contains after a call 2005-04-25 08:55:55 +00:00
Daniel Stenberg
a8ff0a21bf Based on feedback from Cory Nelson, I added some preprocessor magic in
*/setup.h and */config-win32.h to build fine with VS2005 on x64.
2005-04-24 22:25:04 +00:00
Daniel Stenberg
b8bc6bed97 2 days, 4 fixes 2005-04-23 22:08:15 +00:00
Daniel Stenberg
1a4402038c Alex Suykov's ftp upload show progress meter patch, slightly adjusted. 2005-04-23 21:26:27 +00:00
Gunter Knauf
5ac51cc9b5 fix for recent changes. 2005-04-23 11:59:06 +00:00
Daniel Stenberg
c12159ce21 show up to 5 (random) test cases using the keyword 2005-04-22 22:29:48 +00:00
Daniel Stenberg
4485503ecc keywords added 2005-04-22 21:59:08 +00:00
Daniel Stenberg
200ac588cc Dave Dribin: set CURL_STATICLIB when it builds static library variants. 2005-04-22 21:16:22 +00:00
Daniel Stenberg
0bb040822d Andres Garcia's fix for building static curl on windows. 2005-04-22 21:13:27 +00:00
Daniel Stenberg
543fbe14ee Fixed the CN extraction 2005-04-22 20:56:26 +00:00
Daniel Stenberg
e02ab66120 update the copyright year 2005-04-22 20:49:35 +00:00
Daniel Stenberg
76c7c694c5 modified this year 2005-04-22 20:48:07 +00:00
Daniel Stenberg
f0057977b7 ignore the memdump file when showing files after a failure 2005-04-22 20:47:35 +00:00
Daniel Stenberg
e8e43f06af copyright this year 2005-04-22 20:47:21 +00:00
Daniel Stenberg
04b35e86d5 Fixed for Mac OS X builds based on excellent feedback from Heinz Stockinger. 2005-04-22 15:01:02 +00:00
Gunter Knauf
64ab85da4f changes for building with IPV6. 2005-04-22 13:03:17 +00:00
Daniel Stenberg
b8d7a13ea3 modified the test case success reporting, added "test N out of Y" and
"remaining: [time]" outputs to hint users about what to expect
2005-04-22 11:51:06 +00:00
Daniel Stenberg
78a76dc905 test 256 is like test 38 but with proxy + proxy auth 2005-04-22 10:15:21 +00:00
Daniel Stenberg
5fa5fff0e9 keywords 2005-04-22 10:06:58 +00:00
Daniel Stenberg
d323b3d816 Set the retry delay variables after the option parsing, as bug report
#1187787 points out.
2005-04-22 10:01:49 +00:00
Daniel Stenberg
b685b5672a added missing headers 2005-04-21 20:11:31 +00:00
Gunter Knauf
8f6c2f87c8 changes for building with IPV6 and LDAP. 2005-04-20 23:41:25 +00:00
Daniel Stenberg
f30e8b11eb prevent compiler warning 2005-04-19 23:38:57 +00:00
Daniel Stenberg
8bd6d6a4de added typecast when converting from long to unsigned short, to prevent compiler warning 2005-04-19 23:37:45 +00:00
Daniel Stenberg
b3a8f438fc indented source to look more like other ares code,
added (somewhat ugly) typecasts to build warning-free on 64bit platforms (the
result of a (char *) - (char *) cannot be stored in an int universally)
2005-04-19 23:36:21 +00:00
Daniel Stenberg
e78ddf0a95 sortlist_alloc() is never used on win32, so ifdef out it to prevent warning 2005-04-19 23:26:14 +00:00
Daniel Stenberg
5f0366c2cb only define _REENTRANT if not already defined, and only in setup.h 2005-04-19 23:19:23 +00:00
Daniel Stenberg
779ca09775 Check for and config for the ca cert bundle properly when built with GnuTLS.
Previously this was only done for OpenSSL builds.
2005-04-19 22:23:37 +00:00
Daniel Stenberg
313f1a1e83 when --with-gnutls is used, we assume a bin/libgnutls-config file in the
given prefix. Building something with gnutls without it just is too error-
prone.
2005-04-19 22:12:34 +00:00
Daniel Stenberg
21337f4776 remove the warning for a lacking crypto lib since it migth just be a gnutls
build...
2005-04-19 22:03:10 +00:00
Daniel Stenberg
53a8e5655b added CURLOPT_PORT test when using proxy 2005-04-19 08:10:04 +00:00
Daniel Stenberg
2d85585ae1 two bugfixes of today 2005-04-18 19:53:25 +00:00
Daniel Stenberg
63d109f7be Olivier reported that even though he used CURLOPT_PORT, libcurl clearly still
used the default port. He was right. I fixed the problem and added the test
cases 521, 522 and 523 to verify the fix.
2005-04-18 19:41:04 +00:00
Daniel Stenberg
c904b6b5bf Toshiyuki Maezawa reported that when doing a POST with a read callback,
libcurl didn't properly send an Expect: 100-continue header. It does now.
2005-04-18 17:14:58 +00:00
Daniel Stenberg
6a27449922 digest works in the proxyauth too 2005-04-18 14:32:48 +00:00
Daniel Stenberg
9a9c07f571 Initial curl_multi_socket() stuff, #ifdef'ed out for now but committed for
documentational purposes.
2005-04-18 11:40:50 +00:00
Daniel Stenberg
4382204e1b better fix for the socket -1 case 2005-04-18 08:59:46 +00:00
Daniel Stenberg
6d3114efe2 ignore sockfilt 2005-04-18 08:51:04 +00:00
Daniel Stenberg
b62baaed95 safety measure to avoid using -1 as socket 2005-04-18 08:49:46 +00:00
Daniel Stenberg
9b391e531b allow some more time 2005-04-18 08:49:21 +00:00
Daniel Stenberg
a0c7a6d22b ARGH my stupidity is endless. Ipv4-only hosts don't send EPRT or LPRT. 2005-04-18 07:56:43 +00:00
Daniel Stenberg
14424f7058 Modified the FTP server to use the new 'sockfilt' program to do all the socket
level stuff. The FTP server communicates with sockfilt using perl's open2().
This enables easier IPv6 support and hopefully FTP-SSL support in the future.
Added four test cases for FTP-ipv6.
2005-04-18 06:57:44 +00:00
Daniel Stenberg
6063dff8d0 Modified to not mix ordinary print to STDOUT with a system() that prints to
stdout, since I've found cases on Solaris where the second output mixes with
the first and thus the big check-script doesn't properly find the first
string in the output stream.
2005-04-18 05:46:10 +00:00
Daniel Stenberg
7fba9ed398 somewhat clarified that this only sets the fd_sets and expects them to be
cleared before this function is called
2005-04-17 23:01:46 +00:00
Daniel Stenberg
53280a196b keywords added 2005-04-16 23:15:19 +00:00
Daniel Stenberg
0bf9a5704b minor edits, report the test cases without keywords 2005-04-16 23:15:12 +00:00
Daniel Stenberg
8182d17ae1 starting to produce a summary in HTML 2005-04-16 12:43:32 +00:00
Daniel Stenberg
69b1ac7dcd avoid warning on windows 2005-04-16 12:30:01 +00:00
Daniel Stenberg
b15507aac3 clarify that > in the verbose output can contain newlines 2005-04-16 12:24:12 +00:00
Daniel Stenberg
6c2f583f51 keywords added 2005-04-16 00:00:35 +00:00
Daniel Stenberg
a72eaddda3 initial tool to report info/keywords of the test cases 2005-04-15 23:48:58 +00:00
Daniel Stenberg
dc050e45df started adding "keywords" for each test, to better allow us to sum up what
kind of tests we have and how many tests that test certain features
2005-04-15 23:48:31 +00:00
Daniel Stenberg
2fcbf13920 add needed include 2005-04-15 21:51:46 +00:00
Dominick Meglio
099ae31523 Attempted to fix c-ares not building on non-IPv6 systems 2005-04-15 15:25:16 +00:00
Daniel Stenberg
c2fcdf3a02 if libgnutls-config isn't found in the given path, deal with it nicer (but
it is still likely to not do very good since it can't figure out all the lib
dependencies)
2005-04-15 08:45:35 +00:00
Daniel Stenberg
2056a538b9 Two new slowdown tests for better testing of the FTP response reader function
when the response come in many small chunks.
2005-04-14 22:52:42 +00:00
Daniel Stenberg
cd1144dc24 make the ftp server support reply/servercmd, and make SLOWDOWN work, and
update the docs accordingly
2005-04-14 22:52:08 +00:00
Daniel Stenberg
e9d068b913 oops, only negative numbers are errors 2005-04-13 21:17:05 +00:00
Dan Fandrich
ec2ad57c32 Mention GnuTLS and fix a few spelling errors. 2005-04-13 19:31:00 +00:00
Daniel Stenberg
316adac511 don't bail out just because the ca file has a problem, it might be OK 2005-04-13 12:38:01 +00:00
Daniel Stenberg
d7b11d4c33 fix port number 2005-04-13 12:37:38 +00:00
Daniel Stenberg
c52aa6df33 GnuTLS support 2005-04-13 08:50:13 +00:00
Daniel Stenberg
a19b23b59f extended the multi-thread explanation 2005-04-13 08:47:59 +00:00
Daniel Stenberg
4e26b2a65b fix compiler warning 2005-04-13 06:52:03 +00:00
Dan Fandrich
7c4feac6db Allow environment variables to override default autotools. 2005-04-13 00:32:33 +00:00
Daniel Stenberg
e01e364c37 next release will be version 7.14.0 thanks to the added GnuTLS support 2005-04-12 14:17:07 +00:00
Daniel Stenberg
c13a3d7b84 Provides an unconditional strlcat() proto even if strlcat() was found by
configure. An attempt to fix warnings when we build and the strlcat() function
is provided by one if the libs (gss or krb4) since then we have no protos
for it in a system header.
2005-04-12 07:56:57 +00:00
Daniel Stenberg
67805b6dc5 requires OpenSSL, as our GnuTLS doesn't provide support for
CURLOPT_SSL_CTX_FUNCTION (yet).
2005-04-12 07:19:34 +00:00
Daniel Stenberg
0050ab2a3d support tests that requires 'OpenSSL' specificly 2005-04-12 07:18:48 +00:00
Daniel Stenberg
60e66c6cbf credits 2005-04-11 14:07:02 +00:00
Daniel Stenberg
5ad2a253e8 refresh 2005-04-11 13:50:19 +00:00
Daniel Stenberg
b5d50e9298 5.12 Can I make libcurl fake or hide my real IP address? 2005-04-11 13:39:55 +00:00
Daniel Stenberg
37f7362aca HTTP 304 response with Content-Length: header 2005-04-10 22:56:46 +00:00
Dominick Meglio
bee198def5 Removed usage of u_int and u_char 2005-04-09 23:46:31 +00:00
Daniel Stenberg
f09e479fd6 Blah, revert my removal of the extra check since the problem is there for real.
Archived thread of the help-gnutls mailing list regarding this problem:

http://lists.gnu.org/archive/html/help-gnutls/2005-04/msg00000.html

(and I _am_ sorry for my confused behaviour on this problem.)
2005-04-09 22:33:14 +00:00
Daniel Stenberg
80fe93bc33 OK, I must've been halucinating or something because I no longer see the
bug I thought I saw before when I changed this...!
2005-04-09 21:38:14 +00:00
Dominick Meglio
ea03ad3bee Made sortlist support IPv6 (this can probably use some testing) 2005-04-09 19:59:59 +00:00
Dominick Meglio
feec421744 Made sortlist support CIDR matching for IPv4 2005-04-09 16:49:47 +00:00
Dominick Meglio
634982840e Added preliminary IPv6 support to ares_gethostbyname 2005-04-08 19:46:46 +00:00
Daniel Stenberg
fb3c85ab2f fixed the 304 response-with-content-length problem reported by Cory Nelson 2005-04-08 16:59:13 +00:00
Dominick Meglio
a9b7c3531c Added include for inet_net_pton.h to ares__get_hostent.c 2005-04-08 16:22:51 +00:00
Dominick Meglio
a7ba0d908d Made ares_gethostbyaddr support IPv6 by specifying AF_INET6 as the family 2005-04-08 15:41:31 +00:00
Daniel Stenberg
2fc70e2c5d re-arrange some code to prevent warnings on unreachable code 2005-04-08 09:25:48 +00:00
Daniel Stenberg
7ae3f0e70c include sys/types.h too when checking for headers as otherwise this breaks
on Solaris and FreeBSD. At least.
2005-04-08 08:48:17 +00:00
Marty Kuhrt
9afaa51e3f updated instructions 2005-04-08 05:07:04 +00:00
Marty Kuhrt
c736a719f1 fixed control_y trap problem 2005-04-08 05:06:31 +00:00
Marty Kuhrt
37a547842b cast the call to Curl_inet_ntop for DECC compiler squawk 2005-04-08 05:01:40 +00:00
Daniel Stenberg
b9f1d43921 Unfortunately, if a ca file name is set the function fails for whatever reason
(missing file, bad file, etc), gnutls will no longer handshake properly but it
just loops forever. Therefore, we must return error if we get an error when
setting the CA cert file name. This is not the same behaviour as with OpenSSL.

Question/report posted to the help-gnutls mailing list, April 8 2005.
2005-04-07 22:47:43 +00:00
Daniel Stenberg
bec6423c02 one down 2005-04-07 22:14:22 +00:00
Daniel Stenberg
241b2b4ae3 set LD_LIBRARY_PATH when GnuTLS has been found 2005-04-07 22:13:40 +00:00
Daniel Stenberg
14d9b56937 cut 'n paste error 2005-04-07 21:12:09 +00:00
Daniel Stenberg
1c3766eb46 GnuTLS updates 2005-04-07 21:10:31 +00:00
Daniel Stenberg
70024d61eb GnuTLS! 2005-04-07 21:05:45 +00:00
Daniel Stenberg
2085f133d6 added new files 2005-04-07 20:56:04 +00:00
Daniel Stenberg
2a045dfceb fixed to build after the GnuTLS fixes 2005-04-07 20:36:48 +00:00
Daniel Stenberg
893cbaaf2f added some blurb about the GnuTLS license 2005-04-07 15:28:56 +00:00
Daniel Stenberg
6e61939382 GnuTLS support added. There's now a "generic" SSL layer that we use all over
internally, with code provided by sslgen.c. All SSL-layer-specific code is
then written in ssluse.c (for OpenSSL) and gtls.c (for GnuTLS).

As far as possible, internals should not need to know what SSL layer that is
in use. Building with GnuTLS currently makes two test cases fail.

TODO.gnutls contains a few known outstanding issues for the GnuTLS support.

GnuTLS support is enabled with configure --with-gnutls
2005-04-07 15:27:13 +00:00
Daniel Stenberg
015a618172 ssl_version_num is not used anymore 2005-04-07 15:21:50 +00:00
Daniel Stenberg
2a8b91cdb9 ssl_version_num won't be used anymore since we will soon offer multiple SSL
layers and it won't make sense to provide a numerical version for it. I also
doubt that many people have used this for anything critical.
2005-04-07 15:18:51 +00:00
Daniel Stenberg
bebd5dbc5a Add support for --with-gnutls. If configure detects OpenSSL, you need to
to explicitly disable that first with --without-ssl. Initial attempt.
2005-04-07 15:12:03 +00:00
Daniel Stenberg
018dbfe058 bail out if perl is missing, it is needed for building curl anyway 2005-04-07 14:26:03 +00:00
Daniel Stenberg
c6ea597817 check for libtoolize and aclocal to doublecheck the installations better 2005-04-07 08:59:39 +00:00
Daniel Stenberg
175b00c0a2 Try harder to see if arpa/nameser_compat.h REALLY is a good header file to
include, as it seems at least some AIX versions don't really allow it to be
include at the same time as the original nameser.h.
2005-04-07 07:38:53 +00:00
Daniel Stenberg
5ebc6e305e add SSPI 2005-04-07 07:30:02 +00:00
Daniel Stenberg
993600761f Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac OS
X.
2005-04-06 22:27:42 +00:00
Daniel Stenberg
1d9fff80b7 better errno constant replacements, as mentioned by Gisle Vanem 2005-04-06 21:14:58 +00:00
Gisle Vanem
c712b84dd5 Include inet_net_pton.h for 'struct in6_addr'. Ideally this
should come from <ws2tcpip.h>, but Winsock 1.1 should
suffice.
2005-04-06 18:58:33 +00:00
Gisle Vanem
dcf8dd4b5e Moved inet_net_pton.h to HHEADERS. 2005-04-06 18:55:59 +00:00
Daniel Stenberg
ba26c3fb22 check for struct sizes and use those sizes if the NS_* defines are lacking
(IRIX 6.5.22 it seems)
2005-04-06 14:11:50 +00:00
Daniel Stenberg
41563607a8 moved the *_inet_pton protos to inet_net_pton.h instead 2005-04-06 14:02:37 +00:00
Daniel Stenberg
2d4dcfb740 made the ares_inet_net_pton() proto use size_t size, as the function in the
code uses that
2005-04-06 13:54:02 +00:00
Dan Fandrich
34854e70cf Removed extraneous comma 2005-04-06 00:39:48 +00:00
Daniel Stenberg
758d9fe852 too late hacking error 2005-04-05 21:14:59 +00:00
Daniel Stenberg
6a6c0e7a73 test time-conditioned FTP uploads 2005-04-05 21:07:27 +00:00
Daniel Stenberg
ee44eec3e1 Christophe Legry's fix to grok time-conditoned uploads 2005-04-05 20:59:12 +00:00
Daniel Stenberg
eccd0d8e37 with these changes, it builds on my win32 cross-compiler 2005-04-05 20:20:14 +00:00
Daniel Stenberg
983be0ec60 check for another arpa header 2005-04-05 20:19:55 +00:00
Daniel Stenberg
243a45d840 check for the arpa/* headers 2005-04-05 20:08:15 +00:00
Dominick Meglio
60ec804047 Provided implementations of inet_net_pton and inet_pton from BIND for systems that do not include these functions. These will be necessary for CIDR support and IPv6 support. 2005-04-05 18:26:55 +00:00
Daniel Stenberg
c53e9ccf4a 7.13.3 in progress 2005-04-05 15:11:51 +00:00
Daniel Stenberg
6e8e0418fc 5.11 How do I make libcurl not receive the whole HTTP response? 2005-04-05 14:38:38 +00:00
Daniel Stenberg
e9eb52305f two more actual FAQs 2005-04-05 14:36:37 +00:00
Daniel Stenberg
8501ae748c restart with a blank page again 2005-04-05 07:55:41 +00:00
Daniel Stenberg
da59692067 the smell of release 2005-04-05 07:37:08 +00:00
Daniel Stenberg
bae77c0a46 bug report #1156287, ftp upload from VMS 2005-04-05 07:33:30 +00:00
Daniel Stenberg
b42bc7329e win resolve crash, win makefile fix 2005-04-04 22:38:53 +00:00
Daniel Stenberg
9b3c2b6ae2 kill warnings 2005-04-04 21:23:04 +00:00
Daniel Stenberg
833b6df969 Marcelo Juchem's improvements 2005-04-04 13:21:03 +00:00
Gisle Vanem
0b45431139 hostthre.c: destroy_thread_data() made public. Called
from url.c: Curl_disconnect().
2005-04-04 12:30:03 +00:00
Daniel Stenberg
5d1349031c spell fixes, based on the Debian bug report #302820 submitted by "A Costa" 2005-04-04 08:07:04 +00:00
Daniel Stenberg
82388a5e4c fix of tonight 2005-04-03 23:01:33 +00:00
Daniel Stenberg
74816fed6c Hardeep Singh reported a problem doing HTTP POST with Digest. (It was actually
also affecting NTLM and Negotiate.) It turned out that if the server responded
with 100 Continue before the initial 401 response, libcurl didn't take care of
the response properly. Test case 245 and 246 added to verify this.
2005-04-03 22:46:25 +00:00
Daniel Stenberg
b4c9789d5f Test 245 was just added in an attempt to repeat Hardeep Singh's recent bug.
But this works just fine on my host. Plain HTTP POST using Digest.
2005-04-03 22:18:27 +00:00
Daniel Stenberg
f96fadc074 fixed bad comment, pointed out by Marcelo Juchem 2005-03-31 20:34:24 +00:00
Daniel Stenberg
f6b1173437 copyright this year 2005-03-31 14:42:28 +00:00
Daniel Stenberg
346992c366 Attempt to make this code more forgiving for systems that doesn't detect
the failed connect "immediately".
2005-03-31 14:10:54 +00:00
Daniel Stenberg
ab4086bc24 Updated the copyright year since changes have been this year. 2005-03-31 07:02:02 +00:00
Daniel Stenberg
d8e7f2b2c7 the cookie API is better and more likely to happen in a separate release 2005-03-31 06:55:17 +00:00
Daniel Stenberg
93fcb94b62 fix configure's SSL-detection for msys/mingw (from Andres Garcia) 2005-03-30 20:55:44 +00:00
Daniel Stenberg
32a446cf19 format mistake in --form-string, pointed out by Owen Watson 2005-03-30 06:31:32 +00:00
Daniel Stenberg
94459cab98 Better connection keep-alive when POSTing with HTTP Digest or Negotiate. 2005-03-29 21:08:57 +00:00
Daniel Stenberg
158588640a Don't close the connection if we're in a known negotiation mode and we won't
send any data anyway. Probably the bug Tom Moers noticed.
2005-03-29 12:28:25 +00:00
Daniel Stenberg
f00f050d1b proxy multi auth fix, --proxy-anyauth, ftp-ssl and ftp response reading fix 2005-03-29 11:54:07 +00:00
Daniel Stenberg
c4f34c60a5 postpone these 2005-03-29 11:53:22 +00:00
Daniel Stenberg
371ef80dc3 When doing FTP-SSL, advance to the next state properly when the response to
AUTH has been received successfully.
2005-03-29 11:43:02 +00:00
Daniel Stenberg
84b4e9ff7c Fixed the FTP response reader function to properly deal with responses split
up in several chunks when read.
2005-03-29 11:35:25 +00:00
Daniel Stenberg
677a74fa1b Made the server send data to the control/data connections using two dedicated
functions. This enabled me to add a function that automatically delays between
each byte, to proper test curl's ability to read FTP server responses sent in
many (small) chunks. See also upcoming libcurl fixes...
2005-03-29 09:09:58 +00:00
Daniel Stenberg
8a076d1dba Based on Augustus Saunders' comments and findings, the HTTP output auth
function was fixed to use the proper proxy authentication when multiple ones
were added as accepted. test 239 and test 243 were added to repeat the
problems and verify the fixes.
2005-03-28 22:19:31 +00:00
Daniel Stenberg
970722483c Added --proxy-anyauth 2005-03-28 22:17:49 +00:00
Daniel Stenberg
31443724c6 modified some log outputs, added comment about auth required as used in
test 154
2005-03-28 22:15:17 +00:00
Daniel Stenberg
0e7614919b can you spell copy and paste error for me loud and clear? ;-P 2005-03-22 19:58:00 +00:00
Daniel Stenberg
2bf72937d2 provide HTML and PDF versions of the man pages in the dist archive 2005-03-22 19:46:49 +00:00
Daniel Stenberg
4e555c7b32 When cross-compiling, we do some better checking for the NI_WITHSCOPEID option instead of just assuming it is present. 2005-03-22 18:02:06 +00:00
Gisle Vanem
bd7021d05b CURL_EXTERN is already in <curl/curl.h>. 2005-03-22 10:37:26 +00:00
Gisle Vanem
1a14555605 Prevent redefinition warning with CURLDEBUG. 2005-03-22 10:36:20 +00:00
Daniel Stenberg
cb3fb371ea moved out the changes from 2004 to CHANGES.2004 2005-03-22 09:23:56 +00:00
Dan Fandrich
6c6dda1b74 Fixed typo. 2005-03-22 01:24:27 +00:00
Daniel Stenberg
a712808006 the same fix here too, typecast to prevent win32 compiler warning 2005-03-21 22:38:45 +00:00
Daniel Stenberg
e19c203728 typecase to fix win32 compiler warning (and intended as other code is) 2005-03-21 22:37:18 +00:00
Daniel Stenberg
8817779f23 Modified the VALID_SOCK() macro to become VERIFY_SOCK() instead. It is slighly
more involved, but should hopefully not generate any compiler warnings on
win32 systems (that can't check the socket based on the numeric).
2005-03-21 22:34:07 +00:00
Daniel Stenberg
3e5a32671c Make NTLM tests depend on the NTLM feature at not SSL, since the NTLM support
is no longer only present when built with SSL support.
2005-03-21 08:14:32 +00:00
Daniel Stenberg
d34f32b39e format mistake 2005-03-21 07:45:18 +00:00
Daniel Stenberg
c85a77e0b1 removed a (fairly useless) debug output just to compile without warning 2005-03-20 12:46:11 +00:00
Daniel Stenberg
9406e517e6 silence win32 compiler warnings 2005-03-20 12:29:15 +00:00
Daniel Stenberg
4a56049225 attempt to fix the ares link breakage with --enable-debug in libcurl and here 2005-03-20 00:38:50 +00:00
Daniel Stenberg
04ea4b4d75 silence warnings on win32 about static functions that are never used 2005-03-19 01:03:46 +00:00
Daniel Stenberg
5b6b6283f3 some additional debug output 2005-03-19 01:00:00 +00:00
Daniel Stenberg
38f07ce0fb fix compiler warning 2005-03-19 00:44:55 +00:00
Dan Fandrich
987cdebefb Fixed spelling of --runtestopts 2005-03-18 18:41:50 +00:00
Dan Fandrich
6b978db369 Netware builds don't use configure. 2005-03-18 18:03:38 +00:00
Daniel Stenberg
5840c8cb70 fix by Kyrre Kristiansen 2005-03-18 10:16:49 +00:00
Daniel Stenberg
44f2024bab adjust to use plain 'make' even for cross-compiles if using configure-
style build
2005-03-18 09:21:25 +00:00
Daniel Stenberg
410942e9df a Common Lisp binding 2005-03-18 09:01:42 +00:00
Dan Fandrich
5b3730feae Change the bogus address used in test237 to be more reliable when run
on a host with a buggy resolver that strips all but the bottom 8 bits of
each octet.  The resolved address in this case (192.0.2.127) is guaranteed
never to belong to a real host (see RFC3330).
2005-03-17 20:50:17 +00:00
Dan Fandrich
38f797ccd6 Use the proper macro to do uClibc detection. 2005-03-17 20:32:59 +00:00
Daniel Stenberg
553c5a7501 include inet_pton.h 2005-03-17 19:12:15 +00:00
Daniel Stenberg
bbba9d568f added descriptions 2005-03-17 12:16:24 +00:00
Daniel Stenberg
11e43dd021 update year 2005-03-17 12:00:23 +00:00
Daniel Stenberg
e8ddf84871 don't set TEST_F to blank when --runtestopts isn't used, as that will override
the default options set in the Makefile
2005-03-17 09:44:09 +00:00
Daniel Stenberg
67f04d2d5f support multiple error codes for a test case since some things just vary
between platforms
2005-03-17 08:17:48 +00:00
Daniel Stenberg
8f646eef45 add 'FTP ASCII transfers' here, since they seem to be frequently attempted
these days...!
2005-03-17 08:09:10 +00:00
Daniel Stenberg
d26e932858 add new option 2005-03-17 08:04:08 +00:00
Daniel Stenberg
73b9d0840c add new file 2005-03-17 08:04:00 +00:00
Daniel Stenberg
2ea4326c40 its a start 2005-03-17 08:03:46 +00:00
Daniel Stenberg
8b80ac2877 use Curl_inet_pton(), not inet_pton(). 2005-03-17 07:40:15 +00:00
Dan Fandrich
233237740d Added the --runtestsopts option to testcurl.pl to override the default
options used by runtests.pl during testing (useful for disabling valgrind).
2005-03-17 00:57:17 +00:00
Dan Fandrich
f5cdac38bd Removed references to config-vms.h from the makefiles. 2005-03-16 23:09:39 +00:00
Dan Fandrich
760565dcad Removed old VMS config files (on behalf of Marty Kuhrt). The VMS build
scripts use the version in packages/vms/
2005-03-16 22:27:05 +00:00
Daniel Stenberg
b5d97b3d94 more 2005-03-16 22:03:55 +00:00
Daniel Stenberg
4a6cc54eb5 check for the HTTPS server in a manner similar to how we check for the HTTP
server
2005-03-16 22:02:09 +00:00
Daniel Stenberg
61133545f6 - Tru64 and some IRIX boxes seem to not like test 237 as it is. Their
inet_addr() functions seems to use &255 on all numericals in a ipv4 dotted
  address which makes a different failure... Now I've modified the ipv4
  resolve code to use inet_pton() instead in an attempt to make these systems
  better detect this as a bad IP address rather than creating a toally bogus
  address that is then passed on and used.
2005-03-16 22:01:39 +00:00
Dan Fandrich
bf87d13f5b Fixed some compiler warnings I should have noticed before. 2005-03-16 02:25:12 +00:00
Dan Fandrich
efaf688650 Fixed ftp support with uClibc due to differing inet_ntoa_r() behaviour. 2005-03-15 21:00:46 +00:00
Daniel Stenberg
9a5c21c16f test EPSV and PASV response handling when they get well-formated data back
but using illegal values
2005-03-15 12:33:08 +00:00
Daniel Stenberg
06ffb47ef2 initial man page attempt for testcurl.pl 2005-03-15 12:13:37 +00:00
Daniel Stenberg
1acbda97e0 new options to testcurl.pl, fixed curl-config and removed compiler warnings 2005-03-15 07:50:16 +00:00
Daniel Stenberg
d6460aff36 added missing features to curl-config 2005-03-15 07:49:47 +00:00
Daniel Stenberg
a357f77c4c nonsense change for(;;) => while(1) just to prevent gcc from warning on
never executed code when -Wunreachable-code is used
2005-03-15 07:48:45 +00:00
Daniel Stenberg
d5bdd2b2f9 prevent compiler warning 2005-03-15 07:47:59 +00:00
Daniel Stenberg
562d2de303 Added lots of new command line options, made confsuffix get set based on
targetos only and not build os. Commented away the line that enables perl
warnings.
2005-03-15 07:35:36 +00:00
Dan Fandrich
1f68fa19c7 Finally fixed the LDAP library searching bug on libtool ver. 1.5 2005-03-15 04:47:07 +00:00
Dan Fandrich
677ddd6160 Make nonexistent host names absolute so tests will pass on machines
with a wildcard DNS search domain.
2005-03-15 04:04:50 +00:00
Dan Fandrich
228e627475 Use the libtool variables better to make LDAP library search work on
more platforms.
2005-03-14 19:37:07 +00:00
Daniel Stenberg
ec4e653c6f hushing up more warnings 2005-03-14 15:51:10 +00:00
Daniel Stenberg
3916d1e6cb silence compiler warnings for mingw win32 builds --enable-debug 2005-03-14 15:43:23 +00:00
Daniel Stenberg
387aaba810 show LDFLAGS too 2005-03-14 12:26:29 +00:00
Daniel Stenberg
9f3d9da119 if ws2_32 is used, append the lib last in the LIBS list (too) to make it
build and link fine with c-ares
2005-03-14 09:39:11 +00:00
Gisle Vanem
76c24a0d82 Avoid "unused variable" warnings. 2005-03-14 09:37:08 +00:00
Daniel Stenberg
ffd65a1956 configure --enable-sspi 2005-03-14 08:15:06 +00:00
Daniel Stenberg
de8947f92f security.h is removed 2005-03-14 07:46:42 +00:00
Daniel Stenberg
d2b4dedbe4 two issues fixed 2005-03-14 00:52:14 +00:00
Daniel Stenberg
34865ffb4a include security.h with lowercase s to work on cross-compiled mingw 2005-03-14 00:01:30 +00:00
Daniel Stenberg
62970da675 Removed security.h since it shadows an include file mingw needs when building
for SSPI support. The contents of the file has been moved into the krb4.h file.
2005-03-14 00:00:45 +00:00
Daniel Stenberg
8ed31c48e0 Added --enable-sspi that now make libcurl build with SSPI support. This only
works when built for win32.
2005-03-13 23:59:28 +00:00
Gisle Vanem
13d40e33a4 Prevent gcc warning. 2005-03-13 09:21:54 +00:00
Daniel Stenberg
c765213aaa found a common lisp binding 2005-03-12 22:55:57 +00:00
Daniel Stenberg
983bf93a24 --form-string 2005-03-12 19:49:55 +00:00
Daniel Stenberg
2f8085af15 David Houlder added --form-string 2005-03-12 19:39:27 +00:00
Gisle Vanem
88a4dc2795 Swap <security.h> and <sspi.h> (needed for MingW). 2005-03-12 17:31:15 +00:00
Dan Fandrich
b5112096d7 Work around a bug in libtool ver. 1.5 during LDAP library detection. 2005-03-11 23:07:40 +00:00
Daniel Stenberg
fc80c714e8 added CURL_VERSION_SSPI 2005-03-11 15:18:46 +00:00
Daniel Stenberg
84bc23b92f curl_version_info() returns the feature bit CURL_VERSION_SSPI 2005-03-11 15:10:36 +00:00
Daniel Stenberg
d90472dd64 fixed two leftover from Christopher's patch 2005-03-11 15:10:08 +00:00
Daniel Stenberg
3b63ed8230 the ares_parse_aaaa_reply man page 2005-03-11 08:34:51 +00:00
Daniel Stenberg
e75441e027 Check for winsock.h to work with win32. Only include system headers we know
exist.
2005-03-11 08:14:36 +00:00
Daniel Stenberg
0ae8b51230 Replace AC_TRY_RUN() with AC_EGREP_CPP() when checking for constants to
work fine with cross-compiled builds.
2005-03-11 08:06:57 +00:00
Daniel Stenberg
547c136b4f oops, once is enough! ;-) 2005-03-11 08:03:20 +00:00
Daniel Stenberg
4ed13bde55 Define HAVE_AF_INET6_H for Netware too, as Guenter Knauf's builds indicate. 2005-03-11 07:53:42 +00:00
Dan Fandrich
80e01deba0 Added HAVE_AF_INET6 to Netware's config.h 2005-03-11 07:52:24 +00:00
Dan Fandrich
fb9ae9d0e2 Fixed some compiler warnings. 2005-03-11 05:49:04 +00:00
Dan Fandrich
dd54d8551b Added HAVE_STRUCT_IN6_ADDR to Netware's config.h 2005-03-11 05:39:37 +00:00
Dan Fandrich
205f8b266c Fixed LDAP library file name bug (KNOWN_BUGS #1). configure now auto-detects
the correct dynamic library names by default, and provides override switches
--with-ldap-lib, --with-lber-lib and --without-lber-lib.  Added
CURL_DISABLE_LDAP to platform-specific config files to disable LDAP
support on those platforms that probably don't have dynamic OpenLDAP
libraries available to avoid compile errors.
2005-03-11 05:28:07 +00:00
Daniel Stenberg
c4ce9ac4de Add an alert already here if 'make test' is attempted for a cross-compile
since there's no use building the whole test suite first and _then_ tell it
doesn't work anyway...
2005-03-11 00:44:32 +00:00
Daniel Stenberg
0e4e28fdda no more rewriting of the setup file 2005-03-11 00:20:30 +00:00
Daniel Stenberg
db2370a12f Dominick Meglio added ares_parse_aaaa_reply.c and did various adjustments. The
first little steps towards IPv6 support!
2005-03-10 23:30:34 +00:00
Daniel Stenberg
d1d35ba85f Christopher R. Palmer made it possible to build libcurl with the
USE_WINDOWS_SSPI on Windows, and then libcurl will be built to use the native
way to do NTLM. SSPI also allows libcurl to pass on the current user and its
password in the request.
2005-03-10 23:15:29 +00:00
Daniel Stenberg
2ab2e7675c configure, socks, debug, getdate 2005-03-09 23:35:14 +00:00
Daniel Stenberg
0472629222 As reported by 'nodak sodak' we should check for a NULL pointer before
referencing the proxy name pointer.
2005-03-09 22:13:52 +00:00
Dan Fandrich
c4f7570a23 Stopped linking to the SSL libs if a full installation isn't found.
Removed a redundant library check.
2005-03-09 18:40:41 +00:00
Daniel Stenberg
d26cfd5791 skip the test of "2094 Nov 6" for now, since the 64bit time_t systems return
different values for it...
2005-03-09 07:56:32 +00:00
Daniel Stenberg
b7ffc6bb45 remove old printf() debug leftover 2005-03-08 22:21:59 +00:00
Daniel Stenberg
8a96aec567 mktime() returns a time_t. time_t is often 32 bits, even on many architectures
that feature 64 bit 'long'.

Some systems have 64 bit time_t and deal with years beyond 2038. However, even
some of the systems with 64 bit time_t returns -1 for dates beyond 03:14:07
UTC, January 19, 2038. (Such as AIX 5100-06)
2005-03-08 16:31:56 +00:00
Daniel Stenberg
5cd9f57137 days are english 2005-03-08 11:15:29 +00:00
Daniel Stenberg
702664e959 Dominick Meglio reported that using CURLOPT_FILETIME when transferring a FTP
file got a Last-Modified: header written to the data stream, corrupting the
actual data. This was because some conditions from the previous FTP code was
not properly brought into the new FTP code. I fixed and I added test case 520
to verify. (This bug was introduced in 7.13.1)
2005-03-08 08:09:14 +00:00
Dan Fandrich
18d87edd6d Fixed the --with-zlib configure option so that it always adds the specified
path to the compiler flags.  Before, a zlib installation in the default
path was always used in preference to the one in the desired location.
2005-03-08 03:24:49 +00:00
Dan Fandrich
dc59795629 fseek() with SEEK_SET is broken on large file capable 32-bit systems, so
revert to the SEEK_END method of repositioning the stream after a ftruncate()
and only use SEEK_SET if ftruncate() isn't available.
2005-03-07 18:59:04 +00:00
Daniel Stenberg
cb9bb31f7d test 236: FTP resume upload but denied access to remote file 2005-03-07 08:29:28 +00:00
Daniel Stenberg
02706bec94 valgrind.pm fixed 2005-03-07 08:11:36 +00:00
Daniel Stenberg
7657186bf6 added valgrind.pm to the dist 2005-03-06 22:33:05 +00:00
Dan Fandrich
42ac24448c Better cope with a failed or unavailable ftruncate().
Added HAVE_FTRUNCATE to all the static config-*.h files on the assumption
that all those systems provide it.
2005-03-05 00:54:16 +00:00
Daniel Stenberg
31891b55a4 Samuel Daz Garca's correction 2005-03-05 00:04:52 +00:00
Daniel Stenberg
aa47ac4c06 Added test case 235 that makes a resumed upload of a file that isn't present
on the remote side. This then converts the operation to an ordinary STOR
upload. This was requested/pointed out by Ignacio Vazquez-Abrams.

It also proved (and I fixed) a bug in the newly rewritten ftp code (and
present in the 7.13.1 release) when trying to resume an upload and the servers
returns an error to the SIZE command. libcurl then loops and sends SIZE
commands infinitely.
2005-03-04 23:52:06 +00:00
Dan Fandrich
b01151e81c Reduced the length of data read from the random entropy file. 2005-03-04 22:36:56 +00:00
Dan Fandrich
67bd6f9ccd Don't try to read the whole of the random file because when /dev/urandom is
used, it slows initialization too much reading an infinitely long file!
2005-03-04 20:10:29 +00:00
Daniel Stenberg
4869fa285b 7.13.2-CVS 2005-03-04 15:42:33 +00:00
Daniel Stenberg
d221e01406 starting over 2005-03-04 14:09:04 +00:00
Daniel Stenberg
874fc8228a stand clear for release time 2005-03-04 13:41:46 +00:00
Daniel Stenberg
6f752c64bc Dave Dribin made it possible to set CURLOPT_COOKIEFILE to "" to activate
the cookie "engine" without having to provide an empty or non-existing file.
2005-03-04 00:26:50 +00:00
Daniel Stenberg
ccb7950c4c killed trailing whitespace 2005-03-04 00:24:52 +00:00
Daniel Stenberg
750e771376 killed trailing whitespace 2005-03-04 00:14:45 +00:00
Daniel Stenberg
7012a4a291 Rene Rebe fixed a -# crash when more data than expected was retrieved. 2005-03-04 00:12:02 +00:00
Daniel Stenberg
40ab20a252 new VB binding 2005-03-03 23:27:09 +00:00
Daniel Stenberg
6af315e50c VB binding, updated the .NET info 2005-03-03 23:25:13 +00:00
Daniel Stenberg
861b5e608b mention buffer overflows fixed 2005-03-03 13:13:21 +00:00
Daniel Stenberg
f61917594e fix the distribution files 2005-03-03 06:51:31 +00:00
Dan Fandrich
0ddab51ad8 Fix for a base64 decode heap buffer overflow vulnerability. 2005-02-28 23:54:17 +00:00
Dan Fandrich
9798432f56 Fixed some compiler warnings. Fixed a low incidence memory leak in the test server. 2005-02-24 18:54:23 +00:00
Daniel Stenberg
5faf52619d Updated as suggested by Samuel Daz Garca 2005-02-22 18:39:40 +00:00
Daniel Stenberg
f8b4ba80e0 krb4 fixed 2005-02-22 12:20:30 +00:00
Daniel Stenberg
527f70e540 Curl_base64_decode() now returns an allocated buffer 2005-02-22 12:10:30 +00:00
Daniel Stenberg
19f66c7575 Thanks for the notification iDEFENCE. We are the "initial vendor" and we sure
got no notification, no mail, no nothing.

You didn't even bother to mail us when you went public with this. Cool.

NTLM buffer overflow fix, as reported here:

http://www.securityfocus.com/archive/1/391042
2005-02-22 07:44:14 +00:00
Daniel Stenberg
b7721deb02 added test case 234 which is like 233 but uses --location-trusted instead so
thus the second request to the new host will use authentication fine
2005-02-19 22:33:06 +00:00
Daniel Stenberg
5ba188ab2d Ralph Mitchell reported a flaw when you used a proxy with auth, and you
requested data from a host and then followed a redirect to another
host. libcurl then didn't use the proxy-auth properly in the second request,
due to the host-only check for original host name wrongly being extended to
the proxy auth as well. Added test case 233 to verify the flaw and that the
fix removed the problem.
2005-02-18 23:53:07 +00:00
Daniel Stenberg
eadfd78c2e socket leak, mingw build 2005-02-18 11:54:52 +00:00
Daniel Stenberg
4d815c9990 Based on Mike Dobbs' report, BUILDING_LIBCURL is now defined in here if it
runs to build with mingw.
2005-02-18 08:24:53 +00:00
Daniel Stenberg
176981b529 close the socket properly when returning error due to failing localbind
Bug report #1124588 by David
2005-02-17 14:45:03 +00:00
Daniel Stenberg
85baebd0d4 mention filename= for the -F 2005-02-17 07:47:32 +00:00
Daniel Stenberg
ac022b2e30 Christopher R. Palmer reported a problem with HTTP-POSTing using "anyauth"
that picks NTLM. Thanks to David Byron letting me test NTLM against his
servers, I could quickly repeat and fix the problem. It turned out to be:

When libcurl POSTs without knowing/using an authentication and it gets back a
list of types from which it picks NTLM, it needs to either continue sending
its data if it keeps the connection alive, or not send the data but close the
connection. Then do the first step in the NTLM auth. libcurl didn't send the
data nor close the connection but simply read the response-body and then sent
the first negotiation step. Which then failed miserably of course. The fixed
version forces a connection if there is more than 2000 bytes left to send.
2005-02-16 14:31:23 +00:00
Daniel Stenberg
f169b750b8 check for ENGINE_load_builtin_engines() as well if engine is around 2005-02-14 23:50:29 +00:00
Marty Kuhrt
86295eef13 changed config-vms info 2005-02-14 22:37:59 +00:00
Marty Kuhrt
32d60b2714 changed curlmsg.* entries to see if CVS would ignore it now 2005-02-14 22:36:21 +00:00
Daniel Stenberg
0a3065a2f2 Rename Curl_pretransfersec() to *_second_connect() since it does not just
do pretransfer stuff like Curl_pretransfer().
2005-02-14 09:30:40 +00:00
Daniel Stenberg
b98faaa8c0 Fixed bad krb4 code. It always tried to use krb4 if built enabled. 2005-02-11 22:50:57 +00:00
Marty Kuhrt
73772323c9 rename amigaos.c and nwlib.c if they exist before building 2005-02-11 22:42:16 +00:00
Daniel Stenberg
98389066e2 Removed per Marty's request: The .h_* files aren't needed anymore, I
consolidated them into one file called config-vms.h.  The curlmsg.h and .sdl
files are generated from the curlmsg.msg file and, thus, shouldn't be in the
dist.
2005-02-11 22:05:04 +00:00
Marty Kuhrt
fb53ed4c1f re-sync'd with curlmsg.msg 2005-02-11 21:17:23 +00:00
Marty Kuhrt
e719eb5b81 ignore curlmsg.h and .sdl as they are generated by curlmsg.msg 2005-02-11 21:07:35 +00:00
Marty Kuhrt
3858063bcd sync'd error codes with include/curl.h 2005-02-11 21:01:52 +00:00
Marty Kuhrt
d4f5fea840 Added $Id$ and pre-exisiting logical check 2005-02-11 20:17:21 +00:00
Daniel Stenberg
22c1d48cb2 remove the check for strftime(), we don't need it 2005-02-11 19:34:05 +00:00
Daniel Stenberg
e7cefd684b Removed all uses of strftime() since it uses the localised version of the
week day names and month names and servers don't like that.
2005-02-11 00:03:49 +00:00
Daniel Stenberg
d2485e4f20 valgrind stuff for test suite, vms build and more 2005-02-10 08:57:23 +00:00
Daniel Stenberg
160d6b26b0 Moved out the valgrind report parser to valgrind.pm, to make it easier to
test it outside the test suite. Now we also disable valgrind usage if libcurl
was built shared, as then valgrind is only testing the wrapper-script running
shell which is pointless.
2005-02-10 08:50:33 +00:00
Daniel Stenberg
17d61e4f29 typecast assign to ftpport from int to prevent warnings 2005-02-10 07:45:26 +00:00
Daniel Stenberg
446b9467da init fix for non-SSL builds 2005-02-10 07:45:08 +00:00
Marty Kuhrt
3970a7056c Reduced the two config-vms.h_* files into this one. 2005-02-10 01:54:11 +00:00
Daniel Stenberg
74068a6d1b David Byron fixed his SSL problems, initially mentioned here:
http://curl.haxx.se/mail/lib-2005-01/0240.html. It turned out we didn't use
SSL_pending() as we should.

This was TODO-RELEASE issue #59.
2005-02-09 23:16:03 +00:00
Daniel Stenberg
8c83422fe2 David Byron identified the lack of SSL_pending() use, and this is my take
at fixing this issue.
2005-02-09 23:09:12 +00:00
Daniel Stenberg
61a1e3cd01 better error checking and SSL init by David Byron 2005-02-09 23:04:51 +00:00
Daniel Stenberg
89cac6f25c prevent a compiler warning 2005-02-09 22:47:57 +00:00
Gisle Vanem
62082293c5 Some functions are static here, but extern in libxml's
SAX.h. gcc doesn't like that. Rename.
2005-02-09 15:15:01 +00:00
Daniel Stenberg
153fd2752c the new ftp code and Gisle's DICT fix 2005-02-09 14:34:46 +00:00
Daniel Stenberg
e649a40f5d issue #54 done 2005-02-09 14:29:57 +00:00
Gisle Vanem
32d76a5b57 Set 'bits.close' in case of malloc fail.
Don't free 'lud_dn' twice in case curl_unescape()
fails.
2005-02-09 14:28:35 +00:00
Daniel Stenberg
14aa3fa258 add missing error codes 2005-02-09 14:13:21 +00:00
Gisle Vanem
f5394cccb1 Use CURL_SOCKET_BAD. 2005-02-09 14:01:15 +00:00
Gisle Vanem
64dd9c7656 Handle CURLE_LOGIN_DENIED in strerror.c.
For ftp only?
2005-02-09 13:59:40 +00:00
Daniel Stenberg
16ae0c6466 FD_SET can be big macro, use braces 2005-02-09 13:47:35 +00:00
Daniel Stenberg
6a2e21ec8c FTP code turned into state machine. Not completely yet, but a good start.
The tag 'before_ftp_statemachine' was set just before this commit in case
of future need.
2005-02-09 13:06:40 +00:00
Gisle Vanem
120f17ce04 Replace LF with CRLF. Ref RFC-2229, sec 2.3:
"Each command line must be terminated by a CRLF".
2005-02-09 11:50:41 +00:00
Daniel Stenberg
ab938bb9bd -O clarification 2005-02-08 23:39:47 +00:00
Daniel Stenberg
33820cd2ac inflate and out of memory fixes 2005-02-08 19:07:28 +00:00
Daniel Stenberg
41def21f91 ares_gethostbyname wants a 'ares_host_callback' in the 4th argument 2005-02-08 19:03:27 +00:00
Gisle Vanem
d118312922 Curl_addrinfo?_callback() and addrinfo_callback() now returns
CURLE_OK or CURLE_OUT_OF_MEMORY.
Add typecast in hostares.c.
2005-02-08 12:36:13 +00:00
Gisle Vanem
82b93e4945 Don't free too much in freedirs() if realloc() fails. 2005-02-08 12:32:28 +00:00
Daniel Stenberg
e36fb1ecda Curl_wait_for_resolv() no longer disconnects on failure, but leaves that
operation to the caller. Disconnecting has the disadvantage that the conn
pointer gets completely invalidated and this is not handled on lots of places
in the code.
2005-02-08 07:36:57 +00:00
Dan Fandrich
e4a1788614 Fix for a bug report that compressed files that are exactly 64 KiB long
produce a zlib error.
2005-02-07 19:12:37 +00:00
Gisle Vanem
7b23eff9cf Preserve previous status in Curl_http_done(). 2005-02-06 12:43:40 +00:00
Daniel Stenberg
67ff8e3ea3 valgrind errors occur too often when 'make test' is used. It is because too
many third-party libs and tools have problems. When curl is built without
--disable-shared, the testing is done with a front-end script which makes the
valgrind testing include (ba)sh as well and that often causes valgrind
errors. Either we improve the valgrind error scanner a lot to better identify
(lib)curl errors only, or we disable valgrind checking by default
2005-02-05 10:25:20 +00:00
Daniel Stenberg
2248599ae1 fix type 2005-02-04 23:53:12 +00:00
Daniel Stenberg
29350b363b Eric Vergnaud found a use of an uninitialized variable 2005-02-04 23:43:44 +00:00
Daniel Stenberg
83c470a443 David Byron pointed out that this -1 on the buffer size is pointless since
the buffer is already BUFSIZE +1 one big to fit the extra trailing zero. This
change is reported to fix David's weird SSL problem...
2005-02-04 13:42:41 +00:00
Daniel Stenberg
ab96e2d6e9 another example 2005-02-02 19:25:49 +00:00
Daniel Stenberg
6b81cf4bc9 HTML parsing example with libtidy, by Jeff Pohlmeyer 2005-02-02 19:25:37 +00:00
Daniel Stenberg
0d9301539e and we start over again 2005-02-01 08:46:06 +00:00
Daniel Stenberg
4a9e12542d 7.13 coming up 2005-02-01 07:54:36 +00:00
Daniel Stenberg
21b4105454 somewhat nicer libcurl usage 2005-01-31 20:03:01 +00:00
Daniel Stenberg
d7648d94ca htmltitle 2005-01-31 18:23:42 +00:00
Daniel Stenberg
883343ba63 HTML <head> parsing (with libxml) example code by Lars Nilsson. 2005-01-31 18:22:40 +00:00
Daniel Stenberg
16b5dc710f four changes 2005-01-30 22:57:19 +00:00
Daniel Stenberg
686d767053 if the DO operation returns failure, bail out and close down nicely to
prevent memory leakage
2005-01-30 22:54:06 +00:00
Daniel Stenberg
ed3176dd6b Let's add a cookie interface in 7.14 2005-01-30 13:26:12 +00:00
Daniel Stenberg
6a99ab098c Bugfixed the parser that scans the valgrind report outputs. I noticed that it
previously didn't detect and report the "Conditional jump or move depends on
uninitialised value(s)" error.

When I fixed this, I caught a few curl bugs with it. And then I had to spend
time to make the test suite IGNORE these errors when OpenSSL is used since it
produce massive amounts of valgrind warnings (but only of the "Conditional..."
kind it seems).

So, if a test that requires SSL is run, it ignores the "Conditional..."
errors, and you'll get a "valgrind PARTIAL" output instead of "valgrind OK".
2005-01-30 12:56:36 +00:00
Daniel Stenberg
b03adde546 properly mark tests as requiring feature 'SSL' 2005-01-30 12:53:05 +00:00
Daniel Stenberg
e6034ea299 Use calloc() to save us the memset() call and terminate conn->host.name
properly, to avoid reading uninited variables when using file:// (valgrind)
2005-01-30 12:42:15 +00:00
Daniel Stenberg
c7f51ebeab Clear the urlglob struct when allocated, since we might otherwise use
uninitialized variables. Pointed out to us by the friendly Valgrind.
2005-01-29 23:46:27 +00:00
Daniel Stenberg
9a820d7a98 include "url.h" for the Curl_safefree() proto 2005-01-29 22:38:45 +00:00
Daniel Stenberg
8dbaf534c8 Using the multi interface, and doing a requsted a re-used connection that
gets closed just after the request has been sent failed and did not re-issue
a request on a fresh reconnect like the easy interface did. Now it does!
(define CURL_MULTIEASY, run test case 160)
2005-01-29 22:31:06 +00:00
Daniel Stenberg
91f483c591 Define CURL_MULTIEASY when building this, to use my new curl_easy_perform()
that uses the multi interface to run the request. It is a great testbed for
the multi interface and I believe we shall do it this way for real in the
future when we have a successor to curl_multi_fdset().
2005-01-29 22:26:38 +00:00
Daniel Stenberg
c5b448038f corrected the URL 2005-01-29 13:54:15 +00:00
Daniel Stenberg
c4ff5eb0ca conn->ip_addr MUST NOT be used on re-used connections 2005-01-29 13:07:16 +00:00
Daniel Stenberg
0859cd2444 when using valgrind, include a much longer stack trace 2005-01-29 13:06:31 +00:00
Daniel Stenberg
59b45a90cc multi interface: when a request is denied due to "Maximum redirects followed"
libcurl leaked the last Location: URL.
2005-01-29 12:01:20 +00:00
Daniel Stenberg
f661475962 Connect failures with the multi interface was often returned as "connect()
timed out" even though the reason was different. Fixed this problem by not
setting this timeout to zero when using multi.
2005-01-28 23:21:24 +00:00
Daniel Stenberg
54b02ecf09 adjusted to the moved unlock of the DNS entry 2005-01-28 22:22:59 +00:00
Daniel Stenberg
4551e7ce49 KNOWN_BUGS #17 fixed. A DNS cache entry may not remain locked between two
curl_easy_perform() invokes. It was previously unlocked at disconnect, which
could mean that it remained locked between multiple transfers. The DNS cache
may not live as long as the connection cache does, as they are separate.

To deal with the lack of DNS (host address) data availability in re-used
connections, libcurl now keeps a copy of the IP adress as a string, to be able
to show it even on subsequent requests on the same connection.
2005-01-28 22:14:48 +00:00
Daniel Stenberg
064bc3ecbc Stephen More pointed out that CURLOPT_FTPPORT and the -P option didn't work
when built ipv6-enabled. I've now made a fix for it. Writing test cases for
custom port strings turned too tricky so unfortunately there's none.
2005-01-28 08:26:36 +00:00
Daniel Stenberg
cf38a4c470 test the EPRT/LPRT/PORT somewhat more 2005-01-27 23:03:02 +00:00
Daniel Stenberg
aacc79a3a3 Use the same work-around for the memdebug stuff as in the command line client,
to allow the contents of the env var decide the file name.
2005-01-27 22:40:56 +00:00
Daniel Stenberg
9864bf703d a slightly involved work-around to prevent the debug-tracing from logging
a free-without-alloc as the first call
2005-01-27 15:59:01 +00:00
Daniel Stenberg
289a42f050 Make the debug build get the debug dump file path from the environment
variable to allow the test suite to better control where it ends up.
2005-01-27 15:51:03 +00:00
Daniel Stenberg
ade1e79b37 verify a part of the PORT line 2005-01-27 12:59:40 +00:00
Daniel Stenberg
2415724d5f Make the server ignore the given PORT address, to make it possible to test
curl's -P option easier.
2005-01-26 23:18:31 +00:00
Daniel Stenberg
5463177f1f added more official web and download mirrors 2005-01-26 12:05:33 +00:00
Daniel Stenberg
4efd751eda new curlpp URL 2005-01-26 11:53:49 +00:00
Daniel Stenberg
2337efc3b1 fixed sort, mention C, the java binding is now maintained by Vic Hanson 2005-01-26 11:53:12 +00:00
Daniel Stenberg
b942a25a45 add number to the bugs to make them easier to refer to 2005-01-25 23:40:35 +00:00
Daniel Stenberg
beab9a9696 two known bugs 2005-01-25 22:21:42 +00:00
Daniel Stenberg
177dbc7be0 Ian Ford asked about support for the FTP command ACCT, and I discovered it is
present in RFC959... so now (lib)curl supports it as well. --ftp-account and
CURLOPT_FTP_ACCOUNT set the account string. (The server may ask for an account
string after PASS have been sent away. The client responds with "ACCT [account
string]".) Added test case 228 and 229 to verify the functionality. Updated
the test FTP server to support ACCT somewhat.
2005-01-25 22:13:12 +00:00
Daniel Stenberg
f2e71edcbd A minor "syntax error" in numerous test files corrected 2005-01-25 21:45:03 +00:00
Daniel Stenberg
fad6e5a5bc new web mirror 2005-01-25 13:59:48 +00:00
Daniel Stenberg
52f6c437fe --protocols is added in 7.13.0 2005-01-25 12:06:12 +00:00
Daniel Stenberg
80a8be6319 David Shaw contributed a fairly complete and detailed autoconf macro you can
use to detect libcurl and setup variables for the protocols the installed
libcurl supports: docs/libcurl/libcurl.m4
2005-01-25 09:29:05 +00:00
Daniel Stenberg
043d70fcdf Use plain structs and not typedef'ed ones in the hash and linked-list code. 2005-01-25 00:06:29 +00:00
Daniel Stenberg
4f7e958969 two options less 2005-01-23 00:08:56 +00:00
Daniel Stenberg
53143910a1 \fI marked \fP more function calls etc. 2005-01-22 22:43:04 +00:00
Daniel Stenberg
95656cd7f3 If you're using libcurl as a win32 DLL, you MUST use the CURLOPT_WRITEFUNCTION
if you set CURLOPT_WRITEDATA - or you will experience crashes.
2005-01-22 22:24:17 +00:00
Daniel Stenberg
d8f79b263d next release will be 7.13.0 2005-01-22 19:26:37 +00:00
Daniel Stenberg
51da8552c3 added a few items I plan to do 2005-01-22 09:03:55 +00:00
Daniel Stenberg
7e42cb61f7 FTP third transfer support overhaul. See CHANGES for details. 2005-01-21 09:32:32 +00:00
Daniel Stenberg
6c038680f9 clarify the struct name for CURLOPT_HTTPPOST 2005-01-21 08:56:04 +00:00
Daniel Stenberg
291a908f19 Added support for "verify" => "stripfile" to strip contents of the file that
is being checked.

Also made the server retrying sleep only one second instead of three, to reduce
some waiting when fooling around with the servers.
2005-01-20 22:48:43 +00:00
Daniel Stenberg
b264a03f89 Support file names passed to RETR that don't start with a number. In that
case, all non-numeric prefixing letters are cut off to figure out the test
number.
2005-01-20 22:47:31 +00:00
Daniel Stenberg
7472ede32a Philippe Hameau found out that -Q "+[command]" didn't work, although some code
was written for it. I fixed and added test case 227 to verify it.  The curl.1
man page didn't mention the '+' so I added it.
2005-01-20 22:22:12 +00:00
Daniel Stenberg
b5065e462b add support for NOOP 2005-01-20 22:05:44 +00:00
Daniel Stenberg
8dd799b4bd If you give a *_LARGE option you MUST make sure that the type of the passed-in
argument is a curl_off_t. If you use CURLOPT_INFILESIZE (without _LARGE) you
must make sure that to pass in a type 'long' argument. */
2005-01-20 14:24:56 +00:00
Daniel Stenberg
a38520c90d added test226 too 2005-01-19 22:00:54 +00:00
Daniel Stenberg
3050ae57c0 Stephan Bergmann made libcurl return CURLE_URL_MALFORMAT if an FTP URL
contains %0a or %0d in the user, password or CWD parts. (A future fix would
include doing it for %00 as well - see KNOWN_BUGS for details.) Test case 225
and 226 were added to verify this
2005-01-19 21:56:02 +00:00
Daniel Stenberg
01205f772c today's proxy fixes 2005-01-19 18:05:56 +00:00
Gisle Vanem
06ad5be3af Don't copy 'stderr' for Win-CE in IPv6 code. Don't call
GetCurrentProcess() twice; use a local variable.
2005-01-19 10:20:55 +00:00
Daniel Stenberg
2fe3829e5e add a URL to an article about making Apache support PUT 2005-01-19 10:09:15 +00:00
Daniel Stenberg
a0c8b9bc68 Stephan Bergmann pointed out two flaws in libcurl built with HTTP disabled:
1) the proxy environment variables are still read and used to set HTTP proxy

2) you couldn't disable http proxy with CURLOPT_PROXY (since the option was
   disabled)
2005-01-19 09:36:44 +00:00
Daniel Stenberg
0406b1facf skip sys/socket.h on windows CE 2005-01-18 15:13:23 +00:00
Daniel Stenberg
65dbee01e5 check for errno.h 2005-01-18 14:34:50 +00:00
Daniel Stenberg
b1080f7c9a Cody Jones' enhanced version of Samuel Daz Garca's MSVC makefile patch. 2005-01-18 10:17:34 +00:00
Daniel Stenberg
7bfd58d41f Add support for server 'ftp2' which is a second FTP server. Useful for 3rd
party transfer tests or tests that need two FTP servers.
2005-01-17 20:20:34 +00:00
Daniel Stenberg
3851c6aae2 support the new --id command line option, that allows a second (or third or
whatever) instance to run without overwriting the previous' logfiles
2005-01-17 19:49:12 +00:00
Daniel Stenberg
ae03fa7d8e mention the name-prefix protocol guess thing 2005-01-17 14:57:21 +00:00
Daniel Stenberg
8a14dd25a9 updated the wording for -B/--use-ascii 2005-01-17 09:18:04 +00:00
Daniel Stenberg
e0bea7d541 Alex aka WindEagle pointed out that when doing "curl -v dictionary.com", curl
assumed this used the DICT protocol. While guessing protocols will remain
fuzzy, I've now made sure that the host names must start with "[protocol]."
for them to be a valid guessable name. I also removed "https" as a prefix that
indicates HTTPS, since we hardly ever see any host names using that.
2005-01-16 08:51:52 +00:00
Daniel Stenberg
534a8a05f3 mention --netrc in the -u description 2005-01-16 08:34:18 +00:00
Gisle Vanem
f5b8a26d9a errrno can by freak accident become EINTR on DOS or
Windows (unrelated to select). select() can never set errno
to EINTR on Windows.
2005-01-15 09:26:07 +00:00
Daniel Stenberg
cf51f7fb65 output better error detection, like when ipv6 can't resolve 2005-01-15 09:21:51 +00:00
Daniel Stenberg
4d1f3d3cd0 Added README.hostip 2005-01-14 13:43:29 +00:00
Daniel Stenberg
f70b87b4c5 verify the protocol too 2005-01-14 09:39:20 +00:00
Daniel Stenberg
0e26355348 Inspired by Martijn Koster's patch and example source at
http://www.greenhills.co.uk/mak/gentoo/curl-eintr-bug.c, I now made the
select() and poll() calls properly loop if they return -1 and errno is
EINTR. glibc docs for this is found here:
http://www.gnu.org/software/libc/manual/html_node/Interrupted-Primitives.html

This last link says BSD doesn't have this "effect". Will there be a problem
if we do this unconditionally?
S: ----------------------------------------------------------------------
2005-01-13 21:51:48 +00:00
Gisle Vanem
246ea56eab Added dependencies. 2005-01-12 15:32:41 +00:00
Gisle Vanem
7c1bba315b Added '-bd' option; target is a DLL.
Added dependencies.
2005-01-12 15:32:26 +00:00
Daniel Stenberg
9395cad379 support for retrieving used IP addresses 2005-01-11 22:26:00 +00:00
Daniel Stenberg
c5b2e85b47 Dan Torop cleaned up a few no longer used variables from David Phillips'
select() overhaul fix.
2005-01-11 20:22:44 +00:00
Gisle Vanem
38f8087281 Removed CURLTOOLDEBUG. It caused libcurl_wc.dll
to fail in mysterious ways.
2005-01-11 17:08:47 +00:00
Daniel Stenberg
e3fa7d021e Renamed easy.h and multi.h to easyif.h and multiif.h to make sure they don't
shadow our public headers with the former names.
2005-01-11 15:25:29 +00:00
Gisle Vanem
a1813e2b2d ".\lib\easy.h" shadows for <curl/easy.h> in Watcom.
Force including ../include/curl/easy.h.
2005-01-11 14:59:24 +00:00
Gisle Vanem
2e62458eef Fix '!if' expression. 2005-01-11 14:52:42 +00:00
Gisle Vanem
bb9e5565f2 ".\lib\multi.h" shadows for <curl/multi.h> in Watcom.
Force including ../include/curl/multi.h.
2005-01-11 14:32:09 +00:00
Daniel Stenberg
29102befa6 Cyrill Osterwalder posted a detailed analysis about a bug that occurs when
using a custom Host: header and curl fails to send a request on a re-used
persistent connection and thus creates a new connection and resends it. It
then sent two Host: headers. Cyrill's analysis was posted here:
http://curl.haxx.se/mail/archive-2005-01/0022.html
2005-01-11 14:00:45 +00:00
Daniel Stenberg
9d1145598a Bruce Mitchener identified (bug report #1099640) the never-ending SOCKS5
problem with the version byte and the check for bad versions. Bruce has lots
of clues on this, and based on his suggestion I've now removed the check of
that byte since it seems to be able to contain 1 or 5.
2005-01-10 23:32:14 +00:00
Daniel Stenberg
065e466f1a Use Curl_easy_addmulti() to clear associations from easy handles to multi
handles. Include multi.h to get proto.
2005-01-10 11:42:20 +00:00
Daniel Stenberg
3ac00f32af edited wording 2005-01-10 11:27:02 +00:00
Daniel Stenberg
21bb852750 Pavel Orehov reported memory problems with the multi interface in bug report
#1098843. In short, a shared DNS cache was setup for a multi handle and when
the shared cache was deleted before the individual easy handles, the latter
cleanups caused read/writes to already freed memory.
2005-01-10 10:07:07 +00:00
Daniel Stenberg
83bab78bda Hzhijun reported a memory leak in the SSL certificate code, that leaked the
remote certificate name when it didn't match the used host name.
2005-01-10 09:48:39 +00:00
Gisle Vanem
894ec46ef4 Note about the static lib requirement; -DCURL_STATICLIB. 2005-01-08 16:35:03 +00:00
Gisle Vanem
4eb1d3eb1b Watcom additions. 2005-01-08 16:15:06 +00:00
Gisle Vanem
945423e83a Added Watcom targets. 2005-01-08 16:12:27 +00:00
Gisle Vanem
9fd33c0b96 New file. 2005-01-08 16:06:37 +00:00
Gisle Vanem
3c09f2d2bd Added Makefile.Watcom to EXTRA_DIST. 2005-01-08 16:03:45 +00:00
Daniel Stenberg
7b4bf6a22c three recent bug fixes 2005-01-07 21:14:57 +00:00
Daniel Stenberg
b5b77f6367 disable the valgrind log checking 2005-01-07 21:11:24 +00:00
Daniel Stenberg
5a8097a4d5 fixed the valgrind log check and make it possible to disable it for a specific
test, see test 509
2005-01-07 21:11:13 +00:00
Daniel Stenberg
9cdf6fb64b added test 199 2005-01-07 21:09:50 +00:00
Daniel Stenberg
a137223b4f prevent a single byte read outside the string in test case 39 2005-01-06 22:54:37 +00:00
Daniel Stenberg
52e1ce9518 fixed #1097019, multiple GET posts (-G) error 2005-01-06 22:25:35 +00:00
Daniel Stenberg
8127a34f98 recent events 2005-01-05 14:12:06 +00:00
Gisle Vanem
2dcb8b674f Changed curl.dll to libcurl.dll. 2005-01-04 16:16:03 +00:00
Gisle Vanem
1e3b1b6e47 Minor comment fix. 2005-01-04 16:13:58 +00:00
Daniel Stenberg
9cdaae94cc just narrowed some text to fit within 80 cols 2005-01-04 16:01:34 +00:00
Gisle Vanem
316e74be74 Removed _WIN32_WINNT to support IPv6 under Win-2K. 2005-01-04 16:00:14 +00:00
Daniel Stenberg
af69c4f4f7 Marty Kuhrt's VMS update 2005-01-03 19:17:10 +00:00
Daniel Stenberg
ad9648a215 reverted the bad naming of the implib names 2005-01-02 21:15:29 +00:00
Daniel Stenberg
1576f3319e Alex Neblett's minor update 2005-01-02 19:19:32 +00:00
Daniel Stenberg
8ac90316d9 nah, don't use the system's getpass() function since it too often is limited
to 8(!) or similar lengths passwords
2004-12-26 09:17:38 +00:00
Daniel Stenberg
35ba5c826d issue 54 - this takes sweat 2004-12-25 23:15:45 +00:00
Daniel Stenberg
4f4ffa98b5 Test case 241 fails on all systems that support IPv6 but that don't have the
host name 'ip6-localhost' in /etc/hosts (or similar) since the test case uses
that host name to test the IPv6 name to address resolver.
2004-12-25 22:51:37 +00:00
Daniel Stenberg
b7d92c3e03 --protocols, license, src/config.h.in 2004-12-25 22:30:31 +00:00
Daniel Stenberg
4ecf939452 ./src/config.h.in is now removed from CVS. It is copied from the
lib/config.h.in file by buildconf
2004-12-25 22:10:38 +00:00
Daniel Stenberg
7ef6b05ef1 My reimplementation and cleanup of the getpass source code. We officially no
longer use Angus Mackay's getpass code due to the weirdo license his code was
donated to us under.
2004-12-25 22:08:02 +00:00
Daniel Stenberg
695f95aad1 mention the new --protocols 2004-12-24 09:02:23 +00:00
Daniel Stenberg
2a6ea6d7a7 David Shaw added --protocols, and thus the --feature no longer mentions what
protocols that are disabled.
2004-12-24 08:59:44 +00:00
Dan Fandrich
f5e0ff2170 Added LDAP library issue. 2004-12-23 22:34:00 +00:00
Daniel Stenberg
814d176b86 recent changes
and Merry Christmas!
2004-12-23 22:31:39 +00:00
Daniel Stenberg
3955b31362 David Shaw fixed the disable variables so that curl-config --feature works
correctly!
2004-12-23 08:48:59 +00:00
Daniel Stenberg
4b3fb5a01c issue 47 in next release? 2004-12-22 22:46:05 +00:00
Daniel Stenberg
67abd4cd47 Rune Kleveland fixed a minor memory leak for received cookies with the (rare)
version attribute set.
2004-12-22 22:33:31 +00:00
Daniel Stenberg
58f4af7973 Marcin Konicki provided two configure fixes and a source fix to make curl
build out-of-the-box on BeOS.
2004-12-22 22:28:10 +00:00
Dan Fandrich
99befd3a15 C ensures that static variables are initialized to 0 2004-12-22 20:12:15 +00:00
Daniel Stenberg
3acda85c2b added CURLINFO_HTTP_CONNECTCODE 2004-12-22 12:31:55 +00:00
Daniel Stenberg
dbb69797cf uh, fixed! 2004-12-22 09:21:04 +00:00
Daniel Stenberg
2910880b15 Added: 4 protocols we _could_ support and the CONNECT HTTP/1.0 detail we might
fix one day.
2004-12-22 09:19:29 +00:00
Daniel Stenberg
8b5f0abef1 more about error codes 2004-12-21 21:35:00 +00:00
Daniel Stenberg
10b5327b19 test enforced chunked encoding with PUT on a local file 2004-12-21 20:19:05 +00:00
Daniel Stenberg
4ba1eb26fa Added test case 217 that verified CURLINFO_HTTP_CONNECTCODE, and I made the
-w option support 'http_connect' to make it easier to verify!
2004-12-21 19:59:35 +00:00
Daniel Stenberg
444f6427b8 oops, variables first then code 2004-12-21 14:33:37 +00:00
Daniel Stenberg
a173e07eec Prevent failf() from using the va_list variable more than once.
See bug report #1088962 and  Single Unix Specification:
http://www.opengroup.org/onlinepubs/007908799/xsh/vfprintf.html
2004-12-21 14:22:10 +00:00
Daniel Stenberg
3de85777de mention how the FTP code should be fixed one day 2004-12-21 10:54:21 +00:00
Daniel Stenberg
f4c5314890 include sys/types.h before sys/select.h 2004-12-21 10:11:07 +00:00
Daniel Stenberg
1225ad58bd set debug curl too when -c is used 2004-12-21 10:10:40 +00:00
Daniel Stenberg
951fdeba67 How do I list the root dir of an FTP server? 2004-12-21 09:37:55 +00:00
Dan Fandrich
327b46cced Fixed a compile warning introduced by making the protocol table const. This
involves a binary-compatible change to the API struct curl_version_info_data
2004-12-20 21:14:45 +00:00
Dan Fandrich
80d301257c Make some more arrays of pointers const. 2004-12-20 18:23:43 +00:00
Dan Fandrich
0e59182945 gcc 2.7 can't handle a few warning options that gcc 2.95 can. 2004-12-20 18:20:17 +00:00
Daniel Stenberg
7270d5ce26 start working on 7.12.4 2004-12-20 13:09:38 +00:00
Daniel Stenberg
a142d419d2 and we start all over again 2004-12-20 12:51:14 +00:00
Daniel Stenberg
23cf63f550 7.12.3 2004-12-20 12:35:02 +00:00
Gisle Vanem
13ee90bbd4 OpenSSL updates; get CA_BUNDLE from env. Assume no
Kerberos, have <pkcs12.h>, <engine.h> and built-in engines.
2004-12-19 11:52:31 +00:00
Gisle Vanem
754d6c3abd Remove 'data' initialiser. 2004-12-19 11:39:34 +00:00
Daniel Stenberg
c6f6e81238 clarified a few changes 2004-12-19 10:11:03 +00:00
Daniel Stenberg
7803a1a28a fixed the solaris pkcs12 build problem 2004-12-19 09:37:58 +00:00
Daniel Stenberg
3d647b9a98 if the pkcs12.h header exists, include it already in urldata.h to work around
a precedence problem with the zlib header. See CHANGES for details.
2004-12-19 09:37:32 +00:00
Daniel Stenberg
090a7f38be check for openssl/pkcs12.h 2004-12-19 09:36:54 +00:00
Daniel Stenberg
8ad47a13e5 Samuel Listopad added support for PKCS12 formatted certificates. 2004-12-18 10:42:48 +00:00
Daniel Stenberg
497cc6bfaf Samuel Listopad fixed -E to support "C:/path" (with forward slash) as well. 2004-12-18 10:28:31 +00:00
Daniel Stenberg
d5be114c07 mention the new cookie api plans 2004-12-18 10:28:04 +00:00
Daniel Stenberg
6e43a4ccce Jean-Marc Ranger pointed out that the returned data doesn't survive a call
to curl_multi_remove_handle() either.
2004-12-18 10:24:49 +00:00
Dan Fandrich
a07dcfd850 Renamed a variable to avoid conflict with a C++ reserved word. 2004-12-17 20:18:53 +00:00
Gisle Vanem
321511a5be Watcom has strtoll(). 2004-12-17 19:57:50 +00:00
Gisle Vanem
c5297b9fd9 Watcom uses 'i64' suffix. 2004-12-17 18:33:09 +00:00
Gisle Vanem
7e00076586 <windows.h> required for Watcom. 2004-12-17 18:32:41 +00:00
Gisle Vanem
9a8ba19b73 s/_write/write/g 2004-12-17 18:31:40 +00:00
Gisle Vanem
41e776f9db Fix calling convention of wlap32.dll function. Watcom
uses fastcall by default, so force cdecl.
2004-12-17 17:54:21 +00:00
Gisle Vanem
5c2d4a6bdd Watcom has 'struct timeval'. 2004-12-17 17:49:10 +00:00
Gisle Vanem
83b709401c Add libidn.a and iconv libraries if USE_IDNA=1. 2004-12-17 12:43:02 +00:00
Gisle Vanem
3590fffeae Added option for using C-ares and libidn.
Dependencies generated from $(CSOURCES).
2004-12-17 12:38:06 +00:00
Gisle Vanem
5e2e87cc8d getdate.c is gone. 2004-12-17 12:28:04 +00:00
Gisle Vanem
b1bdba7db5 Print true netrc name (.netrc/_netrc). 2004-12-17 12:26:18 +00:00
Daniel Stenberg
e3d342df96 avoid an extra malloc 2004-12-17 10:09:32 +00:00
Daniel Stenberg
ff54a74b4d duplicate ! typo 2004-12-17 10:09:06 +00:00
Daniel Stenberg
ccf65be0a4 fixed minor memory leak when running out of memory 2004-12-17 09:00:19 +00:00
Daniel Stenberg
7dfef13224 oops, add missing return keyword 2004-12-17 08:58:48 +00:00
Daniel Stenberg
0b85e53af2 fix skip-reason 2004-12-16 22:45:06 +00:00
Daniel Stenberg
26cfb21c00 several windows large-file fixes 2004-12-16 22:22:26 +00:00
Daniel Stenberg
b7acdbcb4c two more ftp directory re-use tests added 2004-12-16 22:22:11 +00:00
Daniel Stenberg
6e1e9caa32 Based on Gisle Vanem's patch: make sure the directory re-use works even when
a URL-encoded path is used.
2004-12-16 22:20:33 +00:00
Gisle Vanem
f71725de6e Must include <io.h> and <sys/stat.h> before redefining
stat(), fstat() and lseek().
2004-12-16 21:27:29 +00:00
Dan Fandrich
26fe6da93b Renamed a struct member to avoid conflict with a C++ reserved word. 2004-12-16 21:27:23 +00:00
Daniel Stenberg
8d4ac69175 reduced the number of sub-blocks 2004-12-16 18:18:23 +00:00
Daniel Stenberg
4f5a6a33b4 moved the lseek() and stat() magic defines to setup.h and now take advantage
of struct_stat in formdata.c as well, to support formpost uploads of large
files on Windows too
2004-12-16 18:09:27 +00:00
Gisle Vanem
ec8ee4404b Support uploading and resuming of >2GB files.
Ref. lib/file.c.
2004-12-16 16:49:14 +00:00
Daniel Stenberg
e47b5d4e6c Provide better reasons for why test cases are skipped. Also, don't show the
SKIPPED stuff in the short output. Some platforms get quite a lot of SKIPPED
and they don't add much value and only clutter screen space.
2004-12-16 14:18:11 +00:00
Daniel Stenberg
494c40fd98 NULL the fp pointer after it has been fclosed() 2004-12-16 13:55:19 +00:00
Daniel Stenberg
d3b414724b Dinar in bug report #1086121, found a file handle leak when a multipart
formpost (including a file upload part) was aborted before the whole file was
sent.
2004-12-16 09:52:36 +00:00
Dan Fandrich
38181fbc74 Fix the --enable-debug compiler warning options for older versions of gcc. 2004-12-15 21:09:53 +00:00
Daniel Stenberg
8847e61fca yet another mirror! 2004-12-15 14:09:52 +00:00
Daniel Stenberg
95b84adb9b precaution to prevent double typedefs of the bool 2004-12-15 14:05:07 +00:00
Daniel Stenberg
b34d161703 moved the bool typedef to setup.h 2004-12-15 10:33:51 +00:00
Daniel Stenberg
d88b3d3d5d fixed how backslashes are treated in glob strings 2004-12-15 09:23:24 +00:00
Dan Fandrich
f2fb9039bd Make some arrays of pointers const, too. 2004-12-15 03:03:45 +00:00
Dan Fandrich
a28b32aa45 Make some arrays of pointers const, too. 2004-12-15 02:32:04 +00:00
Dan Fandrich
1ba47e7af9 Add 'const' to immutable arrays. 2004-12-15 01:38:25 +00:00
Daniel Stenberg
9359498b06 clarify that the app must free the engine list 2004-12-14 22:47:13 +00:00
Daniel Stenberg
553082e24a prevent compiler warning when built without engine support 2004-12-14 22:06:25 +00:00
Daniel Stenberg
dc28a9c0c1 make sure the ipv6 http server gets its pid stored in a separate file 2004-12-14 21:52:16 +00:00
Daniel Stenberg
1faef62d59 use the correct variables, not fixed values 2004-12-14 21:25:23 +00:00
Daniel Stenberg
0d0d5e7ee3 Harshal Pradhan fixed changing username/password on a persitent HTTP
connection.
2004-12-14 21:22:51 +00:00
Daniel Stenberg
4f567d0f81 mistake 2004-12-14 21:22:12 +00:00
Dan Fandrich
f23d923fd3 Only declare static variables if they're needed. Fixed some compile warnings. 2004-12-14 20:44:36 +00:00
Dan Fandrich
10d6d8b2ae Header files are in openssl/ only if USE_OPENSSL is set. 2004-12-14 20:25:23 +00:00
Dan Fandrich
358e08b95d Removed fputc() prototype since it's already in stdio.h 2004-12-14 20:17:58 +00:00
Gisle Vanem
e181eda253 Caller must free 'engines' list. 2004-12-14 14:24:04 +00:00
Gisle Vanem
7d3f5d7ac1 urldata.h: Removed engine_list.
ssluse.*: Added SSL_strerror(). Curl_SSL_engines_list() now returns a slist
which must be freed by caller.
2004-12-14 14:20:21 +00:00
Daniel Stenberg
37c7a695a2 Moved the CURLE_SSL_ENGINE_INITFAILED error code last in the list so that
the others remain at previous values.
2004-12-14 09:58:45 +00:00
Daniel Stenberg
07f107ae20 Moved the engine stuff from the root-level of the SessionHandle struct to the
UrlState sub-struct. Also made the engine_list exist for non-ssl builds to
make curl build.
2004-12-14 09:36:22 +00:00
Gisle Vanem
5c14b3be6d Document CURLINFO_SSL_ENGINES and "--engine". 2004-12-13 20:14:04 +00:00
Gisle Vanem
1dc15ec1bc Set 'data->state.os_errno = error' in some places.
Needed elsewhere too?
2004-12-13 17:52:55 +00:00
Gisle Vanem
6a9ed44088 Support for "--engine list" option.
Moved CURLOPT_SSLENGINE* options to after verbose mode is set.
Added a goto. Eek!
2004-12-13 16:47:36 +00:00
Gisle Vanem
bdb0620529 Added handling of CURLINFO_SSL_ENGINES;
Added Curl_SSL_engines_list(), cleanup SSL in url.c
(no HAVE_OPENSSL_x etc.).
2004-12-13 16:43:00 +00:00
Gisle Vanem
be9ea07e87 Handle new type CURLINFO_SLIST.
Handle new info list CURLINFO_SSL_ENGINES.
2004-12-13 16:37:27 +00:00
Gisle Vanem
4cf14e9f85 Added CURLcode CURLE_SSL_ENGINE_INITFAILED,
Added CURLINFO_SLIST type for returing a 'struct slist' in
curl_easy_getinfo().
Added CURLINFO_SSL_ENGINES.
2004-12-13 16:35:56 +00:00
Gisle Vanem
d02b2c4308 Fixed missing braces warning. 2004-12-13 11:31:01 +00:00
Daniel Stenberg
1687a9eb94 large file file:// resumes on windows 2004-12-13 10:58:37 +00:00
Daniel Stenberg
344c6a3725 Gisle's fix for resuming large file:// files on windows - slightly edited
by me.
2004-12-13 10:25:26 +00:00
Daniel Stenberg
f966dad306 Dan Fandrich did minor corrections to his SSL cleanup patch 2004-12-13 08:34:46 +00:00
Daniel Stenberg
887f41c062 Dan Fandrich added libcurl.pc.in to the dist 2004-12-13 08:34:17 +00:00
Daniel Stenberg
4b1350e467 when failing to verify a HTTP server, display what curl said on stderr to
help debugging. (when using ipv6 I fell over this server that didn't have
the ipv6 module loaded)
2004-12-12 23:31:45 +00:00
Gisle Vanem
22a0c57746 Missing 'in6addr_any' in MingW's lib. ld bug? 2004-12-12 20:14:25 +00:00
Daniel Stenberg
fec571f5b0 modified to use the current error code name, not the obsolete one 2004-12-11 22:18:11 +00:00
Daniel Stenberg
976285ccbc undef more obsolete defines if CURL_NO_OLDIES is defined 2004-12-11 22:17:47 +00:00
Daniel Stenberg
9b3b7ad22e HTTP IPv6 support added to the test suite 2004-12-11 21:41:00 +00:00
Daniel Stenberg
1b8ac7c6b5 provide an error string when resuming fails - and use the proper error code,
not the former one
2004-12-11 18:55:51 +00:00
Daniel Stenberg
bd2db87237 fixed error message 2004-12-11 18:55:23 +00:00
Daniel Stenberg
df3ca59116 Dan Fandrich:
Here's a stab at a consolidation of the SSL detection heuristics into
configure. Source files aren't changed by this patch, except for setup.h and
the various config*.h files.  Within the configure script, OPENSSL_ENABLED is
used to determine if SSL is being used or not, and outside configure,
USE_SSLEAY means the same thing; this could be even further unified some day.

Now, when SSL is not detected, configure skips the various checks that are
dependent on SSL, speeding up the configure process and avoiding complications
with cross compiles.  I also updated all the architecture- specific config
files I could see, but I couldn't test them.
2004-12-11 18:47:22 +00:00
Daniel Stenberg
3ca4509ae9 Dan F's initial pkg-config file (not installed yet) 2004-12-11 18:46:40 +00:00
Daniel Stenberg
d531926246 mention the maybe-missing initial zero in the vernum output 2004-12-11 18:38:47 +00:00
Daniel Stenberg
357fdb60b6 Dan Fandrich: added some missing files. "I can't try them so they might still
be broken, but at least they'll be less broken than they are now."
2004-12-10 21:58:11 +00:00
Daniel Stenberg
b6f855cb9b Dan Fandrich corrects spelling mistakes 2004-12-10 21:56:35 +00:00
Daniel Stenberg
b6646310e8 Dan Fandrich extended the cross compile section and corrected spelling errors 2004-12-10 21:55:05 +00:00
Daniel Stenberg
070da3c08f untabified 2004-12-10 21:46:00 +00:00
Daniel Stenberg
6b7f6369ec username and IPv6 numerical address URL parser fix 2004-12-10 21:42:55 +00:00
Daniel Stenberg
309e3ce4f9 David Byron's debug build fix 2004-12-10 19:16:51 +00:00
Daniel Stenberg
8a4eb8ed45 move the port number extraction to after the extraction of user name/password,
as suggested by Kai Sommerfeld
2004-12-10 15:11:11 +00:00
Daniel Stenberg
eee70dcf8e two new test cases for proxy-CONNECT with NTLM (one doing GET, one doing POST) 2004-12-10 14:48:03 +00:00
Daniel Stenberg
c0c885a1f3 don't try the rewind if no http struct is allocated yet 2004-12-10 14:45:35 +00:00
Daniel Stenberg
a7488672bf configure and curl-config fixes 2004-12-10 09:46:14 +00:00
Daniel Stenberg
c1312cab1f Added two chapters: Custom Request Elements and Debug. 2004-12-10 09:45:55 +00:00
Daniel Stenberg
8c833d375a ignore the getpart tool 2004-12-09 09:58:45 +00:00
Daniel Stenberg
18f14ae23d close the connection when a bad test number was requested 2004-12-09 09:58:25 +00:00
Daniel Stenberg
98adcdd466 Ton Voon provided a configure fix that should fix the notorious (mostly
reported on Solaris) problem where the size_t check fails due to the SSL libs
being found in a dir not searched through by the run-time linker.
patch-tracker entry #1081707.
2004-12-09 09:27:30 +00:00
Daniel Stenberg
a2bd47c567 Bryan Henderson pointed out in bug report #1081788 that the curl-config
--vernum output wasn't zero prefixed properly (as claimed in documentation).
This is fixed in maketgz now.
2004-12-09 08:06:59 +00:00
Daniel Stenberg
7b3c308eb0 update the version numbers in the libcurl.plist automaticly on release 2004-12-08 23:09:46 +00:00
Daniel Stenberg
1be1d3cfb8 Matt Veenstra updated to 7.12.3. Starting now, we'll update the version number
in this file automatically on releases using the maketgz script.
2004-12-08 23:09:23 +00:00
Daniel Stenberg
b970469df9 Matt Veenstra:
- removal of getdate.c
- Added hostares.c, hostasyn.c, hostip4.c, hostip6.c, hostsync.c,
hostthre.c, inet_ntop.c, nwlib.c, parsedate.c, sterror.c, strtoofft.c

I have tested the build on 10.3, and will build on 10.2.8 in the next days.
2004-12-08 23:02:55 +00:00
Daniel Stenberg
80a324386b Rene Bernhardt found and fixed a buffer overrun in the NTLM code, where
libcurl always and unconditionally overwrote a stack-based array with 3 zero
bytes. I edited the fix to make it less likely to occur again (and added
a comment explaining the reason to the buffer size).
2004-12-07 23:09:41 +00:00
Daniel Stenberg
163518778c minor updates 2004-12-07 23:08:28 +00:00
Daniel Stenberg
7fd1ce4dc3 NORECURSE clarification, minor formatting update 2004-12-07 10:43:21 +00:00
Daniel Stenberg
c78ee11c41 CURLFTPSSL_ALL should make sure that the transfer fails if the data connection
isn't set to encrypted properly
2004-12-07 10:00:20 +00:00
Daniel Stenberg
4435e3b269 Fixed so that the final error message is sent to the verbose info "stream"
even if no errorbuffer is set.
2004-12-06 23:04:30 +00:00
Daniel Stenberg
b96a0dba90 Gisle Vanem's fix for better info messages when failing to connect using
the multi interface
2004-12-06 22:45:45 +00:00
Gisle Vanem
30dfc00a54 'crypto_engine' not used. 2004-12-06 16:36:50 +00:00
Gisle Vanem
fe5979cfdb Replace MINGW32 with built-in __MINGW32__. 2004-12-06 14:43:04 +00:00
Daniel Stenberg
a1f7987ad8 HTTP PUT a to a FTP URL with username+password - over HTTP proxy 2004-12-06 12:54:50 +00:00
Daniel Stenberg
ac269a8f68 Dan Fandrich added the --disable-cookies option to configure to build
libcurl without cookie support. This is mainly useful if you want to build a
minimalistic libcurl with no cookies support at all. Like for embedded
systems or similar.
2004-12-05 23:59:32 +00:00
Daniel Stenberg
35944744f8 Richard Atterer fixed libcurl's way of dealing with the EPSV
response. Previously, libcurl would re-resolve the host name with the new
port number and attempt to connect to that, while it should use the IP from
the control channel. This bug made it hard to EPSV from an FTP server with
multiple IP addresses!
2004-12-05 23:33:33 +00:00
Daniel Stenberg
4b1c0bd1e7 CURLOPT_FTPSSLAUTH was added in 7.12.2 2004-12-03 11:25:06 +00:00
Daniel Stenberg
b7ff86fa2b credit where credit is due 2004-12-03 11:06:05 +00:00
Daniel Stenberg
2c27e4ee76 Bug report #1078066: when a chunked transfer was pre-maturely closed exactly
at a chunk boundary it was not considered an error and thus went unnoticed.
Added test case 207 to verify.
2004-12-03 09:31:25 +00:00
Daniel Stenberg
6ac9e67bd7 made the intended one hour default timeout in the CONNECT loop actually work 2004-12-02 23:30:13 +00:00
Daniel Stenberg
8726a6b6ed comment cleanup 2004-12-02 22:52:14 +00:00
Daniel Stenberg
2f26069a41 test 206 - HTTP proxy CONNECT auth Digest 2004-12-02 17:11:19 +00:00
Daniel Stenberg
d6c155ff47 added comment about port number in CONNECT string being used as test number 2004-12-02 17:11:09 +00:00
Daniel Stenberg
15360e5e51 prevent an initial "(nil)" to get sent in the initial request when doing
CONNECT to a proxy with digest
2004-12-02 17:08:37 +00:00
Gisle Vanem
e587a56fc0 Use "HAVE_SYS_TYPES_H". 2004-12-01 13:41:22 +00:00
Daniel Stenberg
113531432a make the "check" actually open all those file desciptors as well to make sure
it works, as it has proved to not work in some cases (like on Tor Arntsen's
AIX 5100-06 xlc 5.0 --disable-shared runs).
2004-12-01 10:34:46 +00:00
Gisle Vanem
bfa74c2649 alarm() works unreliable on djgpp 2.03. Don't use it. 2004-11-30 14:59:24 +00:00
Daniel Stenberg
6bb215f56c recent changes 2004-11-30 10:21:25 +00:00
Daniel Stenberg
8b37844e5f fixed test case errors 2004-11-30 10:20:59 +00:00
Daniel Stenberg
1445e62312 three new compress test cases 2004-11-30 09:54:16 +00:00
Daniel Stenberg
4781ff88fd Fixed the array comparison function even more, made the temporary files used
for diff output get created in the log/ dir and no longer deletes them since
they help in understanding the problem, fixing the test case and fixing curl
problems.
2004-11-30 09:53:53 +00:00
Daniel Stenberg
c28e15c682 Dan Fandrich's fix for libz 1.1 and "extra field" usage in a gzip stream 2004-11-30 09:44:54 +00:00
Daniel Stenberg
fe0585ec91 no longer use the MIME::Base64.pm package as it seems to not be standard
on lots of perl versions, provide our own base64 decoder
2004-11-30 09:27:11 +00:00
Daniel Stenberg
18c0b49f3d added test 221 to test a broken gzip content download 2004-11-29 22:37:52 +00:00
Daniel Stenberg
5d69c956ee added test 220 - simple gzip auto decompress 2004-11-29 22:15:42 +00:00
Daniel Stenberg
93aa22ea08 --disable-epsv when connecting to an IPv6 ftp server 2004-11-29 21:45:25 +00:00
Daniel Stenberg
b7c6bc20be removed comment 2004-11-29 21:44:40 +00:00
Daniel Stenberg
9bb4a95e08 include setup.h first 2004-11-29 21:44:23 +00:00
Daniel Stenberg
0966ddafaa As reported in Mandrake's bug tracker bug 12285
(http://qa.mandrakesoft.com/show_bug.cgi?id=12285), when connecting to an
IPv6 host with FTP, --disable-epsv (or --disable-eprt) effectively disables
the ability to transfer a file. Now, when connected to an FTP server with
IPv6, these FTP commands can't be disabled even if asked to with the
available libcurl options.
2004-11-29 21:25:07 +00:00
Daniel Stenberg
c073625fb9 zero terminate the buffer spitout() returns, as the sws.c code depends on
that!
2004-11-29 18:26:09 +00:00
Daniel Stenberg
85dd4bfb8d make it possible for a test case to depend on the feature 'libz' 2004-11-29 12:23:02 +00:00
Daniel Stenberg
5ae34aa8e1 killed trailing whitespace 2004-11-29 12:11:46 +00:00
Daniel Stenberg
0eb8414750 Enable test cases to provide sections base64-encoded to be able to test
with binary data.
2004-11-29 12:10:09 +00:00
Daniel Stenberg
09717d3fc8 utility to base encode data passed on stdin 2004-11-29 12:09:05 +00:00
Daniel Stenberg
81a3246a56 stricter newline policy 2004-11-29 12:01:07 +00:00
Daniel Stenberg
4c8fbe9abf spell 2004-11-29 08:47:33 +00:00
Daniel Stenberg
c0d448f778 if gmtime() returns NULL, this returns -1 to bail out nicely 2004-11-29 08:10:10 +00:00
Daniel Stenberg
16e9a9eaef removed one we won't do, removed the CWD optimize as it is (partly) done 2004-11-28 13:04:34 +00:00
Daniel Stenberg
0d7446c134 add more info to the stderr output 2004-11-28 08:57:03 +00:00
Daniel Stenberg
a4752673bb typecast the coversion from long to int 2004-11-27 09:27:48 +00:00
Daniel Stenberg
9a0d5c4ed8 progress meter newline 2004-11-26 21:35:14 +00:00
Gisle Vanem
d85bc18178 I changed my mind. Remove ioctl() macro in setup.h instead. 2004-11-26 16:08:15 +00:00
Gisle Vanem
f0e66d8c76 Added anyauthput.exe. 2004-11-26 15:04:15 +00:00
Gisle Vanem
af114358c8 Renamed urldata.h members 'ioctl*' to 'ioctrl*' due to
clash with djgpp ioctl() macro in setup.h.
2004-11-26 14:57:01 +00:00
Daniel Stenberg
ffe17a8197 As reported in Mandrake's bug tracker bug 12289
(http://qa.mandrakesoft.com/show_bug.cgi?id=12289), curl would print a newline
to "finish" the progress meter after each redirect and not only after a
completed transfer.
2004-11-26 14:33:13 +00:00
Daniel Stenberg
2459e1e268 removed no longer used variable 2004-11-26 08:52:18 +00:00
Daniel Stenberg
a34a4af36a last-second-before-commit changes corrected 2004-11-26 08:41:39 +00:00
Daniel Stenberg
bf51f05a50 FTP improvements:
If EPSV, EPRT or LPRT is tried and doesn't work, it will not be retried on
the same server again even if a following request is made using a persistent
connection.

If a second request is made to a server, requesting a file from the same
directory as the previous request operated on, libcurl will no longer make
that long series of CWD commands just to end up on the same spot. Note that
this is only for *exactly* the same dir. There is still room for improvements
to optimize the CWD-sending when the dirs are only slightly different.

Added test 210, 211 and 212 to verify these changes. Had to improve the
test script too and added a new primitive to the test file format.
2004-11-25 22:21:49 +00:00
Daniel Stenberg
5d94ff5974 made the code fit within 80 cols 2004-11-25 16:49:14 +00:00
Daniel Stenberg
0d4ddfa743 mingw _has_ a ftruncate() but it doesn't work with 64bit file sizes so we
can just safely pretend we don't have one
2004-11-24 22:11:18 +00:00
Gisle Vanem
56c9899832 Provide a 64-bit capable ftruncate(). MingW has one, but
it takes only 32-bit offsets.
2004-11-24 19:34:25 +00:00
Daniel Stenberg
7b3fba1ad5 added missing new error string 2004-11-24 18:25:33 +00:00
Daniel Stenberg
700e3b685a mingw has a ftruncate() function 2004-11-24 16:16:36 +00:00
Daniel Stenberg
3e1caa6185 HTTP "auth done right". See lib/README.httpauth 2004-11-24 16:11:35 +00:00
Daniel Stenberg
50eafb7668 decided to skip the MSVC makefile fixes, nobody seems to really want them
and they are rather excessive
2004-11-24 16:08:41 +00:00
Daniel Stenberg
25559ac02e Andrs Garca fixed the configure script to detect select properly when run
with Msys/Mingw on Windows.
2004-11-24 15:49:43 +00:00
Gisle Vanem
51a87fa652 Clarify the static vs. import lib issue on Win32. 2004-11-24 15:14:42 +00:00
Daniel Stenberg
b2dad0342f added a bunch of people who really deserve to be here 2004-11-23 22:15:49 +00:00
Daniel Stenberg
a5abce7982 oops, use the precheck too! 2004-11-23 10:05:10 +00:00
Daniel Stenberg
de3f22b288 cut out release with no issue to fix 2004-11-23 09:52:56 +00:00
Daniel Stenberg
be5cc378c8 introducing the client/precheck concept to allow test 518 to *only* run when
it actually can run and test the FD_SETSIZE stuff it is meant to test
2004-11-23 09:50:16 +00:00
Daniel Stenberg
4afc4aed73 yet another binding 2004-11-23 09:22:23 +00:00
Daniel Stenberg
a4e1ac7952 David Phillips fix for test 518 and my extension to make it not run on
systems that can't run it fine.
2004-11-22 22:26:46 +00:00
Daniel Stenberg
f84d2b4d36 trying a version with URLs for all function calls 2004-11-22 16:24:46 +00:00
Daniel Stenberg
b4c7876e4b issue 52 is fixed, I work on 51 2004-11-22 15:49:17 +00:00
Daniel Stenberg
4207ef3d27 removed trailing whitespace 2004-11-22 14:41:36 +00:00
Daniel Stenberg
b3572269a4 removed unused variable and trailing whitespace 2004-11-22 14:41:24 +00:00
Daniel Stenberg
097d449cc1 remove curl_ prefix from functions not present in libcurl 2004-11-22 14:07:23 +00:00
Daniel Stenberg
7f44713487 re-indented to curl style 2004-11-22 13:48:35 +00:00
Daniel Stenberg
b7a6b78e0c renamed curl_thread to my_thread to avoid confusion 2004-11-22 13:43:52 +00:00
Daniel Stenberg
855a9eff76 add URLs in comments for all libcurl function calls 2004-11-22 13:39:23 +00:00
Daniel Stenberg
8e34e75100 Curl_select's timeout arg is an int 2004-11-22 13:28:44 +00:00
Daniel Stenberg
4be60ac155 the FD_SETSIZE problem is fixed 2004-11-21 23:13:13 +00:00
Daniel Stenberg
5ec4501b9d The FD_SETSIZE issue is already sorted, at least internally. We still need
to provide a better multi-API to allow apps to avoid select().
2004-11-21 13:18:36 +00:00
Daniel Stenberg
e80f566a14 added comment for windows people about READFUNCTION being needed 2004-11-21 12:42:28 +00:00
Daniel Stenberg
1729918777 Dan Fandrich fix to compile with libc5 2004-11-20 08:57:56 +00:00
Gisle Vanem
cef290c6b4 Enable >2GB files for MingW. 2004-11-19 15:15:52 +00:00
Gisle Vanem
539e34b5df Suppress signed vs. unsigned warnings on Win32 2004-11-19 14:38:02 +00:00
Daniel Stenberg
765683403f Curl_select() now uses curl_socket_t on socket arguments 2004-11-19 14:03:19 +00:00
Gisle Vanem
cca9fca894 ifdef for portable "/dev/null". 2004-11-19 13:50:41 +00:00
Gisle Vanem
2b403db811 Winsock sockets are not in range 0..FD_SETSIZE.
Shouldn't Curl_select() use curl_socket_t ?
2004-11-19 13:46:58 +00:00
Daniel Stenberg
03e7b7c95f add select.obj 2004-11-19 13:45:46 +00:00
Daniel Stenberg
1a05a90f1c David Phillips' FD_SETSIZE fix 2004-11-19 08:52:33 +00:00
Daniel Stenberg
dcea109bb5 Dan Fandrich fix: eliminates some pedantic CodeWarrior compiler warnings and
errors.
2004-11-18 14:04:40 +00:00
Gisle Vanem
d46a573bbe Added revision tag. 2004-11-16 17:15:07 +00:00
Daniel Stenberg
7d0d19708a Added README.httpauth to the dist 2004-11-16 14:24:54 +00:00
Daniel Stenberg
09f14efade saved for the future 2004-11-16 14:02:24 +00:00
Daniel Stenberg
87753cda49 mention the openssl callbacks for SSL multithread 2004-11-16 08:49:51 +00:00
Daniel Stenberg
66f6f43056 added test case 517: 22 tests of the curl_getdate() function 2004-11-15 21:49:35 +00:00
Daniel Stenberg
86f059dcfb tiny format fix for nicer man output 2004-11-15 21:41:21 +00:00
Daniel Stenberg
5931d43a36 clean up start time and t_startsingle use so that redirect_time works properly 2004-11-15 11:27:03 +00:00
Daniel Stenberg
8475a0df2f new -w variables supported 2004-11-15 11:25:39 +00:00
Gisle Vanem
ccc4c9c02c Added top_srcdir. 2004-11-15 10:41:58 +00:00
Gisle Vanem
16edb15600 Added revision id, test for USE_ARES.
Uses Makefile.inc.
2004-11-15 10:38:34 +00:00
Daniel Stenberg
9e7534a46e binding for R 2004-11-15 08:54:29 +00:00
Gisle Vanem
737dddaec0 Changes for static/dynamic linking of libcurl.
No need to generate a dummy sys/utime.h. Cleanup.
2004-11-14 13:51:33 +00:00
Gisle Vanem
b5c90c9b05 Borland doesn't have <sys/utime.h>, utime() nor
_lseeki64().
2004-11-14 13:50:21 +00:00
Gisle Vanem
c3ecd552f5 Borland doesn't have <sys/utime.h> nor utime(). 2004-11-14 13:49:09 +00:00
Gisle Vanem
56f0227c92 Static lib is libcurl.lib and import lib libcurl_imp.lib.
Added implib command. Cleanup
2004-11-14 13:48:15 +00:00
Daniel Stenberg
dcb5a4df01 Dan fixed the CURL_DISABLE_VERBOSE_STRINGS stuff for older gcc versions since
they don't support C99 varargs macros.
2004-11-13 21:57:33 +00:00
Gisle Vanem
fd64213c2f MingW/djgpp: Use GNU make's internal 'cd' to avoid shell-troubles. 2004-11-13 16:57:56 +00:00
Gisle Vanem
fc2c06754c Fix location of timeval.c. 2004-11-13 16:55:53 +00:00
Gisle Vanem
7ec200f4d1 Update comment. 2004-11-13 16:54:26 +00:00
Gisle Vanem
e53f139925 Add "-DCURL_STATICLIB" for static build.
Add ../lib/timeval.c for objects.
2004-11-13 15:47:17 +00:00
Gisle Vanem
61599ceb7b Renamed import lib to "libcurl_imp.lib".
Some cleanup and making it more readable.
2004-11-13 14:17:41 +00:00
Gisle Vanem
6f8e3f106a Set OpenSSL path to same as in ../lib/Makefile.vc6.
Import lib is now "libcurl_imp.lib".
Some cleanup and making it more readable.
2004-11-13 14:17:24 +00:00
Gisle Vanem
8fd676f73e MSVC with static link must define CURL_STATICLIB.
zlib path set to same as in lib/Makefile.vc6.
2004-11-12 11:48:02 +00:00
Gisle Vanem
98a8103a3b Netware target (hosted on Linux gcc) doesn't support
or need __declspec.
2004-11-12 11:45:05 +00:00
Daniel Stenberg
94043b1150 Dan Fandrich added the --disable-crypto-auth option to configure to allow
libcurl to build without Digest support. (I figure it should also explicitly
disable Negotiate and NTLM.)
2004-11-12 09:18:14 +00:00
Daniel Stenberg
1b02ad5e8a format mistake fixed 2004-11-12 06:42:30 +00:00
Daniel Stenberg
4897587615 Dan Fandrich can spell, I cannot 2004-11-11 23:13:59 +00:00
Daniel Stenberg
8e2f57c82e Dan Fandrich: make --disable-dict actually disable dict 2004-11-11 23:13:06 +00:00
Daniel Stenberg
c3323b1902 clarify and update according to commit made just now 2004-11-11 23:11:32 +00:00
Daniel Stenberg
59c063dfd3 Fix behaviour when passing NULL to CURLOPT_POSTFIELDS and CURLOPT_HTTPPOST. 2004-11-11 23:11:04 +00:00
Daniel Stenberg
8c16696f47 fix a IDN detect/use mistake 2004-11-11 22:01:53 +00:00
Daniel Stenberg
f68950db67 added some details on what to come 2004-11-11 16:56:34 +00:00
Daniel Stenberg
710e370c34 Dan Fandrich added --disable-verbose 2004-11-11 16:34:24 +00:00
Daniel Stenberg
7bb6d76d14 When libidn is detected without explicitly told to, we provide -L/lib and
-I/include options. Not anymore.
2004-11-11 14:41:37 +00:00
Daniel Stenberg
2467f814a8 fix the -I path to the proper include dir when --enable-debug is used 2004-11-11 14:15:41 +00:00
Gisle Vanem
a654ef9ee6 Adapted for C++. 2004-11-11 12:25:40 +00:00
Daniel Stenberg
c1688733c1 recent fixes 2004-11-11 09:51:12 +00:00
Daniel Stenberg
cd73a733c7 dates from 2038 or later now return 0x7fffffff when 32 bit time_t is used 2004-11-11 09:26:09 +00:00
Daniel Stenberg
8ef8e949bd fix curl.h include 2004-11-11 08:03:43 +00:00
Daniel Stenberg
49111a63e6 configure --with-gssapi fix 2004-11-10 21:43:41 +00:00
Daniel Stenberg
ee4ecf5155 Gisle's CURL_EXTERN fix 2004-11-10 15:50:33 +00:00
Gisle Vanem
3478253e5a Replace IsNT with IS_NT(). 2004-11-10 14:30:25 +00:00
Gisle Vanem
6ddc59dadf Replace IsNT with IS_NT().
Return correct timeval in windows_port.c.
Squelch gcc warnings:
  use 'ares_socket_t' in ares_fds.c.
  Don't cast a 'lvalue' in ares_init.c.
2004-11-10 14:23:20 +00:00
Daniel Stenberg
dc8688b8dc fix CURL_EXTERN for debug builds 2004-11-09 18:10:51 +00:00
Gisle Vanem
865e495188 Handle drive-letter on MS-DOS. 2004-11-09 14:57:11 +00:00
Gisle Vanem
d3c0ed007e Removed libcurl.def 2004-11-09 14:55:23 +00:00
Daniel Stenberg
0dc79376e7 with all external functions marked with CURL_EXTERN it is easy to count them
and... yes, they are 46!
2004-11-09 14:42:04 +00:00
Gisle Vanem
3ccbed1022 Changes for removing libcurl.def file on Win32.
Mark public functions with "CURL_EXTERN".
2004-11-09 14:02:58 +00:00
Gisle Vanem
377e43fbb9 Changes for removing libcurl.def file on Win32.
Added "CURL_EXTERN" to memdebug.h functions.
Cleaned up Makefile.vc6.
2004-11-09 14:00:56 +00:00
Daniel Stenberg
1f2b042b95 today's work 2004-11-08 21:39:18 +00:00
Daniel Stenberg
fd49ba6c18 another lame change in an attempt to fix the moot gcc 3.4 warning 2004-11-08 21:31:57 +00:00
Daniel Stenberg
facfa19cdd weirdo hack to fix debian bug report 278691:
'curl -v writes debugging to its network socket if stderr is closed'
2004-11-08 19:41:28 +00:00
Daniel Stenberg
3347ced899 added a default in the switch in an attempt to avoid the moot "will never be
executed" warning by gcc 3.4.0
2004-11-08 14:46:05 +00:00
Gisle Vanem
592686bee9 Change OS name. Fix header guard. 2004-11-08 14:21:24 +00:00
Gisle Vanem
f471a293ea Un-do changes for WinCE; cdecl decoration is not needed.
Confirmed by Paul Nolan.
2004-11-08 14:20:14 +00:00
Daniel Stenberg
c688166066 check for and require tld.h to be present before libidn usage is activated
in the build, since libidn 0.3.X didn't have the header and we don't support
that old libidn versions anyway.

This was mentioned on the list by Jean-Philippe Barrette-LaPierre and in bug
report #1062264.
2004-11-08 07:47:08 +00:00
Daniel Stenberg
5dcd2710d4 two post-1.2.1 changes 2004-11-07 23:48:42 +00:00
Daniel Stenberg
16d8383625 added ares_cancel and ares_version 2004-11-07 13:37:07 +00:00
Daniel Stenberg
6b49fd7483 Tim Sneddon's VMS fix for huge HTTP POSTs 2004-11-05 14:43:35 +00:00
Daniel Stenberg
f10985fc50 removed errno, added EAGAIN 2004-11-05 08:22:46 +00:00
Daniel Stenberg
edeac97773 it has a sys/stat.h file, according to Paul Nolan 2004-11-05 08:19:34 +00:00
Daniel Stenberg
40498ffdd0 update 2004-11-04 16:18:50 +00:00
Daniel Stenberg
fd884a3cd2 more retry stuff 2004-11-04 16:17:23 +00:00
Daniel Stenberg
1887629c5c test server port numbers are now easily changed 2004-11-04 16:15:26 +00:00
Daniel Stenberg
d3be5b2725 delete trailing whitespace 2004-11-04 16:14:33 +00:00
Daniel Stenberg
2e973684c0 based Andres Garcia's patch, added for mingw build 2004-11-04 14:19:22 +00:00
Daniel Stenberg
ab909fc4c2 recent changes 2004-11-02 21:46:27 +00:00
Daniel Stenberg
4cd5220d27 use ifdef not if 2004-11-02 14:02:29 +00:00
Daniel Stenberg
24d47a6e07 Paul Nolan fix to make libcurl build nicely on Windows CE 2004-11-02 10:12:22 +00:00
Daniel Stenberg
8a66584db4 documented the current --retry options 2004-11-02 09:43:50 +00:00
Daniel Stenberg
186f433e40 modified to not use realloc() on a NULL pointer 2004-11-02 08:26:55 +00:00
Daniel Stenberg
736a40fec9 When cross-compiling, the configure script no longer attempts to use
pkg-config on the build host in order to detect OpenSSL compiler options.
2004-11-01 22:50:59 +00:00
Gisle Vanem
4245400ae4 Fixed _write() arguments. 2004-10-28 13:18:09 +00:00
Gisle Vanem
629bba6b35 *** empty log message *** 2004-10-28 13:13:29 +00:00
Daniel Stenberg
f6f2a9e4be use longs 2004-10-28 07:23:19 +00:00
Daniel Stenberg
8bfcae65ef Dan Fandrich's gzip handling fix 2004-10-27 21:46:11 +00:00
Daniel Stenberg
96cf615e9d Added --retry and --retry-delay first attempt with four related test cases. 2004-10-27 21:29:55 +00:00
Daniel Stenberg
e9b3e1d031 log client disconnects 2004-10-27 14:18:57 +00:00
Daniel Stenberg
7167cde020 Testing to define _REENTRANT unconditionally in here. 2004-10-26 13:31:55 +00:00
Daniel Stenberg
2a80a4c521 mention how LDFLAGS=-R can be used (or LD_LIBRARY_PATH or ld.so.conf) 2004-10-26 08:09:16 +00:00
Daniel Stenberg
83f11b1c9b mention incompatibilities with ares 2004-10-26 08:08:41 +00:00
Daniel Stenberg
a00e7f0f5e Tomas Pospisek filed bug report #1053287 that proved -C - and --fail on a
file that was already completely downloaded caused an error, while it
doesn't if you don't use --fail! I added test case 194 to verify the fix.
Grrr. CURLOPT_FAILONERROR is now added to the list stuff to remove in
libcurl v8 due to all the kludges needed to support it.
2004-10-25 11:28:40 +00:00
Daniel Stenberg
e1607f5705 just nicer output when this is seen 2004-10-25 11:28:15 +00:00
Daniel Stenberg
cce931f27d the array sizes _can_ differ and the arrays can still match, since chomp
is used at times but it doesn't decrease the array size
2004-10-25 11:28:01 +00:00
Daniel Stenberg
34089c93bb format update 2004-10-25 11:05:37 +00:00
Daniel Stenberg
beb61ef429 Mohun Biswas found out that formposting a zero-byte file didn't work very
good. I fixed.
2004-10-24 22:31:40 +00:00
Daniel Stenberg
72aff74798 ignore this 2004-10-24 13:02:46 +00:00
Daniel Stenberg
8e715af480 maketgz now creates a ares_version.h.dist file with the given version data
properly set, and the Makefile.am is now fixed to use that when building
a new package with make dist.
2004-10-24 13:02:09 +00:00
Daniel Stenberg
2730842559 Dan Fandrich's better ifdef for include fix 2004-10-21 08:22:07 +00:00
Daniel Stenberg
cac269cf91 1.2.1 release time 2004-10-20 08:01:38 +00:00
Daniel Stenberg
249036ada0 this change was reverted since it broke on solaris 2004-10-19 18:50:46 +00:00
Daniel Stenberg
18d80b9e8f iconv 2.1.3 is considered bad for test case 165 2004-10-19 18:49:31 +00:00
Daniel Stenberg
b2d8e0b476 revert the charset fix as it broke the solaris tests (native iconv doesn't
like that name)
2004-10-19 18:46:12 +00:00
Daniel Stenberg
225a652021 Ralph Mitchell fixed: input field with NAME= and VALUE= weren't processed
properly case insensitive
2004-10-19 18:36:17 +00:00
Daniel Stenberg
38b1d96750 Alexander Krasnostavsky made it possible to make FTP 3rd party transfers with
both source and destination being the same host. It can be useful if you want
to move a file on a server or similar.
2004-10-19 18:26:35 +00:00
Daniel Stenberg
2f069ad3e2 snart isn't really used these days so we cut out the reference to it 2004-10-19 15:34:05 +00:00
Daniel Stenberg
a3dbe03e80 added num_connects 2004-10-19 15:32:31 +00:00
Daniel Stenberg
f4bef25b5e CURLINFO_NUM_CONNECTS and more 2004-10-19 15:30:08 +00:00
Gisle Vanem
ebf7d22503 djgpp has locale.h and setlocale(). 2004-10-19 10:14:06 +00:00
Gisle Vanem
9296d9deb8 All Win compilers have locale.h + setlocale(). 2004-10-19 10:13:26 +00:00
Daniel Stenberg
7b95a25adc bug 1049275 fixes test 165 2004-10-19 06:04:25 +00:00
Daniel Stenberg
82d6cfa7fc Peter Wullinger pointed out that curl should call setlocale() properly to
initiate the specific language operations, to make the IDN stuff work better.
2004-10-18 13:37:18 +00:00
Daniel Stenberg
48750d5fc7 start over on 7.12.3 2004-10-18 08:42:44 +00:00
Daniel Stenberg
4f0258ec09 7.12.2 2004-10-18 07:48:28 +00:00
Daniel Stenberg
db4d0d307a new mirror 2004-10-17 07:48:00 +00:00
Daniel Stenberg
2baf22e184 today's changes 2004-10-16 14:07:31 +00:00
Daniel Stenberg
21d5aead47 Alexander Krasnostavsky made the CURLOPT_FTP_CREATE_MISSING_DIRS option work
fine even for third party transfers.
2004-10-16 14:06:54 +00:00
Daniel Stenberg
f40c9b83df libcurl leaked memory for cookies with the "max-age" field set. 2004-10-16 13:54:40 +00:00
Gisle Vanem
b9e082b811 Changes for issue 50 2004-10-16 13:20:33 +00:00
Gisle Vanem
0bfa601a9f Open "debugit" in binary mode ("rb"). 2004-10-16 13:17:15 +00:00
Gisle Vanem
e356420123 Added Traian Nicolescu's patches for threaded resolver on
Windows. Plugged some potential handle and memory leaks.

Refs.
  http://curl.haxx.se/mail/lib-2004-10/0134.html
  http://curl.haxx.se/mail/lib-2004-10/0157.html
2004-10-16 12:59:05 +00:00
Daniel Stenberg
e8f85cba0f Eric Vergnaud pointed out that libcurl didn't treat ?-letters in the user name
and password fields properly in URLs, like
ftp://us?er:pass?word@site.com/. Added test 191 to verify the fix.
2004-10-14 13:44:54 +00:00
Daniel Stenberg
1aba99b1e7 use quotes to make gdb usage on this easier 2004-10-14 13:44:16 +00:00
Daniel Stenberg
12815d7cd6 let's fix this too 2004-10-14 13:34:42 +00:00
Gisle Vanem
9deb76ce3e Set errno = ENOMEM on faild countcheck(). 2004-10-13 19:11:46 +00:00
Daniel Stenberg
c98676068e .NET binding 2004-10-13 08:46:36 +00:00
Daniel Stenberg
b534f74bf4 correction 2004-10-12 18:20:36 +00:00
Daniel Stenberg
411e9b0c45 #include "strerror.h" to get the strerror proto 2004-10-12 12:49:38 +00:00
Daniel Stenberg
3fa1879f6a recent fixes 2004-10-12 12:47:38 +00:00
Daniel Stenberg
d30cf22c12 one item fixed, one added for 7.12.2 and two more for 7.12.3 2004-10-12 12:47:31 +00:00
Daniel Stenberg
557b6cfd3f add proper error message when send() fails 2004-10-12 07:24:19 +00:00
Daniel Stenberg
84bf03b365 removed trailing whitespace 2004-10-11 17:26:24 +00:00
Daniel Stenberg
34342bcd19 SO_NOSIGPIPE 2004-10-11 17:23:41 +00:00
Daniel Stenberg
5322a86313 another lame attempt to avoid the "warning: will never be executed" warning
by gcc 3.4
2004-10-10 14:36:22 +00:00
Gisle Vanem
1dc50e21c4 MSVC uses 'i64' suffix for 64-bit sizes. 2004-10-10 14:08:05 +00:00
Daniel Stenberg
1eddbb1b47 attempt to make the configure output appear in the build log when it runs
on my solaris 2.7 box too (currently unknown perl version)
2004-10-10 07:51:25 +00:00
Daniel Stenberg
bb8591cf54 set the SIZEOF_LONG define to get the new lib/strtoofft.h fine 2004-10-10 07:45:41 +00:00
Daniel Stenberg
a7913a62a9 If long is 8 bytes we can use strtol() to get 64 bit numbers and won't need
our strtoll() replacement function.
2004-10-10 03:39:59 +00:00
Daniel Stenberg
6d1b37b3da Prevent a longjmp warning by moving the rc assign within Curl_resolv().
Andy Cedilnik reported. Warning on HP-UX?
2004-10-10 03:32:01 +00:00
Daniel Stenberg
34750cc738 Use LL suffix for long long constants if the compiler supports it, to prevent
warnings.
2004-10-10 03:28:51 +00:00
Daniel Stenberg
af677c4e1d If long long is supported, check if [num]LL is supported for numerical
constants.
2004-10-10 03:22:45 +00:00
Daniel Stenberg
298076e00f --enable-ares on AIX has problem 2004-10-08 12:59:36 +00:00
Daniel Stenberg
0d2cdd9773 Use 'struct lifreq' and SIOCGLIFADDR 2004-10-08 09:57:33 +00:00
Daniel Stenberg
eb5d3b5a7c killed trailing whitespace 2004-10-08 09:39:37 +00:00
Daniel Stenberg
7663775971 if basename was found, check for a prototype and if none was found, provide
our own in the formdata.c file to prevent warnings on systems without it
2004-10-08 08:18:08 +00:00
Daniel Stenberg
fe46572f2b prevent warning with comparison between signed and unsigned 2004-10-08 08:16:02 +00:00
Daniel Stenberg
a6d4d3eeac use curlx_strnequal() from the private lib sources instead of strncasecmp()
for maximum portability
2004-10-07 22:57:24 +00:00
Daniel Stenberg
62f97f1817 use curl_strnequal(), not strncasecmp() 2004-10-07 22:56:24 +00:00
Daniel Stenberg
253ff7b2ad Gisle's new fix, the old file:// leak 2004-10-07 12:17:53 +00:00
Daniel Stenberg
c274e51654 use tld_strerror() only if previously detected, since otherwise we can't
work with libidn < 0.5.6
2004-10-07 07:41:44 +00:00
Daniel Stenberg
1239e48304 check for tld_strerror 2004-10-07 07:41:14 +00:00
Gisle Vanem
52313cbac9 Added tld_check_name(). 2004-10-06 19:00:37 +00:00
Gisle Vanem
071218a201 Fixed tld_check_name(). idna_to_unicode_lzlz() should never fail,
but return FALSE if 'uc_name == NULL' just in case.
2004-10-06 18:55:58 +00:00
Gisle Vanem
f0d6cc23ae USE_LIBIDN: Added Top-level-domain (TLD) check for host->name.
Only print a warning if check fails.
2004-10-06 18:40:10 +00:00
Daniel Stenberg
ceefe2e248 test resume and redirect 2004-10-06 14:58:07 +00:00
Daniel Stenberg
9a2aed7d7a Chih-Chung Chang reported that if you use CURLOPT_RESUME_FROM and enabled
CURLOPT_FOLLOWLOCATION, libcurl reported error if a redirect happened even if
the new URL would provide the resumed file. Test case 188 added to verify the
fix (together with existing test 99).
2004-10-06 13:37:12 +00:00
Gisle Vanem
a91a75355d *** empty log message *** 2004-10-06 13:24:08 +00:00
Daniel Stenberg
01acbfa1a5 updates of today 2004-10-06 09:04:20 +00:00
Daniel Stenberg
49b2896a3b avoid warnings on systems with this member set const 2004-10-06 07:52:20 +00:00
Daniel Stenberg
39af394a1c removed tabs and trailing whitespace from source 2004-10-06 07:50:18 +00:00
Daniel Stenberg
5c7dcc6c33 Dan Fandrich fix for hosts that need both -lnsl and -lsocket 2004-10-06 07:33:03 +00:00
Daniel Stenberg
6c5ea2af27 untabify 2004-10-06 06:58:42 +00:00
Gisle Vanem
93e084e097 djgpp has basename() 2004-10-05 13:48:50 +00:00
Daniel Stenberg
1a61bcecfc minor edit to re-use a variable and to hopefully avoid a (moot) warning
about code that won't be reached
2004-10-05 11:03:59 +00:00
Daniel Stenberg
3d9fb701e2 recent fixes 2004-10-05 10:52:51 +00:00
Daniel Stenberg
19a568a983 make the given path to --with-libidn override any other installation 2004-10-05 08:45:13 +00:00
Daniel Stenberg
70c3f6a8dd avoid warning for unused variable 2004-10-05 08:42:56 +00:00
Daniel Stenberg
bb999d8213 use idna_strerror() if it is available (only in libidn 0.5.6 or later) 2004-10-05 08:40:26 +00:00
Daniel Stenberg
121197bc87 Only include libgen.h if we have a basename as well.
Mainly meant to deal with the IRIX case which seems to requrie a "-lgen" lib
to find the basename function and thus without the gen lib, it finds the
header but not the function and our replacement function has a prototype
that doesn't match the IRIX one.

A different approach would be to make configure detect and use -lgen for the
systems that require it.
2004-10-05 06:55:09 +00:00
Daniel Stenberg
d5dd8e0fdc let our basename() be static 2004-10-05 06:49:09 +00:00
Daniel Stenberg
c368800877 name mix fix 2004-10-04 12:54:58 +00:00
Daniel Stenberg
6eb58549a9 closing in on release 2004-10-04 10:37:30 +00:00
Daniel Stenberg
95def48071 Made the dns entry remain locked while a connection to the host remains to
allow verbose output during this period. Bertrand Demiddelaer reported and
helped fixing.
2004-10-04 10:36:51 +00:00
Daniel Stenberg
2ee6c33412 set async.done to TRUE last in the addrinfo callback to prevent the risk that
the multi-threaded resolver does wrong
2004-10-03 21:32:24 +00:00
Daniel Stenberg
be7ce435c0 Replaced the use of isspace() with our own version instead since we have most
data as 'char *' and that makes us pass in negative values if there is 8bit
data in the string. Changing to unsigned causes too much warnings or too many
required typecasts to the normal string functions.
2004-10-03 21:02:01 +00:00
Daniel Stenberg
f4252f8672 when building with libidn support, check for idna_strerror() which is
included in very recent versions
2004-10-03 20:50:47 +00:00
Daniel Stenberg
f4f961c4ea added info about how users get info (like the CURLcode return code) from
individual transfers
2004-10-03 17:38:57 +00:00
Daniel Stenberg
e2fe03df8e removed trailing whitespace 2004-10-03 08:15:40 +00:00
Daniel Stenberg
19b284c214 Gisle Vanem provided code that displays an error message when the (libidn
based) IDN conversion fails. This is really due to a missing suitable
function in the libidn API that I hope we can remove once libidn gets a
function like this.
2004-10-02 13:01:44 +00:00
Daniel Stenberg
6b3e3095ea removed weird preprocessor juggling not needed 2004-10-02 12:58:27 +00:00
Daniel Stenberg
fd2aad1d9b someone should hit me 2004-10-01 11:27:14 +00:00
Daniel Stenberg
d239fc5d04 Aleksandar Milivojevic reported a problem in the Redhat bugzilla (see
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=134133) and not to anyone
involved in the curl project! This happens when you try to curl a file from a
proftpd site using SSL. It seems proftpd sends a somewhat unorthodox PASS
response code (232 instead of 230). I relaxed the response code check to deal
with this and similar cases.
2004-10-01 11:22:11 +00:00
Daniel Stenberg
ec4da97a35 fixed the basename() replacement, reported by Gisle 2004-10-01 11:20:38 +00:00
Daniel Stenberg
bb48ccedd7 mention when this option was added 2004-10-01 06:43:48 +00:00
Daniel Stenberg
afc0dfb141 reflect the last few changes 2004-10-01 06:43:37 +00:00
Daniel Stenberg
8e87223195 - Based on Fedor Karpelevitch's formpost path basename patch, file parts in
formposts no longer include the path part. If you _really_ want them, you
  must provide your preferred full file name with CURLFORM_FILENAME.

  Added detection for libgen.h and basename() to configure. My custom
  basename() replacement function for systems without it, might be a bit too
  naive...

  Updated 6 test cases to make them work with the stripped paths.
2004-10-01 06:36:11 +00:00
Daniel Stenberg
be1cece69b - Larry Campbell added CURLINFO_OS_ERRNO to curl_easy_getinfo() that allows an
app to retrieve the errno variable after a (connect) failure. It will make
  sense to provide this for more failures in a more generic way, but let's
  start like this.
2004-09-30 21:01:23 +00:00
Daniel Stenberg
45be6d6645 killed trailing whitespace 2004-09-30 20:50:34 +00:00
Daniel Stenberg
d4db35c125 Gnter Knauf and Casey O'Donnell worked out an extra #if condition for the
curl/multi.h header to work better in winsock-using apps.
2004-09-30 19:50:36 +00:00
Daniel Stenberg
94c6a5eeab Jean-Philippe Barrette-LaPierre made buildconf run better on Mac OS X by
properly using glibtoolize instead of plain libtoolize. (This is made if
glibtool was found and used instead of plain libtool.)
2004-09-30 19:46:32 +00:00
Daniel Stenberg
35292e794a --max-redirs is _not_ -Z 2004-09-30 14:38:29 +00:00
Daniel Stenberg
c2043a7f94 48 - Harshal Pradhan's isspace() fix for 8bit cookie content 2004-09-30 12:20:04 +00:00
Daniel Stenberg
e752588e8d issue 47 - Peter Sylvester's patch related to the new SRP on the TLS layer 2004-09-30 11:41:25 +00:00
Daniel Stenberg
8f30dbd4f0 fix the multi.h too 2004-09-30 11:38:46 +00:00
Daniel Stenberg
29eb80dbd1 added issue 45 "Chris' suspected race condition in the windows threaded
resolver"
2004-09-30 08:01:47 +00:00
Daniel Stenberg
6cf6f9a21e added five things I want fixed before the next release 2004-09-30 07:59:17 +00:00
Daniel Stenberg
6af6a2bbe8 Fixed an error message: we use CWD, we don't cd into dirs with FTP 2004-09-29 07:21:23 +00:00
Daniel Stenberg
2576ac1c76 Bertrand Demiddelaer fixed curl_easy_reset() so that it doesn't mistakingly
enable the progress meter.
2004-09-28 22:26:47 +00:00
Daniel Stenberg
bfeea8e6b7 - Henrik Stoerner fix: got a report that Tru64 Unix (the unix from Digital
when they made Alpha's) uses /etc/svc.conf for the purpose fixed below for
  other OSes. He made c-ares check for and understand it if present.

- Now c-ares will use local host name lookup _before_ DNS resolving by default
  if nothing else is told.
2004-09-28 22:19:39 +00:00
Daniel Stenberg
2f89f2311c recent stuff 2004-09-28 22:04:17 +00:00
Daniel Stenberg
75e5967afd made pkg-config not get used if a path is given with --with-ssl 2004-09-28 22:04:05 +00:00
Daniel Stenberg
1003628103 Only active the engine code if ssl is enabled. This is how the actual engine
member in the struct is used.
2004-09-28 07:11:32 +00:00
Daniel Stenberg
3451e888b9 - Henrik Stoerner: found out that C-ARES does not look at the /etc/host.conf
file to determine the sequence in which to search /etc/hosts and DNS.  So on
  systems where this order is defined by /etc/host.conf instead of a "lookup"
  entry in /etc/resolv.conf, C-ARES will always default to looking in DNS
  first, and /etc/hosts second.

  c-ares now looks at

  1) resolv.conf (for the "lookup" line);
  2) nsswitch.fon (for the "hosts:" line);
  3) host.conf (for the "order" line).

  First match wins.
2004-09-26 22:35:18 +00:00
Daniel Stenberg
12dc142a28 Dominick Meglio host file path discovery patch for windows 2004-09-26 18:20:58 +00:00
Daniel Stenberg
cb80670885 Ben Greear's minor fix to build (better) with cross-compiled(?) mingw 2004-09-26 06:53:53 +00:00
Daniel Stenberg
c189687188 allow setting CURLOPT_SSLENGINE to NULL even if no SSL engine is supported 2004-09-25 21:28:26 +00:00
Daniel Stenberg
595016d393 Dan Fandrich patched three tests 2004-09-22 18:23:14 +00:00
Daniel Stenberg
23550fe5de Dan Fandrich's fix to use 127.0.0.1 instead of localhost to not depend on
it resolving nicely
2004-09-22 18:21:45 +00:00
Daniel Stenberg
8420de971f Jean-Claude Chauve is a friend! 2004-09-22 12:54:41 +00:00
Daniel Stenberg
17f8f32b2e typo 2004-09-22 12:53:58 +00:00
Daniel Stenberg
7676f40218 jean-claude Chauve fixed an LDAP bug 2004-09-22 08:01:41 +00:00
Daniel Stenberg
2de62cb06f less long => int implicit conversion warnings 2004-09-20 13:21:48 +00:00
Gunter Knauf
be1df3ca0a removed getdate.c hack. 2004-09-19 23:30:34 +00:00
Daniel Stenberg
543ab6f331 added URL to the exception paragraph in the GPL FAQ 2004-09-19 22:37:26 +00:00
Daniel Stenberg
2b6f7ef2a9 the error message fix for failed connects 2004-09-19 14:30:16 +00:00
Daniel Stenberg
0d37f8564e kill trailing whitespace and clarify a few errors 2004-09-19 14:28:16 +00:00
Daniel Stenberg
6cd2536048 set an error message when connection fails 2004-09-19 14:27:56 +00:00
Daniel Stenberg
60fccf4e37 Location:-follow problem 2004-09-17 07:55:14 +00:00
Daniel Stenberg
8a8028394f one more option, one more friend 2004-09-16 22:10:15 +00:00
Daniel Stenberg
6a06667cc0 Added CURLOPT_FTPSSLAUTH 2004-09-16 21:45:16 +00:00
Daniel Stenberg
25bf23105d Location: problem with bad original URL, identified in bug report #1029478 2004-09-16 21:28:38 +00:00
Daniel Stenberg
2544c78083 Bertrand Demiddelaer's correction 2004-09-16 14:26:04 +00:00
Daniel Stenberg
40b9b6f6dc ftp-ssl mistake corrected 2004-09-16 08:45:11 +00:00
Daniel Stenberg
f5e1beddf1 no more getdate.c to care about 2004-09-15 08:07:20 +00:00
Daniel Stenberg
d4076c9a8a fixed to use the new file. Can we make this use Makefile.inc somehow? 2004-09-15 08:05:53 +00:00
Daniel Stenberg
106695d45e the new date parser affects -z 2004-09-15 07:31:48 +00:00
Daniel Stenberg
f71b3f48a1 Replaced the former date parser with a rewrite. No more yacc/bison needed. 2004-09-15 07:28:04 +00:00
Daniel Stenberg
aa8dd932c1 ignore more 2004-09-14 21:31:06 +00:00
Daniel Stenberg
adbe3eefb6 and moved back the month array to a static one since the ftp code won't need
it anymore
2004-09-13 20:49:27 +00:00
Daniel Stenberg
33f69c0546 removed this file again, we only provide a single public function and that
is already in the public header file
2004-09-13 20:48:24 +00:00
Daniel Stenberg
6c3a87a599 no longer includes getdate.h, there's no need for it 2004-09-13 20:47:31 +00:00
Daniel Stenberg
13cc010e38 getdate.h is not required to include, it adds nothing new 2004-09-13 20:47:15 +00:00
Daniel Stenberg
e99bf99829 revert the change for the new date parser, as the new one can deal with
the old format now
2004-09-13 20:43:12 +00:00
Daniel Stenberg
2e7dcc1e2a support for YYYYMMDD added, which allows us to keep using the lib/ftp.c code
I was previously #ifdef'ing to a different look when this parser is used
2004-09-13 20:40:27 +00:00
Daniel Stenberg
b85a036e4a added more examples/docs in the top comment 2004-09-13 07:57:12 +00:00
Daniel Stenberg
7885264b29 Since many users probably already use local time strings as input, I now
made it deal with named time zones as well as mail-style +0200 ones.

Seems to work fine. I'm comparing with GNU date command:

date -d [date] -u +%s
2004-09-13 07:45:19 +00:00
Daniel Stenberg
73dd450147 describes how you can extract the CA cert from a site using the openssl tool 2004-09-12 18:27:12 +00:00
Daniel Stenberg
96efa990f9 Added parsedate.[ch] 2004-09-11 20:06:33 +00:00
Daniel Stenberg
4e0aee9408 mention more friends 2004-09-11 20:06:14 +00:00
Daniel Stenberg
27d509cfe9 Minor adjustment needed for the new date parser to succeed. ifdef'ed out
for now.
2004-09-11 19:19:59 +00:00
Daniel Stenberg
ade8e47a8c more docs and fixed the delta compared to GMT that prevented test case 141 to
work with this
2004-09-11 19:16:34 +00:00
Daniel Stenberg
ca52c963c7 1. cookie expire-strings MUST use GMT timezones
2. adjusted date strings to upcoming date parser rewrite
2004-09-11 19:12:37 +00:00
Daniel Stenberg
17acdb5acf slightly better but still lacks 2004-09-11 13:07:42 +00:00
Daniel Stenberg
f6433211ae getdate replacement code. smaller, slicker, faster. 2004-09-11 09:24:02 +00:00
Daniel Stenberg
0ec4c66fba fixed -F to support setting type= even on parts that aren't file-uploads 2004-09-10 21:47:52 +00:00
Daniel Stenberg
1faa9d6fd5 minor indent change 2004-09-10 21:46:58 +00:00
Daniel Stenberg
23d64e720d up to date with recent changes 2004-09-10 21:13:55 +00:00
Daniel Stenberg
b8b56248bd - Bug report #1025986. When following a Location: with a custom Host: header
replacement, curl only replaced the Host: header on the initial request
  and didn't replace it on the following ones. This resulted in requests with
  two Host: headers.

  Now, curl checks if the location is on the same host as the initial request
  and then continues to replace the Host: header. And when it moves to another
  host, it doesn't replace the Host: header but it also doesn't make the
  second Host: header get used in the request.

  This change is verified by the two new test cases 184 and 185.
2004-09-10 20:58:51 +00:00
Daniel Stenberg
33929117f9 curl --sync 2004-09-09 06:58:01 +00:00
Daniel Stenberg
2b1673c9c8 Now the test servers and test cases can run on a custom port number. There's
no fixed port numbers in use anymore. Starting now, the default ports the
servers use are 8990 - 8993. There's no option to modify these yet, but
changing the $base option in the top of the runtests.pl script.
2004-09-08 08:08:38 +00:00
Gunter Knauf
702f549a6a fixed nasty warnings with gcc 3.3. 2004-09-03 18:51:36 +00:00
Daniel Stenberg
428741d7cf clarify CURLE_SSL_CERTPROBLEM somewhat 2004-09-02 21:05:56 +00:00
Daniel Stenberg
6fa624cf8c improved error message when client cert return failure 2004-09-02 21:03:41 +00:00
Daniel Stenberg
5f60188b8a use the correct struct name in the example 2004-09-02 20:42:44 +00:00
Daniel Stenberg
75a6fdeb58 added more info on the nobody 2004-09-01 12:05:59 +00:00
Daniel Stenberg
5f3fa92062 minor edit of HTTPGET 2004-09-01 09:25:19 +00:00
Daniel Stenberg
66077ae48b fix formatting flaw 2004-09-01 09:24:01 +00:00
Daniel Stenberg
92637303db fix the return code for curl_multi_add_handle() 2004-08-31 06:04:43 +00:00
Daniel Stenberg
811dfd710b mention when the function was added to the lib 2004-08-31 06:03:16 +00:00
Daniel Stenberg
b08dc2cadb proxy connection close and so 2004-08-30 15:02:37 +00:00
Daniel Stenberg
f7c5a097e3 proxy-connection close 2004-08-30 15:02:18 +00:00
Daniel Stenberg
5eb3102cd1 removed issue 36 from this list, we don't know how to do it and no one has
stepped forward to help us. Let's postpone that fix.
2004-08-30 14:22:47 +00:00
Daniel Stenberg
05825a8a9f Make "Proxy-Connection: close" close the current proxy connection, as
Roman Koifman found out.
2004-08-30 12:51:32 +00:00
Daniel Stenberg
24353c4372 getdate fix, adacurl release 2004-08-30 09:16:43 +00:00
Daniel Stenberg
e89ea07626 mention Gisle's recent fixes 2004-08-30 09:16:31 +00:00
Gisle Vanem
b99c95ba46 Removed ares_free_errmem.c from MSCV project files.
Fixed line-endings to CR-LF.
2004-08-29 15:40:17 +00:00
Daniel Stenberg
9432bfe90c updated with minor edits 2004-08-27 07:17:52 +00:00
Daniel Stenberg
37bf6da9c8 don't do SO_KEEPALIVE, we already have a finer grained method built-in 2004-08-27 07:04:31 +00:00
Daniel Stenberg
b3ebbd60a2 added some more details 2004-08-26 13:26:27 +00:00
Daniel Stenberg
e942394bdb getdate and new test cases from yday 2004-08-25 11:21:15 +00:00
Daniel Stenberg
4adfcd4fd7 not accurate anymore anyway 2004-08-25 11:18:33 +00:00
Daniel Stenberg
c10196afc0 Frankie V's description on how to get a CA cert for a random site using
IE
2004-08-25 08:09:48 +00:00
Daniel Stenberg
49746d1dce returned memory should not be freed 2004-08-24 20:36:38 +00:00
Daniel Stenberg
d46e235c2a added test 183 to verify that we properly send good Host: headers when
getting multiple URLs over a single proxy connection
2004-08-24 14:40:32 +00:00
Daniel Stenberg
ee44677d7e Attempt to quick-fix the getdate problem by post-replacing the getdate.c
file after the bison/yacc process to add the fix Harshal Pradhan suggested.
2004-08-24 11:48:02 +00:00
Daniel Stenberg
20057aee2e prevent files named ".nfs[something]" from being displayed when failing 2004-08-24 09:23:40 +00:00
Daniel Stenberg
7119679080 updated in CVS, generated with a much newer bison version 2004-08-23 15:28:53 +00:00
Daniel Stenberg
d869b51a57 Expect: 100-continue info added 2004-08-23 14:46:43 +00:00
Daniel Stenberg
dbacc81af7 added note about WRITEFUNCTION now being called with zero bytes if the file
to be transfered is empty
2004-08-23 14:41:54 +00:00
Daniel Stenberg
b233c13dca verify that transferring a zero byte FTP file results in a zero byte local
file
2004-08-23 14:41:19 +00:00
Daniel Stenberg
464be27479 Provide support for "transferring" zero bytes FTP files and comparing that
the output file actually is zero bytes after the transfer.
2004-08-23 14:40:43 +00:00
Daniel Stenberg
d736ac51c0 stripped trailing whitespace 2004-08-23 14:22:52 +00:00
Daniel Stenberg
e8b295ff7d lost of more into on how to tweak some headers 2004-08-23 14:22:44 +00:00
Daniel Stenberg
4a4490d5f1 debug.c is a fresh new example showing how to use the DEBUGFUNCTION to get
lots of fine info from a transfer
2004-08-23 14:22:26 +00:00
Daniel Stenberg
46313be2f5 added more header info for PUT and POST requests 2004-08-23 14:04:38 +00:00
Daniel Stenberg
723bfe42e7 Roman Koifman pointed out that libcurl send Expect: 100-continue on POSTs and
PUTs even when told to use HTTP 1.0, which is not correct.
2004-08-23 12:34:55 +00:00
Gisle Vanem
e35c7dcd72 More patches for Watt-32 on Win32; don't include "nameser.h". 2004-08-20 14:10:44 +00:00
Gisle Vanem
fa83a0573e No WSAGetLastError() on Watt-32/DOS 2004-08-20 14:07:11 +00:00
Gisle Vanem
7b97371ab1 No <sys/uio.h> on DOS/Win32 2004-08-20 13:48:24 +00:00
Gisle Vanem
b17e32baa7 Changes for Watt-32 on Windows. I've assumed Configure
sets the required HAVE_xx defines for non-DOS/Win targets.
2004-08-20 13:45:26 +00:00
Daniel Stenberg
cd52b9f0da Alexander Krasnostavsky made the write callback get called even when a zero
byte file is downloaded.
2004-08-20 12:09:09 +00:00
Daniel Stenberg
c3d74ffe48 socks proxy and timeouts bug 2004-08-20 10:52:35 +00:00
Daniel Stenberg
a231a96841 actually, we check for a numerical host using either ipv4 or ipv6, as neither
should result in a reverse dns lookup
2004-08-20 09:18:12 +00:00
Daniel Stenberg
93b61bf0d3 use inet_pton() correctly! 2004-08-20 09:11:52 +00:00
Gisle Vanem
06d39bd303 ZLIB_ROOT not needed 2004-08-19 15:24:49 +00:00
Gisle Vanem
52177b1f60 My first CVS commit just to see if this works.
BTW. Used eclipse IDE fo this, which really kicks ass.
2004-08-19 15:16:40 +00:00
Daniel Stenberg
566f7b5e58 simplified expression 2004-08-19 09:37:22 +00:00
Daniel Stenberg
c8c47768c7 Ling Thio pointed out that getaddrinfo() reverse-lookups ip-only names, and
this is an attempt to prevent it from doing that. affects ipv6-enabled only.
2004-08-19 06:44:19 +00:00
Daniel Stenberg
62ff567c47 the autobuilds failed all over on AIX, attempt to fix the strerror_r() problem
by setting _THREAD_SAFE (and -qthreaded) before strerror_r() is checked for.
2004-08-19 06:41:49 +00:00
Daniel Stenberg
ee400f9552 reuse handles in PHP/CURL works - Kirk Hedden told us 2004-08-19 06:31:29 +00:00
Daniel Stenberg
9ac7629e2c PHP FAQ 2004-08-18 11:18:36 +00:00
Daniel Stenberg
d72ca96a43 indented the code curl-style 2004-08-18 06:12:01 +00:00
Daniel Stenberg
d0dcb3b554 removed trailing whitespace 2004-08-17 19:46:34 +00:00
Daniel Stenberg
e139e49826 see also the reset function 2004-08-17 12:39:10 +00:00
Daniel Stenberg
3838745fdb mention the reset function 2004-08-17 12:37:35 +00:00
Daniel Stenberg
06a5c70f4d Kjetil Jacobsen reported an open file leak in file:// transfers of empty
files.
2004-08-17 12:00:39 +00:00
Daniel Stenberg
62af3fb7b9 added a check for the xlc compiler on AIX, and if that is detect we use
the -qthreaded compiler option
2004-08-17 10:47:57 +00:00
Daniel Stenberg
db302a1055 define _THREAD_SAFE on (recent) AIX systems to build thread-safe code 2004-08-17 09:00:30 +00:00
Daniel Stenberg
847c91e568 recent fixes 2004-08-17 06:56:53 +00:00
Daniel Stenberg
2646af106b allow a custom "Accept-Encoding:" header override the internally set one
that gets set with CURLOPT_ENCODING
2004-08-16 13:25:30 +00:00
Daniel Stenberg
7261b4556b strip trailing whitespace 2004-08-16 13:24:01 +00:00
Gunter Knauf
071e3cf007 syncronized with libcurl.def. 2004-08-16 11:09:30 +00:00
Gunter Knauf
164184b484 cosmetic fix. 2004-08-16 11:09:01 +00:00
Daniel Stenberg
8b6e87abee summary edit: mention that some options take a curl_off_t 2004-08-16 10:49:57 +00:00
Daniel Stenberg
45197b188e Roland Krikava's cookies over proxy fix. 2004-08-16 07:24:25 +00:00
Gunter Knauf
559553b169 fixed linkage dll targets. (submitted by Casey O'Donnell) 2004-08-14 22:03:40 +00:00
Daniel Stenberg
84ec4068de added two good ideas 2004-08-13 12:06:30 +00:00
Daniel Stenberg
aea87be19e mention Harshal Pradhan's windows fix 2004-08-13 12:01:20 +00:00
Daniel Stenberg
9f14744d16 Harshal Pradhan made minor syntax change to make this build with MSVC 7.1 2004-08-13 12:00:33 +00:00
Daniel Stenberg
1dc8c1dbc8 removed the ispell-added local word, compressed the final links into a
short section
2004-08-13 11:56:15 +00:00
Daniel Stenberg
e9812c53cb strip trailing whitespace 2004-08-13 11:53:33 +00:00
Daniel Stenberg
ed98565963 spell 2004-08-13 11:47:31 +00:00
Daniel Stenberg
1d3233612a Added "5.9 How does libcurl resolve host names?" since I wrote the text in
a mail anyway the other day.
2004-08-12 14:09:10 +00:00
Daniel Stenberg
8362a34cef updated with recent changes 2004-08-12 14:08:46 +00:00
Daniel Stenberg
edd16d978f hm 2004-08-12 11:39:00 +00:00
Daniel Stenberg
4356356305 3.16 What certificates do I need with I use SSL?
my first attempt at a basic description of the certs involvede
2004-08-12 11:02:01 +00:00
Daniel Stenberg
cb88135220 removed trailing whitespace, indented to curl-style levels 2004-08-12 07:01:20 +00:00
Daniel Stenberg
498a0fe795 Removed the _XOPEN_SOURCE defining again since it caused major havoc in IRIX
land with many warnings and even compiler errors due to missing structs etc
2004-08-12 06:30:17 +00:00
Daniel Stenberg
0ca1b6afcf --disable-[protocol] doesn't disable tests of the specific protocol 2004-08-11 11:18:24 +00:00
Daniel Stenberg
d3c9f3d6f8 clarify that CURLE_FTP_USER_PASSWORD_INCORRECT might in fact get returned
even if user and password are correct
2004-08-11 08:44:36 +00:00
Daniel Stenberg
df59ca1a45 include the server response in the error message when an FTP server gives
back a 530 after the password is provided, as it isn't necessary because of a
bad user name or password.
2004-08-11 08:39:48 +00:00
Daniel Stenberg
9d84442409 define the _XOPEN_SOURCE define in the config.h file instead, and also added a
decent quote about the define, taken from
http://www.opengroup.org/onlinepubs/007908799/xsh/compilation.html
2004-08-11 07:25:08 +00:00
Daniel Stenberg
5ab9d72e45 fixed the default result for xopen and mimpure to work better 2004-08-11 07:14:34 +00:00
Daniel Stenberg
6060e7ed96 experimental code to detect mips-sgi-irix systems that build without gcc
and if so, define _XOPEN_SOURCE to 500 in an attempt to build with less
warnings (on the 64bit versions)
2004-08-11 07:11:35 +00:00
Daniel Stenberg
7ca7f7a725 added several recent bindings 2004-08-11 06:42:20 +00:00
Daniel Stenberg
355b3d3057 updated the CURLOPT_POST description after input from Alan Pinstein 2004-08-10 13:22:08 +00:00
Daniel Stenberg
d5bdf5f89c Ok, setting CURLOPT_POST to 0 will now convert the request to a GET (this
remains undocumented as this is not the way we recommend)
2004-08-10 13:21:32 +00:00
Daniel Stenberg
17de7e0f1c minor reformat to suit the new FAQ parser 2004-08-10 12:41:44 +00:00
Daniel Stenberg
2cea484428 ignore curllib.dsp 2004-08-10 10:43:41 +00:00
Daniel Stenberg
fb3e19ae50 ignore more files 2004-08-10 10:43:10 +00:00
Daniel Stenberg
99db7fb222 7.12.2 work in progress 2004-08-10 10:40:56 +00:00
Daniel Stenberg
49d0272627 and we're back on a clean notes sheet again 2004-08-10 08:56:12 +00:00
648 changed files with 37914 additions and 17520 deletions

2140
CHANGES

File diff suppressed because it is too large Load Diff

1994
CHANGES.2004 Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
COPYRIGHT AND PERMISSION NOTICE COPYRIGHT AND PERMISSION NOTICE
Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se>. Copyright (c) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>.
All rights reserved. All rights reserved.

View File

@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -24,7 +24,7 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
EXTRA_DIST = CHANGES COPYING maketgz reconf Makefile.dist curl-config.in \ EXTRA_DIST = CHANGES COPYING maketgz reconf Makefile.dist curl-config.in \
curl-style.el sample.emacs RELEASE-NOTES buildconf buildconf.bat curl-style.el sample.emacs RELEASE-NOTES buildconf buildconf.bat libcurl.pc.in
bin_SCRIPTS = curl-config bin_SCRIPTS = curl-config
@@ -48,6 +48,15 @@ pdf:
check: test check: test
if CROSSCOMPILING
test-full: test
test-torture: test
test:
@echo "NOTICE: we can't run the tests when cross-compiling!"
else
test: test:
@(cd tests; $(MAKE) all quiet-test) @(cd tests; $(MAKE) all quiet-test)
@@ -57,6 +66,8 @@ test-full:
test-torture: test-torture:
@(cd tests; $(MAKE) all torture-test) @(cd tests; $(MAKE) all torture-test)
endif
# #
# Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros # Build source and binary rpms. For rpm-3.0 and above, the ~/.rpmmacros
# must contain the following line: # must contain the following line:

View File

@@ -5,7 +5,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -53,17 +53,60 @@ borland-clean:
cd ..\src cd ..\src
make -f Makefile.b32 clean make -f Makefile.b32 clean
watcom:
cd lib
wmake -f Makefile.Watcom
cd ..\src
wmake -f Makefile.Watcom
watcom-clean:
cd lib
wmake -f Makefile.Watcom clean
cd ..\src
wmake -f Makefile.Watcom clean
mingw32: mingw32:
cd lib & make -f Makefile.m32 ZLIB=1 $(MAKE) -C lib -f Makefile.m32 ZLIB=1
cd src & make -f Makefile.m32 ZLIB=1 $(MAKE) -C src -f Makefile.m32 ZLIB=1
mingw32-ssl: mingw32-ssl:
cd lib & make -f Makefile.m32 SSL=1 ZLIB=1 $(MAKE) -C lib -f Makefile.m32 SSL=1 ZLIB=1
cd src & make -f Makefile.m32 SSL=1 ZLIB=1 $(MAKE) -C src -f Makefile.m32 SSL=1 ZLIB=1
mingw32-clean: mingw32-clean:
cd lib & make -f Makefile.m32 clean $(MAKE) -C lib -f Makefile.m32 clean
cd src & make -f Makefile.m32 clean $(MAKE) -C src -f Makefile.m32 clean
vc-clean:
cd lib
nmake -f Makefile.vc6 clean
cd ..\src
nmake -f Makefile.vc6 clean
vc-all:
cd lib
nmake -f Makefile.vc6 cfg=release
nmake -f Makefile.vc6 cfg=release-ssl
nmake -f Makefile.vc6 cfg=release-zlib
nmake -f Makefile.vc6 cfg=release-ssl-zlib
nmake -f Makefile.vc6 cfg=release-ssl-dll
nmake -f Makefile.vc6 cfg=release-zlib-dll
nmake -f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=release-dll
nmake -f Makefile.vc6 cfg=release-dll-ssl-dll
nmake -f Makefile.vc6 cfg=release-dll-zlib-dll
nmake -f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug
nmake -f Makefile.vc6 cfg=debug-ssl
nmake -f Makefile.vc6 cfg=debug-zlib
nmake -f Makefile.vc6 cfg=debug-ssl-zlib
nmake -f Makefile.vc6 cfg=debug-ssl-dll
nmake -f Makefile.vc6 cfg=debug-zlib-dll
nmake -f Makefile.vc6 cfg=debug-ssl-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug-dll
nmake -f Makefile.vc6 cfg=debug-dll-ssl-dll
nmake -f Makefile.vc6 cfg=debug-dll-zlib-dll
nmake -f Makefile.vc6 cfg=debug-dll-ssl-dll-zlib-dll
vc: vc:
cd lib cd lib
@@ -93,17 +136,53 @@ vc-ssl-dll:
cd lib cd lib
nmake /f Makefile.vc6 cfg=release-ssl-dll nmake /f Makefile.vc6 cfg=release-ssl-dll
cd ..\src cd ..\src
nmake /f Makefile.vc6 nmake /f Makefile.vc6 cfg=release-ssl-dll
vc-libcurl-ssl-dll: vc-dll-ssl-dll:
cd lib cd lib
nmake /f Makefile.vc6 cfg=release-libcurl-ssl-dll nmake /f Makefile.vc6 cfg=release-dll-ssl-dll
cd ..\src cd ..\src
nmake /f Makefile.vc6 nmake /f Makefile.vc6 cfg=release-dll-ssl-dll
vc-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll
vc-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll-zlib-dll
vc-dll-ssl-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-dll-ssl-dll-zlib-dll
vc-ssl-dll-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-ssl-dll-zlib-dll
vc-zlib-dll:
cd lib
nmake /f Makefile.vc6 cfg=release-zlib-dll
cd ..\src
nmake /f Makefile.vc6 cfg=release-zlib-dll
vc-sspi:
cd lib
nmake /f Makefile.vc6 cfg=release WINDOWS_SSPI=1
cd ..\src
nmake /f Makefile.vc6 cfg=release WINDOWS_SSPI=1
djgpp: djgpp:
make -C lib -f Makefile.dj $(MAKE) -C lib -f Makefile.dj
make -C src -f Makefile.dj $(MAKE) -C src -f Makefile.dj
cygwin: cygwin:
./configure ./configure
@@ -121,9 +200,21 @@ netware:
$(MAKE) -C lib -f Makefile.netware $(MAKE) -C lib -f Makefile.netware
$(MAKE) -C src -f Makefile.netware $(MAKE) -C src -f Makefile.netware
netware-ares:
$(MAKE) -C lib -f Makefile.netware WITH_ARES=1
$(MAKE) -C src -f Makefile.netware WITH_ARES=1
netware-ssl: netware-ssl:
$(MAKE) -C lib -f Makefile.netware SSL=1 $(MAKE) -C lib -f Makefile.netware WITH_SSL=1
$(MAKE) -C src -f Makefile.netware SSL=1 $(MAKE) -C src -f Makefile.netware WITH_SSL=1
netware-ssl-zlib:
$(MAKE) -C lib -f Makefile.netware WITH_SSL=1 WITH_ZLIB=1
$(MAKE) -C src -f Makefile.netware WITH_SSL=1 WITH_ZLIB=1
netware-zlib:
$(MAKE) -C lib -f Makefile.netware WITH_ZLIB=1
$(MAKE) -C src -f Makefile.netware WITH_ZLIB=1
netware-clean: netware-clean:
$(MAKE) -C lib -f Makefile.netware clean $(MAKE) -C lib -f Makefile.netware clean

48
README
View File

@@ -1,12 +1,12 @@
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
| (__| |_| | _ <| |___ | (__| |_| | _ <| |___
\___|\___/|_| \_\_____| \___|\___/|_| \_\_____|
README README
Curl is a command line tool for transfering data specified with URL Curl is a command line tool for transferring data specified with URL
syntax. Find out how to use Curl by reading the curl.1 man page or the syntax. Find out how to use Curl by reading the curl.1 man page or the
MANUAL document. Find out how to install Curl by reading the INSTALL MANUAL document. Find out how to install Curl by reading the INSTALL
document. document.
@@ -26,39 +26,37 @@ CONTACT
If you have problems, questions, ideas or suggestions, please contact us If you have problems, questions, ideas or suggestions, please contact us
by posting to a suitable mailing list. See http://curl.haxx.se/mail/ by posting to a suitable mailing list. See http://curl.haxx.se/mail/
Many major contributors to the project are listed in the THANKS document. All contributors to the project are listed in the THANKS document.
WEB SITE WEB SITE
Visit the curl web site or mirrors for the latest news: Visit the curl web site or mirrors for the latest news and downloads:
Sweden -- http://curl.haxx.se/ Sweden -- http://curl.haxx.se/
Australia -- http://curl.planetmirror.com/ Australia -- http://curl.planetmirror.com/
Austria -- http://curl.gds.tuwien.ac.at/
Canada -- http://curl.meulie.net/
Denmark -- http://curl.cofman.dk/ Denmark -- http://curl.cofman.dk/
Estonia -- http://curl.wildyou.net/ Estonia -- http://curl.wildyou.net/
France -- http://curl.mirror.internet.tp/
Germany -- http://curl.miscellaneousmirror.org/
Germany -- http://curl.mirror.at.stealer.net/ Germany -- http://curl.mirror.at.stealer.net/
Germany -- http://curl.mirroring.de/
Germany -- http://curl.mons-new-media.de/
Germany -- http://curl.netmirror.org/ Germany -- http://curl.netmirror.org/
Russia -- http://curl.tsuren.net/ Russia -- http://curl.tsuren.net/
Taiwan -- http://curl.cs.pu.edu.tw/
Thailand -- http://curl.siamu.ac.th/ Thailand -- http://curl.siamu.ac.th/
US (AZ) -- http://curl.islandofpoker.com/
US (CA) -- http://curl.mirror.redwire.net/ US (CA) -- http://curl.mirror.redwire.net/
US -- http://curl.signal42.com/ US (CA) -- http://curl.mirrormonster.com/
US (CA) -- http://curl.signal42.com/
DOWNLOAD US (CA) -- http://curl.tolix.org/
US (CA) -- http://curl.webhosting76.com/
The official download mirror sites are: US (TX) -- http://curl.109k.com/
US (TX) -- http://curl.mirrors.cyberservers.net/
Australia -- http://curl.planetmirror.com/download.html US (TX) -- http://curl.seekmeup.com/
Estonia -- http://curl.wildyou.net/download.html US (TX) -- http://curl.hostingzero.com/
Germany -- ftp://ftp.fu-berlin.de/pub/unix/network/curl/
Germany -- http://curl.mirror.at.stealer.net/download.html
Germany -- http://curl.netmirror.org/download.html
Germany -- http://www.mirrorspace.org/curl/
Hongkong -- http://www.execve.net/curl/
Russia -- http://curl.tsuren.net/download.html
Sweden -- ftp://ftp.sunet.se/pub/www/utilities/curl/
Sweden -- http://cool.haxx.se/curl/
Thailand -- http://curl.siamu.ac.th/download.html
US (CA) -- http://curl.mirror.redwire.net/download.html
CVS CVS

View File

@@ -1,83 +1,74 @@
Curl and libcurl 7.12.1 Curl and libcurl 7.14.1
Public curl release number: 82 Public curl release number: 89
Releases counted from the very beginning: 109 Releases counted from the very beginning: 116
Available command line options: 96 Available command line options: 108
Available curl_easy_setopt() options: 120 Available curl_easy_setopt() options: 123
Number of public functions in libcurl: 36 Number of public functions in libcurl: 46
Amount of public web site mirrors: 12 Amount of public web site mirrors: 25
Number of known libcurl bindings: 26 Number of known libcurl bindings: 31
Number of contributors: 447
This release includes the following changes: This release includes the following changes:
o the version string now only contains info about (sub) package versions, o GNU GSS support
while for example krb4 and ipv6 now only are available as 'features' o --ignore-content-length and CURLOPT_IGNORE_CONTENT_LENGTH added
o added curl_easy_reset() o negotiates data connection SSL earlier when doing FTPS with PASV
o socks proxy support even when libcurl is built ipv6-enabled o CURLOPT_COOKIELIST and CURLINFO_COOKIELIST
o read callbacks can stop the transfer by returning CURL_READFUNC_ABORT o trailer support for chunked encoded data streams
o libcurl-tutorial.3 is the new man page formerly known as libcurl-the-guide o -x/CURL_PROXY strings may now contain user+password
o additional SSL trace data might be sent to the debug callback using two new o --trace-time now outputs the full microsecond, all 6 digits
types: CURLINFO_SSL_DATA_IN and CURLINFO_SSL_DATA_OUT
o multipart formposts can upload files larger than system memory
o the curl tool continues with the next URL even if one transfer fails
o FTP 3rd party transfer support - seven new setopt() options
This release includes the following bugfixes: This release includes the following bugfixes:
o UTF-8 encoded certificate names can now be verified properly o MSVC build problem with the DSP file
o krb4 link problem o windows threaded resolver access violation with multi interface
o HTTP Negotiate service name now provided in uppercase o test suite works with valgrind 3
o no longer accepts any cookies with domain set to just a TLD o CA cert verification with GnuTLS builds
o HTTP Digest properties without quotes in the header o handles expiry times in cookie files that go beyond 32 bits in size
o bad Host: header case on re-used connections over proxy o several client problems with files, such as doing -d @file when the file
o duplicate Host: header case on re-used connections isn't readable now gets a warning displayed
o curl -o name#[num] now works when no globbing for [num] exists o write callback abort didn't always "take"
o test suite runs fine with valgrind 2.1.x o the curl -z "bad syntax" warning is now hidden when -s is used
o negative Content-Length is ignored o curl -d @nonexisting no longer makes a GET
o test 505 runs fine on windows o minor debug callback data size
o curl_share_cleanup() crash o date parsing of dates including daylight savings time zone names
o --trace files now get the final info lines too o using NTLM over proxy with an FTP URL
o multi interface connects fine to multi-IP resolving hosts o curl-config --features now displays SSL when built with GnuTLS too
o --limit-rate works on Mac OS X (and other systems with bad poll()s) o CURLOPT_HTTPGET, CURLOPT_POST and CURLOPT_HTTPPOST reset CURLOPT_NOBODY
o cookies can now hold 4999 bytes of content o builds fine on AmigaOS again
o HTTP POST/PUT with NTLM/Digest/Negotiate to a URL returning 3XX o corrected date parsing on Windows with auto-DST-adjust enabled
o HTTPS POST/PUT over a proxy requiring NTLM/Digest/Negotiate o treats CONNECT 407 responses with bodies better during Digest/NTLM auth
o less restrictive libidn requirements, 0.4.1 or later is fine o improved strerror_r() API guessing when cross-compiling
o HTTP POST or PUT with Digest/Negotiate/NTLM selected but the server o debug builds work on Tru64
didn't require any authentication o improved libcurl.m4
o win32 file:// transfer free memory bug o possible memory leak in windows name resolves
o configure --disable-http builds a libcurl without HTTP support o c-ares enabled build with mingw
o CURLOPT_FILETIME had wrong type in curl.h, it expects a long argument o proxy host set with numerical IPv6 address
o builds fine with Borland on Windows o better treatment of binary zeroes in HTTP response headers
o the msvc curllib.dsp now builds the libcurl.lib file o fixed the notorious FTP server failure in the test suite
o builds fine on VMS o better checking of text output in the test suite on windows
o builds fine on NetWare o FTP servers' TYPE command response check made less strict
o HTTP Digest authentication with proxies uses correct user name + password o URL-without-slash as in http://somehost?data
o builds fine with lcc-win32 o strerror_r() configure check for HP-UX 10.20 (and others)
o time parse work-around on HP-UX 10.20 since its gmtime_r() is broken
Other curl-related news since the previous public release: Other curl-related news since the previous public release:
o James Hu took over after Kevin Roth as maintainer of the curl package on o cURLpp 0.5.2 was released at http://rrette.com/curlpp.html
cygwin. Many saludos to Kevin for a work well done during many years. o Rexx/CURL 1.3 was released at http://rexxcurl.sf.net/
o Gambas binding: http://gambas.sf.net o http://curl.miscellaneousmirror.org is a new German curl mirror
o pycurl 7.12.0 was released http://pycurl.sf.net o LuaCURL by Alexander Marinov at http://luacurl.luaforge.net/
o wxWidgets binding: http://homepage.mac.com/codonnell/wxcurldav/ o http://curl.hostingzero.com/ is a new US curl mirror
o New Austrian curl web mirror: http://curl.gds.tuwien.ac.at o ocurl 0.2.1 was released at http://sourceforge.net/projects/ocurl
o TclCurl 0.12.0 was released:
http://personal1.iddeo.es/andresgarci/tclcurl/english/
o Ch binding: http://chcurl.sourceforge.net
o New US curl web mirror: http://curl.109k.com
o glib/GTK+ binding: http://atterer.net/glibcurl/
o New French curl web mirror: http://curl.mirror.internet.tp
This release would not have looked like this without help, code, reports and This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:
Gisle Vanem, Vincent Bronner, Alexander Krasnostavsky, Chris Gaukroger, John McGowan, Georg Wicherski, Andres Garcia, Eric Cooper, Todd Kulesza,
G<EFBFBD>nter Knauf, Marty Kuhrt, Kjetil Jacobsen, Steven Bazyl, Seshubabu Pasam, Tupone Alfredo, Gisle Vanem, David Shaw, Andrew Bushnell, Dan Fandrich,
Luca Alteas, Jean-Louis Lemaire, David Byron, David Cohen, Rob Stanzel, Adrian Schuur, Diego Casorran, Peteris Krumins, Jon Grubbs, Christopher
Niels van Tongeren, Andr<64>s Garc<72>a, Toby Peterson, Casey O'Donnell, Brian R. Palmer, Mario Schroeder, Richard Clayton, James Bursa, Jeff Pohlmeyer,
Akins, Bertrand Demiddelaer, Joel Chen, Dylan Salisbury, Enrico Scholz, Norbert Novotny, Toby Peterson, Simon Josefsson, Igor Polyakov, Kevin Lussier
Alexis Carvalho
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@@ -1,9 +1,12 @@
Issues not sorted in any particular order. Issues not sorted in any particular order.
To get fixed in 7.12.2 (planned release: December 2004) To get fixed in 7.14.1 (planned release: August 2005)
====================== ======================
36. Fix HTTP Negotiate authentication so that no bogus user name needs to be To get fixed in 7.14.2 (planned release: October 2005)
provided to activate it. ======================
60 - CONNECT 407 responses that kills the connection
63 -
Bugfixes reported until late November

View File

@@ -87,9 +87,7 @@ AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets]
dnl Ioctlsocket didnt compile, do test 5! dnl Ioctlsocket didnt compile, do test 5!
AC_TRY_COMPILE([ AC_TRY_COMPILE([
/* headers for SO_NONBLOCK test (BeOS) */ /* headers for SO_NONBLOCK test (BeOS) */
#include <sys/types.h> #include <socket.h>
#include <unistd.h>
#include <fcntl.h>
],[ ],[
/* SO_NONBLOCK source code */ /* SO_NONBLOCK source code */
long b = 1; long b = 1;
@@ -124,6 +122,30 @@ dnl end of non-blocking try-compile test
fi fi
]) ])
dnl Check for struct sockaddr_storage. Most IPv6-enabled hosts have it, but
dnl AIX 4.3 is one known exception.
AC_DEFUN([TYPE_SOCKADDR_STORAGE],
[
AC_CHECK_TYPE([struct sockaddr_storage],
AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
[if struct sockaddr_storage is defined]), ,
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
])
])
dnl Check for socklen_t: historically on BSD it is an int, and in dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc. So we dnl types for the argument to getsockopt, getpeername, etc. So we
@@ -170,8 +192,7 @@ AC_DEFUN([TYPE_SOCKLEN_T],
]) ])
dnl Check for in_addr_t: it is used to receive the return code of inet_addr() dnl Check for in_addr_t: it is used to receive the return code of inet_addr()
dnl and a few other things. If not found, we set it to unsigned int, as even dnl and a few other things.
dnl 64-bit implementations use to set it to a 32-bit type.
AC_DEFUN([TYPE_IN_ADDR_T], AC_DEFUN([TYPE_IN_ADDR_T],
[ [
AC_CHECK_TYPE([in_addr_t], ,[ AC_CHECK_TYPE([in_addr_t], ,[
@@ -236,7 +257,7 @@ exit (h == NULL ? 1 : 0); }],[
]) ])
dnl ************************************************************ dnl ************************************************************
dnl check for working getaddrinfo() dnl check for working getaddrinfo() that works with AI_NUMERICHOST
dnl dnl
AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[ AC_DEFUN([CURL_CHECK_WORKING_GETADDRINFO],[
AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[ AC_CACHE_CHECK(for working getaddrinfo, ac_cv_working_getaddrinfo,[
@@ -251,6 +272,7 @@ int main(void)
int error; int error;
memset(&hints, 0, sizeof(hints)); memset(&hints, 0, sizeof(hints));
hints.ai_flags = AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); error = getaddrinfo("127.0.0.1", "8080", &hints, &ai);
@@ -324,8 +346,24 @@ dnl program worked:
[ ac_cv_working_ni_withscopeid="yes" ], [ ac_cv_working_ni_withscopeid="yes" ],
dnl program failed: dnl program failed:
[ ac_cv_working_ni_withscopeid="no" ], [ ac_cv_working_ni_withscopeid="no" ],
dnl we cross-compile: dnl we cross-compile, check the headers using the preprocessor
[ ac_cv_working_ni_withscopeid="yes" ] [
AC_EGREP_CPP(WORKS,
[
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#ifdef NI_WITHSCOPEID
WORKS
#endif
],
ac_cv_working_ni_withscopeid="yes",
ac_cv_working_ni_withscopeid="no" )
]
) dnl end of AC_RUN_IFELSE ) dnl end of AC_RUN_IFELSE
]) dnl end of AC_CACHE_CHECK ]) dnl end of AC_CACHE_CHECK
@@ -378,34 +416,25 @@ dnl int strerror_r(int errnum, char *buf, size_t n);
dnl dnl
AC_DEFUN([CURL_CHECK_STRERROR_R], AC_DEFUN([CURL_CHECK_STRERROR_R],
[ [
dnl determine of strerror_r is present AC_CHECK_FUNCS(strerror_r)
AC_CHECK_FUNCS(strerror_r,[
if test "x$ac_cv_func_strerror_r" = "xyes"; then
AC_MSG_CHECKING(whether strerror_r is declared) AC_MSG_CHECKING(whether strerror_r is declared)
AC_EGREP_CPP(strerror_r,[ AC_EGREP_CPP(strerror_r,[
#include <string.h>],[ #include <string.h>],[
strerror_r="yes"
AC_MSG_RESULT(yes)],[ AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
AC_MSG_CHECKING(whether strerror_r with -D_THREAD_SAFE is declared) AC_MSG_CHECKING(whether strerror_r with -D_REENTRANT is declared)
AC_EGREP_CPP(strerror_r,[ AC_EGREP_CPP(strerror_r,[
#define _THREAD_SAFE #define _REENTRANT
#include <string.h>],[ #include <string.h>],[
strerror_r="yes" CPPFLAGS="-D_REENTRANT $CPPFLAGS"
CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
AC_MSG_RESULT(yes)], AC_MSG_RESULT(yes)],
AC_MSG_RESULT(no))])]) AC_MSG_RESULT(no)
AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
if test "x$strerror_r" = "xyes"; then ) dnl with _THREAD_SAFE
]) dnl plain cpp for it
dnl check if strerror_r is properly declared in the headers
AC_CHECK_DECL(strerror_r, ,
AC_DEFINE(HAVE_NO_STRERROR_R_DECL, 1, [we have no strerror_r() proto])
,
[#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
])
dnl determine if this strerror_r() is glibc or POSIX dnl determine if this strerror_r() is glibc or POSIX
AC_MSG_CHECKING([for a glibc strerror_r API]) AC_MSG_CHECKING([for a glibc strerror_r API])
@@ -427,8 +456,20 @@ main () {
AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()]) AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
AC_MSG_RESULT([yes]), AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]), AC_MSG_RESULT([no]),
dnl cross-compiling!
AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!]) dnl Use an inferior method of strerror_r detection while cross-compiling
AC_EGREP_CPP(yes, [
#include <features.h>
#ifdef __GLIBC__
yes
#endif
],
dnl looks like glibc, so assume a glibc-style strerror_r()
GLIBC_STRERROR_R="1"
AC_DEFINE(HAVE_GLIBC_STRERROR_R, 1, [we have a glibc-style strerror_r()])
AC_MSG_RESULT([yes]),
AC_MSG_NOTICE([cannot determine strerror_r() style: edit lib/config.h manually!])
) dnl while cross-compiling
) )
if test -z "$GLIBC_STRERROR_R"; then if test -z "$GLIBC_STRERROR_R"; then
@@ -690,15 +731,20 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
fi fi
else dnl $ICC = yes else dnl $ICC = yes
dnl this is a set of options we believe *ALL* gcc versions support: dnl this is a set of options we believe *ALL* gcc versions support:
WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare" WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
dnl -Wcast-align is a bit too annoying on all gcc versions ;-) dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
if test "$gccnum" -ge "207"; then
dnl gcc 2.7 or later
WARN="$WARN -Wmissing-declarations"
fi
if test "$gccnum" -gt "295"; then if test "$gccnum" -gt "295"; then
dnl only if the compiler is newer than 2.95 since we got lots of dnl only if the compiler is newer than 2.95 since we got lots of
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
dnl gcc 2.95.4 on FreeBSD 4.9! dnl gcc 2.95.4 on FreeBSD 4.9!
WARN="$WARN -Wundef" WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
fi fi
if test "$gccnum" -ge "296"; then if test "$gccnum" -ge "296"; then
@@ -712,15 +758,18 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
fi fi
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
dnl on i686-Linux as it gives us heaps with false positives dnl on i686-Linux as it gives us heaps with false positives.
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
dnl over making it unusable for generic purposes. Let's not use it.
if test "$gccnum" -ge "303"; then if test "$gccnum" -ge "303"; then
dnl gcc 3.3 and later dnl gcc 3.3 and later
WARN="$WARN -Wendif-labels -Wstrict-prototypes" WARN="$WARN -Wendif-labels -Wstrict-prototypes"
fi fi
if test "$gccnum" -ge "304"; then if test "$gccnum" -ge "304"; then
# try -Wunreachable-code on gcc 3.4 # try these on gcc 3.4
WARN="$WARN -Wunreachable-code" WARN="$WARN -Wdeclaration-after-statement"
fi fi
for flag in $CPPFLAGS; do for flag in $CPPFLAGS; do
@@ -763,3 +812,72 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
]) dnl end of AC_DEFUN() ]) dnl end of AC_DEFUN()
dnl Determine the name of the library to pass to dlopen() based on the name
dnl that would normally be given to AC_CHECK_LIB. The preprocessor symbol
dnl given is set to the quoted library file name.
dnl The standard dynamic library file name is first generated, based on the
dnl current system type, then a search is performed for that file on the
dnl standard dynamic library path. If it is a symbolic link, the destination
dnl of the link is used as the file name, after stripping off any minor
dnl version numbers. If a library file can't be found, a guess is made.
dnl This macro assumes AC_PROG_LIBTOOL has been called and requires perl
dnl to be available in the PATH, or $PERL to be set to its location.
dnl
dnl CURL_DLLIB_NAME(VARIABLE, library_name)
dnl e.g. CURL_DLLIB_NAME(LDAP_NAME, ldap) on a Linux system might result
dnl in LDAP_NAME holding the string "libldap.so.2".
AC_DEFUN([CURL_DLLIB_NAME],
[
AC_MSG_CHECKING([name of dynamic library $2])
dnl The shared library extension variable name changes from version to
dnl version of libtool. Try a few names then just set one statically.
test -z "$shared_ext" && shared_ext="$shrext_cmds"
test -z "$shared_ext" && shared_ext="$shrext"
test -z "$shared_ext" && shared_ext=".so"
dnl Create the library link name of the correct form for this platform
LIBNAME_LINK_SPEC=`echo "$library_names_spec" | $SED 's/^.* //'`
DLGUESSLIB=`name=$2 eval echo "$libname_spec"`
DLGUESSFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$LIBNAME_LINK_SPEC"`
dnl Synthesize a likely dynamic library name in case we can't find an actual one
SO_NAME_SPEC="$soname_spec"
dnl soname_spec undefined when identical to the 1st entry in library_names_spec
test -z "$SO_NAME_SPEC" && SO_NAME_SPEC=`echo "$library_names_spec" | $SED 's/ .*$//'`
DLGUESSSOFILE=`libname="$DLGUESSLIB" release="" major="" versuffix="" eval echo "$SO_NAME_SPEC"`
if test "$cross_compiling" = yes; then
dnl Can't look at filesystem when cross-compiling
AC_DEFINE_UNQUOTED($1, "$DLGUESSSOFILE", [$2 dynamic library file])
AC_MSG_RESULT([$DLGUESSSOFILE (guess while cross-compiling)])
else
DLFOUNDFILE=""
if test "$sys_lib_dlsearch_path_spec" ; then
dnl Search for the link library name and see what it points to.
for direc in $sys_lib_dlsearch_path_spec ; do
DLTRYFILE="$direc/$DLGUESSFILE"
dnl Find where the symbolic link for this name points
changequote(<<, >>)dnl
<<
DLFOUNDFILE=`${PERL:-perl} -e 'use File::Basename; (basename(readlink($ARGV[0])) =~ /^(.*[^\d]\.\d+)[\d\.]*$/ && print ${1}) || exit 1;' "$DLTRYFILE" 2>&5`
>>
changequote([, ])dnl
if test "$?" -eq "0"; then
dnl Found the file link
break
fi
done
fi
if test -z "$DLFOUNDFILE" ; then
dnl Couldn't find a link library, so guess at a name.
DLFOUNDFILE="$DLGUESSSOFILE"
fi
AC_DEFINE_UNQUOTED($1, "$DLFOUNDFILE", [$2 dynamic library file])
AC_MSG_RESULT($DLFOUNDFILE)
fi
])

View File

@@ -6,3 +6,18 @@ ahost
config.log config.log
config.status config.status
aclocal.m4 aclocal.m4
.deps
Makefile.in
config.guess
config.h
config.h.in
config.sub
libtool
ltmain.sh
stamp-h1
*.lo
.libs
depcomp
libcares.la
missing
ares_version.h.dist

13
ares/AUTHORS Normal file
View File

@@ -0,0 +1,13 @@
c-ares is based on ares, and these are the people that have worked on it since
the fork was made:
Daniel Stenberg
Dominick Meglio
liren at vivisimo.com
James Bursa
Duncan Wilcox
Dirk Manske
Dan Fandrich
Gisle Vanem
Gunter Knauf
Henrik Stoerner

View File

@@ -1,5 +1,138 @@
Changelog for the c-ares project Changelog for the c-ares project
Version 1.3.0 (August 29, 2004)
* August 21
- Alfredo Tupone provided a fix for the Windows code in get_iphlpapi_dns_info()
when getting the DNS server etc.
* June 19
- Added some checks for the addrinfo structure.
* June 2
- William Ahern:
Make UDP sockets non-blocking. I've confirmed that at least on Linux 2.4 a
read event can come back from poll() on a valid SOCK_DGRAM socket but
recv(2) will still block. This patch doesn't ignore EAGAIN in
read_udp_packets(), though maybe it should. (This patch was edited by Daniel
Stenberg and a new configure test was added (imported from curl's configure)
to properly detect what non-blocking socket approach to use.)
I'm not quite sure how this was happening, but I've been seeing PTR queries
which seem to return empty responses. At least, they were empty when calling
ares_expand_name() on the record. Here's a patch which guarantees to
NUL-terminate the expanded name. The old behavior failed to NUL-terminate if
len was 0, and this was causing strlen() to run past the end of the buffer
after calling ares_expand_name() and getting ARES_SUCCESS as the return
value. If q is not greater than *s then it's equal and *s is always
allocated with at least one byte.
* May 16
- Added ares_getnameinfo which mimics the getnameinfo API (another feature
that could use testing).
* May 14
- Added an inet_ntop function from BIND for systems that do not have it.
* April 9
- Made sortlist support IPv6 (this can probably use some testing).
- Made sortlist support CIDR matching for IPv4.
* April 8
- Added preliminary IPv6 support to ares_gethostbyname. Currently, sortlist
does not work with IPv6. Also provided an implementation of bitncmp from
BIND for systems that do not supply this function. This will be used to add
IPv6 support to sortlist.
- Made ares_gethostbyaddr support IPv6 by specifying AF_INET6 as the family.
The function can lookup IPv6 addresses both from files (/etc/hosts) and
DNS lookups.
* April 7
- Tupone Alfredo fixed includes of arpa/nameser_compat.h to build fine on Mac
OS X.
* April 5
- Dominick Meglio: Provided implementations of inet_net_pton and inet_pton
from BIND for systems that do not include these functions.
* March 11, 2005
- Dominick Meglio added ares_parse_aaaa_reply.c and did various
adjustments. The first little steps towards IPv6 support!
* November 7
- Fixed the VC project and makefile to use ares_cancel and ares_version
* October 24
- The released ares_version.h from 1.2.1 says 1.2.0 due to a maketgz flaw.
This is now fixed.
Version 1.2.1 (October 20, 2004)
* September 29
- Henrik Stoerner fix: got a report that Tru64 Unix (the unix from Digital
when they made Alpha's) uses /etc/svc.conf for the purpose fixed below for
other OSes. He made c-ares check for and understand it if present.
- Now c-ares will use local host name lookup _before_ DNS resolving by default
if nothing else is told.
* September 26
- Henrik Stoerner: found out that c-ares does not look at the /etc/host.conf
file to determine the sequence in which to search /etc/hosts and DNS. So on
systems where this order is defined by /etc/host.conf instead of a "lookup"
entry in /etc/resolv.conf, c-ares will always default to looking in DNS
first, and /etc/hosts second.
c-ares now looks at
1) resolv.conf (for the "lookup" line);
2) nsswitch.fon (for the "hosts:" line);
3) host.conf (for the "order" line).
First match wins.
- Dominick Meglio patched: C-ares on Windows assumed that the HOSTS file is
located in a static location. It assumed
C:\Windows\System32\Drivers\Etc. This is a poor assumption to make. In fact,
the location of the HOSTS file can be changed via a registry setting.
There is a key called DatabasePath which specifies the path to the HOSTS
file:
http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.mspx
The patch will make c-ares correctly consult the registry for the location
of this file.
* August 29
- Gisle Vanem fixed the MSVC build files.
* August 20
- Gisle Vanem made c-ares build and work with his Watt-32 TCP/IP stack.
* August 13
- Harshal Pradhan made a minor syntax change in ares_init.c to make it build
fine with MSVC 7.1
* July 24 * July 24
- Made the lib get built static only if --enable-debug is used. - Made the lib get built static only if --enable-debug is used.

View File

@@ -12,10 +12,10 @@ MSVCFILES = vc/adig/adig.dep vc/adig/adig.dsp vc/adig/adig.mak \
# adig and ahost are just sample programs and thus not mentioned with the # adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers # regular sources and headers
EXTRA_DIST = CHANGES README.cares Makefile.inc adig.c ahost.c $(man_MANS) \ EXTRA_DIST = CHANGES README.cares Makefile.inc adig.c ahost.c $(man_MANS) \
$(MSVCFILES) $(MSVCFILES) AUTHORS
VER=-version-info 0:0:0 VER=-version-info 1:0:0
# This flag accepts an argument of the form current[:revision[:age]]. So, # This flag accepts an argument of the form current[:revision[:age]]. So,
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
# 1. # 1.
@@ -55,3 +55,12 @@ libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
libcares_ladir = $(includedir) libcares_ladir = $(includedir)
# what headers to install on 'make install': # what headers to install on 'make install':
libcares_la_HEADERS = ares.h ares_version.h libcares_la_HEADERS = ares.h ares_version.h
# Make files named *.dist replace the file without .dist extension
dist-hook:
find $(distdir) -name "*.dist" -exec rm {} \;
(distit=`find $(srcdir) -name "*.dist"`; \
for file in $$distit; do \
strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
cp $$file $(distdir)$$strip; \
done)

View File

@@ -1,56 +1,50 @@
# #
# c-ares Makefile for djgpp/gcc/Watt-32 # c-ares Makefile for djgpp/gcc/Watt-32.
# By Gisle Vanem <giva@bgnett.no> 2004. # By Gisle Vanem <giva@bgnett.no> 2004.
# #
.SUFFIXES: .exe .SUFFIXES: .exe
WATT32_ROOT = $(subst \,/,$(WATT_ROOT)) include Makefile.inc
CC = gcc WATT32_ROOT = $(subst \,/,$(WATT_ROOT))
CFLAGS = -O2 -Wall -DWATT32 -Dselect=select_s -I$(WATT32_ROOT)/inc
LDFLAGS = -s CC = gcc
EX_LIBS = $(WATT32_ROOT)/lib/libwatt.a CFLAGS = -O2 -Wall -DWATT32 -Dselect=select_s -I$(WATT32_ROOT)/inc
LDFLAGS = -s
SOURCE = ares_cancel.c ares_destroy.c ares_expand_name.c ares_expand_string.c ares_fds.c \ EX_LIBS = $(WATT32_ROOT)/lib/libwatt.a
ares_free_hostent.c ares_free_string.c ares_gethostbyaddr.c ares_gethostbyname.c \
ares_init.c ares_mkquery.c ares_parse_a_reply.c ares_parse_ptr_reply.c \ OBJ_DIR = djgpp
ares_process.c ares_query.c ares_search.c ares_send.c ares_strerror.c \
ares_timeout.c ares__close_sockets.c ares__get_hostent.c ares__read_line.c \ OBJECTS = $(addprefix $(OBJ_DIR)/, $(CSOURCES:.c=.o))
ares_version.c
all: $(OBJ_DIR) libcares.a ahost.exe adig.exe
OBJ_DIR = djgpp @echo Welcome to c-ares.
OBJECTS = $(addprefix $(OBJ_DIR)/, $(SOURCE:.c=.o)) $(OBJ_DIR):
- mkdir $(OBJ_DIR)
all: $(OBJ_DIR) libcares.a ahost.exe adig.exe libcares.a: $(OBJECTS)
@echo Welcome to c-ares. ar rs $@ $?
$(OBJ_DIR): ahost.exe: ahost.c libcares.a
- mkdir $(OBJ_DIR) $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
libcares.a: $(OBJECTS) adig.exe: adig.c libcares.a
ar rs $@ $? $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
ahost.exe: ahost.c libcares.a clean:
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) rm -f $(OBJECTS) libcares.a
adig.exe: adig.c libcares.a vclean realclean: clean
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS) rm -f ahost.exe adig.exe depend.dj
- rmdir $(OBJ_DIR)
clean:
rm -f $(OBJECTS) libcares.a $(OBJ_DIR)/%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
vclean realclean: clean @echo
rm -f ahost.exe adig.exe depend.dj
- rmdir $(OBJ_DIR) depend:
$(CC) -MM $(CFLAGS) $(CSOURCES) | \
$(OBJ_DIR)/%.o: %.c sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj
$(CC) $(CFLAGS) -o $@ -c $<
@echo -include depend.dj
depend:
$(CC) -MM $(CFLAGS) $(SOURCE) | \
sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj
-include depend.dj

View File

@@ -1,15 +1,18 @@
CSOURCES = ares_fds.c ares_process.c ares_free_hostent.c ares_query.c \ CSOURCES = ares_fds.c ares_process.c ares_free_hostent.c ares_query.c \
ares__close_sockets.c ares_free_string.c ares_search.c ares__get_hostent.c \ ares__close_sockets.c ares_free_string.c ares_search.c ares__get_hostent.c \
ares_gethostbyaddr.c ares_send.c ares__read_line.c ares_gethostbyname.c \ ares_gethostbyaddr.c ares_send.c ares__read_line.c ares_gethostbyname.c \
ares_strerror.c ares_cancel.c ares_init.c ares_timeout.c ares_destroy.c \ ares_strerror.c ares_cancel.c ares_init.c ares_timeout.c ares_destroy.c \
ares_mkquery.c ares_version.c ares_expand_name.c ares_parse_a_reply.c \ ares_mkquery.c ares_version.c ares_expand_name.c ares_parse_a_reply.c \
windows_port.c ares_expand_string.c ares_parse_ptr_reply.c windows_port.c ares_expand_string.c ares_parse_ptr_reply.c \
ares_parse_aaaa_reply.c ares_getnameinfo.c inet_net_pton.c bitncmp.c \
inet_ntop.c
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h nameser.h HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h \
nameser.h inet_net_pton.h inet_ntop.h ares_ipv6.h bitncmp.h
MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \ MANPAGES= ares_destroy.3 ares_expand_name.3 ares_expand_string.3 ares_fds.3 \
ares_free_hostent.3 ares_free_string.3 ares_gethostbyaddr.3 \ ares_free_hostent.3 ares_free_string.3 ares_gethostbyaddr.3 \
ares_gethostbyname.3 ares_init.3 ares_init_options.3 ares_mkquery.3 \ ares_gethostbyname.3 ares_init.3 ares_init_options.3 ares_mkquery.3 \
ares_parse_a_reply.3 ares_parse_ptr_reply.3 ares_process.3 \ ares_parse_a_reply.3 ares_parse_ptr_reply.3 ares_process.3 \
ares_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \ ares_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \
ares_version.3 ares_cancel.3 ares_version.3 ares_cancel.3 ares_parse_aaaa_reply.3 ares_getnameinfo.3

View File

@@ -20,7 +20,7 @@ endif
TARGETS = adig.nlm ahost.nlm TARGETS = adig.nlm ahost.nlm
LTARGET = libcares.lib LTARGET = libcares.lib
VERSION = $(LIBCARES_VERSION) VERSION = $(LIBCARES_VERSION)
COPYR = Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se> COPYR = Copyright (C) 1996 - 2005, Daniel Stenberg, <daniel@haxx.se>
DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
MTSAFE = YES MTSAFE = YES
STACK = 64000 STACK = 64000
@@ -88,8 +88,8 @@ LD = nlmconv
LDFLAGS = -T LDFLAGS = -T
AR = ar AR = ar
ARFLAGS = -cq ARFLAGS = -cq
CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return -fno-strict-aliasing
CFLAGS += -Wall -Wno-format # -pedantic CFLAGS += -Wall -Wno-format -Wno-uninitialized # -pedantic
ifeq ($(LIBARCH),LIBC) ifeq ($(LIBARCH),LIBC)
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
else else
@@ -104,7 +104,7 @@ SDK_LIBC = $(NDK_ROOT)/libc
ifeq ($(LIBARCH),LIBC) ifeq ($(LIBARCH),LIBC)
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
INCLUDES += -I$(SDK_LIBC)/include/winsock # INCLUDES += -I$(SDK_LIBC)/include/winsock
CFLAGS += -D_POSIX_SOURCE CFLAGS += -D_POSIX_SOURCE
# CFLAGS += -D__ANSIC__ # CFLAGS += -D__ANSIC__
else else
@@ -126,7 +126,10 @@ DL = '
#-include $(NDKBASE)/nlmconv/ncpfs.inc #-include $(NDKBASE)/nlmconv/ncpfs.inc
endif endif
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(wildcard ares_*.c)) # Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES)))
.PHONY: lib nlm prebuild dist install clean .PHONY: lib nlm prebuild dist install clean
@@ -256,6 +259,7 @@ config.h: Makefile.netware
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@ @echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
@echo $(DL)#define PACKAGE_BUGREPORT "curl-bug@haxx.se"$(DL) >> $@ @echo $(DL)#define PACKAGE_BUGREPORT "curl-bug@haxx.se"$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ARPA_NAMESER_H 1$(DL) >> $@
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@ @echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@ @echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@ @echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
@@ -297,6 +301,13 @@ config.h: Makefile.netware
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@ @echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@ @echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@ @echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
@echo $(DL)#define HAVE_AF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_PF_INET6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_IN6_ADDR 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_SOCKADDR_IN6 1$(DL) >> $@
@echo $(DL)#define HAVE_STRUCT_ADDRINFO 1$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN6_ADDR 16$(DL) >> $@
@echo $(DL)#define SIZEOF_STRUCT_IN_ADDR 4$(DL) >> $@
ifdef NW_WINSOCK ifdef NW_WINSOCK
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@ @echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
else else

View File

@@ -1,101 +1,291 @@
dnl Check for how to set a socket to non-blocking state. There seems to exist
dnl We create a function for detecting which compiler we use and then set as dnl four known different ways, with the one used almost everywhere being POSIX
dnl pendantic compiler options as possible for that particular compiler. The dnl and XPG3, while the other different ways for different systems (old BSD,
dnl options are only used for debug-builds. dnl Windows and Amiga).
dnl
dnl This is a copy of the original found in curl's configure script. Don't dnl There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
dnl modify this one, edit the one in curl and copy it back here when that one dnl O_NONBLOCK define is found but does not work. This condition is attempted
dnl is changed. dnl to get caught in this script by using an excessive number of #ifdefs...
dnl
AC_DEFUN([CURL_CC_DEBUG_OPTS], AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
[ [
if test "$GCC" = "yes"; then AC_MSG_CHECKING([non-blocking sockets style])
dnl figure out gcc version! AC_TRY_COMPILE([
AC_MSG_CHECKING([gcc version]) /* headers for O_NONBLOCK test */
gccver=`$CC -dumpversion` #include <sys/types.h>
num1=`echo $gccver | cut -d . -f1` #include <unistd.h>
num2=`echo $gccver | cut -d . -f2` #include <fcntl.h>
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null` ],[
AC_MSG_RESULT($gccver) /* try to compile O_NONBLOCK */
AC_MSG_CHECKING([if this is icc in disguise]) #if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER], # if defined(__SVR4) || defined(__srv4__)
dnl action if the text is found, this it has not been replaced by the # define PLATFORM_SOLARIS
dnl cpp # else
ICC="no" # define PLATFORM_SUNOS4
AC_MSG_RESULT([no]), # endif
dnl the text was not found, it was replaced by the cpp #endif
ICC="yes" #if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX4)
AC_MSG_RESULT([yes]) # define PLATFORM_AIX_V3
) #endif
if test "$ICC" = "yes"; then #if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
dnl this is icc, not gcc. #error "O_NONBLOCK does not work on this platform"
#endif
dnl ICC warnings we ignore: int socket;
dnl * 279 warns on static conditions in while expressions int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
dnl * 269 warns on our "%Od" printf formatters for curl_off_t output: ],[
dnl "invalid format string conversion" dnl the O_NONBLOCK test was fine
nonblock="O_NONBLOCK"
WARN="-wd279,269" AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
],[
if test "$gccnum" -gt "600"; then dnl the code was bad, try a different program now, test 2
dnl icc 6.0 and older doesn't have the -Wall flag
WARN="-Wall $WARN" AC_TRY_COMPILE([
fi /* headers for FIONBIO test */
else dnl $ICC = yes #include <unistd.h>
dnl #include <stropts.h>
WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare" ],[
/* FIONBIO source test (old-style unix) */
dnl -Wcast-align is a bit too annoying ;-) int socket;
int flags = ioctl(socket, FIONBIO, &flags);
if test "$gccnum" -ge "296"; then ],[
dnl gcc 2.96 or later dnl FIONBIO test was good
WARN="$WARN -Wfloat-equal" nonblock="FIONBIO"
AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
if test "$gccnum" -gt "296"; then ],[
dnl this option does not exist in 2.96 dnl FIONBIO test was also bad
WARN="$WARN -Wno-format-nonliteral" dnl the code was bad, try a different program now, test 3
fi
AC_TRY_COMPILE([
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on /* headers for ioctlsocket test (cygwin?) */
dnl on i686-Linux as it gives us heaps with false positives #include <windows.h>
if test "$gccnum" -ge "303"; then ],[
dnl gcc 3.3 and later /* ioctlsocket source code */
WARN="$WARN -Wendif-labels -Wstrict-prototypes" int socket;
fi unsigned long flags = ioctlsocket(socket, FIONBIO, &flags);
fi ],[
dnl ioctlsocket test was good
for flag in $CPPFLAGS; do nonblock="ioctlsocket"
case "$flag" in AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
-I*) ],[
dnl include path dnl ioctlsocket didnt compile!, go to test 4
add=`echo $flag | sed 's/^-I/-isystem /g'`
WARN="$WARN $add" AC_TRY_LINK([
;; /* headers for IoctlSocket test (Amiga?) */
esac #include <sys/ioctl.h>
done ],[
/* IoctlSocket source code */
fi dnl $ICC = no int socket;
int flags = IoctlSocket(socket, FIONBIO, (long)1);
CFLAGS="$CFLAGS $WARN" ],[
dnl ioctlsocket test was good
fi dnl $GCC = yes nonblock="IoctlSocket"
AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
dnl strip off optimizer flags ],[
NEWFLAGS="" dnl Ioctlsocket didnt compile, do test 5!
for flag in $CFLAGS; do AC_TRY_COMPILE([
case "$flag" in /* headers for SO_NONBLOCK test (BeOS) */
-O*) #include <socket.h>
dnl echo "cut off $flag" ],[
;; /* SO_NONBLOCK source code */
*) long b = 1;
NEWFLAGS="$NEWFLAGS $flag" int socket;
;; int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
esac ],[
done dnl the SO_NONBLOCK test was good
CFLAGS=$NEWFLAGS nonblock="SO_NONBLOCK"
AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
]) dnl end of AC_DEFUN() ],[
dnl test 5 didnt compile!
nonblock="nada"
AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
])
dnl end of fifth test
])
dnl end of forth test
])
dnl end of third test
])
dnl end of second test
])
dnl end of non-blocking try-compile test
AC_MSG_RESULT($nonblock)
if test "$nonblock" = "nada"; then
AC_MSG_WARN([non-block sockets disabled])
fi
])
dnl We create a function for detecting which compiler we use and then set as
dnl pendantic compiler options as possible for that particular compiler. The
dnl options are only used for debug-builds.
dnl This is a copy of the original found in curl's configure script. Don't
dnl modify this one, edit the one in curl and copy it back here when that one
dnl is changed.
AC_DEFUN([CURL_CC_DEBUG_OPTS],
[
if test "$GCC" = "yes"; then
dnl figure out gcc version!
AC_MSG_CHECKING([gcc version])
gccver=`$CC -dumpversion`
num1=`echo $gccver | cut -d . -f1`
num2=`echo $gccver | cut -d . -f2`
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
AC_MSG_RESULT($gccver)
AC_MSG_CHECKING([if this is icc in disguise])
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
dnl action if the text is found, this it has not been replaced by the
dnl cpp
ICC="no"
AC_MSG_RESULT([no]),
dnl the text was not found, it was replaced by the cpp
ICC="yes"
AC_MSG_RESULT([yes])
)
if test "$ICC" = "yes"; then
dnl this is icc, not gcc.
dnl ICC warnings we ignore:
dnl * 279 warns on static conditions in while expressions
dnl * 269 warns on our "%Od" printf formatters for curl_off_t output:
dnl "invalid format string conversion"
WARN="-wd279,269"
if test "$gccnum" -gt "600"; then
dnl icc 6.0 and older doesn't have the -Wall flag
WARN="-Wall $WARN"
fi
else dnl $ICC = yes
dnl
WARN="-W -Wall -Wwrite-strings -pedantic -Wno-long-long -Wundef -Wpointer-arith -Wnested-externs -Winline -Wmissing-declarations -Wmissing-prototypes -Wsign-compare"
dnl -Wcast-align is a bit too annoying ;-)
if test "$gccnum" -ge "296"; then
dnl gcc 2.96 or later
WARN="$WARN -Wfloat-equal"
if test "$gccnum" -gt "296"; then
dnl this option does not exist in 2.96
WARN="$WARN -Wno-format-nonliteral"
fi
dnl -Wunreachable-code seems totally unreliable on my gcc 3.3.2 on
dnl on i686-Linux as it gives us heaps with false positives
if test "$gccnum" -ge "303"; then
dnl gcc 3.3 and later
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
fi
fi
for flag in $CPPFLAGS; do
case "$flag" in
-I*)
dnl include path
add=`echo $flag | sed 's/^-I/-isystem /g'`
WARN="$WARN $add"
;;
esac
done
fi dnl $ICC = no
CFLAGS="$CFLAGS $WARN"
fi dnl $GCC = yes
dnl strip off optimizer flags
NEWFLAGS=""
for flag in $CFLAGS; do
case "$flag" in
-O*)
dnl echo "cut off $flag"
;;
*)
NEWFLAGS="$NEWFLAGS $flag"
;;
esac
done
CFLAGS=$NEWFLAGS
]) dnl end of AC_DEFUN()
dnl This macro determines if the specified struct exists in the specified file
dnl Syntax:
dnl CARES_CHECK_STRUCT(headers, struct name, if found, [if not found])
AC_DEFUN([CARES_CHECK_STRUCT], [
AC_MSG_CHECKING([for struct $2])
AC_TRY_COMPILE([$1],
[
struct $2 struct_instance;
], ac_struct="yes", ac_found="no")
if test "$ac_struct" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])
dnl This macro determins if the specified struct contains a specific member.
dnl Syntax:
dnl CARES_CHECK_STRUCT_MEMBER(headers, struct name, member name, if found, [if not found])
AC_DEFUN([CARES_CHECK_STRUCT_MEMBER], [
AC_MSG_CHECKING([if struct $2 has member $3])
AC_TRY_COMPILE([$1],
[
struct $2 struct_instance;
struct_instance.$3 = 0;
], ac_struct="yes", ac_found="no")
if test "$ac_struct" = "yes" ; then
AC_MSG_RESULT(yes)
$4
else
AC_MSG_RESULT(no)
$5
fi
])
dnl This macro determines if the specified constant exists in the specified file
dnl Syntax:
dnl CARES_CHECK_CONSTANT(headers, constant name, if found, [if not found])
AC_DEFUN([CARES_CHECK_CONSTANT], [
AC_MSG_CHECKING([for $2])
AC_EGREP_CPP(VARIABLEWASDEFINED,
[
$1
#ifdef $2
VARIABLEWASDEFINED
#else
NJET
#endif
], ac_constant="yes", ac_constant="no"
)
if test "$ac_constant" = "yes" ; then
AC_MSG_RESULT(yes)
$3
else
AC_MSG_RESULT(no)
$4
fi
])

View File

@@ -37,7 +37,7 @@
#include "ares_dns.h" #include "ares_dns.h"
#ifndef INADDR_NONE #ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff #define INADDR_NONE 0xffffffff
#endif #endif
/* Mac OS X portability check */ /* Mac OS X portability check */
@@ -54,58 +54,58 @@ struct nv {
}; };
static const struct nv flags[] = { static const struct nv flags[] = {
{ "usevc", ARES_FLAG_USEVC }, { "usevc", ARES_FLAG_USEVC },
{ "primary", ARES_FLAG_PRIMARY }, { "primary", ARES_FLAG_PRIMARY },
{ "igntc", ARES_FLAG_IGNTC }, { "igntc", ARES_FLAG_IGNTC },
{ "norecurse", ARES_FLAG_NORECURSE }, { "norecurse", ARES_FLAG_NORECURSE },
{ "stayopen", ARES_FLAG_STAYOPEN }, { "stayopen", ARES_FLAG_STAYOPEN },
{ "noaliases", ARES_FLAG_NOALIASES } { "noaliases", ARES_FLAG_NOALIASES }
}; };
static const int nflags = sizeof(flags) / sizeof(flags[0]); static const int nflags = sizeof(flags) / sizeof(flags[0]);
static const struct nv classes[] = { static const struct nv classes[] = {
{ "IN", C_IN }, { "IN", C_IN },
{ "CHAOS", C_CHAOS }, { "CHAOS", C_CHAOS },
{ "HS", C_HS }, { "HS", C_HS },
{ "ANY", C_ANY } { "ANY", C_ANY }
}; };
static const int nclasses = sizeof(classes) / sizeof(classes[0]); static const int nclasses = sizeof(classes) / sizeof(classes[0]);
static const struct nv types[] = { static const struct nv types[] = {
{ "A", T_A }, { "A", T_A },
{ "NS", T_NS }, { "NS", T_NS },
{ "MD", T_MD }, { "MD", T_MD },
{ "MF", T_MF }, { "MF", T_MF },
{ "CNAME", T_CNAME }, { "CNAME", T_CNAME },
{ "SOA", T_SOA }, { "SOA", T_SOA },
{ "MB", T_MB }, { "MB", T_MB },
{ "MG", T_MG }, { "MG", T_MG },
{ "MR", T_MR }, { "MR", T_MR },
{ "NULL", T_NULL }, { "NULL", T_NULL },
{ "WKS", T_WKS }, { "WKS", T_WKS },
{ "PTR", T_PTR }, { "PTR", T_PTR },
{ "HINFO", T_HINFO }, { "HINFO", T_HINFO },
{ "MINFO", T_MINFO }, { "MINFO", T_MINFO },
{ "MX", T_MX }, { "MX", T_MX },
{ "TXT", T_TXT }, { "TXT", T_TXT },
{ "RP", T_RP }, { "RP", T_RP },
{ "AFSDB", T_AFSDB }, { "AFSDB", T_AFSDB },
{ "X25", T_X25 }, { "X25", T_X25 },
{ "ISDN", T_ISDN }, { "ISDN", T_ISDN },
{ "RT", T_RT }, { "RT", T_RT },
{ "NSAP", T_NSAP }, { "NSAP", T_NSAP },
{ "NSAP_PTR", T_NSAP_PTR }, { "NSAP_PTR", T_NSAP_PTR },
{ "SIG", T_SIG }, { "SIG", T_SIG },
{ "KEY", T_KEY }, { "KEY", T_KEY },
{ "PX", T_PX }, { "PX", T_PX },
{ "GPOS", T_GPOS }, { "GPOS", T_GPOS },
{ "AAAA", T_AAAA }, { "AAAA", T_AAAA },
{ "LOC", T_LOC }, { "LOC", T_LOC },
{ "SRV", T_SRV }, { "SRV", T_SRV },
{ "AXFR", T_AXFR }, { "AXFR", T_AXFR },
{ "MAILB", T_MAILB }, { "MAILB", T_MAILB },
{ "MAILA", T_MAILA }, { "MAILA", T_MAILA },
{ "ANY", T_ANY } { "ANY", T_ANY }
}; };
static const int ntypes = sizeof(types) / sizeof(types[0]); static const int ntypes = sizeof(types) / sizeof(types[0]);
@@ -124,10 +124,10 @@ static const char *rcodes[] = {
static void callback(void *arg, int status, unsigned char *abuf, int alen); static void callback(void *arg, int status, unsigned char *abuf, int alen);
static const unsigned char *display_question(const unsigned char *aptr, static const unsigned char *display_question(const unsigned char *aptr,
const unsigned char *abuf, const unsigned char *abuf,
int alen); int alen);
static const unsigned char *display_rr(const unsigned char *aptr, static const unsigned char *display_rr(const unsigned char *aptr,
const unsigned char *abuf, int alen); const unsigned char *abuf, int alen);
static const char *type_name(int type); static const char *type_name(int type);
static const char *class_name(int dnsclass); static const char *class_name(int dnsclass);
static void usage(void); static void usage(void);
@@ -146,7 +146,7 @@ int main(int argc, char **argv)
WORD wVersionRequested = MAKEWORD(1,1); WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData; WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData); WSAStartup(wVersionRequested, &wsaData);
#endif #endif
options.flags = ARES_FLAG_NOCHECKRESP; options.flags = ARES_FLAG_NOCHECKRESP;
options.servers = NULL; options.servers = NULL;
@@ -154,80 +154,80 @@ int main(int argc, char **argv)
while ((c = getopt(argc, argv, "f:s:c:t:T:U:")) != -1) while ((c = getopt(argc, argv, "f:s:c:t:T:U:")) != -1)
{ {
switch (c) switch (c)
{ {
case 'f': case 'f':
/* Add a flag. */ /* Add a flag. */
for (i = 0; i < nflags; i++) for (i = 0; i < nflags; i++)
{ {
if (strcmp(flags[i].name, optarg) == 0) if (strcmp(flags[i].name, optarg) == 0)
break; break;
} }
if (i == nflags) if (i == nflags)
usage(); usage();
options.flags |= flags[i].value; options.flags |= flags[i].value;
break; break;
case 's': case 's':
/* Add a server, and specify servers in the option mask. */ /* Add a server, and specify servers in the option mask. */
hostent = gethostbyname(optarg); hostent = gethostbyname(optarg);
if (!hostent || hostent->h_addrtype != AF_INET) if (!hostent || hostent->h_addrtype != AF_INET)
{ {
fprintf(stderr, "adig: server %s not found.\n", optarg); fprintf(stderr, "adig: server %s not found.\n", optarg);
return 1; return 1;
} }
options.servers = realloc(options.servers, (options.nservers + 1) options.servers = realloc(options.servers, (options.nservers + 1)
* sizeof(struct in_addr)); * sizeof(struct in_addr));
if (!options.servers) if (!options.servers)
{ {
fprintf(stderr, "Out of memory!\n"); fprintf(stderr, "Out of memory!\n");
return 1; return 1;
} }
memcpy(&options.servers[options.nservers], hostent->h_addr, memcpy(&options.servers[options.nservers], hostent->h_addr,
sizeof(struct in_addr)); sizeof(struct in_addr));
options.nservers++; options.nservers++;
optmask |= ARES_OPT_SERVERS; optmask |= ARES_OPT_SERVERS;
break; break;
case 'c': case 'c':
/* Set the query class. */ /* Set the query class. */
for (i = 0; i < nclasses; i++) for (i = 0; i < nclasses; i++)
{ {
if (strcasecmp(classes[i].name, optarg) == 0) if (strcasecmp(classes[i].name, optarg) == 0)
break; break;
} }
if (i == nclasses) if (i == nclasses)
usage(); usage();
dnsclass = classes[i].value; dnsclass = classes[i].value;
break; break;
case 't': case 't':
/* Set the query type. */ /* Set the query type. */
for (i = 0; i < ntypes; i++) for (i = 0; i < ntypes; i++)
{ {
if (strcasecmp(types[i].name, optarg) == 0) if (strcasecmp(types[i].name, optarg) == 0)
break; break;
} }
if (i == ntypes) if (i == ntypes)
usage(); usage();
type = types[i].value; type = types[i].value;
break; break;
case 'T': case 'T':
/* Set the TCP port number. */ /* Set the TCP port number. */
if (!isdigit((unsigned char)*optarg)) if (!isdigit((unsigned char)*optarg))
usage(); usage();
options.tcp_port = strtol(optarg, NULL, 0); options.tcp_port = strtol(optarg, NULL, 0);
optmask |= ARES_OPT_TCP_PORT; optmask |= ARES_OPT_TCP_PORT;
break; break;
case 'U': case 'U':
/* Set the UDP port number. */ /* Set the UDP port number. */
if (!isdigit((unsigned char)*optarg)) if (!isdigit((unsigned char)*optarg))
usage(); usage();
options.udp_port = strtol(optarg, NULL, 0); options.udp_port = strtol(optarg, NULL, 0);
optmask |= ARES_OPT_UDP_PORT; optmask |= ARES_OPT_UDP_PORT;
break; break;
} }
} }
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@@ -239,7 +239,7 @@ int main(int argc, char **argv)
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
{ {
fprintf(stderr, "ares_init_options: %s\n", fprintf(stderr, "ares_init_options: %s\n",
ares_strerror(status)); ares_strerror(status));
return 1; return 1;
} }
@@ -253,7 +253,7 @@ int main(int argc, char **argv)
else else
{ {
for (; *argv; argv++) for (; *argv; argv++)
ares_query(channel, *argv, dnsclass, type, callback, *argv); ares_query(channel, *argv, dnsclass, type, callback, *argv);
} }
/* Wait for all queries to complete. */ /* Wait for all queries to complete. */
@@ -263,14 +263,14 @@ int main(int argc, char **argv)
FD_ZERO(&write_fds); FD_ZERO(&write_fds);
nfds = ares_fds(channel, &read_fds, &write_fds); nfds = ares_fds(channel, &read_fds, &write_fds);
if (nfds == 0) if (nfds == 0)
break; break;
tvp = ares_timeout(channel, NULL, &tv); tvp = ares_timeout(channel, NULL, &tv);
count = select(nfds, &read_fds, &write_fds, NULL, tvp); count = select(nfds, &read_fds, &write_fds, NULL, tvp);
if (count < 0 && errno != EINVAL) if (count < 0 && errno != EINVAL)
{ {
perror("select"); perror("select");
return 1; return 1;
} }
ares_process(channel, &read_fds, &write_fds); ares_process(channel, &read_fds, &write_fds);
} }
@@ -296,7 +296,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{ {
printf("%s\n", ares_strerror(status)); printf("%s\n", ares_strerror(status));
if (!abuf) if (!abuf)
return; return;
} }
/* Won't happen, but check anyway, for safety. */ /* Won't happen, but check anyway, for safety. */
@@ -320,11 +320,11 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
/* Display the answer header. */ /* Display the answer header. */
printf("id: %d\n", id); printf("id: %d\n", id);
printf("flags: %s%s%s%s%s\n", printf("flags: %s%s%s%s%s\n",
qr ? "qr " : "", qr ? "qr " : "",
aa ? "aa " : "", aa ? "aa " : "",
tc ? "tc " : "", tc ? "tc " : "",
rd ? "rd " : "", rd ? "rd " : "",
ra ? "ra " : ""); ra ? "ra " : "");
printf("opcode: %s\n", opcodes[opcode]); printf("opcode: %s\n", opcodes[opcode]);
printf("rcode: %s\n", rcodes[rcode]); printf("rcode: %s\n", rcodes[rcode]);
@@ -335,7 +335,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{ {
aptr = display_question(aptr, abuf, alen); aptr = display_question(aptr, abuf, alen);
if (aptr == NULL) if (aptr == NULL)
return; return;
} }
/* Display the answers. */ /* Display the answers. */
@@ -344,7 +344,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{ {
aptr = display_rr(aptr, abuf, alen); aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL) if (aptr == NULL)
return; return;
} }
/* Display the NS records. */ /* Display the NS records. */
@@ -353,7 +353,7 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{ {
aptr = display_rr(aptr, abuf, alen); aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL) if (aptr == NULL)
return; return;
} }
/* Display the additional records. */ /* Display the additional records. */
@@ -362,13 +362,13 @@ static void callback(void *arg, int status, unsigned char *abuf, int alen)
{ {
aptr = display_rr(aptr, abuf, alen); aptr = display_rr(aptr, abuf, alen);
if (aptr == NULL) if (aptr == NULL)
return; return;
} }
} }
static const unsigned char *display_question(const unsigned char *aptr, static const unsigned char *display_question(const unsigned char *aptr,
const unsigned char *abuf, const unsigned char *abuf,
int alen) int alen)
{ {
char *name; char *name;
int type, dnsclass, status; int type, dnsclass, status;
@@ -406,7 +406,7 @@ static const unsigned char *display_question(const unsigned char *aptr,
} }
static const unsigned char *display_rr(const unsigned char *aptr, static const unsigned char *display_rr(const unsigned char *aptr,
const unsigned char *abuf, int alen) const unsigned char *abuf, int alen)
{ {
const unsigned char *p; const unsigned char *p;
char *name; char *name;
@@ -463,7 +463,7 @@ static const unsigned char *display_rr(const unsigned char *aptr,
/* For these types, the RR data is just a domain name. */ /* For these types, the RR data is just a domain name. */
status = ares_expand_name(aptr, abuf, alen, &name, &len); status = ares_expand_name(aptr, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); free(name);
break; break;
@@ -473,12 +473,12 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr; p = aptr;
len = *p; len = *p;
if (p + len + 1 > aptr + dlen) if (p + len + 1 > aptr + dlen)
return NULL; return NULL;
printf("\t%.*s", len, p + 1); printf("\t%.*s", len, p + 1);
p += len + 1; p += len + 1;
len = *p; len = *p;
if (p + len + 1 > aptr + dlen) if (p + len + 1 > aptr + dlen)
return NULL; return NULL;
printf("\t%.*s", len, p + 1); printf("\t%.*s", len, p + 1);
break; break;
@@ -487,13 +487,13 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr; p = aptr;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); free(name);
p += len; p += len;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); free(name);
break; break;
@@ -503,11 +503,11 @@ static const unsigned char *display_rr(const unsigned char *aptr,
* then a domain name. * then a domain name.
*/ */
if (dlen < 2) if (dlen < 2)
return NULL; return NULL;
printf("\t%d", (aptr[0] << 8) | aptr[1]); printf("\t%d", (aptr[0] << 8) | aptr[1]);
status = ares_expand_name(aptr + 2, abuf, alen, &name, &len); status = ares_expand_name(aptr + 2, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); free(name);
break; break;
@@ -519,24 +519,24 @@ static const unsigned char *display_rr(const unsigned char *aptr,
p = aptr; p = aptr;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.\n", name); printf("\t%s.\n", name);
free(name); free(name);
p += len; p += len;
status = ares_expand_name(p, abuf, alen, &name, &len); status = ares_expand_name(p, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t\t\t\t\t\t%s.\n", name); printf("\t\t\t\t\t\t%s.\n", name);
free(name); free(name);
p += len; p += len;
if (p + 20 > aptr + dlen) if (p + 20 > aptr + dlen)
return NULL; return NULL;
printf("\t\t\t\t\t\t( %d %d %d %d %d )", printf("\t\t\t\t\t\t( %d %d %d %d %d )",
(p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3], (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3],
(p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7], (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7],
(p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11], (p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11],
(p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15], (p[12] << 24) | (p[13] << 16) | (p[14] << 8) | p[15],
(p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]); (p[16] << 24) | (p[17] << 16) | (p[18] << 8) | p[19]);
break; break;
case T_TXT: case T_TXT:
@@ -544,19 +544,19 @@ static const unsigned char *display_rr(const unsigned char *aptr,
* strings. */ * strings. */
p = aptr; p = aptr;
while (p < aptr + dlen) while (p < aptr + dlen)
{ {
len = *p; len = *p;
if (p + len + 1 > aptr + dlen) if (p + len + 1 > aptr + dlen)
return NULL; return NULL;
printf("\t%.*s", len, p + 1); printf("\t%.*s", len, p + 1);
p += len + 1; p += len + 1;
} }
break; break;
case T_A: case T_A:
/* The RR data is a four-byte Internet address. */ /* The RR data is a four-byte Internet address. */
if (dlen != 4) if (dlen != 4)
return NULL; return NULL;
memcpy(&addr, aptr, sizeof(struct in_addr)); memcpy(&addr, aptr, sizeof(struct in_addr));
printf("\t%s", inet_ntoa(addr)); printf("\t%s", inet_ntoa(addr));
break; break;
@@ -569,18 +569,18 @@ static const unsigned char *display_rr(const unsigned char *aptr,
/* The RR data is three two-byte numbers representing the /* The RR data is three two-byte numbers representing the
* priority, weight, and port, followed by a domain name. * priority, weight, and port, followed by a domain name.
*/ */
printf("\t%d", DNS__16BIT(aptr)); printf("\t%d", DNS__16BIT(aptr));
printf(" %d", DNS__16BIT(aptr + 2)); printf(" %d", DNS__16BIT(aptr + 2));
printf(" %d", DNS__16BIT(aptr + 4)); printf(" %d", DNS__16BIT(aptr + 4));
status = ares_expand_name(aptr + 6, abuf, alen, &name, &len); status = ares_expand_name(aptr + 6, abuf, alen, &name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return NULL; return NULL;
printf("\t%s.", name); printf("\t%s.", name);
free(name); free(name);
break; break;
default: default:
printf("\t[Unknown RR; cannot parse]"); printf("\t[Unknown RR; cannot parse]");
} }
@@ -596,7 +596,7 @@ static const char *type_name(int type)
for (i = 0; i < ntypes; i++) for (i = 0; i < ntypes; i++)
{ {
if (types[i].value == type) if (types[i].value == type)
return types[i].name; return types[i].name;
} }
return "(unknown)"; return "(unknown)";
} }
@@ -608,7 +608,7 @@ static const char *class_name(int dnsclass)
for (i = 0; i < nclasses; i++) for (i = 0; i < nclasses; i++)
{ {
if (classes[i].value == dnsclass) if (classes[i].value == dnsclass)
return classes[i].name; return classes[i].name;
} }
return "(unknown)"; return "(unknown)";
} }
@@ -616,6 +616,6 @@ static const char *class_name(int dnsclass)
static void usage(void) static void usage(void)
{ {
fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] " fprintf(stderr, "usage: adig [-f flag] [-s server] [-c class] "
"[-t type] [-p port] name ...\n"); "[-t type] [-p port] name ...\n");
exit(1); exit(1);
} }

View File

@@ -33,7 +33,7 @@
#include "ares_dns.h" #include "ares_dns.h"
#ifndef INADDR_NONE #ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff #define INADDR_NONE 0xffffffff
#endif #endif
static void callback(void *arg, int status, struct hostent *host); static void callback(void *arg, int status, struct hostent *host);
@@ -51,7 +51,7 @@ int main(int argc, char **argv)
WORD wVersionRequested = MAKEWORD(1,1); WORD wVersionRequested = MAKEWORD(1,1);
WSADATA wsaData; WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData); WSAStartup(wVersionRequested, &wsaData);
#endif #endif
if (argc <= 1) if (argc <= 1)
usage(); usage();
@@ -68,12 +68,12 @@ int main(int argc, char **argv)
{ {
addr.s_addr = inet_addr(*argv); addr.s_addr = inet_addr(*argv);
if (addr.s_addr == INADDR_NONE) if (addr.s_addr == INADDR_NONE)
ares_gethostbyname(channel, *argv, AF_INET, callback, *argv); ares_gethostbyname(channel, *argv, AF_INET, callback, *argv);
else else
{ {
ares_gethostbyaddr(channel, &addr, sizeof(addr), AF_INET, callback, ares_gethostbyaddr(channel, &addr, sizeof(addr), AF_INET, callback,
*argv); *argv);
} }
} }
/* Wait for all queries to complete. */ /* Wait for all queries to complete. */
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
FD_ZERO(&write_fds); FD_ZERO(&write_fds);
nfds = ares_fds(channel, &read_fds, &write_fds); nfds = ares_fds(channel, &read_fds, &write_fds);
if (nfds == 0) if (nfds == 0)
break; break;
tvp = ares_timeout(channel, NULL, &tv); tvp = ares_timeout(channel, NULL, &tv);
select(nfds, &read_fds, &write_fds, NULL, tvp); select(nfds, &read_fds, &write_fds, NULL, tvp);
ares_process(channel, &read_fds, &write_fds); ares_process(channel, &read_fds, &write_fds);

View File

@@ -27,56 +27,86 @@
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#ifdef WIN32 #if defined(WATT32)
#include <winsock.h> #include <netinet/in.h>
#include <windows.h> #include <sys/socket.h>
#include <tcp.h>
#elif defined(WIN32)
#include <winsock.h>
#include <windows.h>
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/socket.h>
#endif #endif
#define ARES_SUCCESS 0 #ifdef __cplusplus
extern "C" {
#endif
#define ARES_SUCCESS 0
/* Server error codes (ARES_ENODATA indicates no relevant answer) */ /* Server error codes (ARES_ENODATA indicates no relevant answer) */
#define ARES_ENODATA 1 #define ARES_ENODATA 1
#define ARES_EFORMERR 2 #define ARES_EFORMERR 2
#define ARES_ESERVFAIL 3 #define ARES_ESERVFAIL 3
#define ARES_ENOTFOUND 4 #define ARES_ENOTFOUND 4
#define ARES_ENOTIMP 5 #define ARES_ENOTIMP 5
#define ARES_EREFUSED 6 #define ARES_EREFUSED 6
/* Locally generated error codes */ /* Locally generated error codes */
#define ARES_EBADQUERY 7 #define ARES_EBADQUERY 7
#define ARES_EBADNAME 8 #define ARES_EBADNAME 8
#define ARES_EBADFAMILY 9 #define ARES_EBADFAMILY 9
#define ARES_EBADRESP 10 #define ARES_EBADRESP 10
#define ARES_ECONNREFUSED 11 #define ARES_ECONNREFUSED 11
#define ARES_ETIMEOUT 12 #define ARES_ETIMEOUT 12
#define ARES_EOF 13 #define ARES_EOF 13
#define ARES_EFILE 14 #define ARES_EFILE 14
#define ARES_ENOMEM 15 #define ARES_ENOMEM 15
#define ARES_EDESTRUCTION 16 #define ARES_EDESTRUCTION 16
#define ARES_EBADSTR 17 #define ARES_EBADSTR 17
/* ares_getnameinfo error codes */
#define ARES_EBADFLAGS 18
/* Flag values */ /* Flag values */
#define ARES_FLAG_USEVC (1 << 0) #define ARES_FLAG_USEVC (1 << 0)
#define ARES_FLAG_PRIMARY (1 << 1) #define ARES_FLAG_PRIMARY (1 << 1)
#define ARES_FLAG_IGNTC (1 << 2) #define ARES_FLAG_IGNTC (1 << 2)
#define ARES_FLAG_NORECURSE (1 << 3) #define ARES_FLAG_NORECURSE (1 << 3)
#define ARES_FLAG_STAYOPEN (1 << 4) #define ARES_FLAG_STAYOPEN (1 << 4)
#define ARES_FLAG_NOSEARCH (1 << 5) #define ARES_FLAG_NOSEARCH (1 << 5)
#define ARES_FLAG_NOALIASES (1 << 6) #define ARES_FLAG_NOALIASES (1 << 6)
#define ARES_FLAG_NOCHECKRESP (1 << 7) #define ARES_FLAG_NOCHECKRESP (1 << 7)
/* Option mask values */ /* Option mask values */
#define ARES_OPT_FLAGS (1 << 0) #define ARES_OPT_FLAGS (1 << 0)
#define ARES_OPT_TIMEOUT (1 << 1) #define ARES_OPT_TIMEOUT (1 << 1)
#define ARES_OPT_TRIES (1 << 2) #define ARES_OPT_TRIES (1 << 2)
#define ARES_OPT_NDOTS (1 << 3) #define ARES_OPT_NDOTS (1 << 3)
#define ARES_OPT_UDP_PORT (1 << 4) #define ARES_OPT_UDP_PORT (1 << 4)
#define ARES_OPT_TCP_PORT (1 << 5) #define ARES_OPT_TCP_PORT (1 << 5)
#define ARES_OPT_SERVERS (1 << 6) #define ARES_OPT_SERVERS (1 << 6)
#define ARES_OPT_DOMAINS (1 << 7) #define ARES_OPT_DOMAINS (1 << 7)
#define ARES_OPT_LOOKUPS (1 << 8) #define ARES_OPT_LOOKUPS (1 << 8)
/* Nameinfo flag values */
#define ARES_NI_NOFQDN (1 << 0)
#define ARES_NI_NUMERICHOST (1 << 1)
#define ARES_NI_NAMEREQD (1 << 2)
#define ARES_NI_NUMERICSERV (1 << 3)
#define ARES_NI_DGRAM (1 << 4)
#define ARES_NI_TCP 0
#define ARES_NI_UDP ARES_NI_DGRAM
#define ARES_NI_SCTP (1 << 5)
#define ARES_NI_DCCP (1 << 6)
#define ARES_NI_NUMERICSCOPE (1 << 7)
#define ARES_NI_LOOKUPHOST (1 << 8)
#define ARES_NI_LOOKUPSERVICE (1 << 9)
/* Reserved for future use */
#define ARES_NI_IDN (1 << 10)
#define ARES_NI_ALLOW_UNASSIGNED (1 << 11)
#define ARES_NI_USE_STD3_ASCII_RULES (1 << 12)
struct ares_options { struct ares_options {
int flags; int flags;
@@ -94,47 +124,57 @@ struct ares_options {
struct hostent; struct hostent;
struct timeval; struct timeval;
struct sockaddr;
struct ares_channeldata; struct ares_channeldata;
typedef struct ares_channeldata *ares_channel; typedef struct ares_channeldata *ares_channel;
typedef void (*ares_callback)(void *arg, int status, unsigned char *abuf, typedef void (*ares_callback)(void *arg, int status, unsigned char *abuf,
int alen); int alen);
typedef void (*ares_host_callback)(void *arg, int status, typedef void (*ares_host_callback)(void *arg, int status,
struct hostent *hostent); struct hostent *hostent);
typedef void (*ares_nameinfo_callback)(void *arg, int status,
char *node, char *service);
int ares_init(ares_channel *channelptr); int ares_init(ares_channel *channelptr);
int ares_init_options(ares_channel *channelptr, struct ares_options *options, int ares_init_options(ares_channel *channelptr, struct ares_options *options,
int optmask); int optmask);
void ares_destroy(ares_channel channel); void ares_destroy(ares_channel channel);
void ares_cancel(ares_channel channel); void ares_cancel(ares_channel channel);
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
ares_callback callback, void *arg); ares_callback callback, void *arg);
void ares_query(ares_channel channel, const char *name, int dnsclass, void ares_query(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg); int type, ares_callback callback, void *arg);
void ares_search(ares_channel channel, const char *name, int dnsclass, void ares_search(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg); int type, ares_callback callback, void *arg);
void ares_gethostbyname(ares_channel channel, const char *name, int family, void ares_gethostbyname(ares_channel channel, const char *name, int family,
ares_host_callback callback, void *arg); ares_host_callback callback, void *arg);
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
int family, ares_host_callback callback, void *arg); int family, ares_host_callback callback, void *arg);
void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
socklen_t salen, int flags, ares_nameinfo_callback callback,
void *arg);
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds); int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
struct timeval *tv); struct timeval *tv);
void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds); void ares_process(ares_channel channel, fd_set *read_fds, fd_set *write_fds);
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen); int rd, unsigned char **buf, int *buflen);
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
int alen, char **s, long *enclen); int alen, char **s, long *enclen);
int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf, int ares_expand_string(const unsigned char *encoded, const unsigned char *abuf,
int alen, unsigned char **s, long *enclen); int alen, unsigned char **s, long *enclen);
int ares_parse_a_reply(const unsigned char *abuf, int alen, int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host); struct hostent **host);
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct hostent **host);
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int addrlen, int family, struct hostent **host); int addrlen, int family, struct hostent **host);
void ares_free_string(void *str); void ares_free_string(void *str);
void ares_free_hostent(struct hostent *host); void ares_free_hostent(struct hostent *host);
const char *ares_strerror(int code); const char *ares_strerror(int code);
void ares_free_errmem(char *mem);
#ifdef __cplusplus
}
#endif
#endif /* ARES__H */ #endif /* ARES__H */

View File

@@ -16,10 +16,10 @@
#include "setup.h" #include "setup.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef WIN32 #ifdef HAVE_UNISTD_H
#else
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"

View File

@@ -16,9 +16,7 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if !defined(WIN32) || defined(WATT32)
#else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@@ -32,113 +30,130 @@
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
#include "inet_net_pton.h"
int ares__get_hostent(FILE *fp, struct hostent **host) int ares__get_hostent(FILE *fp, int family, struct hostent **host)
{ {
char *line = NULL, *p, *q, *canonical, **alias; char *line = NULL, *p, *q, *canonical, **alias;
int status, linesize, end_at_hostname, naliases; int status, linesize, end_at_hostname, naliases;
struct in_addr addr; struct in_addr addr;
struct in6_addr addr6;
int addrlen = sizeof(struct in_addr);
struct hostent *hostent = NULL; struct hostent *hostent = NULL;
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS) while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{ {
/* Skip comment lines; terminate line at comment character. */ /* Skip comment lines; terminate line at comment character. */
if (*line == '#' || !*line) if (*line == '#' || !*line)
continue; continue;
p = strchr(line, '#'); p = strchr(line, '#');
if (p) if (p)
*p = 0; *p = 0;
/* Get the address part. */ /* Get the address part. */
p = line; p = line;
while (*p && !isspace((unsigned char)*p)) while (*p && !isspace((unsigned char)*p))
p++; p++;
if (!*p) if (!*p)
continue; continue;
*p = 0; *p = 0;
addr.s_addr = inet_addr(line); addr.s_addr = inet_addr(line);
if (addr.s_addr == INADDR_NONE) if (addr.s_addr == INADDR_NONE)
continue; {
if (ares_inet_pton(AF_INET6, line, &addr6) > 0)
{
if (family != AF_INET6)
continue;
addrlen = sizeof(struct in6_addr);
}
else
continue;
}
else if (family != AF_INET)
continue;
/* Get the canonical hostname. */ /* Get the canonical hostname. */
p++; p++;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
if (!*p) if (!*p)
continue; continue;
q = p; q = p;
while (*q && !isspace((unsigned char)*q)) while (*q && !isspace((unsigned char)*q))
q++; q++;
end_at_hostname = (*q == 0); end_at_hostname = (*q == 0);
*q = 0; *q = 0;
canonical = p; canonical = p;
naliases = 0; naliases = 0;
if (!end_at_hostname) if (!end_at_hostname)
{ {
/* Count the aliases. */ /* Count the aliases. */
p = q + 1; p = q + 1;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
while (*p) while (*p)
{ {
while (*p && !isspace((unsigned char)*p)) while (*p && !isspace((unsigned char)*p))
p++; p++;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
naliases++; naliases++;
} }
} }
/* Allocate memory for the host structure. */ /* Allocate memory for the host structure. */
hostent = malloc(sizeof(struct hostent)); hostent = malloc(sizeof(struct hostent));
if (!hostent) if (!hostent)
break; break;
hostent->h_aliases = NULL; hostent->h_aliases = NULL;
hostent->h_addr_list = NULL; hostent->h_addr_list = NULL;
hostent->h_name = strdup(canonical); hostent->h_name = strdup(canonical);
if (!hostent->h_name) if (!hostent->h_name)
break; break;
hostent->h_addr_list = malloc(2 * sizeof(char *)); hostent->h_addr_list = malloc(2 * sizeof(char *));
if (!hostent->h_addr_list) if (!hostent->h_addr_list)
break; break;
hostent->h_addr_list[0] = malloc(sizeof(struct in_addr)); hostent->h_addr_list[0] = malloc(addrlen);
if (!hostent->h_addr_list[0]) if (!hostent->h_addr_list[0])
break; break;
hostent->h_aliases = malloc((naliases + 1) * sizeof(char *)); hostent->h_aliases = malloc((naliases + 1) * sizeof(char *));
if (!hostent->h_aliases) if (!hostent->h_aliases)
break; break;
/* Copy in aliases. */ /* Copy in aliases. */
naliases = 0; naliases = 0;
if (!end_at_hostname) if (!end_at_hostname)
{ {
p = canonical + strlen(canonical) + 1; p = canonical + strlen(canonical) + 1;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
while (*p) while (*p)
{ {
q = p; q = p;
while (*q && !isspace((unsigned char)*q)) while (*q && !isspace((unsigned char)*q))
q++; q++;
hostent->h_aliases[naliases] = malloc(q - p + 1); hostent->h_aliases[naliases] = malloc(q - p + 1);
if (hostent->h_aliases[naliases] == NULL) if (hostent->h_aliases[naliases] == NULL)
break; break;
memcpy(hostent->h_aliases[naliases], p, q - p); memcpy(hostent->h_aliases[naliases], p, q - p);
hostent->h_aliases[naliases][q - p] = 0; hostent->h_aliases[naliases][q - p] = 0;
p = q; p = q;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
naliases++; naliases++;
} }
if (*p) if (*p)
break; break;
} }
hostent->h_aliases[naliases] = NULL; hostent->h_aliases[naliases] = NULL;
hostent->h_addrtype = AF_INET; hostent->h_addrtype = family;
hostent->h_length = sizeof(struct in_addr); hostent->h_length = addrlen;
memcpy(hostent->h_addr_list[0], &addr, sizeof(struct in_addr)); if (family == AF_INET)
memcpy(hostent->h_addr_list[0], &addr, addrlen);
else if (family == AF_INET6)
memcpy(hostent->h_addr_list[0], &addr6, addrlen);
hostent->h_addr_list[1] = NULL; hostent->h_addr_list[1] = NULL;
*host = hostent; *host = hostent;
free(line); free(line);
@@ -151,22 +166,22 @@ int ares__get_hostent(FILE *fp, struct hostent **host)
{ {
/* Memory allocation failure; clean up. */ /* Memory allocation failure; clean up. */
if (hostent) if (hostent)
{ {
if(hostent->h_name) if(hostent->h_name)
free((char *) hostent->h_name); free((char *) hostent->h_name);
if (hostent->h_aliases) if (hostent->h_aliases)
{ {
for (alias = hostent->h_aliases; *alias; alias++) for (alias = hostent->h_aliases; *alias; alias++)
free(*alias); free(*alias);
} }
if(hostent->h_aliases) if(hostent->h_aliases)
free(hostent->h_aliases); free(hostent->h_aliases);
if (hostent->h_addr_list && hostent->h_addr_list[0]) if (hostent->h_addr_list && hostent->h_addr_list[0])
free(hostent->h_addr_list[0]); free(hostent->h_addr_list[0]);
if(hostent->h_addr_list) if(hostent->h_addr_list)
free(hostent->h_addr_list); free(hostent->h_addr_list);
free(hostent); free(hostent);
} }
return ARES_ENOMEM; return ARES_ENOMEM;
} }

View File

@@ -38,26 +38,26 @@ int ares__read_line(FILE *fp, char **buf, int *bufsize)
{ {
*buf = malloc(128); *buf = malloc(128);
if (!*buf) if (!*buf)
return ARES_ENOMEM; return ARES_ENOMEM;
*bufsize = 128; *bufsize = 128;
} }
while (1) while (1)
{ {
if (!fgets(*buf + offset, *bufsize - (int)offset, fp)) if (!fgets(*buf + offset, *bufsize - (int)offset, fp))
return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF; return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
len = offset + strlen(*buf + offset); len = offset + strlen(*buf + offset);
if ((*buf)[len - 1] == '\n') if ((*buf)[len - 1] == '\n')
{ {
(*buf)[len - 1] = 0; (*buf)[len - 1] = 0;
return ARES_SUCCESS; return ARES_SUCCESS;
} }
offset = len; offset = len;
/* Allocate more space. */ /* Allocate more space. */
newbuf = realloc(*buf, *bufsize * 2); newbuf = realloc(*buf, *bufsize * 2);
if (!newbuf) if (!newbuf)
return ARES_ENOMEM; return ARES_ENOMEM;
*buf = newbuf; *buf = newbuf;
*bufsize *= 2; *bufsize *= 2;
} }

View File

@@ -33,5 +33,7 @@ might have been stored in their arguments.
.SH SEE ALSO .SH SEE ALSO
.BR ares_init (3) .BR ares_init (3)
.BR ares_destroy (3) .BR ares_destroy (3)
.SH NOTES
This function is not compatible with ares.
.SH AUTHOR .SH AUTHOR
Dirk Manske Dirk Manske

View File

@@ -14,14 +14,14 @@
.\" this software for any purpose. It is provided "as is" .\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty. .\" without express or implied warranty.
.\" .\"
.TH ARES_DESTROY 3 "23 July 1998" .TH ARES_DESTROY 3 "7 December 2004"
.SH NAME .SH NAME
ares_destroy \- Destroy a resolver channel ares_destroy \- Destroy a resolver channel
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.B #include <ares.h> .B #include <ares.h>
.PP .PP
.B int ares_destroy(ares_channel \fIchannel\fP) .B void ares_destroy(ares_channel \fIchannel\fP)
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The

View File

@@ -18,64 +18,64 @@
#ifndef ARES__DNS_H #ifndef ARES__DNS_H
#define ARES__DNS_H #define ARES__DNS_H
#define DNS__16BIT(p) (((p)[0] << 8) | (p)[1]) #define DNS__16BIT(p) (((p)[0] << 8) | (p)[1])
#define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \ #define DNS__32BIT(p) (((p)[0] << 24) | ((p)[1] << 16) | \
((p)[2] << 8) | (p)[3]) ((p)[2] << 8) | (p)[3])
#define DNS__SET16BIT(p, v) (((p)[0] = ((v) >> 8) & 0xff), \ #define DNS__SET16BIT(p, v) (((p)[0] = ((v) >> 8) & 0xff), \
((p)[1] = (v) & 0xff)) ((p)[1] = (v) & 0xff))
#define DNS__SET32BIT(p, v) (((p)[0] = ((v) >> 24) & 0xff), \ #define DNS__SET32BIT(p, v) (((p)[0] = ((v) >> 24) & 0xff), \
((p)[1] = ((v) >> 16) & 0xff), \ ((p)[1] = ((v) >> 16) & 0xff), \
((p)[2] = ((v) >> 8) & 0xff), \ ((p)[2] = ((v) >> 8) & 0xff), \
((p)[3] = (v) & 0xff)) ((p)[3] = (v) & 0xff))
/* Macros for parsing a DNS header */ /* Macros for parsing a DNS header */
#define DNS_HEADER_QID(h) DNS__16BIT(h) #define DNS_HEADER_QID(h) DNS__16BIT(h)
#define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1) #define DNS_HEADER_QR(h) (((h)[2] >> 7) & 0x1)
#define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf) #define DNS_HEADER_OPCODE(h) (((h)[2] >> 3) & 0xf)
#define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1) #define DNS_HEADER_AA(h) (((h)[2] >> 2) & 0x1)
#define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1) #define DNS_HEADER_TC(h) (((h)[2] >> 1) & 0x1)
#define DNS_HEADER_RD(h) ((h)[2] & 0x1) #define DNS_HEADER_RD(h) ((h)[2] & 0x1)
#define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1) #define DNS_HEADER_RA(h) (((h)[3] >> 7) & 0x1)
#define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7) #define DNS_HEADER_Z(h) (((h)[3] >> 4) & 0x7)
#define DNS_HEADER_RCODE(h) ((h)[3] & 0xf) #define DNS_HEADER_RCODE(h) ((h)[3] & 0xf)
#define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4) #define DNS_HEADER_QDCOUNT(h) DNS__16BIT((h) + 4)
#define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6) #define DNS_HEADER_ANCOUNT(h) DNS__16BIT((h) + 6)
#define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8) #define DNS_HEADER_NSCOUNT(h) DNS__16BIT((h) + 8)
#define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10) #define DNS_HEADER_ARCOUNT(h) DNS__16BIT((h) + 10)
/* Macros for constructing a DNS header */ /* Macros for constructing a DNS header */
#define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v) #define DNS_HEADER_SET_QID(h, v) DNS__SET16BIT(h, v)
#define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (((v) & 0x1) << 7)) #define DNS_HEADER_SET_QR(h, v) ((h)[2] |= (((v) & 0x1) << 7))
#define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (((v) & 0xf) << 3)) #define DNS_HEADER_SET_OPCODE(h, v) ((h)[2] |= (((v) & 0xf) << 3))
#define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (((v) & 0x1) << 2)) #define DNS_HEADER_SET_AA(h, v) ((h)[2] |= (((v) & 0x1) << 2))
#define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (((v) & 0x1) << 1)) #define DNS_HEADER_SET_TC(h, v) ((h)[2] |= (((v) & 0x1) << 1))
#define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (((v) & 0x1))) #define DNS_HEADER_SET_RD(h, v) ((h)[2] |= (((v) & 0x1)))
#define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (((v) & 0x1) << 7)) #define DNS_HEADER_SET_RA(h, v) ((h)[3] |= (((v) & 0x1) << 7))
#define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (((v) & 0x7) << 4)) #define DNS_HEADER_SET_Z(h, v) ((h)[3] |= (((v) & 0x7) << 4))
#define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (((v) & 0xf))) #define DNS_HEADER_SET_RCODE(h, v) ((h)[3] |= (((v) & 0xf)))
#define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v) #define DNS_HEADER_SET_QDCOUNT(h, v) DNS__SET16BIT((h) + 4, v)
#define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v) #define DNS_HEADER_SET_ANCOUNT(h, v) DNS__SET16BIT((h) + 6, v)
#define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v) #define DNS_HEADER_SET_NSCOUNT(h, v) DNS__SET16BIT((h) + 8, v)
#define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v) #define DNS_HEADER_SET_ARCOUNT(h, v) DNS__SET16BIT((h) + 10, v)
/* Macros for parsing the fixed part of a DNS question */ /* Macros for parsing the fixed part of a DNS question */
#define DNS_QUESTION_TYPE(q) DNS__16BIT(q) #define DNS_QUESTION_TYPE(q) DNS__16BIT(q)
#define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2) #define DNS_QUESTION_CLASS(q) DNS__16BIT((q) + 2)
/* Macros for constructing the fixed part of a DNS question */ /* Macros for constructing the fixed part of a DNS question */
#define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v) #define DNS_QUESTION_SET_TYPE(q, v) DNS__SET16BIT(q, v)
#define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v) #define DNS_QUESTION_SET_CLASS(q, v) DNS__SET16BIT((q) + 2, v)
/* Macros for parsing the fixed part of a DNS resource record */ /* Macros for parsing the fixed part of a DNS resource record */
#define DNS_RR_TYPE(r) DNS__16BIT(r) #define DNS_RR_TYPE(r) DNS__16BIT(r)
#define DNS_RR_CLASS(r) DNS__16BIT((r) + 2) #define DNS_RR_CLASS(r) DNS__16BIT((r) + 2)
#define DNS_RR_TTL(r) DNS__32BIT((r) + 4) #define DNS_RR_TTL(r) DNS__32BIT((r) + 4)
#define DNS_RR_LEN(r) DNS__16BIT((r) + 8) #define DNS_RR_LEN(r) DNS__16BIT((r) + 8)
/* Macros for constructing the fixed part of a DNS resource record */ /* Macros for constructing the fixed part of a DNS resource record */
#define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v) #define DNS_RR_SET_TYPE(r) DNS__SET16BIT(r, v)
#define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v) #define DNS_RR_SET_CLASS(r) DNS__SET16BIT((r) + 2, v)
#define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v) #define DNS_RR_SET_TTL(r) DNS__SET32BIT((r) + 4, v)
#define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v) #define DNS_RR_SET_LEN(r) DNS__SET16BIT((r) + 8, v)
#endif /* ARES__DNS_H */ #endif /* ARES__DNS_H */

View File

@@ -16,11 +16,14 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -28,7 +31,7 @@
#include "ares_private.h" /* for the memdebug */ #include "ares_private.h" /* for the memdebug */
static int name_length(const unsigned char *encoded, const unsigned char *abuf, static int name_length(const unsigned char *encoded, const unsigned char *abuf,
int alen); int alen);
/* Expand an RFC1035-encoded domain name given by encoded. The /* Expand an RFC1035-encoded domain name given by encoded. The
* containing message is given by abuf and alen. The result given by * containing message is given by abuf and alen. The result given by
@@ -55,7 +58,7 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
*/ */
int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf, int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
int alen, char **s, long *enclen) int alen, char **s, long *enclen)
{ {
int len, indir = 0; int len, indir = 0;
char *q; char *q;
@@ -75,27 +78,27 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
while (*p) while (*p)
{ {
if ((*p & INDIR_MASK) == INDIR_MASK) if ((*p & INDIR_MASK) == INDIR_MASK)
{ {
if (!indir) if (!indir)
{ {
*enclen = p + 2 - encoded; *enclen = p + 2 - encoded;
indir = 1; indir = 1;
} }
p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1)); p = abuf + ((*p & ~INDIR_MASK) << 8 | *(p + 1));
} }
else else
{ {
len = *p; len = *p;
p++; p++;
while (len--) while (len--)
{ {
if (*p == '.' || *p == '\\') if (*p == '.' || *p == '\\')
*q++ = '\\'; *q++ = '\\';
*q++ = *p; *q++ = *p;
p++; p++;
} }
*q++ = '.'; *q++ = '.';
} }
} }
if (!indir) if (!indir)
*enclen = p + 1 - encoded; *enclen = p + 1 - encoded;
@@ -103,6 +106,8 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
/* Nuke the trailing period if we wrote one. */ /* Nuke the trailing period if we wrote one. */
if (q > *s) if (q > *s)
*(q - 1) = 0; *(q - 1) = 0;
else
*q = 0; /* zero terminate */
return ARES_SUCCESS; return ARES_SUCCESS;
} }
@@ -111,7 +116,7 @@ int ares_expand_name(const unsigned char *encoded, const unsigned char *abuf,
* -1 if the encoding is invalid. * -1 if the encoding is invalid.
*/ */
static int name_length(const unsigned char *encoded, const unsigned char *abuf, static int name_length(const unsigned char *encoded, const unsigned char *abuf,
int alen) int alen)
{ {
int n = 0, offset, indir = 0; int n = 0, offset, indir = 0;
@@ -122,34 +127,34 @@ static int name_length(const unsigned char *encoded, const unsigned char *abuf,
while (*encoded) while (*encoded)
{ {
if ((*encoded & INDIR_MASK) == INDIR_MASK) if ((*encoded & INDIR_MASK) == INDIR_MASK)
{ {
/* Check the offset and go there. */ /* Check the offset and go there. */
if (encoded + 1 >= abuf + alen) if (encoded + 1 >= abuf + alen)
return -1; return -1;
offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1); offset = (*encoded & ~INDIR_MASK) << 8 | *(encoded + 1);
if (offset >= alen) if (offset >= alen)
return -1; return -1;
encoded = abuf + offset; encoded = abuf + offset;
/* If we've seen more indirects than the message length, /* If we've seen more indirects than the message length,
* then there's a loop. * then there's a loop.
*/ */
if (++indir > alen) if (++indir > alen)
return -1; return -1;
} }
else else
{ {
offset = *encoded; offset = *encoded;
if (encoded + offset + 1 >= abuf + alen) if (encoded + offset + 1 >= abuf + alen)
return -1; return -1;
encoded++; encoded++;
while (offset--) while (offset--)
{ {
n += (*encoded == '.' || *encoded == '\\') ? 2 : 1; n += (*encoded == '.' || *encoded == '\\') ? 2 : 1;
encoded++; encoded++;
} }
n++; n++;
} }
} }
/* If there were any labels at all, then the number of dots is one /* If there were any labels at all, then the number of dots is one

View File

@@ -16,7 +16,7 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <netinet/in.h> #include <netinet/in.h>

View File

@@ -16,9 +16,7 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #ifdef HAVE_SYS_TIME_H
#else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
@@ -28,7 +26,8 @@
int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds) int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
{ {
struct server_state *server; struct server_state *server;
int i, nfds; ares_socket_t nfds;
int i;
/* No queries, no file descriptors. */ /* No queries, no file descriptors. */
if (!channel->queries) if (!channel->queries)
@@ -39,19 +38,19 @@ int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
{ {
server = &channel->servers[i]; server = &channel->servers[i];
if (server->udp_socket != ARES_SOCKET_BAD) if (server->udp_socket != ARES_SOCKET_BAD)
{ {
FD_SET(server->udp_socket, read_fds); FD_SET(server->udp_socket, read_fds);
if (server->udp_socket >= nfds) if (server->udp_socket >= nfds)
nfds = server->udp_socket + 1; nfds = server->udp_socket + 1;
} }
if (server->tcp_socket != ARES_SOCKET_BAD) if (server->tcp_socket != ARES_SOCKET_BAD)
{ {
FD_SET(server->tcp_socket, read_fds); FD_SET(server->tcp_socket, read_fds);
if (server->qhead) if (server->qhead)
FD_SET(server->tcp_socket, write_fds); FD_SET(server->tcp_socket, write_fds);
if (server->tcp_socket >= nfds) if (server->tcp_socket >= nfds)
nfds = server->tcp_socket + 1; nfds = server->tcp_socket + 1;
} }
} }
return nfds; return (int)nfds;
} }

View File

@@ -28,8 +28,8 @@ The
.I ares_free_hostent .I ares_free_hostent
function frees a function frees a
.B struct hostent .B struct hostent
allocated by one of the functions \fIares_parse_a_reply(3)\fP or allocated by one of the functions \fIares_parse_a_reply(3)\fP,
\fIares_parse_ptr_reply(3)\fP. \fIares_parse_aaaa_reply(3)\fP, or \fIares_parse_ptr_reply(3)\fP.
.SH NOTES .SH NOTES
It is not necessary (and is not correct) to free the host structure passed to It is not necessary (and is not correct) to free the host structure passed to
the callback functions for \fIares_gethostbyname(3)\fP or the callback functions for \fIares_gethostbyname(3)\fP or
@@ -37,6 +37,7 @@ the callback functions for \fIares_gethostbyname(3)\fP or
host structures when the callback returns. host structures when the callback returns.
.SH SEE ALSO .SH SEE ALSO
.BR ares_parse_a_reply (3), .BR ares_parse_a_reply (3),
.BR ares_parse_aaaa_reply (3),
.BR ares_parse_ptr_reply (3) .BR ares_parse_ptr_reply (3)
.SH AUTHOR .SH AUTHOR
Greg Hudson, MIT Information Systems Greg Hudson, MIT Information Systems

View File

@@ -16,9 +16,7 @@
#include "setup.h" #include "setup.h"
#include <stdlib.h> #include <stdlib.h>
#ifdef WIN32 #if !defined(WIN32) || defined(WATT32)
#else
#include <netdb.h> #include <netdb.h>
#endif #endif

View File

@@ -12,29 +12,38 @@
* this software for any purpose. It is provided "as is" * this software for any purpose. It is provided "as is"
* without express or implied warranty. * without express or implied warranty.
*/ */
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
#include "inet_net_pton.h"
#ifdef WATT32
#undef WIN32
#endif
struct addr_query { struct addr_query {
/* Arguments passed to ares_gethostbyaddr() */ /* Arguments passed to ares_gethostbyaddr() */
ares_channel channel; ares_channel channel;
struct in_addr addr; union ares_addr addr;
int family;
ares_host_callback callback; ares_host_callback callback;
void *arg; void *arg;
@@ -43,17 +52,24 @@ struct addr_query {
static void next_lookup(struct addr_query *aquery); static void next_lookup(struct addr_query *aquery);
static void addr_callback(void *arg, int status, unsigned char *abuf, static void addr_callback(void *arg, int status, unsigned char *abuf,
int alen); int alen);
static void end_aquery(struct addr_query *aquery, int status, static void end_aquery(struct addr_query *aquery, int status,
struct hostent *host); struct hostent *host);
static int file_lookup(struct in_addr *addr, struct hostent **host); static int file_lookup(union ares_addr *addr, int family, struct hostent **host);
void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen, void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
int family, ares_host_callback callback, void *arg) int family, ares_host_callback callback, void *arg)
{ {
struct addr_query *aquery; struct addr_query *aquery;
if (family != AF_INET || addrlen != sizeof(struct in_addr)) if (family != AF_INET && family != AF_INET6)
{
callback(arg, ARES_ENOTIMP, NULL);
return;
}
if ((family == AF_INET && addrlen != sizeof(struct in_addr)) ||
(family == AF_INET6 && addrlen != sizeof(struct in6_addr)))
{ {
callback(arg, ARES_ENOTIMP, NULL); callback(arg, ARES_ENOTIMP, NULL);
return; return;
@@ -66,7 +82,11 @@ void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
return; return;
} }
aquery->channel = channel; aquery->channel = channel;
memcpy(&aquery->addr, addr, sizeof(aquery->addr)); if (family == AF_INET)
memcpy(&aquery->addr.addr4, addr, sizeof(struct in_addr));
else
memcpy(&aquery->addr.addr6, addr, sizeof(struct in6_addr));
aquery->family = family;
aquery->callback = callback; aquery->callback = callback;
aquery->arg = arg; aquery->arg = arg;
aquery->remaining_lookups = channel->lookups; aquery->remaining_lookups = channel->lookups;
@@ -77,7 +97,7 @@ void ares_gethostbyaddr(ares_channel channel, const void *addr, int addrlen,
static void next_lookup(struct addr_query *aquery) static void next_lookup(struct addr_query *aquery)
{ {
const char *p; const char *p;
char name[64]; char name[128];
int a1, a2, a3, a4, status; int a1, a2, a3, a4, status;
struct hostent *host; struct hostent *host;
unsigned long addr; unsigned long addr;
@@ -85,27 +105,47 @@ static void next_lookup(struct addr_query *aquery)
for (p = aquery->remaining_lookups; *p; p++) for (p = aquery->remaining_lookups; *p; p++)
{ {
switch (*p) switch (*p)
{ {
case 'b': case 'b':
addr = ntohl(aquery->addr.s_addr); if (aquery->family == AF_INET)
a1 = (int)((addr >> 24) & 0xff); {
a2 = (int)((addr >> 16) & 0xff); addr = ntohl(aquery->addr.addr4.s_addr);
a3 = (int)((addr >> 8) & 0xff); a1 = (int)((addr >> 24) & 0xff);
a4 = (int)(addr & 0xff); a2 = (int)((addr >> 16) & 0xff);
sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1); a3 = (int)((addr >> 8) & 0xff);
aquery->remaining_lookups = p + 1; a4 = (int)(addr & 0xff);
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback, sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1);
aquery); aquery->remaining_lookups = p + 1;
return; ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
case 'f': aquery);
status = file_lookup(&aquery->addr, &host); }
if (status != ARES_ENOTFOUND) else
{ {
end_aquery(aquery, status, host); unsigned char *bytes;
return; bytes = (unsigned char *)&aquery->addr.addr6.s6_addr;
} sprintf(name, "%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.%x.ip6.arpa",
break; bytes[15]&0xf, bytes[15] >> 4, bytes[14]&0xf, bytes[14] >> 4,
} bytes[13]&0xf, bytes[13] >> 4, bytes[12]&0xf, bytes[12] >> 4,
bytes[11]&0xf, bytes[11] >> 4, bytes[10]&0xf, bytes[10] >> 4,
bytes[9]&0xf, bytes[9] >> 4, bytes[8]&0xf, bytes[8] >> 4,
bytes[7]&0xf, bytes[7] >> 4, bytes[6]&0xf, bytes[6] >> 4,
bytes[5]&0xf, bytes[5] >> 4, bytes[4]&0xf, bytes[4] >> 4,
bytes[3]&0xf, bytes[3] >> 4, bytes[2]&0xf, bytes[2] >> 4,
bytes[1]&0xf, bytes[1] >> 4, bytes[0]&0xf, bytes[0] >> 4);
aquery->remaining_lookups = p + 1;
ares_query(aquery->channel, name, C_IN, T_PTR, addr_callback,
aquery);
}
return;
case 'f':
status = file_lookup(&aquery->addr, aquery->family, &host);
if (status != ARES_ENOTFOUND)
{
end_aquery(aquery, status, host);
return;
}
break;
}
} }
end_aquery(aquery, ARES_ENOTFOUND, NULL); end_aquery(aquery, ARES_ENOTFOUND, NULL);
} }
@@ -117,8 +157,12 @@ static void addr_callback(void *arg, int status, unsigned char *abuf, int alen)
if (status == ARES_SUCCESS) if (status == ARES_SUCCESS)
{ {
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr, if (aquery->family == AF_INET)
sizeof(struct in_addr), AF_INET, &host); status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addr4,
sizeof(struct in_addr), AF_INET, &host);
else
status = ares_parse_ptr_reply(abuf, alen, &aquery->addr.addr6,
sizeof(struct in6_addr), AF_INET6, &host);
end_aquery(aquery, status, host); end_aquery(aquery, status, host);
} }
else if (status == ARES_EDESTRUCTION) else if (status == ARES_EDESTRUCTION)
@@ -128,7 +172,7 @@ static void addr_callback(void *arg, int status, unsigned char *abuf, int alen)
} }
static void end_aquery(struct addr_query *aquery, int status, static void end_aquery(struct addr_query *aquery, int status,
struct hostent *host) struct hostent *host)
{ {
aquery->callback(aquery->arg, status, host); aquery->callback(aquery->arg, status, host);
if (host) if (host)
@@ -136,21 +180,31 @@ static void end_aquery(struct addr_query *aquery, int status,
free(aquery); free(aquery);
} }
static int file_lookup(struct in_addr *addr, struct hostent **host) static int file_lookup(union ares_addr *addr, int family, struct hostent **host)
{ {
FILE *fp; FILE *fp;
int status; int status;
#ifdef WIN32 #ifdef WIN32
char PATH_HOSTS[MAX_PATH]; char PATH_HOSTS[MAX_PATH];
if (IsNT) { if (IS_NT()) {
GetSystemDirectory(PATH_HOSTS, MAX_PATH); char tmp[MAX_PATH];
strcat(PATH_HOSTS, PATH_HOSTS_NT); HKEY hkeyHosts;
} else {
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
strcat(PATH_HOSTS, PATH_HOSTS_9X); == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
} }
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
#elif defined(WATT32) #elif defined(WATT32)
extern const char *_w32_GetHostsFile (void); extern const char *_w32_GetHostsFile (void);
@@ -163,11 +217,23 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
fp = fopen(PATH_HOSTS, "r"); fp = fopen(PATH_HOSTS, "r");
if (!fp) if (!fp)
return ARES_ENOTFOUND; return ARES_ENOTFOUND;
while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
while ((status = ares__get_hostent(fp, host)) == ARES_SUCCESS)
{ {
if (memcmp((*host)->h_addr, addr, sizeof(struct in_addr)) == 0) if (family != (*host)->h_addrtype)
break; {
ares_free_hostent(*host);
continue;
}
if (family == AF_INET)
{
if (memcmp((*host)->h_addr, &addr->addr4, sizeof(struct in_addr)) == 0)
break;
}
else if (family == AF_INET6)
{
if (memcmp((*host)->h_addr, &addr->addr6, sizeof(struct in6_addr)) == 0)
break;
}
ares_free_hostent(*host); ares_free_hostent(*host);
} }
fclose(fp); fclose(fp);

View File

@@ -16,22 +16,34 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h> #include <arpa/nameser.h>
#endif #endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
#include "inet_net_pton.h"
#include "bitncmp.h"
#ifdef WATT32
#undef WIN32
#endif
struct host_query { struct host_query {
/* Arguments passed to ares_gethostbyname() */ /* Arguments passed to ares_gethostbyname() */
@@ -39,36 +51,40 @@ struct host_query {
char *name; char *name;
ares_host_callback callback; ares_host_callback callback;
void *arg; void *arg;
int family;
const char *remaining_lookups; const char *remaining_lookups;
}; };
static void next_lookup(struct host_query *hquery); static void next_lookup(struct host_query *hquery);
static void host_callback(void *arg, int status, unsigned char *abuf, static void host_callback(void *arg, int status, unsigned char *abuf,
int alen); int alen);
static void end_hquery(struct host_query *hquery, int status, static void end_hquery(struct host_query *hquery, int status,
struct hostent *host); struct hostent *host);
static int fake_hostent(const char *name, ares_host_callback callback, static int fake_hostent(const char *name, int family, ares_host_callback callback,
void *arg); void *arg);
static int file_lookup(const char *name, struct hostent **host); static int file_lookup(const char *name, int family, struct hostent **host);
static void sort_addresses(struct hostent *host, struct apattern *sortlist, static void sort_addresses(struct hostent *host, struct apattern *sortlist,
int nsort); int nsort);
static void sort6_addresses(struct hostent *host, struct apattern *sortlist,
int nsort);
static int get_address_index(struct in_addr *addr, struct apattern *sortlist, static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
int nsort); int nsort);
static int get6_address_index(struct in6_addr *addr, struct apattern *sortlist,
int nsort);
void ares_gethostbyname(ares_channel channel, const char *name, int family, void ares_gethostbyname(ares_channel channel, const char *name, int family,
ares_host_callback callback, void *arg) ares_host_callback callback, void *arg)
{ {
struct host_query *hquery; struct host_query *hquery;
/* Right now we only know how to look up Internet addresses. */ /* Right now we only know how to look up Internet addresses. */
if (family != AF_INET) if (family != AF_INET && family != AF_INET6)
{ {
callback(arg, ARES_ENOTIMP, NULL); callback(arg, ARES_ENOTIMP, NULL);
return; return;
} }
if (fake_hostent(name, callback, arg)) if (fake_hostent(name, family, callback, arg))
return; return;
/* Allocate and fill in the host query structure. */ /* Allocate and fill in the host query structure. */
@@ -80,6 +96,7 @@ void ares_gethostbyname(ares_channel channel, const char *name, int family,
} }
hquery->channel = channel; hquery->channel = channel;
hquery->name = strdup(name); hquery->name = strdup(name);
hquery->family = family;
if (!hquery->name) if (!hquery->name)
{ {
free(hquery); free(hquery);
@@ -101,26 +118,30 @@ static void next_lookup(struct host_query *hquery)
struct hostent *host; struct hostent *host;
for (p = hquery->remaining_lookups; *p; p++) for (p = hquery->remaining_lookups; *p; p++)
{ {
switch (*p) switch (*p)
{ {
case 'b': case 'b':
/* DNS lookup */ /* DNS lookup */
hquery->remaining_lookups = p + 1; hquery->remaining_lookups = p + 1;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback, if (hquery->family == AF_INET6)
hquery); ares_search(hquery->channel, hquery->name, C_IN, T_AAAA, host_callback,
return; hquery);
else
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
return;
case 'f': case 'f':
/* Host file lookup */ /* Host file lookup */
status = file_lookup(hquery->name, &host); status = file_lookup(hquery->name, hquery->family, &host);
if (status != ARES_ENOTFOUND) if (status != ARES_ENOTFOUND)
{ {
end_hquery(hquery, status, host); end_hquery(hquery, status, host);
return; return;
} }
break; break;
} }
} }
end_hquery(hquery, ARES_ENOTFOUND, NULL); end_hquery(hquery, ARES_ENOTFOUND, NULL);
} }
@@ -133,11 +154,27 @@ static void host_callback(void *arg, int status, unsigned char *abuf, int alen)
if (status == ARES_SUCCESS) if (status == ARES_SUCCESS)
{ {
status = ares_parse_a_reply(abuf, alen, &host); if (hquery->family == AF_INET)
if (host && channel->nsort) {
sort_addresses(host, channel->sortlist, channel->nsort); status = ares_parse_a_reply(abuf, alen, &host);
if (host && channel->nsort)
sort_addresses(host, channel->sortlist, channel->nsort);
}
else if (hquery->family == AF_INET6)
{
status = ares_parse_aaaa_reply(abuf, alen, &host);
if (host && channel->nsort)
sort6_addresses(host, channel->sortlist, channel->nsort);
}
end_hquery(hquery, status, host); end_hquery(hquery, status, host);
} }
else if (status == ARES_ENODATA && hquery->family == AF_INET6)
{
/* There was no AAAA now lookup an A */
hquery->family = AF_INET;
ares_search(hquery->channel, hquery->name, C_IN, T_A, host_callback,
hquery);
}
else if (status == ARES_EDESTRUCTION) else if (status == ARES_EDESTRUCTION)
end_hquery(hquery, status, NULL); end_hquery(hquery, status, NULL);
else else
@@ -145,7 +182,7 @@ static void host_callback(void *arg, int status, unsigned char *abuf, int alen)
} }
static void end_hquery(struct host_query *hquery, int status, static void end_hquery(struct host_query *hquery, int status,
struct hostent *host) struct hostent *host)
{ {
hquery->callback(hquery->arg, status, host); hquery->callback(hquery->arg, status, host);
if (host) if (host)
@@ -157,36 +194,34 @@ static void end_hquery(struct host_query *hquery, int status,
/* If the name looks like an IP address, fake up a host entry, end the /* If the name looks like an IP address, fake up a host entry, end the
* query immediately, and return true. Otherwise return false. * query immediately, and return true. Otherwise return false.
*/ */
static int fake_hostent(const char *name, ares_host_callback callback, static int fake_hostent(const char *name, int family, ares_host_callback callback,
void *arg) void *arg)
{ {
struct in_addr addr;
struct hostent hostent; struct hostent hostent;
const char *p;
char *aliases[1] = { NULL }; char *aliases[1] = { NULL };
char *addrs[2]; char *addrs[2];
int result = 0;
struct in_addr in;
struct in6_addr in6;
/* It only looks like an IP address if it's all numbers and dots. */ if (family == AF_INET)
for (p = name; *p; p++) result = ((in.s_addr = inet_addr(name)) == INADDR_NONE ? 0 : 1);
{ else if (family == AF_INET6)
if (!isdigit((unsigned char)*p) && *p != '.') result = (ares_inet_pton(AF_INET6, name, &in6) < 1 ? 0 : 1);
return 0;
}
/* It also only looks like an IP address if it's non-zero-length and if (!result)
* doesn't end with a dot.
*/
if (p == name || *(p - 1) == '.')
return 0; return 0;
/* It looks like an IP address. Figure out what IP address it is. */ if (family == AF_INET)
addr.s_addr = inet_addr(name);
if (addr.s_addr == INADDR_NONE)
{ {
callback(arg, ARES_EBADNAME, NULL); hostent.h_length = sizeof(struct in_addr);
return 1; addrs[0] = (char *)&in;
}
else if (family == AF_INET6)
{
hostent.h_length = sizeof(struct in6_addr);
addrs[0] = (char *)&in6;
} }
/* Duplicate the name, to avoid a constness violation. */ /* Duplicate the name, to avoid a constness violation. */
hostent.h_name = strdup(name); hostent.h_name = strdup(name);
if (!hostent.h_name) if (!hostent.h_name)
@@ -196,11 +231,9 @@ static int fake_hostent(const char *name, ares_host_callback callback,
} }
/* Fill in the rest of the host structure and terminate the query. */ /* Fill in the rest of the host structure and terminate the query. */
addrs[0] = (char *) &addr;
addrs[1] = NULL; addrs[1] = NULL;
hostent.h_aliases = aliases; hostent.h_aliases = aliases;
hostent.h_addrtype = AF_INET; hostent.h_addrtype = family;
hostent.h_length = sizeof(struct in_addr);
hostent.h_addr_list = addrs; hostent.h_addr_list = addrs;
callback(arg, ARES_SUCCESS, &hostent); callback(arg, ARES_SUCCESS, &hostent);
@@ -208,22 +241,32 @@ static int fake_hostent(const char *name, ares_host_callback callback,
return 1; return 1;
} }
static int file_lookup(const char *name, struct hostent **host) static int file_lookup(const char *name, int family, struct hostent **host)
{ {
FILE *fp; FILE *fp;
char **alias; char **alias;
int status; int status;
#ifdef WIN32 #ifdef WIN32
char PATH_HOSTS[MAX_PATH]; char PATH_HOSTS[MAX_PATH];
if (IsNT) { if (IS_NT()) {
GetSystemDirectory(PATH_HOSTS, MAX_PATH); char tmp[MAX_PATH];
strcat(PATH_HOSTS, PATH_HOSTS_NT); HKEY hkeyHosts;
} else {
GetWindowsDirectory(PATH_HOSTS, MAX_PATH); if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ, &hkeyHosts)
strcat(PATH_HOSTS, PATH_HOSTS_9X); == ERROR_SUCCESS)
{
DWORD dwLength = MAX_PATH;
RegQueryValueEx(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,
&dwLength);
ExpandEnvironmentStrings(tmp, PATH_HOSTS, MAX_PATH);
RegCloseKey(hkeyHosts);
}
} }
else
GetWindowsDirectory(PATH_HOSTS, MAX_PATH);
strcat(PATH_HOSTS, WIN_PATH_HOSTS);
#elif defined(WATT32) #elif defined(WATT32)
extern const char *_w32_GetHostsFile (void); extern const char *_w32_GetHostsFile (void);
@@ -237,17 +280,17 @@ static int file_lookup(const char *name, struct hostent **host)
if (!fp) if (!fp)
return ARES_ENOTFOUND; return ARES_ENOTFOUND;
while ((status = ares__get_hostent(fp, host)) == ARES_SUCCESS) while ((status = ares__get_hostent(fp, family, host)) == ARES_SUCCESS)
{ {
if (strcasecmp((*host)->h_name, name) == 0) if (strcasecmp((*host)->h_name, name) == 0)
break; break;
for (alias = (*host)->h_aliases; *alias; alias++) for (alias = (*host)->h_aliases; *alias; alias++)
{ {
if (strcasecmp(*alias, name) == 0) if (strcasecmp(*alias, name) == 0)
break; break;
} }
if (*alias) if (*alias)
break; break;
ares_free_hostent(*host); ares_free_hostent(*host);
} }
fclose(fp); fclose(fp);
@@ -259,7 +302,7 @@ static int file_lookup(const char *name, struct hostent **host)
} }
static void sort_addresses(struct hostent *host, struct apattern *sortlist, static void sort_addresses(struct hostent *host, struct apattern *sortlist,
int nsort) int nsort)
{ {
struct in_addr a1, a2; struct in_addr a1, a2;
int i1, i2, ind1, ind2; int i1, i2, ind1, ind2;
@@ -274,13 +317,13 @@ static void sort_addresses(struct hostent *host, struct apattern *sortlist,
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr)); memcpy(&a1, host->h_addr_list[i1], sizeof(struct in_addr));
ind1 = get_address_index(&a1, sortlist, nsort); ind1 = get_address_index(&a1, sortlist, nsort);
for (i2 = i1 - 1; i2 >= 0; i2--) for (i2 = i1 - 1; i2 >= 0; i2--)
{ {
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr)); memcpy(&a2, host->h_addr_list[i2], sizeof(struct in_addr));
ind2 = get_address_index(&a2, sortlist, nsort); ind2 = get_address_index(&a2, sortlist, nsort);
if (ind2 <= ind1) if (ind2 <= ind1)
break; break;
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr)); memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in_addr));
} }
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr)); memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in_addr));
} }
} }
@@ -289,14 +332,72 @@ static void sort_addresses(struct hostent *host, struct apattern *sortlist,
* if none of them match. * if none of them match.
*/ */
static int get_address_index(struct in_addr *addr, struct apattern *sortlist, static int get_address_index(struct in_addr *addr, struct apattern *sortlist,
int nsort) int nsort)
{ {
int i; int i;
for (i = 0; i < nsort; i++) for (i = 0; i < nsort; i++)
{ {
if ((addr->s_addr & sortlist[i].mask.s_addr) == sortlist[i].addr.s_addr) if (sortlist[i].family != AF_INET)
break; continue;
if (sortlist[i].type == PATTERN_MASK)
{
if ((addr->s_addr & sortlist[i].mask.addr.addr4.s_addr)
== sortlist[i].addr.addr4.s_addr)
break;
}
else
{
if (!ares_bitncmp(&addr->s_addr, &sortlist[i].addr.addr4.s_addr,
sortlist[i].mask.bits))
break;
}
} }
return i; return i;
} }
static void sort6_addresses(struct hostent *host, struct apattern *sortlist,
int nsort)
{
struct in6_addr a1, a2;
int i1, i2, ind1, ind2;
/* This is a simple insertion sort, not optimized at all. i1 walks
* through the address list, with the loop invariant that everything
* to the left of i1 is sorted. In the loop body, the value at i1 is moved
* back through the list (via i2) until it is in sorted order.
*/
for (i1 = 0; host->h_addr_list[i1]; i1++)
{
memcpy(&a1, host->h_addr_list[i1], sizeof(struct in6_addr));
ind1 = get6_address_index(&a1, sortlist, nsort);
for (i2 = i1 - 1; i2 >= 0; i2--)
{
memcpy(&a2, host->h_addr_list[i2], sizeof(struct in6_addr));
ind2 = get6_address_index(&a2, sortlist, nsort);
if (ind2 <= ind1)
break;
memcpy(host->h_addr_list[i2 + 1], &a2, sizeof(struct in6_addr));
}
memcpy(host->h_addr_list[i2 + 1], &a1, sizeof(struct in6_addr));
}
}
/* Find the first entry in sortlist which matches addr. Return nsort
* if none of them match.
*/
static int get6_address_index(struct in6_addr *addr, struct apattern *sortlist,
int nsort)
{
int i;
for (i = 0; i < nsort; i++)
{
if (sortlist[i].family != AF_INET6)
continue;
if (!ares_bitncmp(&addr->s6_addr, &sortlist[i].addr.addr6.s6_addr, sortlist[i].mask.bits))
break;
}
return i;
}

145
ares/ares_getnameinfo.3 Normal file
View File

@@ -0,0 +1,145 @@
.\" $Id$
.\"
.\" Copyright 2005 by Dominick Meglio.
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.TH ARES_GETNAMEINFO 3 "16 May 2005"
.SH NAME
ares_getnameinfo \- Address-to-nodename translation in protocol-independent manner
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B typedef void (*ares_nameinfo_callback)(void *\fIarg\fP, int \fIstatus\fP,
.B char *\fInode\fP, char *\fIservice\fP)
.PP
.B void ares_getnameinfo(ares_channel \fIchannel\fP, const struct sockaddr *\fIsa\fP,
.B socklen_t \fIsalen\fP, int \fIflags\fP, ares_nameinfo_callback \fIcallback\fP,
.B void *\fIarg\fP)
.fi
.SH DESCRIPTION
The
.B ares_getnameinfo
function is defined for protocol-independent address translation. The function
is a combination of \fIares_gethostbyaddr(3)\fP and \fIgetservbyport(3)\fP. The function will
translate the address either by executing a host query on the name service channel
identified by
.IR channel
or it will attempt to resolve it locally if possible.
The parameters
.I sa
and
.I len
give the address as a sockaddr structure, and
.I flags
gives the options that the function will use. Valid flags are listed below:
.TP 19
.B ARES_NI_NOFQDN
Only the nodename portion of the FQDN is returned for local hosts.
.TP 19
.B ARES_NI_NUMERICHOST
The numeric form of the hostname is returned rather than the name.
.TP 19
.B ARES_NI_NAMEREQD
An error is returned if the hostname cannot be found in the DNS.
.TP 19
.B ARES_NI_NUMERICSERV
The numeric form of the service is returned rather than the name.
.TP 19
.B ARES_NI_TCP
The service name is to be looked up for the TCP protocol.
.TP 19
.B ARES_NI_UDP
The service name is to be looked up for the UDP protocol.
.TP 19
.B ARES_NI_SCTP
The service name is to be looked up for the SCTP protocol.
.TP 19
.B ARES_NI_DCCP
The service name is to be looked up for the DCCP protocol.
.TP 19
.B ARES_NI_NUMERICSCOPE
The numeric form of the scope ID is returned rather than the name.
.TP 19
.B ARES_NI_LOOKUPHOST
A hostname lookup is being requested.
.TP 19
.B ARES_NI_LOOKUPSERVICE
A service name lookup is being requested.
.PP
When the query
is complete or has
failed, the ares library will invoke \fIcallback\fP. Completion or failure of
the query may happen immediately, or may happen during a later call to
\fIares_process(3)\fP, \fIares_destroy(3)\fP or \fIares_cancel(3)\fP.
.PP
The callback argument
.I arg
is copied from the
.B ares_getnameinfo
argument
.IR arg .
The callback argument
.I status
indicates whether the query succeeded and, if not, how it failed. It
may have any of the following values:
.TP 19
.B ARES_SUCCESS
The host lookup completed successfully.
.TP 19
.B ARES_ENOTIMP
The ares library does not know how to look up addresses of type
.IR family .
.TP 19
.B ARES_ENOTFOUND
The address
.I addr
was not found.
.TP 19
.B ARES_ENOMEM
Memory was exhausted.
.TP 19
.B ARES_EDESTRUCTION
The name service channel
.I channel
is being destroyed; the query will not be completed.
.TP 19
.B ARES_EBADFLAGS
The
.I flags
parameter contains an illegal value.
.PP
On successful completion of the query, the callback argument
.I node
contains a string representing the hostname (assuming
.B ARES_NI_LOOKUPHOST
was specified). Additionally,
.I service
contains a string representing the service name (assuming
.B ARES_NI_LOOKUPSERVICE
was specified).
If the query did not complete successfully, or one of the values
was not requested,
.I node
or
.I service
will be
.BR NULL .
.SH SEE ALSO
.BR ares_process (3),
.BR ares_getaddrinfo (3)
.SH AUTHOR
Dominick Meglio
.br
Copyright 2005 by Dominick Meglio.

331
ares/ares_getnameinfo.c Normal file
View File

@@ -0,0 +1,331 @@
/* Copyright 2005 by Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "setup.h"
#include <sys/types.h>
#include <ctype.h>
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_private.h"
#include "ares_ipv6.h"
#include "inet_ntop.h"
#ifdef WATT32
#undef WIN32
#endif
struct nameinfo_query {
ares_nameinfo_callback callback;
void *arg;
union {
struct sockaddr_in addr4;
struct sockaddr_in6 addr6;
} addr;
int family;
int flags;
};
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
#define IPBUFSIZ 40+IF_NAMESIZE
#else
#define IPBUFSIZ 40
#endif
static void nameinfo_callback(void *arg, int status, struct hostent *host);
static char *lookup_service(unsigned short port, int flags, char *buf);
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
static char *append_scopeid(struct sockaddr_in6 *addr6, unsigned int scopeid, char *buf);
#endif
static char *ares_striendstr(const char *s1, const char *s2);
void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa, socklen_t salen,
int flags, ares_nameinfo_callback callback, void *arg)
{
struct sockaddr_in *addr;
struct sockaddr_in6 *addr6;
struct nameinfo_query *niquery;
/* Verify the buffer size */
if (salen == sizeof(struct sockaddr_in))
addr = (struct sockaddr_in *)sa;
else if (salen == sizeof(struct sockaddr_in6))
addr6 = (struct sockaddr_in6 *)sa;
else
{
callback(arg, ARES_ENOTIMP, NULL, NULL);
return;
}
/* If neither, assume they want a host */
if (!(flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
flags |= ARES_NI_LOOKUPHOST;
/* All they want is a service, no need for DNS */
if ((flags & ARES_NI_LOOKUPSERVICE) && !(flags & ARES_NI_LOOKUPHOST))
{
char buf[33], *service;
unsigned int port = 0;
if (salen == sizeof(struct sockaddr_in))
port = addr->sin_port;
else
port = addr6->sin6_port;
service = lookup_service(port, flags, buf);
callback(arg, ARES_SUCCESS, NULL, service);
return;
}
/* They want a host lookup */
if ((flags & ARES_NI_LOOKUPHOST))
{
/* A numeric host can be handled without DNS */
if ((flags & ARES_NI_NUMERICHOST))
{
unsigned int port = 0;
char ipbuf[IPBUFSIZ];
char srvbuf[32];
char *service = NULL;
ipbuf[0] = 0;
/* Specifying not to lookup a host, but then saying a host
* is required has to be illegal.
*/
if (flags & ARES_NI_NAMEREQD)
{
callback(arg, ARES_EBADFLAGS, NULL, NULL);
return;
}
if (salen == sizeof(struct sockaddr_in6))
{
ares_inet_ntop(AF_INET6, &addr6->sin6_addr, ipbuf, IPBUFSIZ);
port = addr6->sin6_port;
/* If the system supports scope IDs, use it */
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
append_scopeid(addr6, flags, ipbuf);
#endif
}
else
{
ares_inet_ntop(AF_INET, &addr->sin_addr, ipbuf, IPBUFSIZ);
port = addr->sin_port;
}
/* They also want a service */
if (flags & ARES_NI_LOOKUPSERVICE)
service = lookup_service(port, flags, srvbuf);
callback(arg, ARES_SUCCESS, ipbuf, service);
return;
}
/* This is where a DNS lookup becomes necessary */
else
{
niquery = malloc(sizeof(struct nameinfo_query));
if (!niquery)
{
callback(arg, ARES_ENOMEM, NULL, NULL);
return;
}
niquery->callback = callback;
niquery->arg = arg;
niquery->flags = flags;
if (sa->sa_family == AF_INET)
{
niquery->family = AF_INET;
memcpy(&niquery->addr.addr4, addr, sizeof(addr));
ares_gethostbyaddr(channel, &addr->sin_addr, sizeof(struct in_addr), AF_INET,
nameinfo_callback, niquery);
}
else
{
niquery->family = AF_INET6;
memcpy(&niquery->addr.addr6, addr6, sizeof(addr6));
ares_gethostbyaddr(channel, &addr6->sin6_addr, sizeof(struct in6_addr), AF_INET6,
nameinfo_callback, niquery);
}
}
}
}
static void nameinfo_callback(void *arg, int status, struct hostent *host)
{
struct nameinfo_query *niquery = (struct nameinfo_query *) arg;
char srvbuf[33];
char *service = NULL;
if (status == ARES_SUCCESS)
{
/* They want a service too */
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
{
if (niquery->family == AF_INET)
service = lookup_service(niquery->addr.addr4.sin_port, niquery->flags, srvbuf);
else
service = lookup_service(niquery->addr.addr6.sin6_port, niquery->flags, srvbuf);
}
/* NOFQDN means we have to strip off the domain name portion.
We do this by determining our own domain name, then searching the string
for this domain name and removing it.
*/
if (niquery->flags & ARES_NI_NOFQDN)
{
char buf[255];
char *domain;
gethostname(buf, 255);
if ((domain = strchr(buf, '.')))
{
char *end = ares_striendstr(host->h_name, domain);
if (end)
*end = 0;
}
}
niquery->callback(niquery->arg, ARES_SUCCESS, host->h_name, service);
return;
}
/* We couldn't find the host, but it's OK, we can use the IP */
else if (status == ARES_ENOTFOUND && !(niquery->flags & ARES_NI_NAMEREQD))
{
char ipbuf[IPBUFSIZ];
if (niquery->family == AF_INET)
ares_inet_ntop(AF_INET, &niquery->addr.addr4.sin_addr, ipbuf, IPBUFSIZ);
else
{
ares_inet_ntop(AF_INET6, &niquery->addr.addr6.sin6_addr, ipbuf, IPBUFSIZ);
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
append_scopeid(&niquery->addr.addr6, niquery->flags, ipbuf);
#endif
}
/* They want a service too */
if (niquery->flags & ARES_NI_LOOKUPSERVICE)
{
if (niquery->family == AF_INET)
service = lookup_service(niquery->addr.addr4.sin_port, niquery->flags, srvbuf);
else
service = lookup_service(niquery->addr.addr6.sin6_port, niquery->flags, srvbuf);
}
niquery->callback(niquery->arg, ARES_SUCCESS, ipbuf, service);
return;
}
niquery->callback(niquery->arg, status, NULL, NULL);
free(niquery);
}
static char *lookup_service(unsigned short port, int flags, char *buf)
{
if (port)
{
/* Just return the port as a string */
if (flags & ARES_NI_NUMERICSERV)
sprintf(buf, "%u", ntohs(port));
else
{
struct servent *se;
const char *proto;
if (flags & ARES_NI_UDP)
proto = "udp";
else if (flags & ARES_NI_SCTP)
proto = "sctp";
else if (flags & ARES_NI_DCCP)
proto = "dccp";
else
proto = "tcp";
se = getservbyport(port, proto);
if (se && se->s_name)
strcpy(buf, se->s_name);
else
sprintf(buf, "%u", ntohs(port));
}
return buf;
}
return NULL;
}
#ifdef HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID
static char *append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags, char *buf)
{
char tmpbuf[IF_NAMESIZE + 1];
tmpbuf[0] = '%';
#ifdef HAVE_IF_INDEXTONAME
if ((flags & ARES_NI_NUMERICSCOPE) || (!IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr)
&& !IN6_IS_ADDR_MC_LINKLOCAL(&addr6->sin6_addr)))
{
sprintf(&tmpbuf[1], "%u", addr6->sin6_scope_id);
}
else
{
if (if_indextoname(addr6->sin6_scope_id, &tmpbuf[1]) == NULL)
sprintf(&tmpbuf[1], "%u", addr6->sin6_scope_id);
}
#else
sprintf(&tmpbuf[1], "%u", addr6->sin6_scope_id);
#endif
strcat(buf, tmpbuf);
return buf;
}
#endif
/* Determines if s1 ends with the string in s2 (case-insensitive) */
static char *ares_striendstr(const char *s1, const char *s2)
{
const char *c1, *c2, *c1_begin;
size_t s1_len = strlen(s1), s2_len = strlen(s2);
/* If the substr is longer than the full str, it can't match */
if (s2_len > s1_len)
return NULL;
/* Jump to the end of s1 minus the length of s2 */
c1_begin = s1+s1_len-s2_len;
c1 = (const char *)c1_begin;
c2 = s2;
while (c2 < s2+s2_len)
{
if (tolower(*c1) != tolower(*c2))
return NULL;
else
{
c1++;
c2++;
}
}
if (c2 == c1 && c2 == NULL)
return (char *)c1_begin;
return NULL;
}

View File

@@ -14,7 +14,7 @@
.\" this software for any purpose. It is provided "as is" .\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty. .\" without express or implied warranty.
.\" .\"
.TH ARES_INIT 3 "21 July 1998" .TH ARES_INIT 3 "7 December 2004"
.SH NAME .SH NAME
ares_init, ares_init_options \- Initialize a resolver channel ares_init, ares_init_options \- Initialize a resolver channel
.SH SYNOPSIS .SH SYNOPSIS
@@ -25,31 +25,20 @@ ares_init, ares_init_options \- Initialize a resolver channel
.B int ares_init_options(ares_channel *\fIchannel\fP, .B int ares_init_options(ares_channel *\fIchannel\fP,
.B struct ares_options *\fIoptions\fP, int \fIoptmask\fP) .B struct ares_options *\fIoptions\fP, int \fIoptmask\fP)
.PP .PP
.B cc file.c -lares .B cc file.c -lcares
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
The The \fBares_init\fP function initializes a communications channel for name
.B ares_init service lookups. If it returns successfully, \fBares_init\fP will set the
function initializes a communications channel for name service variable pointed to by \fIchannel\fP to a handle used to identify the name
lookups. If it returns successfully, service channel. The caller should invoke
.B ares_init
will set the variable pointed to by
.I channel
to a handle used to identify the name service channel. The caller
should invoke
.BR ares_destroy (3) .BR ares_destroy (3)
on the handle when the channel is no longer needed. on the handle when the channel is no longer needed.
.PP .PP
The The \fBares_init_options\fP function also initializes a name service channel,
.B ares_init_options with additional options useful for applications requiring more control over
function also initializes a name service channel, with additional name service configuration. The \fIoptmask\fP parameter specifies which fields
options useful for applications requiring more control over name in the structure pointed to by \fIoptions\fP are set, as follows:
service configuration. The
.I optmask
parameter specifies which fields in the structure pointed to by
.I options
are set, as follows:
.PP
.TP 18 .TP 18
.B ARES_OPT_FLAGS .B ARES_OPT_FLAGS
.B int \fIflags\fP; .B int \fIflags\fP;
@@ -127,9 +116,11 @@ If a truncated response to a UDP query is received, do not fall back
to TCP; simply continue on with the truncated response. to TCP; simply continue on with the truncated response.
.TP 23 .TP 23
.B ARES_FLAG_NORECURSE .B ARES_FLAG_NORECURSE
Do not set the "recursion desired" bit on outgoing queries, so that Do not set the "recursion desired" bit on outgoing queries, so that the name
the name server being contacted will not try to fetch the answer from server being contacted will not try to fetch the answer from other servers if
other servers if it doesn't know the answer locally. it doesn't know the answer locally. Be aware that ares will not do the
recursion for you. Recursion must be handled by the application calling ares
if \fIARES_FLAG_NORECURSE\fP is set.
.TP 23 .TP 23
.B ARES_FLAG_STAYOPEN .B ARES_FLAG_STAYOPEN
Do not close communciations sockets when the number of active queries Do not close communciations sockets when the number of active queries

View File

@@ -16,19 +16,32 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#include <iphlpapi.h> #include <iphlpapi.h>
#include <malloc.h> #include <malloc.h>
#else #else
#include <sys/param.h> #include <sys/param.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -38,24 +51,34 @@
#include <errno.h> #include <errno.h>
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
#include "inet_net_pton.h"
#ifdef WATT32
#undef WIN32 /* Redefined in MingW/MSVC headers */
#endif
static int init_by_options(ares_channel channel, struct ares_options *options, static int init_by_options(ares_channel channel, struct ares_options *options,
int optmask); int optmask);
static int init_by_environment(ares_channel channel); static int init_by_environment(ares_channel channel);
static int init_by_resolv_conf(ares_channel channel); static int init_by_resolv_conf(ares_channel channel);
static int init_by_defaults(ares_channel channel); static int init_by_defaults(ares_channel channel);
static int config_domain(ares_channel channel, char *str);
static int config_lookup(ares_channel channel, const char *str);
static int config_nameserver(struct server_state **servers, int *nservers, static int config_nameserver(struct server_state **servers, int *nservers,
char *str); char *str);
static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str);
static int set_search(ares_channel channel, const char *str); static int set_search(ares_channel channel, const char *str);
static int set_options(ares_channel channel, const char *str); static int set_options(ares_channel channel, const char *str);
static char *try_config(char *s, const char *opt);
static const char *try_option(const char *p, const char *q, const char *opt); static const char *try_option(const char *p, const char *q, const char *opt);
#ifndef WIN32
static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat);
static int ip_addr(const char *s, int len, struct in_addr *addr); static int ip_addr(const char *s, int len, struct in_addr *addr);
static void natural_mask(struct apattern *pat); static void natural_mask(struct apattern *pat);
static int config_domain(ares_channel channel, char *str);
static int config_lookup(ares_channel channel, const char *str,
const char *bindch, const char *filech);
static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str);
static char *try_config(char *s, const char *opt);
#endif
int ares_init(ares_channel *channelptr) int ares_init(ares_channel *channelptr)
{ {
@@ -63,7 +86,7 @@ int ares_init(ares_channel *channelptr)
} }
int ares_init_options(ares_channel *channelptr, struct ares_options *options, int ares_init_options(ares_channel *channelptr, struct ares_options *options,
int optmask) int optmask)
{ {
ares_channel channel; ares_channel channel;
int i, status; int i, status;
@@ -105,15 +128,15 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
{ {
/* Something failed; clean up memory we may have allocated. */ /* Something failed; clean up memory we may have allocated. */
if (channel->nservers != -1) if (channel->nservers != -1)
free(channel->servers); free(channel->servers);
if (channel->domains) if (channel->domains)
{ {
for (i = 0; i < channel->ndomains; i++) for (i = 0; i < channel->ndomains; i++)
free(channel->domains[i]); free(channel->domains[i]);
free(channel->domains); free(channel->domains);
} }
if (channel->sortlist) if (channel->sortlist)
free(channel->sortlist); free(channel->sortlist);
if(channel->lookups) if(channel->lookups)
free(channel->lookups); free(channel->lookups);
free(channel); free(channel);
@@ -152,7 +175,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
} }
static int init_by_options(ares_channel channel, struct ares_options *options, static int init_by_options(ares_channel channel, struct ares_options *options,
int optmask) int optmask)
{ {
int i; int i;
@@ -174,11 +197,11 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1) if ((optmask & ARES_OPT_SERVERS) && channel->nservers == -1)
{ {
channel->servers = channel->servers =
malloc(options->nservers * sizeof(struct server_state)); malloc(options->nservers * sizeof(struct server_state));
if (!channel->servers && options->nservers != 0) if (!channel->servers && options->nservers != 0)
return ARES_ENOMEM; return ARES_ENOMEM;
for (i = 0; i < options->nservers; i++) for (i = 0; i < options->nservers; i++)
channel->servers[i].addr = options->servers[i]; channel->servers[i].addr = options->servers[i];
channel->nservers = options->nservers; channel->nservers = options->nservers;
} }
@@ -189,14 +212,14 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
{ {
channel->domains = malloc(options->ndomains * sizeof(char *)); channel->domains = malloc(options->ndomains * sizeof(char *));
if (!channel->domains && options->ndomains != 0) if (!channel->domains && options->ndomains != 0)
return ARES_ENOMEM; return ARES_ENOMEM;
for (i = 0; i < options->ndomains; i++) for (i = 0; i < options->ndomains; i++)
{ {
channel->ndomains = i; channel->ndomains = i;
channel->domains[i] = strdup(options->domains[i]); channel->domains[i] = strdup(options->domains[i]);
if (!channel->domains[i]) if (!channel->domains[i])
return ARES_ENOMEM; return ARES_ENOMEM;
} }
channel->ndomains = options->ndomains; channel->ndomains = options->ndomains;
} }
@@ -205,7 +228,7 @@ static int init_by_options(ares_channel channel, struct ares_options *options,
{ {
channel->lookups = strdup(options->lookups); channel->lookups = strdup(options->lookups);
if (!channel->lookups) if (!channel->lookups)
return ARES_ENOMEM; return ARES_ENOMEM;
} }
return ARES_SUCCESS; return ARES_SUCCESS;
@@ -221,7 +244,7 @@ static int init_by_environment(ares_channel channel)
{ {
status = set_search(channel, localdomain); status = set_search(channel, localdomain);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return status; return status;
} }
res_options = getenv("RES_OPTIONS"); res_options = getenv("RES_OPTIONS");
@@ -229,7 +252,7 @@ static int init_by_environment(ares_channel channel)
{ {
status = set_options(channel, res_options); status = set_options(channel, res_options);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return status; return status;
} }
return ARES_SUCCESS; return ARES_SUCCESS;
@@ -253,7 +276,8 @@ static int get_res_nt(HKEY hKey, const char *subkey, char **obuf)
if (!*obuf) if (!*obuf)
return 0; return 0;
if (RegQueryValueEx(hKey, subkey, 0, NULL, *obuf, &size) != ERROR_SUCCESS) if (RegQueryValueEx(hKey, subkey, 0, NULL,
(LPBYTE)*obuf, &size) != ERROR_SUCCESS)
{ {
free(*obuf); free(*obuf);
return 0; return 0;
@@ -294,7 +318,8 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
{ {
FIXED_INFO *fi = alloca (sizeof(*fi)); FIXED_INFO *fi = alloca (sizeof(*fi));
DWORD size = sizeof (*fi); DWORD size = sizeof (*fi);
DWORD WINAPI (*GetNetworkParams) (FIXED_INFO*, DWORD*); /* available only on Win-98/2000+ */ typedef DWORD (WINAPI* get_net_param_func) (FIXED_INFO*, DWORD*);
get_net_param_func GetNetworkParams; /* available only on Win-98/2000+ */
HMODULE handle; HMODULE handle;
IP_ADDR_STRING *ipAddr; IP_ADDR_STRING *ipAddr;
int i, count = 0; int i, count = 0;
@@ -302,6 +327,7 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
size_t ip_size = sizeof("255.255.255.255,")-1; size_t ip_size = sizeof("255.255.255.255,")-1;
size_t left = ret_size; size_t left = ret_size;
char *ret = ret_buf; char *ret = ret_buf;
HRESULT res;
if (!fi) if (!fi)
return (0); return (0);
@@ -310,11 +336,12 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
if (!handle) if (!handle)
return (0); return (0);
(void*)GetNetworkParams = GetProcAddress (handle, "GetNetworkParams"); GetNetworkParams = (get_net_param_func) GetProcAddress (handle, "GetNetworkParams");
if (!GetNetworkParams) if (!GetNetworkParams)
goto quit; goto quit;
if ((*GetNetworkParams) (fi, &size) != ERROR_BUFFER_OVERFLOW) res = (*GetNetworkParams) (fi, &size);
if ((res != ERROR_BUFFER_OVERFLOW) && (res != ERROR_SUCCESS))
goto quit; goto quit;
fi = alloca (size); fi = alloca (size);
@@ -364,7 +391,7 @@ quit:
static int init_by_resolv_conf(ares_channel channel) static int init_by_resolv_conf(ares_channel channel)
{ {
char *line = NULL; char *line = NULL;
int status, nservers = 0, nsort = 0; int status = -1, nservers = 0, nsort = 0;
struct server_state *servers = NULL; struct server_state *servers = NULL;
struct apattern *sortlist = NULL; struct apattern *sortlist = NULL;
@@ -381,14 +408,14 @@ static int init_by_resolv_conf(ares_channel channel)
On Windows 9X, the DNS server can be found in: On Windows 9X, the DNS server can be found in:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\VxD\MSTCP\NameServer
On Windows NT/2000/XP/2003: On Windows NT/2000/XP/2003:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NameServer
or or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer
or or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
NameServer NameServer
or or
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\ HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\{AdapterID}\
DhcpNameServer DhcpNameServer
*/ */
@@ -410,7 +437,7 @@ DhcpNameServer
goto okay; goto okay;
} }
if (IsNT) if (IS_NT())
{ {
if (RegOpenKeyEx( if (RegOpenKeyEx(
HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0,
@@ -539,7 +566,7 @@ DhcpNameServer
if ((p = try_config(line, "domain"))) if ((p = try_config(line, "domain")))
status = config_domain(channel, p); status = config_domain(channel, p);
else if ((p = try_config(line, "lookup")) && !channel->lookups) else if ((p = try_config(line, "lookup")) && !channel->lookups)
status = config_lookup(channel, p); status = config_lookup(channel, p, "bind", "file");
else if ((p = try_config(line, "search"))) else if ((p = try_config(line, "search")))
status = set_search(channel, p); status = set_search(channel, p);
else if ((p = try_config(line, "nameserver")) && channel->nservers == -1) else if ((p = try_config(line, "nameserver")) && channel->nservers == -1)
@@ -553,9 +580,49 @@ DhcpNameServer
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
} }
fclose(fp);
if (!channel->lookups) {
/* Many systems (Solaris, Linux, BSD's) use nsswitch.conf */
fp = fopen("/etc/nsswitch.conf", "r");
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
if ((p = try_config(line, "hosts:")) && !channel->lookups)
status = config_lookup(channel, p, "dns", "files");
}
fclose(fp);
}
}
if (!channel->lookups) {
/* Linux / GNU libc 2.x and possibly others have host.conf */
fp = fopen("/etc/host.conf", "r");
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
if ((p = try_config(line, "order")) && !channel->lookups)
status = config_lookup(channel, p, "bind", "hosts");
}
fclose(fp);
}
}
if (!channel->lookups) {
/* Tru64 uses /etc/svc.conf */
fp = fopen("/etc/svc.conf", "r");
if (fp) {
while ((status = ares__read_line(fp, &line, &linesize)) == ARES_SUCCESS)
{
if ((p = try_config(line, "hosts=")) && !channel->lookups)
status = config_lookup(channel, p, "bind", "local");
}
fclose(fp);
}
}
if(line) if(line)
free(line); free(line);
fclose(fp);
} }
#endif #endif
@@ -612,7 +679,7 @@ static int init_by_defaults(ares_channel channel)
/* If nobody specified servers, try a local named. */ /* If nobody specified servers, try a local named. */
channel->servers = malloc(sizeof(struct server_state)); channel->servers = malloc(sizeof(struct server_state));
if (!channel->servers) if (!channel->servers)
return ARES_ENOMEM; return ARES_ENOMEM;
channel->servers[0].addr.s_addr = htonl(INADDR_LOOPBACK); channel->servers[0].addr.s_addr = htonl(INADDR_LOOPBACK);
channel->nservers = 1; channel->nservers = 1;
} }
@@ -623,22 +690,22 @@ static int init_by_defaults(ares_channel channel)
* or set it to empty if the hostname isn't helpful. * or set it to empty if the hostname isn't helpful.
*/ */
if (gethostname(hostname, sizeof(hostname)) == -1 if (gethostname(hostname, sizeof(hostname)) == -1
|| !strchr(hostname, '.')) || !strchr(hostname, '.'))
{ {
channel->domains = malloc(0); channel->domains = malloc(0);
channel->ndomains = 0; channel->ndomains = 0;
} }
else else
{ {
channel->domains = malloc(sizeof(char *)); channel->domains = malloc(sizeof(char *));
if (!channel->domains) if (!channel->domains)
return ARES_ENOMEM; return ARES_ENOMEM;
channel->ndomains = 0; channel->ndomains = 0;
channel->domains[0] = strdup(strchr(hostname, '.') + 1); channel->domains[0] = strdup(strchr(hostname, '.') + 1);
if (!channel->domains[0]) if (!channel->domains[0])
return ARES_ENOMEM; return ARES_ENOMEM;
channel->ndomains = 1; channel->ndomains = 1;
} }
} }
if (channel->nsort == -1) if (channel->nsort == -1)
@@ -649,14 +716,15 @@ static int init_by_defaults(ares_channel channel)
if (!channel->lookups) if (!channel->lookups)
{ {
channel->lookups = strdup("bf"); channel->lookups = strdup("fb");
if (!channel->lookups) if (!channel->lookups)
return ARES_ENOMEM; return ARES_ENOMEM;
} }
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static int config_domain(ares_channel channel, char *str) static int config_domain(ares_channel channel, char *str)
{ {
char *q; char *q;
@@ -669,7 +737,8 @@ static int config_domain(ares_channel channel, char *str)
return set_search(channel, str); return set_search(channel, str);
} }
static int config_lookup(ares_channel channel, const char *str) static int config_lookup(ares_channel channel, const char *str,
const char *bindch, const char *filech)
{ {
char lookups[3], *l; char lookups[3], *l;
const char *p; const char *p;
@@ -682,20 +751,24 @@ static int config_lookup(ares_channel channel, const char *str)
p = str; p = str;
while (*p) while (*p)
{ {
if ((*p == 'b' || *p == 'f') && l < lookups + 2) if ((*p == *bindch || *p == *filech) && l < lookups + 2) {
*l++ = *p; if (*p == *bindch) *l++ = 'b';
while (*p && !isspace((unsigned char)*p)) else *l++ = 'f';
p++; }
while (isspace((unsigned char)*p)) while (*p && !isspace((unsigned char)*p) && (*p != ','))
p++; p++;
while (*p && (isspace((unsigned char)*p) || (*p == ',')))
p++;
} }
*l = 0; *l = 0;
channel->lookups = strdup(lookups); channel->lookups = strdup(lookups);
return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM; return (channel->lookups) ? ARES_SUCCESS : ARES_ENOMEM;
} }
#endif
static int config_nameserver(struct server_state **servers, int *nservers, static int config_nameserver(struct server_state **servers, int *nservers,
char *str) char *str)
{ {
struct in_addr addr; struct in_addr addr;
struct server_state *newserv; struct server_state *newserv;
@@ -755,52 +828,88 @@ static int config_nameserver(struct server_state **servers, int *nservers,
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static int config_sortlist(struct apattern **sortlist, int *nsort, static int config_sortlist(struct apattern **sortlist, int *nsort,
const char *str) const char *str)
{ {
struct apattern pat, *newsort; struct apattern pat;
const char *q; const char *q;
/* Add sortlist entries. */ /* Add sortlist entries. */
while (*str && *str != ';') while (*str && *str != ';')
{ {
int bits;
char ipbuf[16], ipbufpfx[32];
/* Find just the IP */
q = str; q = str;
while (*q && *q != '/' && *q != ';' && !isspace((unsigned char)*q)) while (*q && *q != '/' && *q != ';' && !isspace((unsigned char)*q))
q++; q++;
if (ip_addr(str, (int)(q - str), &pat.addr) == 0) memcpy(ipbuf, str, (int)(q-str));
{ ipbuf[(int)(q-str)] = 0;
/* We have a pattern address; now determine the mask. */ /* Find the prefix */
if (*q == '/') if (*q == '/')
{ {
str = q + 1; const char *str2 = q+1;
while (*q && *q != ';' && !isspace((unsigned char)*q)) while (*q && *q != ';' && !isspace((unsigned char)*q))
q++; q++;
if (ip_addr(str, (int)(q - str), &pat.mask) != 0) memcpy(ipbufpfx, str, (int)(q-str));
natural_mask(&pat); ipbufpfx[(int)(q-str)] = 0;
} str = str2;
else }
natural_mask(&pat);
/* Add this pattern to our list. */
newsort = realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern));
if (!newsort)
return ARES_ENOMEM;
newsort[*nsort] = pat;
*sortlist = newsort;
(*nsort)++;
}
else else
{ ipbufpfx[0] = 0;
while (*q && *q != ';' && !isspace((unsigned char)*q)) /* Lets see if it is CIDR */
q++; /* First we'll try IPv6 */
} if ((bits = ares_inet_net_pton(AF_INET6, ipbufpfx ? ipbufpfx : ipbuf,
&pat.addr.addr6,
sizeof(pat.addr.addr6))) > 0)
{
pat.type = PATTERN_CIDR;
pat.mask.bits = bits;
pat.family = AF_INET6;
if (!sortlist_alloc(sortlist, nsort, &pat))
return ARES_ENOMEM;
}
if (ipbufpfx &&
(bits = ares_inet_net_pton(AF_INET, ipbufpfx, &pat.addr.addr4,
sizeof(pat.addr.addr4))) > 0)
{
pat.type = PATTERN_CIDR;
pat.mask.bits = bits;
pat.family = AF_INET;
if (!sortlist_alloc(sortlist, nsort, &pat))
return ARES_ENOMEM;
}
/* See if it is just a regular IP */
else if (ip_addr(ipbuf, (int)(q-str), &pat.addr.addr4) == 0)
{
if (ipbufpfx)
{
memcpy(ipbuf, str, (int)(q-str));
ipbuf[(int)(q-str)] = 0;
if (ip_addr(ipbuf, (int)(q - str), &pat.mask.addr.addr4) != 0)
natural_mask(&pat);
}
else
natural_mask(&pat);
pat.family = AF_INET;
pat.type = PATTERN_MASK;
if (!sortlist_alloc(sortlist, nsort, &pat))
return ARES_ENOMEM;
}
else
{
while (*q && *q != ';' && !isspace((unsigned char)*q))
q++;
}
str = q; str = q;
while (isspace((unsigned char)*str)) while (isspace((unsigned char)*str))
str++; str++;
} }
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#endif
static int set_search(ares_channel channel, const char *str) static int set_search(ares_channel channel, const char *str)
{ {
@@ -821,9 +930,9 @@ static int set_search(ares_channel channel, const char *str)
while (*p) while (*p)
{ {
while (*p && !isspace((unsigned char)*p)) while (*p && !isspace((unsigned char)*p))
p++; p++;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
n++; n++;
} }
@@ -839,15 +948,15 @@ static int set_search(ares_channel channel, const char *str)
channel->ndomains = n; channel->ndomains = n;
q = p; q = p;
while (*q && !isspace((unsigned char)*q)) while (*q && !isspace((unsigned char)*q))
q++; q++;
channel->domains[n] = malloc(q - p + 1); channel->domains[n] = malloc(q - p + 1);
if (!channel->domains[n]) if (!channel->domains[n])
return ARES_ENOMEM; return ARES_ENOMEM;
memcpy(channel->domains[n], p, q - p); memcpy(channel->domains[n], p, q - p);
channel->domains[n][q - p] = 0; channel->domains[n][q - p] = 0;
p = q; p = q;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
n++; n++;
} }
channel->ndomains = n; channel->ndomains = n;
@@ -864,24 +973,25 @@ static int set_options(ares_channel channel, const char *str)
{ {
q = p; q = p;
while (*q && !isspace((unsigned char)*q)) while (*q && !isspace((unsigned char)*q))
q++; q++;
val = try_option(p, q, "ndots:"); val = try_option(p, q, "ndots:");
if (val && channel->ndots == -1) if (val && channel->ndots == -1)
channel->ndots = atoi(val); channel->ndots = atoi(val);
val = try_option(p, q, "retrans:"); val = try_option(p, q, "retrans:");
if (val && channel->timeout == -1) if (val && channel->timeout == -1)
channel->timeout = atoi(val); channel->timeout = atoi(val);
val = try_option(p, q, "retry:"); val = try_option(p, q, "retry:");
if (val && channel->tries == -1) if (val && channel->tries == -1)
channel->tries = atoi(val); channel->tries = atoi(val);
p = q; p = q;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
} }
return ARES_SUCCESS; return ARES_SUCCESS;
} }
#ifndef WIN32
static char *try_config(char *s, const char *opt) static char *try_config(char *s, const char *opt)
{ {
size_t len; size_t len;
@@ -895,21 +1005,34 @@ static char *try_config(char *s, const char *opt)
return s; return s;
} }
#endif
static const char *try_option(const char *p, const char *q, const char *opt) static const char *try_option(const char *p, const char *q, const char *opt)
{ {
size_t len = strlen(opt); size_t len = strlen(opt);
return ((size_t)(q - p) > len && !strncmp(p, opt, len)) ? &p[len] : NULL; return ((size_t)(q - p) > len && !strncmp(p, opt, len)) ? &p[len] : NULL;
} }
static int ip_addr(const char *s, int len, struct in_addr *addr) #ifndef WIN32
static int sortlist_alloc(struct apattern **sortlist, int *nsort,
struct apattern *pat)
{
struct apattern *newsort;
newsort = realloc(*sortlist, (*nsort + 1) * sizeof(struct apattern));
if (!newsort)
return 0;
newsort[*nsort] = *pat;
*sortlist = newsort;
(*nsort)++;
return 1;
}
static int ip_addr(const char *ipbuf, int len, struct in_addr *addr)
{ {
char ipbuf[16];
/* Four octets and three periods yields at most 15 characters. */ /* Four octets and three periods yields at most 15 characters. */
if (len > 15) if (len > 15)
return -1; return -1;
memcpy(ipbuf, s, len);
ipbuf[len] = 0;
addr->s_addr = inet_addr(ipbuf); addr->s_addr = inet_addr(ipbuf);
if (addr->s_addr == INADDR_NONE && strcmp(ipbuf, "255.255.255.255") != 0) if (addr->s_addr == INADDR_NONE && strcmp(ipbuf, "255.255.255.255") != 0)
@@ -924,15 +1047,16 @@ static void natural_mask(struct apattern *pat)
/* Store a host-byte-order copy of pat in a struct in_addr. Icky, /* Store a host-byte-order copy of pat in a struct in_addr. Icky,
* but portable. * but portable.
*/ */
addr.s_addr = ntohl(pat->addr.s_addr); addr.s_addr = ntohl(pat->addr.addr4.s_addr);
/* This is out of date in the CIDR world, but some people might /* This is out of date in the CIDR world, but some people might
* still rely on it. * still rely on it.
*/ */
if (IN_CLASSA(addr.s_addr)) if (IN_CLASSA(addr.s_addr))
pat->mask.s_addr = htonl(IN_CLASSA_NET); pat->mask.addr.addr4.s_addr = htonl(IN_CLASSA_NET);
else if (IN_CLASSB(addr.s_addr)) else if (IN_CLASSB(addr.s_addr))
pat->mask.s_addr = htonl(IN_CLASSB_NET); pat->mask.addr.addr4.s_addr = htonl(IN_CLASSB_NET);
else else
pat->mask.s_addr = htonl(IN_CLASSC_NET); pat->mask.addr.addr4.s_addr = htonl(IN_CLASSC_NET);
} }
#endif

81
ares/ares_ipv6.h Normal file
View File

@@ -0,0 +1,81 @@
/* $Id$ */
/*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef ARES_IPV6_H
#define ARES_IPV6_H
#ifndef HAVE_PF_INET6
#define PF_INET6 AF_INET6
#endif
#ifndef HAVE_STRUCT_IN6_ADDR
struct in6_addr
{
unsigned char s6_addr[16];
};
#endif
#ifndef HAVE_STRUCT_SOCKADDR_IN6
struct sockaddr_in6
{
unsigned short sin6_family;
unsigned short sin6_port;
unsigned long sin6_flowinfo;
struct in6_addr sin6_addr;
unsigned int sin6_scope_id;
};
#endif
#ifndef HAVE_STRUCT_ADDRINFO
struct addrinfo
{
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
size_t ai_addrlen;
char *ai_cannonname;
struct sockaddr *ai_addr;
struct addrinfo *ai_next;
};
#endif
#ifndef NS_IN6ADDRSZ
#if SIZEOF_STRUCT_IN6_ADDR == 0
/* We cannot have it set to zero, so we pick a fixed value here */
#define NS_IN6ADDRSZ 16
#else
#define NS_IN6ADDRSZ SIZEOF_STRUCT_IN6_ADDR
#endif
#endif
#ifndef NS_INADDRSZ
#define NS_INADDRSZ SIZEOF_STRUCT_IN_ADDR
#endif
#ifndef NS_INT16SZ
#define NS_INT16SZ 2
#endif
#ifndef IF_NAMESIZE
#ifdef IFNAMSIZ
#define IF_NAMESIZE IFNAMSIZ
#else
#define IF_NAMESIZE 256
#endif
#endif
#endif /* ARES_IPV6_H */

View File

@@ -16,11 +16,14 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -47,15 +50,15 @@
* *
* AA, TC, RA, and RCODE are only set in responses. Brief description * AA, TC, RA, and RCODE are only set in responses. Brief description
* of the remaining fields: * of the remaining fields:
* ID Identifier to match responses with queries * ID Identifier to match responses with queries
* QR Query (0) or response (1) * QR Query (0) or response (1)
* Opcode For our purposes, always QUERY * Opcode For our purposes, always QUERY
* RD Recursion desired * RD Recursion desired
* Z Reserved (zero) * Z Reserved (zero)
* QDCOUNT Number of queries * QDCOUNT Number of queries
* ANCOUNT Number of answers * ANCOUNT Number of answers
* NSCOUNT Number of name server records * NSCOUNT Number of name server records
* ARCOUNT Number of additional records * ARCOUNT Number of additional records
* *
* Question format, from RFC 1035: * Question format, from RFC 1035:
* 1 1 1 1 1 1 * 1 1 1 1 1 1
@@ -77,7 +80,7 @@
*/ */
int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id, int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
int rd, unsigned char **buf, int *buflen) int rd, unsigned char **buf, int *buflen)
{ {
int len; int len;
unsigned char *q; unsigned char *q;
@@ -89,7 +92,7 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
for (p = name; *p; p++) for (p = name; *p; p++)
{ {
if (*p == '\\' && *(p + 1) != 0) if (*p == '\\' && *(p + 1) != 0)
p++; p++;
len++; len++;
} }
/* If there are n periods in the name, there are n + 1 labels, and /* If there are n periods in the name, there are n + 1 labels, and
@@ -121,31 +124,31 @@ int ares_mkquery(const char *name, int dnsclass, int type, unsigned short id,
while (*name) while (*name)
{ {
if (*name == '.') if (*name == '.')
return ARES_EBADNAME; return ARES_EBADNAME;
/* Count the number of bytes in this label. */ /* Count the number of bytes in this label. */
len = 0; len = 0;
for (p = name; *p && *p != '.'; p++) for (p = name; *p && *p != '.'; p++)
{ {
if (*p == '\\' && *(p + 1) != 0) if (*p == '\\' && *(p + 1) != 0)
p++; p++;
len++; len++;
} }
if (len > MAXLABEL) if (len > MAXLABEL)
return ARES_EBADNAME; return ARES_EBADNAME;
/* Encode the length and copy the data. */ /* Encode the length and copy the data. */
*q++ = len; *q++ = len;
for (p = name; *p && *p != '.'; p++) for (p = name; *p && *p != '.'; p++)
{ {
if (*p == '\\' && *(p + 1) != 0) if (*p == '\\' && *(p + 1) != 0)
p++; p++;
*q++ = *p; *q++ = *p;
} }
/* Go to the next label and repeat, unless we hit the end. */ /* Go to the next label and repeat, unless we hit the end. */
if (!*p) if (!*p)
break; break;
name = p + 1; name = p + 1;
} }

View File

@@ -16,7 +16,7 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <sys/socket.h> #include <sys/socket.h>
@@ -24,6 +24,9 @@
#include <arpa/inet.h> #include <arpa/inet.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -33,7 +36,7 @@
#include "ares_private.h" #include "ares_private.h"
int ares_parse_a_reply(const unsigned char *abuf, int alen, int ares_parse_a_reply(const unsigned char *abuf, int alen,
struct hostent **host) struct hostent **host)
{ {
unsigned int qdcount, ancount; unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs; int status, i, rr_type, rr_class, rr_len, naddrs;
@@ -92,49 +95,49 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
/* Decode the RR up to the data field. */ /* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len); status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
aptr += len; aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen) if (aptr + RRFIXEDSZ > abuf + alen)
{ {
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
rr_type = DNS_RR_TYPE(aptr); rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr); rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr); rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ; aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_A if (rr_class == C_IN && rr_type == T_A
&& rr_len == sizeof(struct in_addr) && rr_len == sizeof(struct in_addr)
&& strcasecmp(rr_name, hostname) == 0) && strcasecmp(rr_name, hostname) == 0)
{ {
memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr)); memcpy(&addrs[naddrs], aptr, sizeof(struct in_addr));
naddrs++; naddrs++;
status = ARES_SUCCESS; status = ARES_SUCCESS;
} }
if (rr_class == C_IN && rr_type == T_CNAME) if (rr_class == C_IN && rr_type == T_CNAME)
{ {
/* Record the RR name as an alias. */ /* Record the RR name as an alias. */
aliases[naliases] = rr_name; aliases[naliases] = rr_name;
naliases++; naliases++;
/* Decode the RR data and replace the hostname with it. */ /* Decode the RR data and replace the hostname with it. */
status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
free(hostname); free(hostname);
hostname = rr_data; hostname = rr_data;
} }
else else
free(rr_name); free(rr_name);
aptr += rr_len; aptr += rr_len;
if (aptr > abuf + alen) if (aptr > abuf + alen)
{ {
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
} }
if (status == ARES_SUCCESS && naddrs == 0) if (status == ARES_SUCCESS && naddrs == 0)
@@ -145,23 +148,23 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
aliases[naliases] = NULL; aliases[naliases] = NULL;
hostent = malloc(sizeof(struct hostent)); hostent = malloc(sizeof(struct hostent));
if (hostent) if (hostent)
{ {
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *)); hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
if (hostent->h_addr_list) if (hostent->h_addr_list)
{ {
/* Fill in the hostent and return successfully. */ /* Fill in the hostent and return successfully. */
hostent->h_name = hostname; hostent->h_name = hostname;
hostent->h_aliases = aliases; hostent->h_aliases = aliases;
hostent->h_addrtype = AF_INET; hostent->h_addrtype = AF_INET;
hostent->h_length = sizeof(struct in_addr); hostent->h_length = sizeof(struct in_addr);
for (i = 0; i < naddrs; i++) for (i = 0; i < naddrs; i++)
hostent->h_addr_list[i] = (char *) &addrs[i]; hostent->h_addr_list[i] = (char *) &addrs[i];
hostent->h_addr_list[naddrs] = NULL; hostent->h_addr_list[naddrs] = NULL;
*host = hostent; *host = hostent;
return ARES_SUCCESS; return ARES_SUCCESS;
} }
free(hostent); free(hostent);
} }
status = ARES_ENOMEM; status = ARES_ENOMEM;
} }
for (i = 0; i < naliases; i++) for (i = 0; i < naliases; i++)

View File

@@ -0,0 +1,64 @@
.\" $Id$
.\"
.\" Copyright 2005 by Dominick Meglio.
.\"
.\" Permission to use, copy, modify, and distribute this
.\" software and its documentation for any purpose and without
.\" fee is hereby granted, provided that the above copyright
.\" notice appear in all copies and that both that copyright
.\" notice and this permission notice appear in supporting
.\" documentation, and that the name of M.I.T. not be used in
.\" advertising or publicity pertaining to distribution of the
.\" software without specific, written prior permission.
.\" M.I.T. makes no representations about the suitability of
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
.TH ARES_PARSE_AAAA_REPLY 3 "10 March 2005"
.SH NAME
ares_parse_aaaa_reply \- Parse a reply to a DNS query of type AAAA into a hostent
.SH SYNOPSIS
.nf
.B #include <ares.h>
.PP
.B int ares_parse_aaaa_reply(const unsigned char *\fIabuf\fP, int \fIalen\fP,
.B struct hostent **\fIhost\fP);
.fi
.SH DESCRIPTION
The
.B ares_parse_aaaa_reply
function parses the response to a query of type AAAA into a
.BR "struct hostent" .
The parameters
.I abuf
and
.I alen
give the contents of the response. The result is stored in allocated
memory and a pointer to it stored into the variable pointed to by
.IR host .
It is the caller's responsibility to free the resulting host structure
using
.BR ares_free_hostent (3)
when it is no longer needed.
.SH RETURN VALUES
.B ares_parse_aaaa_reply
can return any of the following values:
.TP 15
.B ARES_SUCCESS
The response was successfully parsed.
.TP 15
.B ARES_EBADRESP
The response was malformatted.
.TP 15
.B ARES_ENODATA
The response did not contain an answer to the query.
.TP 15
.B ARES_ENOMEM
Memory was exhausted.
.SH SEE ALSO
.BR ares_gethostbyname (3),
.BR ares_free_hostent (3)
.SH AUTHOR
Dominick Meglio
.br
Copyright 2005 by Dominick Meglio.

View File

@@ -0,0 +1,179 @@
/* Copyright 2005 Dominick Meglio
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#include "setup.h"
#include <sys/types.h>
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif
#include <stdlib.h>
#include <string.h>
#include "ares.h"
#include "ares_dns.h"
#include "inet_net_pton.h"
#include "ares_private.h"
int ares_parse_aaaa_reply(const unsigned char *abuf, int alen,
struct hostent **host)
{
unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len, naddrs;
int naliases;
long len;
const unsigned char *aptr;
char *hostname, *rr_name, *rr_data, **aliases;
struct in6_addr *addrs;
struct hostent *hostent;
/* Set *host to NULL for all failure cases. */
*host = NULL;
/* Give up if abuf doesn't have room for a header. */
if (alen < HFIXEDSZ)
return ARES_EBADRESP;
/* Fetch the question and answer count from the header. */
qdcount = DNS_HEADER_QDCOUNT(abuf);
ancount = DNS_HEADER_ANCOUNT(abuf);
if (qdcount != 1)
return ARES_EBADRESP;
/* Expand the name from the question, and skip past the question. */
aptr = abuf + HFIXEDSZ;
status = ares_expand_name(aptr, abuf, alen, &hostname, &len);
if (status != ARES_SUCCESS)
return status;
if (aptr + len + QFIXEDSZ > abuf + alen)
{
free(hostname);
return ARES_EBADRESP;
}
aptr += len + QFIXEDSZ;
/* Allocate addresses and aliases; ancount gives an upper bound for both. */
addrs = malloc(ancount * sizeof(struct in6_addr));
if (!addrs)
{
free(hostname);
return ARES_ENOMEM;
}
aliases = malloc((ancount + 1) * sizeof(char *));
if (!aliases)
{
free(hostname);
free(addrs);
return ARES_ENOMEM;
}
naddrs = 0;
naliases = 0;
/* Examine each answer resource record (RR) in turn. */
for (i = 0; i < (int)ancount; i++)
{
/* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS)
break;
aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_AAAA
&& rr_len == sizeof(struct in6_addr)
&& strcasecmp(rr_name, hostname) == 0)
{
memcpy(&addrs[naddrs], aptr, sizeof(struct in6_addr));
naddrs++;
status = ARES_SUCCESS;
}
if (rr_class == C_IN && rr_type == T_CNAME)
{
/* Record the RR name as an alias. */
aliases[naliases] = rr_name;
naliases++;
/* Decode the RR data and replace the hostname with it. */
status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
if (status != ARES_SUCCESS)
break;
free(hostname);
hostname = rr_data;
}
else
free(rr_name);
aptr += rr_len;
if (aptr > abuf + alen)
{
status = ARES_EBADRESP;
break;
}
}
if (status == ARES_SUCCESS && naddrs == 0)
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{
/* We got our answer. Allocate memory to build the host entry. */
aliases[naliases] = NULL;
hostent = malloc(sizeof(struct hostent));
if (hostent)
{
hostent->h_addr_list = malloc((naddrs + 1) * sizeof(char *));
if (hostent->h_addr_list)
{
/* Fill in the hostent and return successfully. */
hostent->h_name = hostname;
hostent->h_aliases = aliases;
hostent->h_addrtype = AF_INET6;
hostent->h_length = sizeof(struct in6_addr);
for (i = 0; i < naddrs; i++)
hostent->h_addr_list[i] = (char *) &addrs[i];
hostent->h_addr_list[naddrs] = NULL;
*host = hostent;
return ARES_SUCCESS;
}
free(hostent);
}
status = ARES_ENOMEM;
}
for (i = 0; i < naliases; i++)
free(aliases[i]);
free(aliases);
free(addrs);
free(hostname);
return status;
}

View File

@@ -16,13 +16,16 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -32,7 +35,7 @@
#include "ares_private.h" #include "ares_private.h"
int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr, int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
int addrlen, int family, struct hostent **host) int addrlen, int family, struct hostent **host)
{ {
unsigned int qdcount, ancount; unsigned int qdcount, ancount;
int status, i, rr_type, rr_class, rr_len; int status, i, rr_type, rr_class, rr_len;
@@ -73,47 +76,47 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* Decode the RR up to the data field. */ /* Decode the RR up to the data field. */
status = ares_expand_name(aptr, abuf, alen, &rr_name, &len); status = ares_expand_name(aptr, abuf, alen, &rr_name, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
aptr += len; aptr += len;
if (aptr + RRFIXEDSZ > abuf + alen) if (aptr + RRFIXEDSZ > abuf + alen)
{ {
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
rr_type = DNS_RR_TYPE(aptr); rr_type = DNS_RR_TYPE(aptr);
rr_class = DNS_RR_CLASS(aptr); rr_class = DNS_RR_CLASS(aptr);
rr_len = DNS_RR_LEN(aptr); rr_len = DNS_RR_LEN(aptr);
aptr += RRFIXEDSZ; aptr += RRFIXEDSZ;
if (rr_class == C_IN && rr_type == T_PTR if (rr_class == C_IN && rr_type == T_PTR
&& strcasecmp(rr_name, ptrname) == 0) && strcasecmp(rr_name, ptrname) == 0)
{ {
/* Decode the RR data and set hostname to it. */ /* Decode the RR data and set hostname to it. */
status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
if (hostname) if (hostname)
free(hostname); free(hostname);
hostname = rr_data; hostname = rr_data;
} }
if (rr_class == C_IN && rr_type == T_CNAME) if (rr_class == C_IN && rr_type == T_CNAME)
{ {
/* Decode the RR data and replace ptrname with it. */ /* Decode the RR data and replace ptrname with it. */
status = ares_expand_name(aptr, abuf, alen, &rr_data, &len); status = ares_expand_name(aptr, abuf, alen, &rr_data, &len);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
break; break;
free(ptrname); free(ptrname);
ptrname = rr_data; ptrname = rr_data;
} }
free(rr_name); free(rr_name);
aptr += rr_len; aptr += rr_len;
if (aptr > abuf + alen) if (aptr > abuf + alen)
{ {
status = ARES_EBADRESP; status = ARES_EBADRESP;
break; break;
} }
} }
if (status == ARES_SUCCESS && !hostname) if (status == ARES_SUCCESS && !hostname)
@@ -123,33 +126,33 @@ int ares_parse_ptr_reply(const unsigned char *abuf, int alen, const void *addr,
/* We got our answer. Allocate memory to build the host entry. */ /* We got our answer. Allocate memory to build the host entry. */
hostent = malloc(sizeof(struct hostent)); hostent = malloc(sizeof(struct hostent));
if (hostent) if (hostent)
{ {
hostent->h_addr_list = malloc(2 * sizeof(char *)); hostent->h_addr_list = malloc(2 * sizeof(char *));
if (hostent->h_addr_list) if (hostent->h_addr_list)
{ {
hostent->h_addr_list[0] = malloc(addrlen); hostent->h_addr_list[0] = malloc(addrlen);
if (hostent->h_addr_list[0]) if (hostent->h_addr_list[0])
{ {
hostent->h_aliases = malloc(sizeof (char *)); hostent->h_aliases = malloc(sizeof (char *));
if (hostent->h_aliases) if (hostent->h_aliases)
{ {
/* Fill in the hostent and return successfully. */ /* Fill in the hostent and return successfully. */
hostent->h_name = hostname; hostent->h_name = hostname;
hostent->h_aliases[0] = NULL; hostent->h_aliases[0] = NULL;
hostent->h_addrtype = family; hostent->h_addrtype = family;
hostent->h_length = addrlen; hostent->h_length = addrlen;
memcpy(hostent->h_addr_list[0], addr, addrlen); memcpy(hostent->h_addr_list[0], addr, addrlen);
hostent->h_addr_list[1] = NULL; hostent->h_addr_list[1] = NULL;
*host = hostent; *host = hostent;
free(ptrname); free(ptrname);
return ARES_SUCCESS; return ARES_SUCCESS;
} }
free(hostent->h_addr_list[0]); free(hostent->h_addr_list[0]);
} }
free(hostent->h_addr_list); free(hostent->h_addr_list);
} }
free(hostent); free(hostent);
} }
status = ARES_ENOMEM; status = ARES_ENOMEM;
} }
if (hostname) if (hostname)

View File

@@ -18,9 +18,7 @@
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if !defined(WIN32) || defined(WATT32)
#else
#include <netinet/in.h> #include <netinet/in.h>
/* We define closesocket() here so that we can use this function all over /* We define closesocket() here so that we can use this function all over
the source code for closing sockets. */ the source code for closing sockets. */
@@ -35,21 +33,25 @@
#define writev(s,v,c) writev_s(s,v,c) #define writev(s,v,c) writev_s(s,v,c)
#endif #endif
#define DEFAULT_TIMEOUT 5 #ifdef NETWARE
#define DEFAULT_TRIES 4 #include <time.h>
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif #endif
#ifdef WIN32 #define DEFAULT_TIMEOUT 5
#define DEFAULT_TRIES 4
#ifndef INADDR_NONE
#define INADDR_NONE 0xffffffff
#endif
#define IsNT ((int)GetVersion()>0) #if defined(WIN32) && !defined(WATT32)
#define IS_NT() ((int)GetVersion() > 0)
#define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP" #define WIN_NS_9X "System\\CurrentControlSet\\Services\\VxD\\MSTCP"
#define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters" #define WIN_NS_NT_KEY "System\\CurrentControlSet\\Services\\Tcpip\\Parameters"
#define NAMESERVER "NameServer" #define NAMESERVER "NameServer"
#define DHCPNAMESERVER "DhcpNameServer" #define DHCPNAMESERVER "DhcpNameServer"
#define PATH_HOSTS_NT "\\drivers\\etc\\hosts" #define DATABASEPATH "DatabasePath"
#define PATH_HOSTS_9X "\\hosts" #define WIN_PATH_HOSTS "\\hosts"
#elif defined(WATT32) #elif defined(WATT32)
@@ -58,19 +60,21 @@
#elif defined(NETWARE) #elif defined(NETWARE)
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg" #define PATH_RESOLV_CONF "sys:/etc/resolv.cfg"
#define PATH_HOSTS "sys:/etc/hosts" #define PATH_HOSTS "sys:/etc/hosts"
#else #else
#define PATH_RESOLV_CONF "/etc/resolv.conf" #define PATH_RESOLV_CONF "/etc/resolv.conf"
#ifdef ETC_INET #ifdef ETC_INET
#define PATH_HOSTS "/etc/inet/hosts" #define PATH_HOSTS "/etc/inet/hosts"
#else #else
#define PATH_HOSTS "/etc/hosts" #define PATH_HOSTS "/etc/hosts"
#endif #endif
#endif #endif
#include "ares_ipv6.h"
struct send_request { struct send_request {
/* Remaining data to send */ /* Remaining data to send */
const unsigned char *data; const unsigned char *data;
@@ -126,9 +130,23 @@ struct query {
}; };
/* An IP address pattern; matches an IP address X if X & mask == addr */ /* An IP address pattern; matches an IP address X if X & mask == addr */
#define PATTERN_MASK 0x1
#define PATTERN_CIDR 0x2
union ares_addr {
struct in_addr addr4;
struct in6_addr addr6;
};
struct apattern { struct apattern {
struct in_addr addr; union ares_addr addr;
struct in_addr mask; union
{
union ares_addr addr;
unsigned short bits;
} mask;
int family;
unsigned short type;
}; };
struct ares_channeldata { struct ares_channeldata {
@@ -158,7 +176,7 @@ struct ares_channeldata {
void ares__send_query(ares_channel channel, struct query *query, time_t now); void ares__send_query(ares_channel channel, struct query *query, time_t now);
void ares__close_sockets(struct server_state *server); void ares__close_sockets(struct server_state *server);
int ares__get_hostent(FILE *fp, struct hostent **host); int ares__get_hostent(FILE *fp, int family, struct hostent **host);
int ares__read_line(FILE *fp, char **buf, int *bufsize); int ares__read_line(FILE *fp, char **buf, int *bufsize);
#ifdef CURLDEBUG #ifdef CURLDEBUG

View File

@@ -16,48 +16,68 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <sys/socket.h> #include <sys/socket.h>
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h> #include <sys/uio.h>
#endif
#include <netinet/in.h> #include <netinet/in.h>
#include <netdb.h> #include <netdb.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#ifdef NETWARE
#include <sys/filio.h>
#endif
#endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include "ares.h" #include "ares.h"
#include "ares_dns.h" #include "ares_dns.h"
#include "ares_private.h" #include "ares_private.h"
#ifdef WIN32 #ifndef TRUE
/* at least Solaris 7 does not have TRUE at this point */
#define TRUE 1
#endif
#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS)
#define GET_ERRNO() WSAGetLastError() #define GET_ERRNO() WSAGetLastError()
#else #else
#define GET_ERRNO() errno #define GET_ERRNO() errno
#endif #endif
static void write_tcp_data(ares_channel channel, fd_set *write_fds, static void write_tcp_data(ares_channel channel, fd_set *write_fds,
time_t now); time_t now);
static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now); static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now);
static void read_udp_packets(ares_channel channel, fd_set *read_fds, static void read_udp_packets(ares_channel channel, fd_set *read_fds,
time_t now); time_t now);
static void process_timeouts(ares_channel channel, time_t now); static void process_timeouts(ares_channel channel, time_t now);
static void process_answer(ares_channel channel, unsigned char *abuf, static void process_answer(ares_channel channel, unsigned char *abuf,
int alen, int whichserver, int tcp, int now); int alen, int whichserver, int tcp, int now);
static void handle_error(ares_channel channel, int whichserver, time_t now); static void handle_error(ares_channel channel, int whichserver, time_t now);
static struct query *next_server(ares_channel channel, struct query *query, time_t now); static struct query *next_server(ares_channel channel, struct query *query, time_t now);
static int open_tcp_socket(ares_channel channel, struct server_state *server); static int open_tcp_socket(ares_channel channel, struct server_state *server);
static int open_udp_socket(ares_channel channel, struct server_state *server); static int open_udp_socket(ares_channel channel, struct server_state *server);
static int same_questions(const unsigned char *qbuf, int qlen, static int same_questions(const unsigned char *qbuf, int qlen,
const unsigned char *abuf, int alen); const unsigned char *abuf, int alen);
static struct query *end_query(ares_channel channel, struct query *query, int status, static struct query *end_query(ares_channel channel, struct query *query, int status,
unsigned char *abuf, int alen); unsigned char *abuf, int alen);
/* Something interesting happened on the wire, or there was a timeout. /* Something interesting happened on the wire, or there was a timeout.
* See what's up and respond accordingly. * See what's up and respond accordingly.
@@ -91,81 +111,81 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
/* Make sure server has data to send and is selected in write_fds. */ /* Make sure server has data to send and is selected in write_fds. */
server = &channel->servers[i]; server = &channel->servers[i];
if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD
|| !FD_ISSET(server->tcp_socket, write_fds)) || !FD_ISSET(server->tcp_socket, write_fds))
continue; continue;
/* Count the number of send queue items. */ /* Count the number of send queue items. */
n = 0; n = 0;
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
n++; n++;
/* Allocate iovecs so we can send all our data at once. */ /* Allocate iovecs so we can send all our data at once. */
vec = malloc(n * sizeof(struct iovec)); vec = malloc(n * sizeof(struct iovec));
if (vec) if (vec)
{ {
/* Fill in the iovecs and send. */ /* Fill in the iovecs and send. */
n = 0; n = 0;
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next) for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
{ {
vec[n].iov_base = (char *) sendreq->data; vec[n].iov_base = (char *) sendreq->data;
vec[n].iov_len = sendreq->len; vec[n].iov_len = sendreq->len;
n++; n++;
} }
wcount = writev(server->tcp_socket, vec, n); wcount = writev(server->tcp_socket, vec, n);
free(vec); free(vec);
if (wcount < 0) if (wcount < 0)
{ {
handle_error(channel, i, now); handle_error(channel, i, now);
continue; continue;
} }
/* Advance the send queue by as many bytes as we sent. */ /* Advance the send queue by as many bytes as we sent. */
while (wcount) while (wcount)
{ {
sendreq = server->qhead; sendreq = server->qhead;
if ((size_t)wcount >= sendreq->len) if ((size_t)wcount >= sendreq->len)
{ {
wcount -= sendreq->len; wcount -= sendreq->len;
server->qhead = sendreq->next; server->qhead = sendreq->next;
if (server->qhead == NULL) if (server->qhead == NULL)
server->qtail = NULL; server->qtail = NULL;
free(sendreq); free(sendreq);
} }
else else
{ {
sendreq->data += wcount; sendreq->data += wcount;
sendreq->len -= wcount; sendreq->len -= wcount;
break; break;
} }
} }
} }
else else
{ {
/* Can't allocate iovecs; just send the first request. */ /* Can't allocate iovecs; just send the first request. */
sendreq = server->qhead; sendreq = server->qhead;
scount = send(server->tcp_socket, sendreq->data, sendreq->len, 0); scount = send(server->tcp_socket, sendreq->data, sendreq->len, 0);
if (scount < 0) if (scount < 0)
{ {
handle_error(channel, i, now); handle_error(channel, i, now);
continue; continue;
} }
/* Advance the send queue by as many bytes as we sent. */ /* Advance the send queue by as many bytes as we sent. */
if ((size_t)scount == sendreq->len) if ((size_t)scount == sendreq->len)
{ {
server->qhead = sendreq->next; server->qhead = sendreq->next;
if (server->qhead == NULL) if (server->qhead == NULL)
server->qtail = NULL; server->qtail = NULL;
free(sendreq); free(sendreq);
} }
else else
{ {
sendreq->data += scount; sendreq->data += scount;
sendreq->len -= scount; sendreq->len -= scount;
} }
} }
} }
} }
@@ -184,67 +204,68 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
server = &channel->servers[i]; server = &channel->servers[i];
if (server->tcp_socket == ARES_SOCKET_BAD || if (server->tcp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->tcp_socket, read_fds)) !FD_ISSET(server->tcp_socket, read_fds))
continue; continue;
if (server->tcp_lenbuf_pos != 2) if (server->tcp_lenbuf_pos != 2)
{ {
/* We haven't yet read a length word, so read that (or /* We haven't yet read a length word, so read that (or
* what's left to read of it). * what's left to read of it).
*/ */
count = recv(server->tcp_socket, count = recv(server->tcp_socket,
server->tcp_lenbuf + server->tcp_buffer_pos, server->tcp_lenbuf + server->tcp_buffer_pos,
2 - server->tcp_buffer_pos, 0); 2 - server->tcp_buffer_pos, 0);
if (count <= 0) if (count <= 0)
{ {
handle_error(channel, i, now); handle_error(channel, i, now);
continue; continue;
} }
server->tcp_lenbuf_pos += count; server->tcp_lenbuf_pos += count;
if (server->tcp_lenbuf_pos == 2) if (server->tcp_lenbuf_pos == 2)
{ {
/* We finished reading the length word. Decode the /* We finished reading the length word. Decode the
* length and allocate a buffer for the data. * length and allocate a buffer for the data.
*/ */
server->tcp_length = server->tcp_lenbuf[0] << 8 server->tcp_length = server->tcp_lenbuf[0] << 8
| server->tcp_lenbuf[1]; | server->tcp_lenbuf[1];
server->tcp_buffer = malloc(server->tcp_length); server->tcp_buffer = malloc(server->tcp_length);
if (!server->tcp_buffer) if (!server->tcp_buffer)
handle_error(channel, i, now); handle_error(channel, i, now);
server->tcp_buffer_pos = 0; server->tcp_buffer_pos = 0;
} }
} }
else else
{ {
/* Read data into the allocated buffer. */ /* Read data into the allocated buffer. */
count = recv(server->tcp_socket, count = recv(server->tcp_socket,
server->tcp_buffer + server->tcp_buffer_pos, server->tcp_buffer + server->tcp_buffer_pos,
server->tcp_length - server->tcp_buffer_pos, 0); server->tcp_length - server->tcp_buffer_pos, 0);
if (count <= 0) if (count <= 0)
{ {
handle_error(channel, i, now); handle_error(channel, i, now);
continue; continue;
} }
server->tcp_buffer_pos += count; server->tcp_buffer_pos += count;
if (server->tcp_buffer_pos == server->tcp_length) if (server->tcp_buffer_pos == server->tcp_length)
{ {
/* We finished reading this answer; process it and /* We finished reading this answer; process it and
* prepare to read another length word. * prepare to read another length word.
*/ */
process_answer(channel, server->tcp_buffer, server->tcp_length, process_answer(channel, server->tcp_buffer, server->tcp_length,
i, 1, now); i, 1, now);
free(server->tcp_buffer); if (server->tcp_buffer)
server->tcp_buffer = NULL; free(server->tcp_buffer);
server->tcp_lenbuf_pos = 0; server->tcp_buffer = NULL;
} server->tcp_lenbuf_pos = 0;
} }
}
} }
} }
/* If any UDP sockets select true for reading, process them. */ /* If any UDP sockets select true for reading, process them. */
static void read_udp_packets(ares_channel channel, fd_set *read_fds, static void read_udp_packets(ares_channel channel, fd_set *read_fds,
time_t now) time_t now)
{ {
struct server_state *server; struct server_state *server;
int i, count; int i, count;
@@ -257,11 +278,11 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
if (server->udp_socket == ARES_SOCKET_BAD || if (server->udp_socket == ARES_SOCKET_BAD ||
!FD_ISSET(server->udp_socket, read_fds)) !FD_ISSET(server->udp_socket, read_fds))
continue; continue;
count = recv(server->udp_socket, buf, sizeof(buf), 0); count = recv(server->udp_socket, buf, sizeof(buf), 0);
if (count <= 0) if (count <= 0)
handle_error(channel, i, now); handle_error(channel, i, now);
process_answer(channel, buf, count, i, 0, now); process_answer(channel, buf, count, i, 0, now);
} }
@@ -276,16 +297,16 @@ static void process_timeouts(ares_channel channel, time_t now)
{ {
next = query->next; next = query->next;
if (query->timeout != 0 && now >= query->timeout) if (query->timeout != 0 && now >= query->timeout)
{ {
query->error_status = ARES_ETIMEOUT; query->error_status = ARES_ETIMEOUT;
next = next_server(channel, query, now); next = next_server(channel, query, now);
} }
} }
} }
/* Handle an answer from a server. */ /* Handle an answer from a server. */
static void process_answer(ares_channel channel, unsigned char *abuf, static void process_answer(ares_channel channel, unsigned char *abuf,
int alen, int whichserver, int tcp, int now) int alen, int whichserver, int tcp, int now)
{ {
int id, tc, rcode; int id, tc, rcode;
struct query *query; struct query *query;
@@ -304,7 +325,7 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
for (query = channel->queries; query; query = query->next) for (query = channel->queries; query; query = query->next)
{ {
if (query->qid == id) if (query->qid == id)
break; break;
} }
if (!query) if (!query)
return; return;
@@ -316,10 +337,10 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
if ((tc || alen > PACKETSZ) && !tcp && !(channel->flags & ARES_FLAG_IGNTC)) if ((tc || alen > PACKETSZ) && !tcp && !(channel->flags & ARES_FLAG_IGNTC))
{ {
if (!query->using_tcp) if (!query->using_tcp)
{ {
query->using_tcp = 1; query->using_tcp = 1;
ares__send_query(channel, query, now); ares__send_query(channel, query, now);
} }
return; return;
} }
@@ -335,18 +356,18 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
if (!(channel->flags & ARES_FLAG_NOCHECKRESP)) if (!(channel->flags & ARES_FLAG_NOCHECKRESP))
{ {
if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED) if (rcode == SERVFAIL || rcode == NOTIMP || rcode == REFUSED)
{ {
query->skip_server[whichserver] = 1; query->skip_server[whichserver] = 1;
if (query->server == whichserver) if (query->server == whichserver)
next_server(channel, query, now); next_server(channel, query, now);
return; return;
} }
if (!same_questions(query->qbuf, query->qlen, abuf, alen)) if (!same_questions(query->qbuf, query->qlen, abuf, alen))
{ {
if (query->server == whichserver) if (query->server == whichserver)
next_server(channel, query, now); next_server(channel, query, now);
return; return;
} }
} }
end_query(channel, query, ARES_SUCCESS, abuf, alen); end_query(channel, query, ARES_SUCCESS, abuf, alen);
@@ -367,10 +388,10 @@ static void handle_error(ares_channel channel, int whichserver, time_t now)
{ {
next = query->next; next = query->next;
if (query->server == whichserver) if (query->server == whichserver)
{ {
query->skip_server[whichserver] = 1; query->skip_server[whichserver] = 1;
next = next_server(channel, query, now); next = next_server(channel, query, now);
} }
} }
} }
@@ -381,18 +402,18 @@ static struct query *next_server(ares_channel channel, struct query *query, time
for (; query->try < channel->tries; query->try++) for (; query->try < channel->tries; query->try++)
{ {
for (; query->server < channel->nservers; query->server++) for (; query->server < channel->nservers; query->server++)
{ {
if (!query->skip_server[query->server]) if (!query->skip_server[query->server])
{ {
ares__send_query(channel, query, now); ares__send_query(channel, query, now);
return (query->next); return (query->next);
} }
} }
query->server = 0; query->server = 0;
/* Only one try if we're using TCP. */ /* Only one try if we're using TCP. */
if (query->using_tcp) if (query->using_tcp)
break; break;
} }
return end_query(channel, query, query->error_status, NULL, 0); return end_query(channel, query, query->error_status, NULL, 0);
} }
@@ -409,57 +430,124 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
* a send request. * a send request.
*/ */
if (server->tcp_socket == ARES_SOCKET_BAD) if (server->tcp_socket == ARES_SOCKET_BAD)
{ {
if (open_tcp_socket(channel, server) == -1) if (open_tcp_socket(channel, server) == -1)
{ {
query->skip_server[query->server] = 1; query->skip_server[query->server] = 1;
next_server(channel, query, now); next_server(channel, query, now);
return; return;
} }
} }
sendreq = calloc(sizeof(struct send_request), 1); sendreq = calloc(sizeof(struct send_request), 1);
if (!sendreq) if (!sendreq)
{ {
end_query(channel, query, ARES_ENOMEM, NULL, 0); end_query(channel, query, ARES_ENOMEM, NULL, 0);
return; return;
} }
sendreq->data = query->tcpbuf; sendreq->data = query->tcpbuf;
sendreq->len = query->tcplen; sendreq->len = query->tcplen;
sendreq->next = NULL; sendreq->next = NULL;
if (server->qtail) if (server->qtail)
server->qtail->next = sendreq; server->qtail->next = sendreq;
else else
server->qhead = sendreq; server->qhead = sendreq;
server->qtail = sendreq; server->qtail = sendreq;
query->timeout = 0; query->timeout = 0;
} }
else else
{ {
if (server->udp_socket == ARES_SOCKET_BAD) if (server->udp_socket == ARES_SOCKET_BAD)
{ {
if (open_udp_socket(channel, server) == -1) if (open_udp_socket(channel, server) == -1)
{ {
query->skip_server[query->server] = 1; query->skip_server[query->server] = 1;
next_server(channel, query, now); next_server(channel, query, now);
return; return;
} }
} }
if (send(server->udp_socket, query->qbuf, query->qlen, 0) == -1) if (send(server->udp_socket, query->qbuf, query->qlen, 0) == -1)
{ {
query->skip_server[query->server] = 1; query->skip_server[query->server] = 1;
next_server(channel, query, now); next_server(channel, query, now);
return; return;
} }
query->timeout = now query->timeout = now
+ ((query->try == 0) ? channel->timeout + ((query->try == 0) ? channel->timeout
: channel->timeout << query->try / channel->nservers); : channel->timeout << query->try / channel->nservers);
} }
} }
/*
* nonblock() set the given socket to either blocking or non-blocking mode
* based on the 'nonblock' boolean argument. This function is highly portable.
*/
static int nonblock(ares_socket_t sockfd, /* operate on this */
int nonblock /* TRUE or FALSE */)
{
#undef SETBLOCK
#define SETBLOCK 0
#ifdef HAVE_O_NONBLOCK
/* most recent unix versions */
int flags;
flags = fcntl(sockfd, F_GETFL, 0);
if (TRUE == nonblock)
return fcntl(sockfd, F_SETFL, flags | O_NONBLOCK);
else
return fcntl(sockfd, F_SETFL, flags & (~O_NONBLOCK));
#undef SETBLOCK
#define SETBLOCK 1
#endif
#if defined(HAVE_FIONBIO) && (SETBLOCK == 0)
/* older unix versions */
int flags;
flags = nonblock;
return ioctl(sockfd, FIONBIO, &flags);
#undef SETBLOCK
#define SETBLOCK 2
#endif
#if defined(HAVE_IOCTLSOCKET) && (SETBLOCK == 0)
/* Windows? */
unsigned long flags;
flags = nonblock;
return ioctlsocket(sockfd, FIONBIO, &flags);
#undef SETBLOCK
#define SETBLOCK 3
#endif
#if defined(HAVE_IOCTLSOCKET_CASE) && (SETBLOCK == 0)
/* presumably for Amiga */
return IoctlSocket(sockfd, FIONBIO, (long)nonblock);
#undef SETBLOCK
#define SETBLOCK 4
#endif
#if defined(HAVE_SO_NONBLOCK) && (SETBLOCK == 0)
/* BeOS */
long b = nonblock ? 1 : 0;
return setsockopt(sockfd, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
#undef SETBLOCK
#define SETBLOCK 5
#endif
#ifdef HAVE_DISABLED_NONBLOCKING
return 0; /* returns success */
#undef SETBLOCK
#define SETBLOCK 6
#endif
#if (SETBLOCK == 0)
#error "no non-blocking method was found/used/set"
#endif
}
static int open_tcp_socket(ares_channel channel, struct server_state *server) static int open_tcp_socket(ares_channel channel, struct server_state *server)
{ {
ares_socket_t s; ares_socket_t s;
int flags;
struct sockaddr_in sockin; struct sockaddr_in sockin;
/* Acquire a socket. */ /* Acquire a socket. */
@@ -468,25 +556,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
return -1; return -1;
/* Set the socket non-blocking. */ /* Set the socket non-blocking. */
nonblock(s, TRUE);
#if defined(WIN32) || defined(WATT32)
flags = 1;
ioctlsocket(s, FIONBIO, &flags);
#else
flags = fcntl(s, F_GETFL, 0);
if (flags == -1)
{
closesocket(s);
return -1;
}
flags |= O_NONBLOCK;
if (fcntl(s, F_SETFL, flags) == -1)
{
closesocket(s);
return -1;
}
#endif
/* Connect to the server. */ /* Connect to the server. */
memset(&sockin, 0, sizeof(sockin)); memset(&sockin, 0, sizeof(sockin));
@@ -517,6 +587,9 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
if (s == ARES_SOCKET_BAD) if (s == ARES_SOCKET_BAD)
return -1; return -1;
/* Set the socket non-blocking. */
nonblock(s, TRUE);
/* Connect to the server. */ /* Connect to the server. */
memset(&sockin, 0, sizeof(sockin)); memset(&sockin, 0, sizeof(sockin));
sockin.sin_family = AF_INET; sockin.sin_family = AF_INET;
@@ -533,7 +606,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
} }
static int same_questions(const unsigned char *qbuf, int qlen, static int same_questions(const unsigned char *qbuf, int qlen,
const unsigned char *abuf, int alen) const unsigned char *abuf, int alen)
{ {
struct { struct {
const unsigned char *p; const unsigned char *p;
@@ -560,14 +633,14 @@ static int same_questions(const unsigned char *qbuf, int qlen,
{ {
/* Decode the question in the query. */ /* Decode the question in the query. */
if (ares_expand_name(q.p, qbuf, qlen, &q.name, &q.namelen) if (ares_expand_name(q.p, qbuf, qlen, &q.name, &q.namelen)
!= ARES_SUCCESS) != ARES_SUCCESS)
return 0; return 0;
q.p += q.namelen; q.p += q.namelen;
if (q.p + QFIXEDSZ > qbuf + qlen) if (q.p + QFIXEDSZ > qbuf + qlen)
{ {
free(q.name); free(q.name);
return 0; return 0;
} }
q.type = DNS_QUESTION_TYPE(q.p); q.type = DNS_QUESTION_TYPE(q.p);
q.dnsclass = DNS_QUESTION_CLASS(q.p); q.dnsclass = DNS_QUESTION_CLASS(q.p);
q.p += QFIXEDSZ; q.p += QFIXEDSZ;
@@ -575,44 +648,44 @@ static int same_questions(const unsigned char *qbuf, int qlen,
/* Search for this question in the answer. */ /* Search for this question in the answer. */
a.p = abuf + HFIXEDSZ; a.p = abuf + HFIXEDSZ;
for (j = 0; j < a.qdcount; j++) for (j = 0; j < a.qdcount; j++)
{ {
/* Decode the question in the answer. */ /* Decode the question in the answer. */
if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen) if (ares_expand_name(a.p, abuf, alen, &a.name, &a.namelen)
!= ARES_SUCCESS) != ARES_SUCCESS)
{ {
free(q.name); free(q.name);
return 0; return 0;
} }
a.p += a.namelen; a.p += a.namelen;
if (a.p + QFIXEDSZ > abuf + alen) if (a.p + QFIXEDSZ > abuf + alen)
{ {
free(q.name); free(q.name);
free(a.name); free(a.name);
return 0; return 0;
} }
a.type = DNS_QUESTION_TYPE(a.p); a.type = DNS_QUESTION_TYPE(a.p);
a.dnsclass = DNS_QUESTION_CLASS(a.p); a.dnsclass = DNS_QUESTION_CLASS(a.p);
a.p += QFIXEDSZ; a.p += QFIXEDSZ;
/* Compare the decoded questions. */ /* Compare the decoded questions. */
if (strcasecmp(q.name, a.name) == 0 && q.type == a.type if (strcasecmp(q.name, a.name) == 0 && q.type == a.type
&& q.dnsclass == a.dnsclass) && q.dnsclass == a.dnsclass)
{ {
free(a.name); free(a.name);
break; break;
} }
free(a.name); free(a.name);
} }
free(q.name); free(q.name);
if (j == a.qdcount) if (j == a.qdcount)
return 0; return 0;
} }
return 1; return 1;
} }
static struct query *end_query (ares_channel channel, struct query *query, int status, static struct query *end_query (ares_channel channel, struct query *query, int status,
unsigned char *abuf, int alen) unsigned char *abuf, int alen)
{ {
struct query **q, *next; struct query **q, *next;
int i; int i;
@@ -621,7 +694,7 @@ static struct query *end_query (ares_channel channel, struct query *query, int s
for (q = &channel->queries; *q; q = &(*q)->next) for (q = &channel->queries; *q; q = &(*q)->next)
{ {
if (*q == query) if (*q == query)
break; break;
} }
*q = query->next; *q = query->next;
if (*q) if (*q)
@@ -638,7 +711,7 @@ static struct query *end_query (ares_channel channel, struct query *query, int s
if (!channel->queries && !(channel->flags & ARES_FLAG_STAYOPEN)) if (!channel->queries && !(channel->flags & ARES_FLAG_STAYOPEN))
{ {
for (i = 0; i < channel->nservers; i++) for (i = 0; i < channel->nservers; i++)
ares__close_sockets(&channel->servers[i]); ares__close_sockets(&channel->servers[i]);
} }
return (next); return (next);
} }

View File

@@ -16,11 +16,14 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -36,7 +39,7 @@ struct qquery {
static void qcallback(void *arg, int status, unsigned char *abuf, int alen); static void qcallback(void *arg, int status, unsigned char *abuf, int alen);
void ares_query(ares_channel channel, const char *name, int dnsclass, void ares_query(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg) int type, ares_callback callback, void *arg)
{ {
struct qquery *qquery; struct qquery *qquery;
unsigned char *qbuf; unsigned char *qbuf;
@@ -45,7 +48,7 @@ void ares_query(ares_channel channel, const char *name, int dnsclass,
/* Compose the query. */ /* Compose the query. */
rd = !(channel->flags & ARES_FLAG_NORECURSE); rd = !(channel->flags & ARES_FLAG_NORECURSE);
status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf, status = ares_mkquery(name, dnsclass, type, channel->next_id, rd, &qbuf,
&qlen); &qlen);
channel->next_id++; channel->next_id++;
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
{ {
@@ -85,26 +88,26 @@ static void qcallback(void *arg, int status, unsigned char *abuf, int alen)
/* Convert errors. */ /* Convert errors. */
switch (rcode) switch (rcode)
{ {
case NOERROR: case NOERROR:
status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA; status = (ancount > 0) ? ARES_SUCCESS : ARES_ENODATA;
break; break;
case FORMERR: case FORMERR:
status = ARES_EFORMERR; status = ARES_EFORMERR;
break; break;
case SERVFAIL: case SERVFAIL:
status = ARES_ESERVFAIL; status = ARES_ESERVFAIL;
break; break;
case NXDOMAIN: case NXDOMAIN:
status = ARES_ENOTFOUND; status = ARES_ENOTFOUND;
break; break;
case NOTIMP: case NOTIMP:
status = ARES_ENOTIMP; status = ARES_ENOTIMP;
break; break;
case REFUSED: case REFUSED:
status = ARES_EREFUSED; status = ARES_EREFUSED;
break; break;
} }
qquery->callback(qquery->arg, status, abuf, alen); qquery->callback(qquery->arg, status, abuf, alen);
} }
free(qquery); free(qquery);

View File

@@ -19,7 +19,7 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#endif #endif
@@ -29,26 +29,26 @@
struct search_query { struct search_query {
/* Arguments passed to ares_search */ /* Arguments passed to ares_search */
ares_channel channel; ares_channel channel;
char *name; /* copied into an allocated buffer */ char *name; /* copied into an allocated buffer */
int dnsclass; int dnsclass;
int type; int type;
ares_callback callback; ares_callback callback;
void *arg; void *arg;
int status_as_is; /* error status from trying as-is */ int status_as_is; /* error status from trying as-is */
int next_domain; /* next search domain to try */ int next_domain; /* next search domain to try */
int trying_as_is; /* current query is for name as-is */ int trying_as_is; /* current query is for name as-is */
}; };
static void search_callback(void *arg, int status, unsigned char *abuf, static void search_callback(void *arg, int status, unsigned char *abuf,
int alen); int alen);
static void end_squery(struct search_query *squery, int status, static void end_squery(struct search_query *squery, int status,
unsigned char *abuf, int alen); unsigned char *abuf, int alen);
static int cat_domain(const char *name, const char *domain, char **s); static int cat_domain(const char *name, const char *domain, char **s);
static int single_domain(ares_channel channel, const char *name, char **s); static int single_domain(ares_channel channel, const char *name, char **s);
void ares_search(ares_channel channel, const char *name, int dnsclass, void ares_search(ares_channel channel, const char *name, int dnsclass,
int type, ares_callback callback, void *arg) int type, ares_callback callback, void *arg)
{ {
struct search_query *squery; struct search_query *squery;
char *s; char *s;
@@ -99,7 +99,7 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
for (p = name; *p; p++) for (p = name; *p; p++)
{ {
if (*p == '.') if (*p == '.')
ndots++; ndots++;
} }
/* If ndots is at least the channel ndots threshold (usually 1), /* If ndots is at least the channel ndots threshold (usually 1),
@@ -120,22 +120,22 @@ void ares_search(ares_channel channel, const char *name, int dnsclass,
squery->trying_as_is = 0; squery->trying_as_is = 0;
status = cat_domain(name, channel->domains[0], &s); status = cat_domain(name, channel->domains[0], &s);
if (status == ARES_SUCCESS) if (status == ARES_SUCCESS)
{ {
ares_query(channel, s, dnsclass, type, search_callback, squery); ares_query(channel, s, dnsclass, type, search_callback, squery);
free(s); free(s);
} }
else else
{ {
/* failed, free the malloc()ed memory */ /* failed, free the malloc()ed memory */
free(squery->name); free(squery->name);
free(squery); free(squery);
callback(arg, status, NULL, 0); callback(arg, status, NULL, 0);
} }
} }
} }
static void search_callback(void *arg, int status, unsigned char *abuf, static void search_callback(void *arg, int status, unsigned char *abuf,
int alen) int alen)
{ {
struct search_query *squery = (struct search_query *) arg; struct search_query *squery = (struct search_query *) arg;
ares_channel channel = squery->channel; ares_channel channel = squery->channel;
@@ -149,37 +149,37 @@ static void search_callback(void *arg, int status, unsigned char *abuf,
{ {
/* Save the status if we were trying as-is. */ /* Save the status if we were trying as-is. */
if (squery->trying_as_is) if (squery->trying_as_is)
squery->status_as_is = status; squery->status_as_is = status;
if (squery->next_domain < channel->ndomains) if (squery->next_domain < channel->ndomains)
{ {
/* Try the next domain. */ /* Try the next domain. */
status = cat_domain(squery->name, status = cat_domain(squery->name,
channel->domains[squery->next_domain], &s); channel->domains[squery->next_domain], &s);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
end_squery(squery, status, NULL, 0); end_squery(squery, status, NULL, 0);
else else
{ {
squery->trying_as_is = 0; squery->trying_as_is = 0;
squery->next_domain++; squery->next_domain++;
ares_query(channel, s, squery->dnsclass, squery->type, ares_query(channel, s, squery->dnsclass, squery->type,
search_callback, squery); search_callback, squery);
free(s); free(s);
} }
} }
else if (squery->status_as_is == -1) else if (squery->status_as_is == -1)
{ {
/* Try the name as-is at the end. */ /* Try the name as-is at the end. */
squery->trying_as_is = 1; squery->trying_as_is = 1;
ares_query(channel, squery->name, squery->dnsclass, squery->type, ares_query(channel, squery->name, squery->dnsclass, squery->type,
search_callback, squery); search_callback, squery);
} }
else else
end_squery(squery, squery->status_as_is, NULL, 0); end_squery(squery, squery->status_as_is, NULL, 0);
} }
} }
static void end_squery(struct search_query *squery, int status, static void end_squery(struct search_query *squery, int status,
unsigned char *abuf, int alen) unsigned char *abuf, int alen)
{ {
squery->callback(squery->arg, status, abuf, alen); squery->callback(squery->arg, status, abuf, alen);
free(squery->name); free(squery->name);
@@ -229,41 +229,41 @@ static int single_domain(ares_channel channel, const char *name, char **s)
/* The name might be a host alias. */ /* The name might be a host alias. */
hostaliases = getenv("HOSTALIASES"); hostaliases = getenv("HOSTALIASES");
if (hostaliases) if (hostaliases)
{ {
fp = fopen(hostaliases, "r"); fp = fopen(hostaliases, "r");
if (fp) if (fp)
{ {
while ((status = ares__read_line(fp, &line, &linesize)) while ((status = ares__read_line(fp, &line, &linesize))
== ARES_SUCCESS) == ARES_SUCCESS)
{ {
if (strncasecmp(line, name, len) != 0 || if (strncasecmp(line, name, len) != 0 ||
!isspace((unsigned char)line[len])) !isspace((unsigned char)line[len]))
continue; continue;
p = line + len; p = line + len;
while (isspace((unsigned char)*p)) while (isspace((unsigned char)*p))
p++; p++;
if (*p) if (*p)
{ {
q = p + 1; q = p + 1;
while (*q && !isspace((unsigned char)*q)) while (*q && !isspace((unsigned char)*q))
q++; q++;
*s = malloc(q - p + 1); *s = malloc(q - p + 1);
if (*s) if (*s)
{ {
memcpy(*s, p, q - p); memcpy(*s, p, q - p);
(*s)[q - p] = 0; (*s)[q - p] = 0;
} }
free(line); free(line);
fclose(fp); fclose(fp);
return (*s) ? ARES_SUCCESS : ARES_ENOMEM; return (*s) ? ARES_SUCCESS : ARES_ENOMEM;
} }
} }
free(line); free(line);
fclose(fp); fclose(fp);
if (status != ARES_SUCCESS) if (status != ARES_SUCCESS)
return status; return status;
} }
} }
} }
if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0) if (channel->flags & ARES_FLAG_NOSEARCH || channel->ndomains == 0)

View File

@@ -16,11 +16,14 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include "nameser.h" #include "nameser.h"
#else #else
#include <netinet/in.h> #include <netinet/in.h>
#include <arpa/nameser.h> #include <arpa/nameser.h>
#ifdef HAVE_ARPA_NAMESER_COMPAT_H
#include <arpa/nameser_compat.h>
#endif
#endif #endif
#include <stdlib.h> #include <stdlib.h>
@@ -31,7 +34,7 @@
#include "ares_private.h" #include "ares_private.h"
void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen, void ares_send(ares_channel channel, const unsigned char *qbuf, int qlen,
ares_callback callback, void *arg) ares_callback callback, void *arg)
{ {
struct query *query; struct query *query;
int i; int i;

View File

@@ -30,7 +30,8 @@ function gets the description of the ares library error code
.IR code , .IR code ,
returning the result as a NUL-terminated C string. returning the result as a NUL-terminated C string.
.SH NOTES .SH NOTES
This function is not compatible with ares. This function is not compatible with ares, it takes a different set of
arguments.
.SH AUTHOR .SH AUTHOR
Greg Hudson, MIT Information Systems Greg Hudson, MIT Information Systems
.br .br

View File

@@ -38,7 +38,8 @@ const char *ares_strerror(int code)
"Error reading file", "Error reading file",
"Out of memory", "Out of memory",
"Channel is being destroyed", "Channel is being destroyed",
"Misformatted string" "Misformatted string",
"Illegal flags specified"
}; };
assert(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext))); assert(code >= 0 && code < (int)(sizeof(errtext) / sizeof(*errtext)));

View File

@@ -16,18 +16,17 @@
#include "setup.h" #include "setup.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef WIN32 #ifdef HAVE_SYS_TIME_H
#else
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#include <time.h> #include <time.h>
#include "ares.h" #include "ares.h"
#include "ares_private.h" #include "ares_private.h"
struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
struct timeval *tvbuf) struct timeval *tvbuf)
{ {
struct query *query; struct query *query;
time_t now; time_t now;
@@ -43,12 +42,12 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv,
for (query = channel->queries; query; query = query->next) for (query = channel->queries; query; query = query->next)
{ {
if (query->timeout == 0) if (query->timeout == 0)
continue; continue;
offset = query->timeout - now; offset = query->timeout - now;
if (offset < 0) if (offset < 0)
offset = 0; offset = 0;
if (min_offset == -1 || offset < min_offset) if (min_offset == -1 || offset < min_offset)
min_offset = offset; min_offset = offset;
} }
/* If we found a minimum timeout and it's sooner than the one /* If we found a minimum timeout and it's sooner than the one

View File

@@ -4,12 +4,12 @@
#define ARES__VERSION_H #define ARES__VERSION_H
#define ARES_VERSION_MAJOR 1 #define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 2 #define ARES_VERSION_MINOR 3
#define ARES_VERSION_PATCH 0 #define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\ #define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\ (ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH)) (ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.2.0" #define ARES_VERSION_STR "1.3.0"
const char *ares_version(int *version); const char *ares_version(int *version);

60
ares/bitncmp.c Normal file
View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef HAVE_BITNCMP
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include "bitncmp.h"
/*
* int
* bitncmp(l, r, n)
* compare bit masks l and r, for n bits.
* return:
* -1, 1, or 0 in the libc tradition.
* note:
* network byte order assumed. this means 192.5.5.240/28 has
* 0x11110000 in its fourth octet.
* author:
* Paul Vixie (ISC), June 1996
*/
int
ares_bitncmp(const void *l, const void *r, int n) {
unsigned int lb, rb;
int x, b;
b = n / 8;
x = memcmp(l, r, b);
if (x)
return (x);
lb = ((const unsigned char *)l)[b];
rb = ((const unsigned char *)r)[b];
for (b = n % 8; b > 0; b--) {
if ((lb & 0x80) != (rb & 0x80)) {
if (lb & 0x80)
return (1);
return (-1);
}
lb <<= 1;
rb <<= 1;
}
return (0);
}
#endif

26
ares/bitncmp.h Normal file
View File

@@ -0,0 +1,26 @@
/* $Id$ */
/*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef BITNCMP_H
#define BITNCMP_H
#ifndef HAVE_BITNCMP
int ares_bitncmp(const void *l, const void *r, int n);
#else
#define ares_bitncmp(x,y,z) bitncmp(x,y,z)
#endif
#endif /* BITNCMP_H */

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
libtoolize --copy --automake --force ${LIBTOOLIZE:-libtoolize} --copy --automake --force
aclocal ${ACLOCAL:-aclocal}
autoheader ${AUTOHEADER:-autoheader}
autoconf ${AUTOCONF:-autoconf}
automake --add-missing ${AUTOMAKE:-automake} --add-missing

View File

@@ -1,66 +1,351 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(ares_init.c) AC_INIT(ares_init.c)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AM_INIT_AUTOMAKE(c-ares, CVS) AM_INIT_AUTOMAKE(c-ares, CVS)
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
case $host_os in case $host_os in
solaris*) solaris*)
AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used]) AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
;; ;;
esac esac
# check for ssize_t # check for ssize_t
AC_CHECK_TYPE(ssize_t, , AC_CHECK_TYPE(ssize_t, ,
AC_DEFINE(ssize_t, int, [the signed version of size_t])) AC_DEFINE(ssize_t, int, [the signed version of size_t]))
AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(socket, socket) AC_SEARCH_LIBS(socket, socket)
dnl ************************************************************ dnl ************************************************************
dnl Option to switch on debug options. This makes an assumption that dnl Option to switch on debug options. This makes an assumption that
dnl this is built as an 'ares' subdir in the curl source tree. Subject for dnl this is built as an 'ares' subdir in the curl source tree. Subject for
dnl improval in the future! dnl improval in the future!
dnl dnl
AC_MSG_CHECKING([whether to enable debug options]) AC_MSG_CHECKING([whether to enable debug options])
AC_ARG_ENABLE(debug, AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable pedantic debug options]) AC_HELP_STRING([--enable-debug],[Enable pedantic debug options])
AC_HELP_STRING([--disable-debug],[Disable debug options]), AC_HELP_STRING([--disable-debug],[Disable debug options]),
[ case "$enableval" in [ case "$enableval" in
no) no)
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
;; ;;
*) AC_MSG_RESULT(yes) *) AC_MSG_RESULT(yes)
dnl when doing the debug stuff, use static library only dnl when doing the debug stuff, use static library only
AC_DISABLE_SHARED AC_DISABLE_SHARED
dnl Checks for standard header files, to make memdebug.h inclusions bettter dnl Checks for standard header files, to make memdebug.h inclusions bettter
AC_HEADER_STDC AC_HEADER_STDC
CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I../include" dnl the entire --enable-debug is a hack that lives and runs on top of
CFLAGS="$CFLAGS -g" dnl libcurl stuff so this BUILDING_LIBCURL is not THAT much uglier
AC_DEFINE(BUILDING_LIBCURL, 1, [when building as static part of libcurl])
dnl set compiler "debug" options to become more picky, and remove
dnl optimize options from CFLAGS CPPFLAGS="$CPPFLAGS -DCURLDEBUG -I$srcdir/../include"
CURL_CC_DEBUG_OPTS CFLAGS="$CFLAGS -g"
;; dnl set compiler "debug" options to become more picky, and remove
esac ], dnl optimize options from CFLAGS
AC_MSG_RESULT(no) CURL_CC_DEBUG_OPTS
)
;;
AC_PROG_LIBTOOL esac ],
AC_MSG_RESULT(no)
dnl check for a few basic system headers we need )
AC_CHECK_HEADERS(
sys/types.h \ AC_PROG_LIBTOOL
sys/time.h \
sys/select.h \ dnl check for a few basic system headers we need
sys/socket.h \ AC_CHECK_HEADERS(
) sys/types.h \
sys/time.h \
AC_OUTPUT(Makefile) sys/select.h \
sys/socket.h \
sys/ioctl.h \
winsock.h \
netinet/in.h \
net/if.h \
arpa/nameser.h \
arpa/nameser_compat.h \
arpa/inet.h, , ,
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
dnl We do this default-include simply to make sure that the nameser_compat.h
dnl header *REALLY* can be include after the new nameser.h. It seems AIX 5.1
dnl (and others?) is not designed to allow this.
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
dnl *Sigh* these are needed in order for net/if.h to get properly detected.
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
]
)
AC_CHECK_TYPE(socklen_t, ,
AC_DEFINE(socklen_t, int, [the length of a socket address]),
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
])
dnl check for AF_INET6
CARES_CHECK_CONSTANT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
], [PF_INET6],
AC_DEFINE_UNQUOTED(HAVE_PF_INET6,1,[Define to 1 if you have PF_INET6.])
)
dnl check for PF_INET6
CARES_CHECK_CONSTANT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
], [AF_INET6],
AC_DEFINE_UNQUOTED(HAVE_AF_INET6,1,[Define to 1 if you have AF_INET6.])
)
dnl check for the in6_addr structure
CARES_CHECK_STRUCT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
], [in6_addr],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_IN6_ADDR,1,[Define to 1 if you have struct in6_addr.])
)
dnl check for the sockaddr_in6 structure
CARES_CHECK_STRUCT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
], [sockaddr_in6],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_SOCKADDR_IN6,1,
[Define to 1 if you have struct sockaddr_in6.]) ac_have_sockaddr_in6=yes
)
if test "$ac_have_sockaddr_in6" = "yes" ; then
CARES_CHECK_STRUCT_MEMBER(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
], [sockaddr_in6], [sin6_scope_id],
AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID,1,
[Define to 1 if your struct sockaddr_in6 has sin6_scope_id.])
)
fi
dnl check for the addrinfo structure
CARES_CHECK_STRUCT(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
], [addrinfo],
AC_DEFINE_UNQUOTED(HAVE_STRUCT_ADDRINFO,1,
[Define to 1 if you have struct addrinfo.])
)
dnl check for inet_pton
AC_CHECK_FUNCS(inet_pton)
dnl Some systems have it, but not IPv6
if test "$ac_cv_func_inet_pton" = "yes" ; then
AC_MSG_CHECKING(if inet_pton supports IPv6)
AC_TRY_RUN(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int main()
{
struct in6_addr addr6;
if (inet_pton(AF_INET6, "::1", &addr6) < 1)
exit(1);
else
exit(0);
}
], [
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_INET_PTON_IPV6,1,[Define to 1 if inet_pton supports IPv6.])
], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
fi
dnl Check for inet_net_pton
AC_CHECK_FUNCS(inet_net_pton)
dnl Again, some systems have it, but not IPv6
if test "$ac_cv_func_inet_net_pton" = "yes" ; then
AC_MSG_CHECKING(if inet_net_pton supports IPv6)
AC_TRY_RUN(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
int main()
{
struct in6_addr addr6;
if (inet_net_pton(AF_INET6, "::1", &addr6, sizeof(addr6)) < 1)
exit(1);
else
exit(0);
}
], [
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_INET_NET_PTON_IPV6,1,[Define to 1 if inet_net_pton supports IPv6.])
], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
fi
dnl Check for inet_ntop
AC_CHECK_FUNCS(inet_ntop)
dnl Again, some systems have it, but not IPv6
if test "$ac_cv_func_inet_ntop" = "yes" ; then
AC_MSG_CHECKING(if inet_ntop supports IPv6)
AC_TRY_RUN(
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#include <errno.h>
int main()
{
struct in6_addr addr6;
char buf[128];
if (inet_ntop(AF_INET6, &addr6, buf, 128) == 0 && errno == EAFNOSUPPORT)
exit(1);
else
exit(0);
}
], [
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_INET_NTOP_IPV6,1,[Define to 1 if inet_ntop supports IPv6.])
], AC_MSG_RESULT(no),AC_MSG_RESULT(no))
fi
AC_CHECK_SIZEOF(struct in6_addr, ,
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
]
)
AC_CHECK_SIZEOF(struct in_addr, ,
[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
]
)
AC_CHECK_FUNCS([bitncmp if_indextoname])
CURL_CHECK_NONBLOCKING_SOCKET
AC_OUTPUT(Makefile)

439
ares/inet_net_pton.c Normal file
View File

@@ -0,0 +1,439 @@
/*
* Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996,1999 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "setup.h"
#include <sys/types.h>
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#endif
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ares_ipv6.h"
#include "inet_net_pton.h"
#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6) || \
!defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6)
/*
* static int
* inet_net_pton_ipv4(src, dst, size)
* convert IPv4 network number from presentation to network format.
* accepts hex octets, hex strings, decimal octets, and /CIDR.
* "size" is in bytes and describes "dst".
* return:
* number of bits, either imputed classfully or specified with /CIDR,
* or -1 if some failure occurred (check errno). ENOENT means it was
* not an IPv4 network specification.
* note:
* network byte order assumed. this means 192.5.5.240/28 has
* 0b11110000 in its fourth octet.
* author:
* Paul Vixie (ISC), June 1996
*/
static int
inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
{
static const char xdigits[] = "0123456789abcdef";
static const char digits[] = "0123456789";
int n, ch, tmp = 0, dirty, bits;
const unsigned char *odst = dst;
ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& isascii((unsigned char)(src[1]))
&& isxdigit((unsigned char)(src[1]))) {
/* Hexadecimal: Eat nybble string. */
if (size <= 0U)
goto emsgsize;
dirty = 0;
src++; /* skip x or X. */
while ((ch = *src++) != '\0' && isascii(ch) && isxdigit(ch)) {
if (isupper(ch))
ch = tolower(ch);
n = (int)(strchr(xdigits, ch) - xdigits);
if (dirty == 0)
tmp = n;
else
tmp = (tmp << 4) | n;
if (++dirty == 2) {
if (size-- <= 0U)
goto emsgsize;
*dst++ = (unsigned char) tmp;
dirty = 0;
}
}
if (dirty) { /* Odd trailing nybble? */
if (size-- <= 0U)
goto emsgsize;
*dst++ = (unsigned char) (tmp << 4);
}
} else if (isascii(ch) && isdigit(ch)) {
/* Decimal: eat dotted digit string. */
for (;;) {
tmp = 0;
do {
n = (int)(strchr(digits, ch) - digits);
tmp *= 10;
tmp += n;
if (tmp > 255)
goto enoent;
} while ((ch = *src++) != '\0' &&
isascii(ch) && isdigit(ch));
if (size-- <= 0U)
goto emsgsize;
*dst++ = (unsigned char) tmp;
if (ch == '\0' || ch == '/')
break;
if (ch != '.')
goto enoent;
ch = *src++;
if (!isascii(ch) || !isdigit(ch))
goto enoent;
}
} else
goto enoent;
bits = -1;
if (ch == '/' && isascii((unsigned char)(src[0])) &&
isdigit((unsigned char)(src[0])) && dst > odst) {
/* CIDR width specifier. Nothing can follow it. */
ch = *src++; /* Skip over the /. */
bits = 0;
do {
n = (int)(strchr(digits, ch) - digits);
bits *= 10;
bits += n;
} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
if (ch != '\0')
goto enoent;
if (bits > 32)
goto emsgsize;
}
/* Firey death and destruction unless we prefetched EOS. */
if (ch != '\0')
goto enoent;
/* If nothing was written to the destination, we found no address. */
if (dst == odst)
goto enoent;
/* If no CIDR spec was given, infer width from net class. */
if (bits == -1) {
if (*odst >= 240) /* Class E */
bits = 32;
else if (*odst >= 224) /* Class D */
bits = 8;
else if (*odst >= 192) /* Class C */
bits = 24;
else if (*odst >= 128) /* Class B */
bits = 16;
else /* Class A */
bits = 8;
/* If imputed mask is narrower than specified octets, widen. */
if (bits < ((dst - odst) * 8))
bits = (int)(dst - odst) * 8;
/*
* If there are no additional bits specified for a class D
* address adjust bits to 4.
*/
if (bits == 8 && *odst == 224)
bits = 4;
}
/* Extend network to cover the actual mask. */
while (bits > ((dst - odst) * 8)) {
if (size-- <= 0U)
goto emsgsize;
*dst++ = '\0';
}
return (bits);
enoent:
errno = ENOENT;
return (-1);
emsgsize:
errno = EMSGSIZE;
return (-1);
}
static int
getbits(const char *src, int *bitsp)
{
static const char digits[] = "0123456789";
int n;
int val;
char ch;
val = 0;
n = 0;
while ((ch = *src++) != '\0') {
const char *pch;
pch = strchr(digits, ch);
if (pch != NULL) {
if (n++ != 0 && val == 0) /* no leading zeros */
return (0);
val *= 10;
val += (pch - digits);
if (val > 128) /* range */
return (0);
continue;
}
return (0);
}
if (n == 0)
return (0);
*bitsp = val;
return (1);
}
static int
getv4(const char *src, unsigned char *dst, int *bitsp)
{
static const char digits[] = "0123456789";
unsigned char *odst = dst;
int n;
unsigned int val;
char ch;
val = 0;
n = 0;
while ((ch = *src++) != '\0') {
const char *pch;
pch = strchr(digits, ch);
if (pch != NULL) {
if (n++ != 0 && val == 0) /* no leading zeros */
return (0);
val *= 10;
val += (pch - digits);
if (val > 255) /* range */
return (0);
continue;
}
if (ch == '.' || ch == '/') {
if (dst - odst > 3) /* too many octets? */
return (0);
*dst++ = val;
if (ch == '/')
return (getbits(src, bitsp));
val = 0;
n = 0;
continue;
}
return (0);
}
if (n == 0)
return (0);
if (dst - odst > 3) /* too many octets? */
return (0);
*dst++ = val;
return (1);
}
static int
inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
{
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
const char *xdigits, *curtok;
int ch, saw_xdigit;
unsigned int val;
int digits;
int bits;
size_t bytes;
int words;
int ipv4;
memset((tp = tmp), '\0', NS_IN6ADDRSZ);
endp = tp + NS_IN6ADDRSZ;
colonp = NULL;
/* Leading :: requires some special handling. */
if (*src == ':')
if (*++src != ':')
goto enoent;
curtok = src;
saw_xdigit = 0;
val = 0;
digits = 0;
bits = -1;
ipv4 = 0;
while ((ch = *src++) != '\0') {
const char *pch;
if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
pch = strchr((xdigits = xdigits_u), ch);
if (pch != NULL) {
val <<= 4;
val |= (pch - xdigits);
if (++digits > 4)
goto enoent;
saw_xdigit = 1;
continue;
}
if (ch == ':') {
curtok = src;
if (!saw_xdigit) {
if (colonp)
goto enoent;
colonp = tp;
continue;
} else if (*src == '\0')
goto enoent;
if (tp + NS_INT16SZ > endp)
return (0);
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
saw_xdigit = 0;
digits = 0;
val = 0;
continue;
}
if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
getv4(curtok, tp, &bits) > 0) {
tp += NS_INADDRSZ;
saw_xdigit = 0;
ipv4 = 1;
break; /* '\0' was seen by inet_pton4(). */
}
if (ch == '/' && getbits(src, &bits) > 0)
break;
goto enoent;
}
if (saw_xdigit) {
if (tp + NS_INT16SZ > endp)
goto enoent;
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
}
if (bits == -1)
bits = 128;
words = (bits + 15) / 16;
if (words < 2)
words = 2;
if (ipv4)
words = 8;
endp = tmp + 2 * words;
if (colonp != NULL) {
/*
* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand.
*/
const int n = (int)(tp - colonp);
int i;
if (tp == endp)
goto enoent;
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
}
tp = endp;
}
if (tp != endp)
goto enoent;
bytes = (bits + 7) / 8;
if (bytes > size)
goto emsgsize;
memcpy(dst, tmp, bytes);
return (bits);
enoent:
errno = ENOENT;
return (-1);
emsgsize:
errno = EMSGSIZE;
return (-1);
}
/*
* int
* inet_net_pton(af, src, dst, size)
* convert network number from presentation to network format.
* accepts hex octets, hex strings, decimal octets, and /CIDR.
* "size" is in bytes and describes "dst".
* return:
* number of bits, either imputed classfully or specified with /CIDR,
* or -1 if some failure occurred (check errno). ENOENT means it was
* not a valid network specification.
* author:
* Paul Vixie (ISC), June 1996
*/
int
ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
{
switch (af) {
case AF_INET:
return (inet_net_pton_ipv4(src, dst, size));
case AF_INET6:
return (inet_net_pton_ipv6(src, dst, size));
default:
errno = EAFNOSUPPORT;
return (-1);
}
}
#endif
#if !defined(HAVE_INET_PTON) || !defined(HAVE_INET_PTON_IPV6)
int ares_inet_pton(int af, const char *src, void *dst)
{
int size, result;
if (af == AF_INET)
size = sizeof(struct in_addr);
else if (af == AF_INET6)
size = sizeof(struct in6_addr);
else
{
errno = EAFNOSUPPORT;
return -1;
}
result = ares_inet_net_pton(af, src, dst, size);
if (result == -1 && errno == ENOENT)
return 0;
return (result > -1 ? 1 : -1);
}
#endif

31
ares/inet_net_pton.h Normal file
View File

@@ -0,0 +1,31 @@
/* $Id$ */
/*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef INET_NET_PTON_H
#define INET_NET_PTON_H
#if defined(HAVE_INET_PTON) && defined(HAVE_INET_PTON_IPV6)
#define ares_inet_pton(x,y,z) inet_pton(x,y,z)
#else
int ares_inet_pton(int af, const char *src, void *dst);
#endif
#if defined(HAVE_INET_NET_PTON) && defined(HAVE_INET_NET_PTON_IPV6)
#define ares_inet_net_pton(w,x,y,z) inet_net_pton(w,x,y,z)
#else
int ares_inet_net_pton(int af, const char *src, void *dst, size_t size);
#endif
#endif /* INET_NET_PTON_H */

206
ares/inet_ntop.c Normal file
View File

@@ -0,0 +1,206 @@
/* Copyright (c) 1996 by Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
* CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include "setup.h"
#include <sys/types.h>
#if defined(WIN32) && !defined(WATT32)
#include "nameser.h"
#else
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_NAMESER_H
#include <arpa/nameser.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#endif
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ares_ipv6.h"
#include "inet_ntop.h"
#if !defined(HAVE_INET_NTOP) || !defined(HAVE_INET_NTOP_IPV6)
#ifdef SPRINTF_CHAR
# define SPRINTF(x) strlen(sprintf/**/x)
#else
# define SPRINTF(x) ((size_t)sprintf x)
#endif
/*
* WARNING: Don't even consider trying to compile this on a system where
* sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX.
*/
static const char *inet_ntop4(const unsigned char *src, char *dst, size_t size);
static const char *inet_ntop6(const unsigned char *src, char *dst, size_t size);
/* char *
* inet_ntop(af, src, dst, size)
* convert a network format address to presentation format.
* return:
* pointer to presentation format address (`dst'), or NULL (see errno).
* author:
* Paul Vixie, 1996.
*/
const char *
ares_inet_ntop(int af, const void *src, char *dst, size_t size)
{
switch (af) {
case AF_INET:
return (inet_ntop4(src, dst, size));
case AF_INET6:
return (inet_ntop6(src, dst, size));
default:
errno = EAFNOSUPPORT;
return (NULL);
}
/* NOTREACHED */
}
/* const char *
* inet_ntop4(src, dst, size)
* format an IPv4 address, more or less like inet_ntoa()
* return:
* `dst' (as a const)
* notes:
* (1) uses no statics
* (2) takes a unsigned char* not an in_addr as input
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop4(const unsigned char *src, char *dst, size_t size)
{
static const char fmt[] = "%u.%u.%u.%u";
char tmp[sizeof "255.255.255.255"];
if (SPRINTF((tmp, fmt, src[0], src[1], src[2], src[3])) > size) {
errno = ENOSPC;
return (NULL);
}
strcpy(dst, tmp);
return (dst);
}
/* const char *
* inet_ntop6(src, dst, size)
* convert IPv6 binary address into presentation (printable) format
* author:
* Paul Vixie, 1996.
*/
static const char *
inet_ntop6(const unsigned char *src, char *dst, size_t size)
{
/*
* Note that int32_t and int16_t need only be "at least" large enough
* to contain a value of the specified size. On some systems, like
* Crays, there is no such thing as an integer variable with 16 bits.
* Keep this in mind if you think this function should have been coded
* to use pointer overlays. All the world's not a VAX.
*/
char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"], *tp;
struct { int base, len; } best, cur;
unsigned int words[NS_IN6ADDRSZ / NS_INT16SZ];
int i;
/*
* Preprocess:
* Copy the input (bytewise) array into a wordwise array.
* Find the longest run of 0x00's in src[] for :: shorthanding.
*/
memset(words, '\0', sizeof words);
for (i = 0; i < NS_IN6ADDRSZ; i++)
words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3));
best.base = -1;
cur.base = -1;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
if (words[i] == 0) {
if (cur.base == -1)
cur.base = i, cur.len = 1;
else
cur.len++;
} else {
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
cur.base = -1;
}
}
}
if (cur.base != -1) {
if (best.base == -1 || cur.len > best.len)
best = cur;
}
if (best.base != -1 && best.len < 2)
best.base = -1;
/*
* Format the result.
*/
tp = tmp;
for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) {
/* Are we inside the best run of 0x00's? */
if (best.base != -1 && i >= best.base &&
i < (best.base + best.len)) {
if (i == best.base)
*tp++ = ':';
continue;
}
/* Are we following an initial run of 0x00s or any real hex? */
if (i != 0)
*tp++ = ':';
/* Is this address an encapsulated IPv4? */
if (i == 6 && best.base == 0 &&
(best.len == 6 || (best.len == 5 && words[5] == 0xffff))) {
if (!inet_ntop4(src+12, tp, sizeof tmp - (tp - tmp)))
return (NULL);
tp += strlen(tp);
break;
}
tp += SPRINTF((tp, "%x", words[i]));
}
/* Was it a trailing run of 0x00's? */
if (best.base != -1 && (best.base + best.len) == (NS_IN6ADDRSZ / NS_INT16SZ))
*tp++ = ':';
*tp++ = '\0';
/*
* Check for overflow, copy, and we're done.
*/
if ((size_t)(tp - tmp) > size) {
errno = ENOSPC;
return (NULL);
}
strcpy(dst, tmp);
return (dst);
}
#endif

26
ares/inet_ntop.h Normal file
View File

@@ -0,0 +1,26 @@
/* $Id$ */
/*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is"
* without express or implied warranty.
*/
#ifndef INET_NTOP_H
#define INET_NTOP_H
#ifdef HAVE_INET_NTOP
#define ares_inet_ntop(w,x,y,z) inet_ntop(w,x,y,z)
#else
const char *ares_inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
#endif /* INET_NET_NTOP_H */

View File

@@ -12,6 +12,27 @@ if(!-f "ares.h") {
exit; exit;
} }
my ($major, $minor, $patch)=split(/\./, $version);
$major += 0;
$minor += 0;
$patch += 0;
open(VER, "<ares_version.h") ||
die "can't open ares_version.h";
open(NEWV, ">ares_version.h.dist");
while(<VER>) {
$_ =~ s/^\#define ARES_VERSION_MAJOR .*/\#define ARES_VERSION_MAJOR $major/;
$_ =~ s/^\#define ARES_VERSION_MINOR .*/\#define ARES_VERSION_MINOR $minor/;
$_ =~ s/^\#define ARES_VERSION_PATCH .*/\#define ARES_VERSION_PATCH $patch/;
$_ =~ s/^\#define ARES_VERSION_STR .*/\#define ARES_VERSION_STR \"$version\"/;
print NEWV $_;
}
close(VER);
close(NEWV);
print "ares_version.h.dist created\n";
if(!-f "configure") { if(!-f "configure") {
print "running buildconf\n"; print "running buildconf\n";
`./buildconf`; `./buildconf`;

View File

@@ -16,6 +16,8 @@
#define EINPROGRESS WSAEINPROGRESS #define EINPROGRESS WSAEINPROGRESS
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#define EMSGSIZE WSAEMSGSIZE
#define EAFNOSUPPORT WSAEAFNOSUPPORT
/* Structure for scatter/gather I/O. */ /* Structure for scatter/gather I/O. */
struct iovec struct iovec
@@ -36,8 +38,10 @@ int ares_gettimeofday(struct timeval *tv, struct timezone *tz);
#endif /* !NETWARE */ #endif /* !NETWARE */
#define NS_CMPRSFLGS 0xc0 #define NS_CMPRSFLGS 0xc0
#define NS_IN6ADDRSZ 16
#define NS_INT16SZ 2
#define NS_INADDRSZ 4
/* Flag bits indicating name compression. */ /* Flag bits indicating name compression. */
#define INDIR_MASK NS_CMPRSFLGS #define INDIR_MASK NS_CMPRSFLGS
@@ -134,7 +138,7 @@ typedef enum __ns_opcode {
#define QUERY ns_o_query #define QUERY ns_o_query
#define NS_MAXLABEL 63 #define NS_MAXLABEL 63
#define MAXLABEL NS_MAXLABEL #define MAXLABEL NS_MAXLABEL
#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ #define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */
@@ -221,16 +225,4 @@ typedef enum __ns_rcode {
#define T_MAILA ns_t_maila #define T_MAILA ns_t_maila
#define T_ANY ns_t_any #define T_ANY ns_t_any
#if !(defined(__MINGW32__) || defined(NETWARE))
/* protos for the functions we provide in windows_port.c */
int ares_strncasecmp(const char *s1, const char *s2, size_t n);
int ares_strcasecmp(const char *s1, const char *s2);
/* use this define magic to prevent us from adding symbol names to the library
that is a high-risk to collide with another libraries' attempts to do the
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
#endif
#endif /* ARES_NAMESER_H */ #endif /* ARES_NAMESER_H */

View File

@@ -1,7 +1,7 @@
#ifndef ARES_SETUP_H #ifndef ARES_SETUP_H
#define ARES_SETUP_H #define ARES_SETUP_H
/* Copyright (C) 2004 by Daniel Stenberg et al /* Copyright (C) 2004 - 2005 by Daniel Stenberg et al
* *
* Permission to use, copy, modify, and distribute this software and its * Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose and without fee is hereby granted, provided * documentation for any purpose and without fee is hereby granted, provided
@@ -19,6 +19,7 @@
#else #else
/* simple work-around for now, for systems without configure support */ /* simple work-around for now, for systems without configure support */
#define ssize_t int #define ssize_t int
#define socklen_t int
#endif #endif
/* Recent autoconf versions define these symbols in config.h. We don't want /* Recent autoconf versions define these symbols in config.h. We don't want
@@ -33,7 +34,7 @@
#undef PACKAGE #undef PACKAGE
/* now typedef our socket type */ /* now typedef our socket type */
#ifdef WIN32 #if defined(WIN32) && !defined(WATT32)
#include <winsock.h> #include <winsock.h>
typedef SOCKET ares_socket_t; typedef SOCKET ares_socket_t;
#define ARES_SOCKET_BAD INVALID_SOCKET #define ARES_SOCKET_BAD INVALID_SOCKET
@@ -42,4 +43,40 @@ typedef int ares_socket_t;
#define ARES_SOCKET_BAD -1 #define ARES_SOCKET_BAD -1
#endif #endif
/* Assume a few thing unless they're set by configure
*/
#if !defined(HAVE_SYS_TIME_H) && !defined(_MSC_VER)
#define HAVE_SYS_TIME_H
#endif
#if !defined(HAVE_UNISTD_H) && !defined(_MSC_VER)
#define HAVE_UNISTD_H 1
#endif
#if !defined(HAVE_SYS_UIO_H) && !defined(WIN32) && !defined(MSDOS)
#define HAVE_SYS_UIO_H
#endif
#if (defined(WIN32) || defined(WATT32)) && \
!(defined(__MINGW32__) || defined(NETWARE))
/* protos for the functions we provide in windows_port.c */
int ares_strncasecmp(const char *s1, const char *s2, int n);
int ares_strcasecmp(const char *s1, const char *s2);
/* use this define magic to prevent us from adding symbol names to the library
that is a high-risk to collide with another libraries' attempts to do the
same */
#define strncasecmp(a,b,c) ares_strncasecmp(a,b,c)
#define strcasecmp(a,b) ares_strcasecmp(a,b)
#endif
/* IPv6 compatibility */
#if !defined(HAVE_AF_INET6)
#if defined(HAVE_PF_INET6)
#define AF_INET6 PF_INET6
#else
#define AF_INET6 AF_MAX+1
#endif
#endif
#endif /* ARES_SETUP_H */ #endif /* ARES_SETUP_H */

View File

@@ -185,24 +185,24 @@ SOURCE=..\..\getopt.c
!IF "$(CFG)" == "adig - Win32 Release" !IF "$(CFG)" == "adig - Win32 Release"
"areslib - Win32 Release" : "areslib - Win32 Release" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
cd "..\adig" cd "..\adig"
"areslib - Win32 ReleaseCLEAN" : "areslib - Win32 ReleaseCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
cd "..\adig" cd "..\adig"
!ELSEIF "$(CFG)" == "adig - Win32 Debug" !ELSEIF "$(CFG)" == "adig - Win32 Debug"
"areslib - Win32 Debug" : "areslib - Win32 Debug" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
cd "..\adig" cd "..\adig"
"areslib - Win32 DebugCLEAN" : "areslib - Win32 DebugCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
cd "..\adig" cd "..\adig"

View File

@@ -195,24 +195,24 @@ SOURCE=..\..\ahost.c
!IF "$(CFG)" == "ahost - Win32 Release" !IF "$(CFG)" == "ahost - Win32 Release"
"areslib - Win32 Release" : "areslib - Win32 Release" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release"
cd "..\ahost" cd "..\ahost"
"areslib - Win32 ReleaseCLEAN" : "areslib - Win32 ReleaseCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Release" RECURSE=1 CLEAN
cd "..\ahost" cd "..\ahost"
!ELSEIF "$(CFG)" == "ahost - Win32 Debug" !ELSEIF "$(CFG)" == "ahost - Win32 Debug"
"areslib - Win32 Debug" : "areslib - Win32 Debug" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug"
cd "..\ahost" cd "..\ahost"
"areslib - Win32 DebugCLEAN" : "areslib - Win32 DebugCLEAN" :
cd "\ARES-1.1.1\vc\areslib" cd "..\areslib"
$(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN $(MAKE) /$(MAKEFLAGS) /F ".\areslib.mak" CFG="areslib - Win32 Debug" RECURSE=1 CLEAN
cd "..\ahost" cd "..\ahost"

View File

@@ -7,19 +7,19 @@
CFG=areslib - Win32 Debug CFG=areslib - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run !MESSAGE use the Export Makefile command and run
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "areslib.mak". !MESSAGE NMAKE /f "areslib.mak".
!MESSAGE !MESSAGE
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "areslib.mak" CFG="areslib - Win32 Debug" !MESSAGE NMAKE /f "areslib.mak" CFG="areslib - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "areslib - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "areslib - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "areslib - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "areslib - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
# Begin Project # Begin Project
# PROP AllowPerConfigDependencies 0 # PROP AllowPerConfigDependencies 0
@@ -74,7 +74,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo # ADD BASE LIB32 /nologo
# ADD LIB32 /nologo # ADD LIB32 /nologo
!ENDIF !ENDIF
# Begin Target # Begin Target
@@ -109,10 +109,6 @@ SOURCE=..\..\ares_fds.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\ares_free_errmem.c
# End Source File
# Begin Source File
SOURCE=..\..\ares_free_hostent.c SOURCE=..\..\ares_free_hostent.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -157,6 +153,14 @@ SOURCE=..\..\ares_search.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\ares_cancel.c
# End Source File
# Begin Source File
SOURCE=..\..\ares_version.c
# End Source File
# Begin Source File
SOURCE=..\..\ares_send.c SOURCE=..\..\ares_send.c
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -185,6 +189,10 @@ SOURCE=..\..\ares_dns.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\ares_version.h
# End Source File
# Begin Source File
SOURCE=..\..\ares_private.h SOURCE=..\..\ares_private.h
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -1,361 +1,367 @@
# Microsoft Developer Studio Generated NMAKE File, Based on areslib.dsp # Microsoft Developer Studio Generated NMAKE File, Based on areslib.dsp
!IF "$(CFG)" == "" !IF "$(CFG)" == ""
CFG=areslib - Win32 Debug CFG=areslib - Win32 Debug
!MESSAGE No configuration specified. Defaulting to areslib - Win32 Debug. !MESSAGE No configuration specified. Defaulting to areslib - Win32 Debug.
!ENDIF !ENDIF
!IF "$(CFG)" != "areslib - Win32 Release" && "$(CFG)" != "areslib - Win32 Debug" !IF "$(CFG)" != "areslib - Win32 Release" && "$(CFG)" != "areslib - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified. !MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE !MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE !MESSAGE
!MESSAGE NMAKE /f "areslib.mak" CFG="areslib - Win32 Debug" !MESSAGE NMAKE /f "areslib.mak" CFG="areslib - Win32 Debug"
!MESSAGE !MESSAGE
!MESSAGE Possible choices for configuration are: !MESSAGE Possible choices for configuration are:
!MESSAGE !MESSAGE
!MESSAGE "areslib - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "areslib - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "areslib - Win32 Debug" (based on "Win32 (x86) Static Library") !MESSAGE "areslib - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE !MESSAGE
!ERROR An invalid configuration is specified. !ERROR An invalid configuration is specified.
!ENDIF !ENDIF
!IF "$(OS)" == "Windows_NT" !IF "$(OS)" == "Windows_NT"
NULL= NULL=
!ELSE !ELSE
NULL=nul NULL=nul
!ENDIF !ENDIF
CPP=cl.exe CPP=cl.exe
RSC=rc.exe RSC=rc.exe
!IF "$(CFG)" == "areslib - Win32 Release" !IF "$(CFG)" == "areslib - Win32 Release"
OUTDIR=.\Release OUTDIR=.\Release
INTDIR=.\Release INTDIR=.\Release
# Begin Custom Macros # Begin Custom Macros
OutDir=.\Release OutDir=.\Release
# End Custom Macros # End Custom Macros
ALL : "$(OUTDIR)\areslib.lib" ALL : "$(OUTDIR)\areslib.lib"
CLEAN : CLEAN :
-@erase "$(INTDIR)\ares__close_sockets.obj" -@erase "$(INTDIR)\ares__close_sockets.obj"
-@erase "$(INTDIR)\ares__get_hostent.obj" -@erase "$(INTDIR)\ares__get_hostent.obj"
-@erase "$(INTDIR)\ares__read_line.obj" -@erase "$(INTDIR)\ares__read_line.obj"
-@erase "$(INTDIR)\ares_destroy.obj" -@erase "$(INTDIR)\ares_destroy.obj"
-@erase "$(INTDIR)\ares_expand_name.obj" -@erase "$(INTDIR)\ares_expand_name.obj"
-@erase "$(INTDIR)\ares_fds.obj" -@erase "$(INTDIR)\ares_fds.obj"
-@erase "$(INTDIR)\ares_free_errmem.obj" -@erase "$(INTDIR)\ares_free_hostent.obj"
-@erase "$(INTDIR)\ares_free_hostent.obj" -@erase "$(INTDIR)\ares_free_string.obj"
-@erase "$(INTDIR)\ares_free_string.obj" -@erase "$(INTDIR)\ares_gethostbyaddr.obj"
-@erase "$(INTDIR)\ares_gethostbyaddr.obj" -@erase "$(INTDIR)\ares_gethostbyname.obj"
-@erase "$(INTDIR)\ares_gethostbyname.obj" -@erase "$(INTDIR)\ares_init.obj"
-@erase "$(INTDIR)\ares_init.obj" -@erase "$(INTDIR)\ares_mkquery.obj"
-@erase "$(INTDIR)\ares_mkquery.obj" -@erase "$(INTDIR)\ares_parse_a_reply.obj"
-@erase "$(INTDIR)\ares_parse_a_reply.obj" -@erase "$(INTDIR)\ares_parse_ptr_reply.obj"
-@erase "$(INTDIR)\ares_parse_ptr_reply.obj" -@erase "$(INTDIR)\ares_process.obj"
-@erase "$(INTDIR)\ares_process.obj" -@erase "$(INTDIR)\ares_query.obj"
-@erase "$(INTDIR)\ares_query.obj" -@erase "$(INTDIR)\ares_search.obj"
-@erase "$(INTDIR)\ares_search.obj" -@erase "$(INTDIR)\ares_send.obj"
-@erase "$(INTDIR)\ares_send.obj" -@erase "$(INTDIR)\ares_strerror.obj"
-@erase "$(INTDIR)\ares_strerror.obj" -@erase "$(INTDIR)\ares_timeout.obj"
-@erase "$(INTDIR)\ares_timeout.obj" -@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.idb" -@erase "$(INTDIR)\windows_port.obj"
-@erase "$(INTDIR)\windows_port.obj" -@erase "$(OUTDIR)\areslib.lib"
-@erase "$(OUTDIR)\areslib.lib"
"$(OUTDIR)" :
"$(OUTDIR)" : if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\areslib.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\areslib.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c BSC32=bscmake.exe
BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(OUTDIR)\areslib.bsc"
BSC32_FLAGS=/nologo /o"$(OUTDIR)\areslib.bsc" BSC32_SBRS= \
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32=link.exe -lib LIB32_FLAGS=/nologo /out:"$(OUTDIR)\areslib.lib"
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\areslib.lib" LIB32_OBJS= \
LIB32_OBJS= \ "$(INTDIR)\ares__close_sockets.obj" \
"$(INTDIR)\ares__close_sockets.obj" \ "$(INTDIR)\ares__get_hostent.obj" \
"$(INTDIR)\ares__get_hostent.obj" \ "$(INTDIR)\ares__read_line.obj" \
"$(INTDIR)\ares__read_line.obj" \ "$(INTDIR)\ares_destroy.obj" \
"$(INTDIR)\ares_destroy.obj" \ "$(INTDIR)\ares_expand_name.obj" \
"$(INTDIR)\ares_expand_name.obj" \ "$(INTDIR)\ares_fds.obj" \
"$(INTDIR)\ares_fds.obj" \ "$(INTDIR)\ares_free_hostent.obj" \
"$(INTDIR)\ares_free_errmem.obj" \ "$(INTDIR)\ares_free_string.obj" \
"$(INTDIR)\ares_free_hostent.obj" \ "$(INTDIR)\ares_gethostbyaddr.obj" \
"$(INTDIR)\ares_free_string.obj" \ "$(INTDIR)\ares_gethostbyname.obj" \
"$(INTDIR)\ares_gethostbyaddr.obj" \ "$(INTDIR)\ares_init.obj" \
"$(INTDIR)\ares_gethostbyname.obj" \ "$(INTDIR)\ares_mkquery.obj" \
"$(INTDIR)\ares_init.obj" \ "$(INTDIR)\ares_parse_a_reply.obj" \
"$(INTDIR)\ares_mkquery.obj" \ "$(INTDIR)\ares_parse_ptr_reply.obj" \
"$(INTDIR)\ares_parse_a_reply.obj" \ "$(INTDIR)\ares_process.obj" \
"$(INTDIR)\ares_parse_ptr_reply.obj" \ "$(INTDIR)\ares_query.obj" \
"$(INTDIR)\ares_process.obj" \ "$(INTDIR)\ares_search.obj" \
"$(INTDIR)\ares_query.obj" \ "$(INTDIR)\ares_cancel.obj" \
"$(INTDIR)\ares_search.obj" \ "$(INTDIR)\ares_version.obj" \
"$(INTDIR)\ares_send.obj" \ "$(INTDIR)\ares_send.obj" \
"$(INTDIR)\ares_strerror.obj" \ "$(INTDIR)\ares_strerror.obj" \
"$(INTDIR)\ares_timeout.obj" \ "$(INTDIR)\ares_timeout.obj" \
"$(INTDIR)\windows_port.obj" "$(INTDIR)\windows_port.obj"
"$(OUTDIR)\areslib.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) "$(OUTDIR)\areslib.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<< $(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<< <<
!ELSEIF "$(CFG)" == "areslib - Win32 Debug" !ELSEIF "$(CFG)" == "areslib - Win32 Debug"
OUTDIR=.\Debug OUTDIR=.\Debug
INTDIR=.\Debug INTDIR=.\Debug
# Begin Custom Macros # Begin Custom Macros
OutDir=.\Debug OutDir=.\Debug
# End Custom Macros # End Custom Macros
ALL : "$(OUTDIR)\areslib.lib" ALL : "$(OUTDIR)\areslib.lib"
CLEAN : CLEAN :
-@erase "$(INTDIR)\ares__close_sockets.obj" -@erase "$(INTDIR)\ares__close_sockets.obj"
-@erase "$(INTDIR)\ares__get_hostent.obj" -@erase "$(INTDIR)\ares__get_hostent.obj"
-@erase "$(INTDIR)\ares__read_line.obj" -@erase "$(INTDIR)\ares__read_line.obj"
-@erase "$(INTDIR)\ares_destroy.obj" -@erase "$(INTDIR)\ares_destroy.obj"
-@erase "$(INTDIR)\ares_expand_name.obj" -@erase "$(INTDIR)\ares_expand_name.obj"
-@erase "$(INTDIR)\ares_fds.obj" -@erase "$(INTDIR)\ares_fds.obj"
-@erase "$(INTDIR)\ares_free_errmem.obj" -@erase "$(INTDIR)\ares_free_hostent.obj"
-@erase "$(INTDIR)\ares_free_hostent.obj" -@erase "$(INTDIR)\ares_free_string.obj"
-@erase "$(INTDIR)\ares_free_string.obj" -@erase "$(INTDIR)\ares_gethostbyaddr.obj"
-@erase "$(INTDIR)\ares_gethostbyaddr.obj" -@erase "$(INTDIR)\ares_gethostbyname.obj"
-@erase "$(INTDIR)\ares_gethostbyname.obj" -@erase "$(INTDIR)\ares_init.obj"
-@erase "$(INTDIR)\ares_init.obj" -@erase "$(INTDIR)\ares_mkquery.obj"
-@erase "$(INTDIR)\ares_mkquery.obj" -@erase "$(INTDIR)\ares_parse_a_reply.obj"
-@erase "$(INTDIR)\ares_parse_a_reply.obj" -@erase "$(INTDIR)\ares_parse_ptr_reply.obj"
-@erase "$(INTDIR)\ares_parse_ptr_reply.obj" -@erase "$(INTDIR)\ares_process.obj"
-@erase "$(INTDIR)\ares_process.obj" -@erase "$(INTDIR)\ares_query.obj"
-@erase "$(INTDIR)\ares_query.obj" -@erase "$(INTDIR)\ares_search.obj"
-@erase "$(INTDIR)\ares_search.obj" -@erase "$(INTDIR)\ares_cancel.obj"
-@erase "$(INTDIR)\ares_send.obj" -@erase "$(INTDIR)\ares_version.obj"
-@erase "$(INTDIR)\ares_strerror.obj" -@erase "$(INTDIR)\ares_send.obj"
-@erase "$(INTDIR)\ares_timeout.obj" -@erase "$(INTDIR)\ares_strerror.obj"
-@erase "$(INTDIR)\vc60.idb" -@erase "$(INTDIR)\ares_timeout.obj"
-@erase "$(INTDIR)\vc60.pdb" -@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\windows_port.obj" -@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\areslib.lib" -@erase "$(INTDIR)\windows_port.obj"
-@erase "$(OUTDIR)\areslib.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" "$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\areslib.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
BSC32=bscmake.exe CPP_PROJ=/nologo /MLd /W3 /Gm /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /Fp"$(INTDIR)\areslib.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
BSC32_FLAGS=/nologo /o"$(OUTDIR)\areslib.bsc" BSC32=bscmake.exe
BSC32_SBRS= \ BSC32_FLAGS=/nologo /o"$(OUTDIR)\areslib.bsc"
BSC32_SBRS= \
LIB32=link.exe -lib
LIB32_FLAGS=/nologo /out:"$(OUTDIR)\areslib.lib" LIB32=link.exe -lib
LIB32_OBJS= \ LIB32_FLAGS=/nologo /out:"$(OUTDIR)\areslib.lib"
"$(INTDIR)\ares__close_sockets.obj" \ LIB32_OBJS= \
"$(INTDIR)\ares__get_hostent.obj" \ "$(INTDIR)\ares__close_sockets.obj" \
"$(INTDIR)\ares__read_line.obj" \ "$(INTDIR)\ares__get_hostent.obj" \
"$(INTDIR)\ares_destroy.obj" \ "$(INTDIR)\ares__read_line.obj" \
"$(INTDIR)\ares_expand_name.obj" \ "$(INTDIR)\ares_destroy.obj" \
"$(INTDIR)\ares_fds.obj" \ "$(INTDIR)\ares_expand_name.obj" \
"$(INTDIR)\ares_free_errmem.obj" \ "$(INTDIR)\ares_fds.obj" \
"$(INTDIR)\ares_free_hostent.obj" \ "$(INTDIR)\ares_free_hostent.obj" \
"$(INTDIR)\ares_free_string.obj" \ "$(INTDIR)\ares_free_string.obj" \
"$(INTDIR)\ares_gethostbyaddr.obj" \ "$(INTDIR)\ares_gethostbyaddr.obj" \
"$(INTDIR)\ares_gethostbyname.obj" \ "$(INTDIR)\ares_gethostbyname.obj" \
"$(INTDIR)\ares_init.obj" \ "$(INTDIR)\ares_init.obj" \
"$(INTDIR)\ares_mkquery.obj" \ "$(INTDIR)\ares_mkquery.obj" \
"$(INTDIR)\ares_parse_a_reply.obj" \ "$(INTDIR)\ares_parse_a_reply.obj" \
"$(INTDIR)\ares_parse_ptr_reply.obj" \ "$(INTDIR)\ares_parse_ptr_reply.obj" \
"$(INTDIR)\ares_process.obj" \ "$(INTDIR)\ares_process.obj" \
"$(INTDIR)\ares_query.obj" \ "$(INTDIR)\ares_query.obj" \
"$(INTDIR)\ares_search.obj" \ "$(INTDIR)\ares_search.obj" \
"$(INTDIR)\ares_send.obj" \ "$(INTDIR)\ares_send.obj" \
"$(INTDIR)\ares_strerror.obj" \ "$(INTDIR)\ares_strerror.obj" \
"$(INTDIR)\ares_timeout.obj" \ "$(INTDIR)\ares_timeout.obj" \
"$(INTDIR)\windows_port.obj" "$(INTDIR)\windows_port.obj"
"$(OUTDIR)\areslib.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS) "$(OUTDIR)\areslib.lib" : "$(OUTDIR)" $(DEF_FILE) $(LIB32_OBJS)
$(LIB32) @<< $(LIB32) @<<
$(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS) $(LIB32_FLAGS) $(DEF_FLAGS) $(LIB32_OBJS)
<< <<
!ENDIF !ENDIF
.c{$(INTDIR)}.obj:: .c{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cpp{$(INTDIR)}.obj:: .cpp{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cxx{$(INTDIR)}.obj:: .cxx{$(INTDIR)}.obj::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.c{$(INTDIR)}.sbr:: .c{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cpp{$(INTDIR)}.sbr:: .cpp{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
.cxx{$(INTDIR)}.sbr:: .cxx{$(INTDIR)}.sbr::
$(CPP) @<< $(CPP) @<<
$(CPP_PROJ) $< $(CPP_PROJ) $<
<< <<
!IF "$(NO_EXTERNAL_DEPS)" != "1" !IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("areslib.dep") !IF EXISTS("areslib.dep")
!INCLUDE "areslib.dep" !INCLUDE "areslib.dep"
!ELSE !ELSE
!MESSAGE Warning: cannot find "areslib.dep" !MESSAGE Warning: cannot find "areslib.dep"
!ENDIF !ENDIF
!ENDIF !ENDIF
!IF "$(CFG)" == "areslib - Win32 Release" || "$(CFG)" == "areslib - Win32 Debug" !IF "$(CFG)" == "areslib - Win32 Release" || "$(CFG)" == "areslib - Win32 Debug"
SOURCE=..\..\ares__close_sockets.c SOURCE=..\..\ares__close_sockets.c
"$(INTDIR)\ares__close_sockets.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares__close_sockets.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares__get_hostent.c SOURCE=..\..\ares__get_hostent.c
"$(INTDIR)\ares__get_hostent.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares__get_hostent.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares__read_line.c SOURCE=..\..\ares__read_line.c
"$(INTDIR)\ares__read_line.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares__read_line.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_destroy.c SOURCE=..\..\ares_destroy.c
"$(INTDIR)\ares_destroy.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_destroy.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_expand_name.c SOURCE=..\..\ares_expand_name.c
"$(INTDIR)\ares_expand_name.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_expand_name.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_fds.c SOURCE=..\..\ares_fds.c
"$(INTDIR)\ares_fds.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_fds.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_free_errmem.c SOURCE=..\..\ares_free_hostent.c
"$(INTDIR)\ares_free_errmem.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_free_hostent.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_free_hostent.c SOURCE=..\..\ares_free_string.c
"$(INTDIR)\ares_free_hostent.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_free_string.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_free_string.c SOURCE=..\..\ares_gethostbyaddr.c
"$(INTDIR)\ares_free_string.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_gethostbyaddr.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_gethostbyaddr.c SOURCE=..\..\ares_gethostbyname.c
"$(INTDIR)\ares_gethostbyaddr.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_gethostbyname.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_gethostbyname.c SOURCE=..\..\ares_init.c
"$(INTDIR)\ares_gethostbyname.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_init.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_init.c SOURCE=..\..\ares_mkquery.c
"$(INTDIR)\ares_init.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_mkquery.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_mkquery.c SOURCE=..\..\ares_parse_a_reply.c
"$(INTDIR)\ares_mkquery.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_parse_a_reply.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_parse_a_reply.c SOURCE=..\..\ares_parse_ptr_reply.c
"$(INTDIR)\ares_parse_a_reply.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_parse_ptr_reply.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_parse_ptr_reply.c SOURCE=..\..\ares_process.c
"$(INTDIR)\ares_parse_ptr_reply.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_process.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_process.c SOURCE=..\..\ares_query.c
"$(INTDIR)\ares_process.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_query.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_query.c SOURCE=..\..\ares_search.c
"$(INTDIR)\ares_query.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_search.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_search.c SOURCE=..\..\ares_version.c
"$(INTDIR)\ares_search.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_version.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_send.c SOURCE=..\..\ares_cancel.c
"$(INTDIR)\ares_send.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_cancel.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_strerror.c SOURCE=..\..\ares_send.c
"$(INTDIR)\ares_strerror.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_send.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\ares_timeout.c SOURCE=..\..\ares_strerror.c
"$(INTDIR)\ares_timeout.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_strerror.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\windows_port.c SOURCE=..\..\ares_timeout.c
"$(INTDIR)\windows_port.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\ares_timeout.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE) $(CPP) $(CPP_PROJ) $(SOURCE)
SOURCE=..\..\windows_port.c
!ENDIF
"$(INTDIR)\windows_port.obj" : $(SOURCE) "$(INTDIR)"
$(CPP) $(CPP_PROJ) $(SOURCE)
!ENDIF

View File

@@ -1,6 +1,8 @@
#include "setup.h" #include "setup.h"
#ifdef WIN32 /* only do the following on windows */ /* only do the following on windows
*/
#if (defined(WIN32) || defined(WATT32)) && !defined(MSDOS)
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
@@ -8,13 +10,19 @@
#include <errno.h> #include <errno.h>
#include <malloc.h> #include <malloc.h>
#ifdef WATT32
#include <sys/socket.h>
#else
#include "nameser.h" #include "nameser.h"
#endif
#include "ares.h"
#include "ares_private.h"
#ifndef __MINGW32__ #ifndef __MINGW32__
int int
ares_strncasecmp(const char *a, const char *b, size_t n) ares_strncasecmp(const char *a, const char *b, int n)
{ {
size_t i; int i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int c1 = isupper(a[i]) ? tolower(a[i]) : a[i]; int c1 = isupper(a[i]) ? tolower(a[i]) : a[i];
@@ -31,33 +39,39 @@ ares_strcasecmp(const char *a, const char *b)
} }
#endif #endif
/*
* Number of micro-seconds between the beginning of the Windows epoch
* (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970).
*/
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define EPOCH_FILETIME 11644473600000000Ui64
#else
#define EPOCH_FILETIME 11644473600000000ULL
#endif
int int
ares_gettimeofday(struct timeval *tv, struct timezone *tz) ares_gettimeofday(struct timeval *tv, struct timezone *tz)
{ {
FILETIME ft; FILETIME ft;
LARGE_INTEGER li; LARGE_INTEGER li;
__int64 t; __int64 t;
static int tzflag;
if (tv) if (tv)
{ {
GetSystemTimeAsFileTime(&ft); GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime; li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime; li.HighPart = ft.dwHighDateTime;
t = li.QuadPart; /* In 100-nanosecond intervals */ t = li.QuadPart / 10; /* In micro-second intervals */
#if 0 t -= EPOCH_FILETIME; /* Offset to the Epoch time */
t -= EPOCHFILETIME; /* Offset to the Epoch time */
#endif
t /= 10; /* In microseconds */
tv->tv_sec = (long)(t / 1000000); tv->tv_sec = (long)(t / 1000000);
tv->tv_usec = (long)(t % 1000000); tv->tv_usec = (long)(t % 1000000);
} }
(void) tz;
return 0; return 0;
} }
int int
ares_writev (SOCKET s, const struct iovec *vector, size_t count) ares_writev (ares_socket_t s, const struct iovec *vector, size_t count)
{ {
char *buffer, *bp; char *buffer, *bp;
size_t i, bytes = 0; size_t i, bytes = 0;

View File

@@ -13,7 +13,7 @@ findtool(){
IFS=":" IFS=":"
for path in $PATH for path in $PATH
do do
if test -r "$path/$file"; then if test -f "$path/$file"; then
echo "$path/$file" echo "$path/$file"
return return
fi fi
@@ -24,7 +24,7 @@ findtool(){
# autoconf 2.57 or newer # autoconf 2.57 or newer
# #
need_autoconf="2.57" need_autoconf="2.57"
ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` ac_version=`${AUTOCONF:-autoconf} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ac_version"; then if test -z "$ac_version"; then
echo "buildconf: autoconf not found." echo "buildconf: autoconf not found."
echo " You need autoconf version $need_autoconf or newer installed." echo " You need autoconf version $need_autoconf or newer installed."
@@ -45,7 +45,7 @@ echo "buildconf: autoconf version $ac_version (ok)"
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# autoheader 2.50 or newer # autoheader 2.50 or newer
# #
ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'` ah_version=`${AUTOHEADER:-autoheader} --version 2>/dev/null|head -n 1| sed -e 's/^[^0-9]*//' -e 's/[a-z]* *$//'`
if test -z "$ah_version"; then if test -z "$ah_version"; then
echo "buildconf: autoheader not found." echo "buildconf: autoheader not found."
echo " You need autoheader version 2.50 or newer installed." echo " You need autoheader version 2.50 or newer installed."
@@ -67,7 +67,7 @@ echo "buildconf: autoheader version $ah_version (ok)"
# automake 1.7 or newer # automake 1.7 or newer
# #
need_automake="1.7" need_automake="1.7"
am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'` am_version=`${AUTOMAKE:-automake} --version 2>/dev/null|head -n 1| sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//' -e 's/\(.*\)\(-p.*\)/\1/'`
if test -z "$am_version"; then if test -z "$am_version"; then
echo "buildconf: automake not found." echo "buildconf: automake not found."
echo " You need automake version $need_automake or newer installed." echo " You need automake version $need_automake or newer installed."
@@ -85,6 +85,14 @@ fi
echo "buildconf: automake version $am_version (ok)" echo "buildconf: automake version $am_version (ok)"
ac=`findtool aclocal`
if test -z "$ac"; then
echo "buildconf: aclocal not found. Weird automake installation!"
exit 1
else
echo "buildconf: aclocal found"
fi
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# libtool check # libtool check
@@ -101,7 +109,11 @@ libtool=`findtool glibtool 2>/dev/null`
if test ! -x "$libtool"; then if test ! -x "$libtool"; then
libtool=`findtool libtool` libtool=`findtool libtool`
fi fi
lt_pversion=`$libtool --version 2>/dev/null|head -1|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
# set the LIBTOOLIZE here so that glibtoolize is used if glibtool was found
LIBTOOLIZE="${libtool}ize"
lt_pversion=`$libtool --version 2>/dev/null|head -n 1|sed -e 's/^[^0-9]*//g' -e 's/[- ].*//'`
if test -z "$lt_pversion"; then if test -z "$lt_pversion"; then
echo "buildconf: libtool not found." echo "buildconf: libtool not found."
echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed" echo " You need libtool version $LIBTOOL_WANTED_VERSION or newer installed"
@@ -138,10 +150,17 @@ fi
echo "buildconf: libtool version $lt_version (ok)" echo "buildconf: libtool version $lt_version (ok)"
if test -f "$LIBTOOLIZE"; then
echo "buildconf: libtoolize found"
else
echo "buildconf: libtoolize not found. Weird libtool installation!"
exit 1
fi
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# m4 check # m4 check
# #
m4=`${M4:-m4} --version 2>/dev/null|head -1`; m4=`${M4:-m4} --version 2>/dev/null|head -n 1`;
m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'` m4_version=`echo $m4 | sed -e 's/^.* \([0-9]\)/\1/' -e 's/[a-z]* *$//'`
if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then if { echo $m4 | grep "GNU" >/dev/null 2>&1; } then
@@ -151,6 +170,10 @@ else
exit 1 exit 1
fi fi
#--------------------------------------------------------------------------
# perl check
#
PERL=`findtool perl`
# ------------------------------------------------------------ # ------------------------------------------------------------
@@ -160,18 +183,27 @@ echo "buildconf: running libtoolize"
${LIBTOOLIZE:-libtoolize} --copy --automake --force || die "The libtool command failed" ${LIBTOOLIZE:-libtoolize} --copy --automake --force || die "The libtool command failed"
echo "buildconf: running aclocal" echo "buildconf: running aclocal"
${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed" ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The aclocal command line failed"
echo "buildconf: running aclocal hack to convert all mv to mv -f" if test -n "$PERL"; then
perl -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4 echo "buildconf: running aclocal hack to convert all mv to mv -f"
$PERL -i.bak -pe 's/\bmv +([^-\s])/mv -f $1/g' aclocal.m4
else
echo "buildconf: perl not found"
exit 1
fi
echo "buildconf: running autoheader" echo "buildconf: running autoheader"
${AUTOHEADER:-autoheader} || die "The autoheader command failed" ${AUTOHEADER:-autoheader} || die "The autoheader command failed"
echo "buildconf: cp lib/config.h.in src/config.h.in"
cp lib/config.h.in src/config.h.in
echo "buildconf: running autoconf" echo "buildconf: running autoconf"
${AUTOCONF:-autoconf} || die "The autoconf command failed" ${AUTOCONF:-autoconf} || die "The autoconf command failed"
if test -d ares; then if test -d ares; then
cd ares cd ares
echo "buildconf: running aclocal in the ares directory" echo "buildconf: running ares/libtoolize"
${LIBTOOLIZE:-libtoolize} --copy --automake --force || die "The libtool command failed"
echo "buildconf: running ares/aclocal"
${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The ares aclocal command failed" ${ACLOCAL:-aclocal} $ACLOCAL_FLAGS || die "The ares aclocal command failed"
echo "buildconf: running autoconf in the ares directory" echo "buildconf: running ares/autoconf"
${AUTOCONF:-autoconf} || die "The ares autoconf command failed" ${AUTOCONF:-autoconf} || die "The ares autoconf command failed"
cd .. cd ..
fi fi

View File

@@ -7,9 +7,6 @@ REM create ca-bundle.h
echo /* This file is generated automatically */ >lib\ca-bundle.h echo /* This file is generated automatically */ >lib\ca-bundle.h
echo #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") >>lib\ca-bundle.h echo #define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE") >>lib\ca-bundle.h
REM create getdate.c
copy lib\getdate.c.cvs lib\getdate.c
REM create hugehelp.c REM create hugehelp.c
copy src\hugehelp.c.cvs src\hugehelp.c copy src\hugehelp.c.cvs src\hugehelp.c

File diff suppressed because it is too large Load Diff

View File

@@ -19,7 +19,8 @@ Available values for OPTION include:
--ca ca bundle install path --ca ca bundle install path
--cc compiler --cc compiler
--cflags pre-processor and compiler flags --cflags pre-processor and compiler flags
--feature newline separated list of enabled features --features newline separated list of enabled features
--protocols newline separated list of enabled protocols
--help display this help and exit --help display this help and exit
--libs library linking information --libs library linking information
--prefix curl install prefix --prefix curl install prefix
@@ -45,19 +46,22 @@ while test $# -gt 0; do
case "$1" in case "$1" in
--ca) --ca)
echo @CURL_CA_BUNDLE@ echo "@CURL_CA_BUNDLE@"
;; ;;
--cc) --cc)
echo @CC@ echo "@CC@"
;; ;;
--prefix) --prefix)
echo $prefix echo "$prefix"
;; ;;
--feature) --feature|--features)
if test "@OPENSSL_ENABLED@" = "1"; then if test "@USE_SSLEAY@" = "1"; then
echo "SSL"
NTLM=1 # OpenSSL implies NTLM
elif test -n "@USE_GNUTLS@"; then
echo "SSL" echo "SSL"
fi fi
if test "@KRB4_ENABLED@" = "1"; then if test "@KRB4_ENABLED@" = "1"; then
@@ -69,32 +73,50 @@ while test $# -gt 0; do
if test "@HAVE_LIBZ@" = "1"; then if test "@HAVE_LIBZ@" = "1"; then
echo "libz" echo "libz"
fi fi
if test "@CURL_DISABLE_HTTP@" = "1"; then
echo "HTTP-disabled"
fi
if test "@CURL_DISABLE_FTP@" = "1"; then
echo "FTP-disabled"
fi
if test "@CURL_DISABLE_GOPHER@" = "1"; then
echo "GOPHER-disabled"
fi
if test "@CURL_DISABLE_FILE@" = "1"; then
echo "FILE-disabled"
fi
if test "@CURL_DISABLE_TELNET@" = "1"; then
echo "TELNET-disabled"
fi
if test "@CURL_DISABLE_LDAP@" = "1"; then
echo "LDAP-disabled"
fi
if test "@CURL_DISABLE_DICT@" = "1"; then
echo "DICT-disabled"
fi
if test "@HAVE_ARES@" = "1"; then if test "@HAVE_ARES@" = "1"; then
echo "AsynchDNS" echo "AsynchDNS"
fi fi
if test "@IDN_ENABLED@" = "1"; then
echo "IDN"
fi
if test "@USE_WINDOWS_SSPI@" = "1"; then
echo "SSPI"
NTLM=1
fi
if test "$NTLM" = "1"; then
echo "NTLM"
fi
;; ;;
--protocols)
if test "@CURL_DISABLE_HTTP@" != "1"; then
echo "HTTP"
if test "@USE_SSLEAY@" = "1"; then
echo "HTTPS"
fi
fi
if test "@CURL_DISABLE_FTP@" != "1"; then
echo "FTP"
if test "@USE_SSLEAY@" = "1"; then
echo "FTPS"
fi
fi
if test "@CURL_DISABLE_GOPHER@" != "1"; then
echo "GOPHER"
fi
if test "@CURL_DISABLE_FILE@" != "1"; then
echo "FILE"
fi
if test "@CURL_DISABLE_TELNET@" != "1"; then
echo "TELNET"
fi
if test "@CURL_DISABLE_LDAP@" != "1"; then
echo "LDAP"
fi
if test "@CURL_DISABLE_DICT@" != "1"; then
echo "DICT"
fi
;;
--version) --version)
echo libcurl @VERSION@ echo libcurl @VERSION@
exit 0 exit 0
@@ -123,8 +145,7 @@ while test $# -gt 0; do
*) *)
echo "unknown option: $1" echo "unknown option: $1"
usage usage 1
exit 1
;; ;;
esac esac
shift shift

View File

@@ -20,6 +20,13 @@
) )
"Curl C Programming Style") "Curl C Programming Style")
(defun curl-code-cleanup ()
"no docs"
(interactive)
(untabify (point-min) (point-max))
(delete-trailing-whitespace)
)
;; Customizations for all of c-mode, c++-mode, and objc-mode ;; Customizations for all of c-mode, c++-mode, and objc-mode
(defun curl-c-mode-common-hook () (defun curl-c-mode-common-hook ()
"Curl C mode hook" "Curl C mode hook"
@@ -33,7 +40,7 @@
;; keybindings for C, C++, and Objective-C. We can put these in ;; keybindings for C, C++, and Objective-C. We can put these in
;; c-mode-base-map because of inheritance ... ;; c-mode-base-map because of inheritance ...
(define-key c-mode-base-map "\M-q" 'c-fill-paragraph) (define-key c-mode-base-map "\M-q" 'c-fill-paragraph)
(define-key c-mode-base-map "\M-m" 'delete-trailing-whitespace) (define-key c-mode-base-map "\M-m" 'curl-code-cleanup)
(setq c-recognize-knr-p nil) (setq c-recognize-knr-p nil)
;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t) ;;; (add-hook 'write-file-hooks 'delete-trailing-whitespace t)
(setq show-trailing-whitespace t) (setq show-trailing-whitespace t)

View File

@@ -1,7 +1,7 @@
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
| (__| |_| | _ <| |___ | (__| |_| | _ <| |___
\___|\___/|_| \_\_____| \___|\___/|_| \_\_____|
libcurl bindings libcurl bindings
@@ -17,22 +17,31 @@ archives, but must be downloaded and installed separately.
Ada95 Ada95
Writtten by Andreas Almroth. Writtten by Andreas Almroth
http://www.almroth.com/adacurl/index.html http://www.almroth.com/adacurl/index.html
Basic Basic
ScriptBasic bindings to libcurl. Writtten by Peter Verhas. ScriptBasic bindings to libcurl. Writtten by Peter Verhas
http://scriptbasic.com/ http://scriptbasic.com/
C
libcurl is a C library in itself!
http://curl.haxx.se/libcurl/
C++ C++
Written by Jean-Philippe Barrette-LaPierre. Written by Jean-Philippe Barrette-LaPierre
http://www.sourceforge.net/projects/curlpp http://rrette.com/curlpp.html
Ch
Written by Stephen Nestinger and Jonathan Rogado
http://chcurl.sourceforge.net/
Cocoa Cocoa
Written by Dan Wood. Written by Dan Wood
http://curlhandle.sourceforge.net/ http://curlhandle.sourceforge.net/
D D
@@ -42,26 +51,49 @@ D
Dylan Dylan
Written by Chris Double. Written by Chris Double
http://dylanlibs.sourceforge.net/ http://dylanlibs.sourceforge.net/
Euphoria Euphoria
Written by Ray Smith. Written by Ray Smith
http://rays-web.com/eulibcurl.htm http://rays-web.com/eulibcurl.htm
Ferite Ferite
Written by Paul Querna
http://www.ferite.org/ http://www.ferite.org/
Gambas
http://gambas.sourceforge.net
glib/GTK+
Written by Richard Atterer
http://atterer.net/glibcurl/
Java Java
Written by Daniel Stenberg. Maintained by Vic Hanson
http://curl.haxx.se/libcurl/java/ http://curl.haxx.se/libcurl/java/
Lisp
Written by Liam Healy
http://common-lisp.net/project/cl-curl/
Lua Lua
Written by Steve Dekorte. LuaCURL Written by Alexander Marinov
http://curl.haxx.se/libcurl/lua/ http://luacurl.luaforge.net/
Mono
Written by Jeffrey Phillips
http://forge.novell.com/modules/xfmod/project/?libcurl-mono
.NET
libcurl-net Written by Jeffrey Phillips
http://sourceforge.net/projects/libcurl-net/
Object-Pascal Object-Pascal
@@ -70,7 +102,7 @@ Object-Pascal
O'Caml O'Caml
Written by Lars Nilsson. Written by Lars Nilsson
http://sourceforge.net/projects/ocurl/ http://sourceforge.net/projects/ocurl/
Pascal Pascal
@@ -80,40 +112,59 @@ Pascal
Perl Perl
Maintained by Cris Bailiff. Maintained by Cris Bailiff
http://curl.haxx.se/libcurl/perl/ http://curl.haxx.se/libcurl/perl/
PHP PHP
Written by Sterling Hughes. Written by Sterling Hughes
http://curl.haxx.se/libcurl/php/ http://curl.haxx.se/libcurl/php/
PostgreSQL PostgreSQL
Written by Gian Paolo Ciceri. Written by Gian Paolo Ciceri
http://gborg.postgresql.org/project/pgcurl/projdisplay.php http://gborg.postgresql.org/project/pgcurl/projdisplay.php
Python Python
Written by Kjetil Jacobsen. PycURL is written by Kjetil Jacobsen
http://pycurl.sourceforge.net/ http://pycurl.sourceforge.net/
R
RCurl is written by Duncan Temple Lang
http://www.omegahat.org/RCurl/
Rexx Rexx
Written Mark Hessling. Written Mark Hessling
http://rexxcurl.sourceforge.net/ http://rexxcurl.sourceforge.net/
Ruby Ruby
Written by Hirotaka Matsuyuki. Written by Hirotaka Matsuyuki
http://www.d1.dion.ne.jp/~matuyuki/ruby.html http://www.d1.dion.ne.jp/~matuyuki/ruby.html
Scheme Scheme
Bigloo binding written by Kirill Lisovsky. Bigloo binding written by Kirill Lisovsky
http://curl.haxx.se/libcurl/scheme/ http://curl.haxx.se/libcurl/scheme/
Tcl Tcl
Written by Andr<64>s Garc<72>a. Tclcurl is written by Andr<64>s Garc<72>a
http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html http://personal1.iddeo.es/andresgarci/tclcurl/english/docs.html
Visual Basic
libcurl-vb is written by Jeffrey Phillips
http://sourceforge.net/projects/libcurl-vb/
Q
http://q-lang.sourceforge.net/
wxWidgets
Written by Casey O'Donnell
http://homepage.mac.com/codonnell/wxcurldav/

View File

@@ -1,7 +1,7 @@
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
| (__| |_| | _ <| |___ | (__| |_| | _ <| |___
\___|\___/|_| \_\_____| \___|\___/|_| \_\_____|
To Think About When Contributing Source Code To Think About When Contributing Source Code
@@ -138,15 +138,15 @@ How To Make a Patch
If you have modified a single file, try something like: If you have modified a single file, try something like:
diff -u undmodified-file.c my-changed-one.c > my-fixes.diff diff -u unmodified-file.c my-changed-one.c > my-fixes.diff
If you have modified several files, possibly in different directories, you If you have modified several files, possibly in different directories, you
can use diff recursively: can use diff recursively:
diff -ur curl-original-dir curl-modfied-sources-dir > my-fixes.diff diff -ur curl-original-dir curl-modified-sources-dir > my-fixes.diff
The GNU diff and GNU patch tools exist for virtually all platforms, including The GNU diff and GNU patch tools exist for virtually all platforms, including
all kinds of unixes and Windows: all kinds of Unixes and Windows:
For unix-like operating systems: For unix-like operating systems:

186
docs/DISTRO-DILEMMA Normal file
View File

@@ -0,0 +1,186 @@
Date: September 1, 2005
Author: Daniel Stenberg <daniel@haxx.se>
URL: http://curl.haxx.se/legal/distro-dilemma.html
Condition
This document is written to describe the sitution as it is right now. libcurl
7.14.0 is currently the latest version available. Things may (or perhaps
will) of course change in the future.
This document reflects my view and understanding of these things. Please tell
me where and how you think I'm wrong, and I'll try to correct my mistakes.
Background
The Free Software Foundation has deemed the Original BSD license[1] to be
"incompatible"[2] with GPL[3]. I'd rather say it is the other way around, but
the point is the same: if you distribute a binary version of a GPL program,
it MUST NOT be linked with any Original BSD-licenced parts or
libraries. Doing so will violate the GPL license. For a long time, very many
GPL licensed programs have avoided this license mess by adding an
exception[8] to their license. And many others have just closed their eyes
for this problem.
libcurl is MIT-style[4] licensed - how on earth did this dilemma fall onto
our plates?
libcurl is only a little library. libcurl can be built to use OpenSSL for its
SSL/TLS capabilities. OpenSSL is basically Original BSD licensed[5].
If libcurl built to use OpenSSL is used by a GPL-licensed application and you
decide to distribute a binary version of it (Linux distros - for example -
tend to), you have a clash. GPL vs Original BSD.
This dilemma is not libcurl-specific nor is it specific to any particular
Linux distro.
Part of the Operating System
This would not be a problem if the used lib would be considered part of the
uderlying operating system, as then the GPL license has an exception
clause[6] that allows applications to use such libs without having to be
allowed to distribute it or its sources. Possibly some distros will claim
that OpenSSL is part of their operating system.
Debian does however not take this stance and has officially(?) claimed that
OpenSSL is not a required part of the Debian operating system
Debian-legal
In August 2004 I figured I should start pulling people's attention to this to
see if anyone has any bright ideas or if they would dismiss my worries based
on some elegant writing I had missed somewhere:
My post to debian-legal on August 12 2004:
http://lists.debian.org/debian-legal/2004/08/msg00279.html
Several people agreed then that this is a known and rather big problem, but
the following discussion didn't result in much.
GnuTLS
With the release of libcurl 7.14.0 (May 2005), it can now get built to use
GnuTLS instead of OpenSSL. GnuTLS is a LGPL[7] licensed library that offers a
matching set of features as OpenSSL does. Now, you can build and distribute
an SSL capable libcurl without including any Original BSD licensed code.
I believe Debian is the first distro to provide libcurl/GnutTLS packages.
GnuTLS vs OpenSSL
While these two libraries offer similar features, they are not equal. Both
libraries have features the other one lacks. libcurl does not (yet) offer a
standardized stable ABI if you decide to switch from using libcurl-openssl to
libcurl-gnutls or vice versa. The GnuTLS support is very recent in libcurl
and it has not been tested nor used very extensively, while the OpenSSL
equivalent code has been used and thus matured for more than seven (7) years.
In August 2005, the debian-devel mailing list discovered the license issue as
a GPL licensed application wanted SSL capabilities from libcurl and thus was
forced to use the GnuTLS powered libcurl. For a reason that is unknown to me,
the application authors didn't want to or was unable to add an exception to
their GPL license. Alas, the license problem hit the fan again.
The Better License, Original BSD or LGPL?
It isn't obvious or without debate to any objective interested party that
either of these licenses are the "better" or even the "preferred" one in a
generic situation.
Instead, I think we should accept the fact that the SSL/TLS libraries and
their different licenses will fit different applications and their authors
differently depending on the applications' licenses and their general usage
pattern (considering how LGPL libraries can be burdonsome for embedded
systems usage).
More SSL Libraries
In libcurl, there's no stopping us here. There are at least a few more Open
Source/Free SSL/TLS libraries and we would very much like to support them as
well, to offer application authors an even wider scope of choice.
Application Angle of this Problem
libcurl is built to use one SSL/TLS library. It uses a single fixed name (by
default), and applications are built/linked to use that single lib. Replacing
one libcurl instance with another one that uses the other SSL/TLS library
might break one or more applications (due to ABI differences and/or different
feature set). You want your application to use the libcurl it was built for.
Project cURL Angle of this Problem
We distribute libcurl and everyone may build libcurl with either library. At
their choice. This problem is not directly a problem of ours. It merely
affects users - GPL application authors only - of our lib as it comes
included and delivered on some distros.
Distro Angle of this Problem
A distro can provide separate libcurls built with different SSL/TLS libraries
to work around this, but at least Debian seems to be very hostile against
such an approach, probably since it makes things like devel packages for the
different libs collide since they would provide the same include files and
man pages etc.
Fixing the Only Problem
The only problem is thus for distributions that want to offer libcurl
versions built with more than one SSL/TLS library.
Since multiple libcurl binaries using different names are ruled out, we need
to come up with a way to have one single libcurl that someone uses different
underlying libraries. The best(?) approach currently suggested involves this:
A new intermediate library (named lib2 so far in the discussions) with the
single purpose of providing libcurl with SSL/TLS capabilities. It would have
a unified API and ABI no matter what underlying library it would use.
There would be one lib2 binary provided for each supported SSL/TLS library.
For example: lib2-openssl, lib2-gnutls, lib2-yassl, lib2-matrixssl and
lib2-nossl. Yes, take note of the last one that provides the lib2 ABI but
that lacks the actual powers.
When libcurl is built and linked, it will be linked against a lib2 with the
set ABI.
When you link an app against libcurl, it would also need to provide one of
the (many) lib2 libs to decide what approach that fits the app. An app that
doesn't want SSL at all would still need to link with the lib2-nossl lib.
GPL apps can pick the lib2-gnutls, others may pick the lib2-openssl.
This concept works equally well both for shared and static libraries.
A positive side effect of this approach could be a more generic "de facto"
standard API for SSL/TLS libraries.
When Will This Happen
Note again that this is not a problem in curl, it doesn't solve any actual
technical problems in our project. Don't hold your breath for this to happen
very soon (if at all) unless you step forward and contribute.
The suggestion that is outlined above is still only a suggestion. Feel free
to bring a better idea!
Also, to keep in mind: I don't want this new concept to have too much of an
impact on the existing code. Preferably it should be possible to build the
code like today (without the use of lib2), should you decide to ignore the
problems outlined in this document.
Footnotes
[1] = http://www.xfree86.org/3.3.6/COPYRIGHT2.html#6
[2] = http://www.fsf.org/licensing/essays/bsd.html
[3] = http://www.fsf.org/licensing/licenses/gpl.html
[4] = http://curl.haxx.se/docs/copyright.html
[5] = http://www.openssl.org/source/license.html
[6] = http://www.fsf.org/licensing/licenses/gpl.html end of section 3
[7] = http://www.fsf.org/licensing/licenses/lgpl.html
[8] = http://en.wikipedia.org/wiki/OpenSSL_exception
Feedback/Updates provided by
Eric Cooper

307
docs/FAQ
View File

@@ -1,4 +1,4 @@
Updated: August 10, 2004 (http://curl.haxx.se/docs/faq.html) Updated: August 26, 2005 (http://curl.haxx.se/docs/faq.html)
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
@@ -10,10 +10,10 @@ FAQ
1. Philosophy 1. Philosophy
1.1 What is cURL? 1.1 What is cURL?
1.2 What is libcurl? 1.2 What is libcurl?
1.3 What is cURL not? 1.3 What is curl not?
1.4 When will you make curl do XXXX ? 1.4 When will you make curl do XXXX ?
1.5 Who makes cURL? 1.5 Who makes curl?
1.6 What do you get for making cURL? 1.6 What do you get for making curl?
1.7 What about CURL from curl.com? 1.7 What about CURL from curl.com?
1.8 I have a problem who do I mail? 1.8 I have a problem who do I mail?
@@ -23,7 +23,7 @@ FAQ
2.1.2 only the libssl lib is missing 2.1.2 only the libssl lib is missing
2.2 Does curl work/build with other SSL libraries? 2.2 Does curl work/build with other SSL libraries?
2.3 Where can I find a copy of LIBEAY32.DLL? 2.3 Where can I find a copy of LIBEAY32.DLL?
2.4 Does cURL support Socks (RFC 1928) ? 2.4 Does curl support Socks (RFC 1928) ?
3. Usage Problems 3. Usage Problems
3.1 curl: (1) SSL is disabled, https: not supported 3.1 curl: (1) SSL is disabled, https: not supported
@@ -41,6 +41,9 @@ FAQ
3.13 Why does my single/double quotes fail? 3.13 Why does my single/double quotes fail?
3.14 Does curl support javascript or pac (automated proxy config)? 3.14 Does curl support javascript or pac (automated proxy config)?
3.15 Can I do recursive fetches with curl? 3.15 Can I do recursive fetches with curl?
3.16 What certificates do I need when I use SSL?
3.17 How do I list the root dir of an FTP server?
3.18 Can I use curl to send a POST/PUT and not wait for a response?
4. Running Problems 4. Running Problems
4.1 Problems connecting to SSL servers. 4.1 Problems connecting to SSL servers.
@@ -61,6 +64,8 @@ FAQ
4.10 My HTTP request using HEAD, PUT or DELETE doesn't work! 4.10 My HTTP request using HEAD, PUT or DELETE doesn't work!
4.11 Why does my HTTP range requests return the full document? 4.11 Why does my HTTP range requests return the full document?
4.12 Why do I get "certificate verify failed" ? 4.12 Why do I get "certificate verify failed" ?
4.13 Why is curl -R on Windows one hour off?
4.14 Redirects work in browser but not with curl!
5. libcurl Issues 5. libcurl Issues
5.1 Is libcurl thread-safe? 5.1 Is libcurl thread-safe?
@@ -71,6 +76,10 @@ FAQ
5.6 What about Keep-Alive or persistent connections? 5.6 What about Keep-Alive or persistent connections?
5.7 Link errors when building libcurl on Windows! 5.7 Link errors when building libcurl on Windows!
5.8 libcurl.so.3: open failed: No such file or directory 5.8 libcurl.so.3: open failed: No such file or directory
5.9 How does libcurl resolve host names?
5.10 How do I prevent libcurl from writing the response to stdout?
5.11 How do I make libcurl not receive the whole HTTP response?
5.12 Can I make libcurl fake or hide my real IP address?
6. License Issues 6. License Issues
6.1 I have a GPL program, can I use the libcurl library? 6.1 I have a GPL program, can I use the libcurl library?
@@ -80,30 +89,56 @@ FAQ
6.5 Can I modify curl/libcurl for my program and keep the changes secret? 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? 6.6 Can you please change the curl/libcurl license to XXXX?
7. PHP/CURL Issues
7.1 What is PHP/CURL?
7.2 Who write PHP/CURL?
7.3 Can I perform multiple requests using the same handle?
============================================================================== ==============================================================================
1. Philosophy 1. Philosophy
1.1 What is cURL? 1.1 What is cURL?
cURL (or simply just 'curl') is a command line tool for getting or sending cURL is the name of the project. The name is a play on 'Client for URLs',
files using URL syntax. The name is a play on 'Client for URLs', originally originally with URL spelled in uppercase to make it obvious it deals with
with URL spelled in uppercase to make it obvious it deals with URLs. The URLs. The fact it can also be pronounced 'see URL' also helped, it works as
fact it can also be pronounced 'see URL' also helped, it works as an an abbreviation for "Client URL Request Library" or why not the recursive
abbrivation for "Client URL Request Library" or why not the recursive
version: "Curl URL Request Library". version: "Curl URL Request Library".
Curl supports a range of common Internet protocols, currently including The cURL project produces two products:
HTTP, HTTPS, FTP, FTPS, GOPHER, LDAP, DICT, TELNET and FILE.
We spell it cURL or just curl. We pronounce it with an initial k sound: libcurl
[kurl].
NOTE: there are numerous sub-projects and related projects that also use the A free and easy-to-use client-side URL transfer library, supporting FTP,
word curl in the project names in various combinations, but you should take FTPS, HTTP, HTTPS, GOPHER, TELNET, DICT, FILE and LDAP. libcurl supports
HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading, kerberos, HTTP
form based upload, proxies, cookies, user+password authentication, file
transfer resume, http proxy tunneling and more!
libcurl is highly portable, it builds and works identically on numerous
platforms, including Solaris, NetBSD, FreeBSD, OpenBSD, Darwin, HPUX,
IRIX, AIX, Tru64, Linux, UnixWare, HURD, Windows, Amiga, OS/2, BeOs, Mac
OS X, Ultrix, QNX, OpenVMS, RISC OS, Novell NetWare, DOS and more...
libcurl is free, thread-safe, IPv6 compatible, feature rich, well
supported and fast.
curl
A command line tool for getting or sending files using URL syntax.
Since curl uses libcurl, it supports a range of common Internet protocols,
currently including HTTP, HTTPS, FTP, FTPS, GOPHER, LDAP, DICT, TELNET and
FILE.
We pronounce curl and cURL with an initial k sound: [kurl].
There are numerous sub-projects and related projects that also use the word
curl in the project names in various combinations, but you should take
notice that this FAQ is directed at the command-line tool named curl (and notice that this FAQ is directed at the command-line tool named curl (and
libcurl the library), and may therefore not be valid for other curl-related libcurl the library), and may therefore not be valid for other curl-related
projects. projects. (There is however a small section for the PHP/CURL in this FAQ.)
1.2 What is libcurl? 1.2 What is libcurl?
@@ -113,7 +148,7 @@ FAQ
You can use libcurl for free in your application, be it open source, You can use libcurl for free in your application, be it open source,
commercial or closed-source. commercial or closed-source.
1.3 What is cURL not? 1.3 What is curl not?
Curl is *not* a wget clone. That is a common misconception. Never, during Curl is *not* a wget clone. That is a common misconception. Never, during
curl's development, have we intended curl to replace wget or compete on its curl's development, have we intended curl to replace wget or compete on its
@@ -128,7 +163,7 @@ FAQ
script (or write a new program that interfaces libcurl) and do it. 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 Curl is not a PHP tool, even though it works perfectly well when used from
or with PHP. or with PHP (when using the PHP/CURL module).
Curl is not a single-OS program. Curl exists, compiles, builds and runs Curl is not a single-OS program. Curl exists, compiles, builds and runs
under a wide range of operating systems, including all modern Unixes (and a under a wide range of operating systems, including all modern Unixes (and a
@@ -162,35 +197,32 @@ FAQ
* If you write the code, chances are bigger that it will get into curl * If you write the code, chances are bigger that it will get into curl
faster. faster.
1.5 Who makes cURL? 1.5 Who makes curl?
cURL and libcurl are not made by any single individual. Sure, Daniel curl and libcurl are not made by any single individual. Daniel Stenberg is
Stenberg writes the major parts, but other persons' submissions are project leader and main developer, but other persons' submissions are
important and crucial. Anyone can contribute and post their changes and important and crucial. Anyone can contribute and post their changes and
improvements and have them inserted in the main sources (of course on the improvements and have them inserted in the main sources (of course on the
condition that developers agree on that the fixes are good). condition that developers agree on that the fixes are good).
The list of contributors in the docs/THANKS file is only a small part of all The full list of the more than 400 contributors is found in the docs/THANKS
the people that every day provide us with bug reports, suggestions, ideas file.
and source code.
curl is developed by a community, with Daniel at the wheel. curl is developed by a community, with Daniel at the wheel.
1.6 What do you get for making cURL? 1.6 What do you get for making curl?
Project cURL is entirely free and open. No person gets paid for developing Project cURL is entirely free and open. No person gets paid for developing
curl. We do this voluntarily on our spare time. (lib)curl. We do this voluntarily on our spare time.
We get some help from companies. Contactor Data hosts the curl web site, We get some help from companies. Contactor Data hosts the curl web site,
Haxx owns the curl web site's domain and sourceforge.net hosts project Haxx owns the curl web site's domain and sourceforge.net hosts project
services we take advantage from, like the bug tracker. services we take advantage from, like the bug tracker. Also, some companies
have sponsored certain parts of the development in the past and I hope some
will continue to do so in the future.
If you want to support our project with a donation or similar, one way of If you want to support our project, consider a donation or a banner-program
doing that would be to buy "gift certificates" at useful online shopping or even better: by helping us coding, documenting, testing etc.
sites, such as amazon.com or thinkgeek.com. Another way would be to sponsor
us through a banner-program or even better: by helping us coding,
documenting, testing etc. You're welcome to send us a buck using paypal, as
described here: http://curl.haxx.se/donation.html
1.7 What about CURL from curl.com? 1.7 What about CURL from curl.com?
@@ -221,6 +253,12 @@ FAQ
users thanks to the web based archives of the mailing lists), thus saving us users thanks to the web based archives of the mailing lists), thus saving us
from having to repeat ourselves even more. Thanks for respecting this. from having to repeat ourselves even more. Thanks for respecting this.
If you have found or simply suspect a security problem in curl or libcurl,
mail curl-security at haxx.se (closed list of receivers, mails are not
disclosed) and tell. Then we can produce a fix in a timely manner before the
flaw is announced to the world, thus lessen the impact the problem will have
on existing users.
2. Install Related Problems 2. Install Related Problems
@@ -265,8 +303,8 @@ FAQ
2.2 Does curl work/build with other SSL libraries? 2.2 Does curl work/build with other SSL libraries?
Curl has been written to use OpenSSL, although there should not be much Curl has been written to use OpenSSL or GnuTLS, although there should not be
problems using a different library. If anyone does "port" curl to use a many problems using a different library. If anyone does "port" curl to use a
different SSL library, we are of course very interested in getting the different SSL library, we are of course very interested in getting the
patch! patch!
@@ -279,7 +317,7 @@ FAQ
accurate and up-to-date pointers to recent OpenSSL DLLs and other binary accurate and up-to-date pointers to recent OpenSSL DLLs and other binary
packages. packages.
2.4 Does cURL support Socks (RFC 1928) ? 2.4 Does curl support Socks (RFC 1928) ?
Yes, SOCKS5 is supported. Yes, SOCKS5 is supported.
@@ -361,6 +399,8 @@ FAQ
curl -L http://redirector.com curl -L http://redirector.com
Not all redirects are HTTP ones, see 4.14
3.9 How do I use curl in my favorite programming language? 3.9 How do I use curl in my favorite programming language?
There exist many language interfaces/bindings for curl that integrates it There exist many language interfaces/bindings for curl that integrates it
@@ -370,8 +410,7 @@ FAQ
Find out more about which languages that support curl directly, and how to Find out more about which languages that support curl directly, and how to
install and use them, in the libcurl section of the curl web site: install and use them, in the libcurl section of the curl web site:
http://curl.haxx.se/libcurl/
http://curl.haxx.se/libcurl/
In February 2003, there are interfaces available for the following In February 2003, there are interfaces available for the following
languages: Basic, C, C++, Cocoa, Dylan, Euphoria, Java, Lua, Object-Pascal, languages: Basic, C, C++, Cocoa, Dylan, Euphoria, Java, Lua, Object-Pascal,
@@ -444,15 +483,15 @@ FAQ
Some work-arounds usually suggested to overcome this javascript dependency: Some work-arounds usually suggested to overcome this javascript dependency:
- Depending on the javascript complexity, write up a script that - Depending on the javascript complexity, write up a script that
translates it to another language and execute that. translates it to another language and execute that.
- Read the javascript code and rewrite the same logic in another language. - Read the javascript code and rewrite the same logic in another language.
- Implement a javascript interpreter, people have successfully used the - Implement a javascript interpreter, people have successfully used the
Mozilla javascript engine in the past. Mozilla javascript engine in the past.
- Ask your admins to stop this, for a static proxy setup or similar. - Ask your admins to stop this, for a static proxy setup or similar.
3.15 Can I do recursive fetches with curl? 3.15 Can I do recursive fetches with curl?
@@ -463,6 +502,50 @@ FAQ
curlmirror perl script), and you can write programs based on libcurl to do curlmirror perl script), and you can write programs based on libcurl to do
it, but the command line tool curl itself cannot. it, but the command line tool curl itself cannot.
3.16 What certificates do I need when I use SSL?
There are three different kinds of "certificates" to keep track of when we
talk about using SSL-based protocols (HTTPS or FTPS) using curl or libcurl.
- Client certificate. The server you communicate may require that you can
provide this in order to prove that you actually are who you claim to be.
If the server doesn't require this, you don't need a client certificate.
- Server certificate. The server you communicate with has a server
certificate. You can and should verify this certificate to make sure that
you are truly talking to the real server and not a server impersonating
it. The server certificate verification process is made by using a
Certificate Authority certificate ("CA cert") that was used to sign the
server certificate. Server certificate verification is enabled by default
in curl and libcurl and is often the reason for problems as explained in
FAQ entry 4.12 and the SSLCERTS document
(http://curl.haxx.se/docs/sslcerts.html). Server certificates that are
"self-signed" or otherwise signed by a CA that you do not have a CA cert
for, cannot be verified. If the verification during a connect fails, you
are refused access. You then need to explicitly disable the verification
to connect to the server.
- Certificate Authority certificate ("CA cert"). You often have several CA
certs in a CA cert bundle that can be used to verify a server certificate
that was signed by one of the authorities in the bundle. curl comes with a
default CA cert bundle. You can override the default.
3.17 How do I list the root dir of an FTP server?
There are two ways. The way defined in the RFC is to use an encoded slash
in the first path part. List the "/tmp" dir like this:
curl ftp://ftp.sunet.se/%2ftmp/
or the not-quite-kosher-but-more-readable way, by simply starting the path
section of the URL with a slash:
curl ftp://ftp.sunet.se//tmp/
3.18 Can I use curl to send a POST/PUT and not wait for a response?
No.
4. Running Problems 4. Running Problems
@@ -566,7 +649,10 @@ FAQ
4.6 Can you tell me what error code 142 means? 4.6 Can you tell me what error code 142 means?
All error codes that are larger than the highest documented error code means All curl error codes are described at the end of the man page, in the
section called "EXIT CODES".
Error codes that are larger than the highest documented error code means
that curl has exited due to a crash. This is a serious error, and we that curl has exited due to a crash. This is a serious error, and we
appreciate a detailed bug report from you that describes how we could go appreciate a detailed bug report from you that describes how we could go
ahead and repeat this! ahead and repeat this!
@@ -653,6 +739,28 @@ FAQ
Details are also in the SSLCERTS file in the release archives, found online Details are also in the SSLCERTS file in the release archives, found online
here: http://curl.haxx.se/docs/sslcerts.html here: http://curl.haxx.se/docs/sslcerts.html
4.13 Why is curl -R on Windows one hour off?
During daylight savings time, when -R is used, curl will set a time that
appears one hour off. This happens due to a flaw in how Windows stores and
uses file modification times and it is not easily worked around. For details
on this problem, read this: http://www.codeproject.com/datetime/dstbugs.asp
4.14 Redirects work in browser but not with curl!
curl supports HTTP redirects fine (see item 3.8). Browsers generally support
at least two other ways to perform directs that curl does not:
1 - Meta tags. You can write a HTML tag that will cause the browser to
redirect to another given URL after a certain time.
2 - Javascript. You can write a javascript program embeded in a HTML page
that redirects the browser to another given URL.
There is no way to make curl follow these redirects. You must either
manually figure out what the page is set to do, or you write a script that
parses the results and fetches the new URL.
5. libcurl Issues 5. libcurl Issues
@@ -660,12 +768,20 @@ FAQ
Yes. Yes.
We have written the libcurl code specificly adjusted for multi-threaded We have written the libcurl code specifically adjusted for multi-threaded
programs. libcurl will use thread-safe functions instead of non-safe ones if programs. libcurl will use thread-safe functions instead of non-safe ones if
your system has such. your system has such.
We would appreciate some kind of report or README file from those who have If you use a OpenSSL-powered libcurl in a multi-threaded environment, you
used libcurl in a threaded environment. need to provide one or two locking functions:
http://www.openssl.org/docs/crypto/threads.html#DESCRIPTION
If you use a GnuTLS-powered libcurl in a multi-threaded environment, you
need to provide locking function(s) for libgcrypt (which is used by GnuTLS
for the crypto functions).
http://www.gnu.org/software/gnutls/manual/html_node/Multi_002dthreaded-applications.html
5.2 How can I receive all data into a large memory chunk? 5.2 How can I receive all data into a large memory chunk?
@@ -746,6 +862,22 @@ FAQ
(Provided by Andrew Francis) (Provided by Andrew Francis)
When building an application that uses the static libcurl library, you must
add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for
dynamic import symbols. If you get linker error like "unknown symbol
__imp__curl_easy_init ..." you have linked against the wrong (static)
library. If you want to use the libcurl.dll and import lib, you don't need
any extra CFLAGS, but use one of the import libraries below. These are the
libraries produced by the various lib/Makefile.* files:
Target: static lib. import lib for libcurl*.dll.
-----------------------------------------------------------
MingW: libcurl.a libcurldll.a
MSVC (release): libcurl.lib libcurl_imp.lib
MSVC (debug): libcurld.lib libcurld_imp.lib
Borland: libcurl.lib libcurl_imp.lib
5.8 libcurl.so.3: open failed: No such file or directory 5.8 libcurl.so.3: open failed: No such file or directory
This is an error message you might get when you try to run a program linked This is an error message you might get when you try to run a program linked
@@ -767,6 +899,55 @@ FAQ
'man ld.so' and 'man ld' will tell you more details 'man ld.so' and 'man ld' will tell you more details
5.9 How does libcurl resolve host names?
libcurl includes a number of different name resolve functions:
- The non-ipv6 resolver that can use one out of four host name resolve calls
(depending on what your system supports):
A - gethostbyname()
B - gethostbyname_r() with 3 arguments
C - gethostbyname_r() with 5 arguments
D - gethostbyname_r() with 6 arguments
- The ipv6-resolver that uses getaddrinfo()
- The c-ares based name resolver that uses the c-ares library for resolves.
- The Windows threaded resolver. It use:
A - gethostbyname() on plain ipv4 windows hosts
B - getaddrinfo() on ipv6-enabled windows hosts
Also note that libcurl never resolves or reverse-lookups addresses given as
pure numbers, such as 127.0.0.1 or ::1.
5.10 How do I prevent libcurl from writing the response to stdout?
libcurl provides a default built-in write function that writes received data
to stdout. Set a WRITEFUNCTION to receive the data, or possibly set
WRITEDATA to a different FILE * handle.
5.11 How do I make libcurl not receive the whole HTTP response?
You make the write callback (or progress callback) return an error and
libcurl will then abort the transfer.
5.12 Can I make libcurl fake or hide my real IP address?
No. libcurl operates on a higher level than so. Besides, faking IP address
would imply sending IP packages with a made-up source address, and then you
normally get a problem with intercepting the packages sent back as they
would then not be routed to you!
If you use a proxy to access remote sites, the sites will not see your local
IP address but instead the address of the proxy.
Also note that on many networks NATs or other IP-munging techniques are used
that makes you see and use a different IP address locally than what the
remote server will see you coming from.
6. License Issues 6. License Issues
@@ -818,3 +999,31 @@ FAQ
we want on curl/libcurl and it does not spread to other programs or we want on curl/libcurl and it does not spread to other programs or
libraries that use it. It should be possible for everyone to use libcurl or libraries that use it. It should be possible for everyone to use libcurl or
curl in their projects, no matter what license they already have in use. curl in their projects, no matter what license they already have in use.
7. PHP/CURL Issues
7.1 What is PHP/CURL?
The module for PHP that makes it possible for PHP programs to access curl-
functions from within PHP.
In the cURL project we call this module PHP/CURL to differentiate it from
curl the command line tool and libcurl the library. The PHP team however
does not refer to it like this (for unknown reasons). They call it plain
CURL (often using all caps) which causes much confusion to users which in
turn gives us a higher question load.
7.2 Who write PHP/CURL?
PHP/CURL is a module that comes with the regular PHP package. It depends and
uses libcurl, so you need to have libcurl installed properly first before
PHP/CURL can be used. PHP/CURL is written by Sterling Hughes.
7.3 Can I perform multiple requests using the same handle?
Yes - at least in PHP version 4.3.8 and later (this has been known to not
work in earlier versions, but the exact version when it started to work is
unknown to me).
After a transfer, you just set new options in the handle and make another
transfer. This will make libcurl to re-use the same connection if it can.

View File

@@ -6,26 +6,33 @@
FEATURES FEATURES
Misc curl tool
- full URL syntax - config file support
- multiple URLs in a single command line
- range "globbing" support: [0-13], {one,two,three}
- multiple file upload on a single command line
- custom maximum transfer rate
- redirectable stderr
libcurl supports
- full URL syntax with no length limit
- custom maximum download time - custom maximum download time
- custom least download speed acceptable - custom least download speed acceptable
- custom output result after completion - custom output result after completion
- multiple URLs
- guesses protocol from host name unless specified - guesses protocol from host name unless specified
- uses .netrc - uses .netrc
- progress bar/time specs while downloading - progress bar/time specs while downloading
- "standard" proxy environment variables support - "standard" proxy environment variables support
- config file support
- compiles on win32 (reported builds on 40+ operating systems) - compiles on win32 (reported builds on 40+ operating systems)
- redirectable stderr
- selectable network interface for outgoing traffic - selectable network interface for outgoing traffic
- IPv6 support - IPv6 support on unix and Windows
- persistant connections - persistant connections
- socks5 support - socks5 support
- supports user name + password in proxy environment variables - supports user name + password in proxy environment variables
- operations through proxy "tunnel" (using CONNECT) - operations through proxy "tunnel" (using CONNECT)
- supports transfers of large files (>2GB and >4GB) - supports large files (>2GB and >4GB) both upload/download
- replacable memory functions (malloc, free, realloc, etc)
- asynchronous name resolving (*6)
HTTP HTTP
- HTTP/1.1 compliant (optionally uses 1.0) - HTTP/1.1 compliant (optionally uses 1.0)
@@ -35,7 +42,7 @@ HTTP
- POST - POST
- multipart formpost (RFC1867-style) - multipart formpost (RFC1867-style)
- authentication: Basic, Digest, NTLM(*1), GSS-Negotiate/Negotiate(*3) and - authentication: Basic, Digest, NTLM(*1), GSS-Negotiate/Negotiate(*3) and
SPNEGO (*4) SPNEGO (*4) to server and proxy
- resume (both GET and PUT) - resume (both GET and PUT)
- follow redirects - follow redirects
- maximum amount of redirects to follow - maximum amount of redirects to follow
@@ -55,11 +62,11 @@ HTTP
HTTPS (*1) HTTPS (*1)
- (all the HTTP features) - (all the HTTP features)
- using certificates - using client certificates
- verify server certificate - verify server certificate
- via http-proxy - via http-proxy
- select desired encryption - select desired encryption
- force usage of a specific SSL version (SSLv2, SSLv3 or TLSv1) - force usage of a specific SSL version (SSLv2(*7), SSLv3 or TLSv1)
FTP FTP
- download - download
@@ -80,6 +87,8 @@ FTP
- via http-proxy - via http-proxy
- all operations can be tunneled through a http-proxy - all operations can be tunneled through a http-proxy
- customizable to retrieve file modification date - customizable to retrieve file modification date
- third party transfers
- no dir depth limit
FTPS (*1) FTPS (*1)
- explicit ftps:// support that use SSL on both connections - explicit ftps:// support that use SSL on both connections
@@ -103,12 +112,16 @@ GOPHER
FILE FILE
- URL support - URL support
- "uploads"
- resume
FOOTNOTES FOOTNOTES
========= =========
*1 = requires OpenSSL *1 = requires OpenSSL or GnuTLS
*2 = requires OpenLDAP *2 = requires OpenLDAP
*3 = requires a GSSAPI-compliant library, such as Heimdal or similar. *3 = requires a GSSAPI-compliant library, such as Heimdal or similar.
*4 = requires FBopenssl *4 = requires FBopenssl
*5 = requires a krb4 library, such as the MIT one or similar. *5 = requires a krb4 library, such as the MIT one or similar.
*6 = requires c-ares
*7 = requires OpenSSL specificly, as GnuTLS only supports SSLv3 and TLSv1

View File

@@ -1,7 +1,7 @@
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
| (__| |_| | _ <| |___ | (__| |_| | _ <| |___
\___|\___/|_| \_\_____| \___|\___/|_| \_\_____|
How cURL Became Like This How cURL Became Like This
@@ -114,6 +114,8 @@ distributions and otherwise retrieved as part of other software.
September 2002, with the release of curl 7.10 it is released under the MIT September 2002, with the release of curl 7.10 it is released under the MIT
license only. license only.
January 2003. Started working on the distributed curl tests. The autobuilds.
February 2003, the curl site averages at 20000 visits weekly. At any given February 2003, the curl site averages at 20000 visits weekly. At any given
moment, there's an average of 3 people browsing the curl.haxx.se site. moment, there's an average of 3 people browsing the curl.haxx.se site.
@@ -139,3 +141,7 @@ August 2004:
Number of public functions in libcurl: 36 Number of public functions in libcurl: 36
Amount of public web site mirrors: 12 Amount of public web site mirrors: 12
Number of known libcurl bindings: 26 Number of known libcurl bindings: 26
April 2005:
GnuTLS can now optionally be used for the secure layer when curl is built.

View File

@@ -1,25 +0,0 @@
Steps To Perform When Building a Public Release
* "make distcheck"
* ./maketgz
then upload the 3 curl packages maketgz created
* update these files:
www/_download.html
www/_changes.html
www/_newslog.html
www/Makefile
* commit the web changes
* 'cvs commit'
* 'cvs tag'
* write the release announcement, including:
- changes / bugfixes
- other curl-related news
- contributors
* mail release-announcement to curl-announce and curl-users

View File

@@ -1,7 +1,7 @@
_ _ ____ _ _ _ ____ _
___| | | | _ \| | ___| | | | _ \| |
/ __| | | | |_) | | / __| | | | |_) | |
| (__| |_| | _ <| |___ | (__| |_| | _ <| |___
\___|\___/|_| \_\_____| \___|\___/|_| \_\_____|
How To Compile How To Compile
@@ -75,12 +75,22 @@ UNIX
./configure ./configure
(with csh, tcsh and their clones): (with csh, tcsh and their clones):
env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \ env CPPFLAGS="-I/path/to/ssl/include" LDFLAGS="-L/path/to/ssl/lib" \
./configure ./configure
If your SSL library was compiled with rsaref (usually for use in the United If you have shared SSL libs installed in a directory where your run-time
States), you may also need to set: linker doesn't find them (which usually causes configure failures), you can
provide the -R option to ld on some operating systems to set a hard-coded
path to the run-time linker:
LDFLAGS=-R/usr/local/ssl/lib ./configure --with-ssl
Another option to the previous trick, is to set LD_LIBRARY_PATH or edit the
/etc/ld.so.conf file.
If your SSL library was compiled with rsaref (this was common in the past
when used in the United States), you may also need to set:
LIBS=-lRSAglue -lrsaref LIBS=-lRSAglue -lrsaref
(as suggested by Doug Kaufman) (as suggested by Doug Kaufman)
@@ -92,7 +102,7 @@ UNIX
CC=cc ./configure CC=cc ./configure
or or
env Cc=cc ./configure env CC=cc ./configure
To force a static library compile, disable the shared library creation To force a static library compile, disable the shared library creation
by running configure like: by running configure like:
@@ -121,7 +131,7 @@ UNIX
Win32 Win32
===== =====
Without SSL: Without SSL:
MingW32 (GCC-2.95) style MingW32 (GCC-2.95) style
@@ -158,17 +168,9 @@ Win32
Make the sources in the src/ drawer be a "win32 console application" Make the sources in the src/ drawer be a "win32 console application"
project. Name it curl. project. Name it curl.
With VC++, add 'ws2_32.lib' to the link libs when you build curl!
Borland seems to do that itself magically. Of course you have to make
sure it links with the libcurl too!
For VC++ 6, there's an included Makefile.vc6 that should be possible For VC++ 6, there's an included Makefile.vc6 that should be possible
to use out-of-the-box. to use out-of-the-box.
Microsoft note: add /Zm200 to the compiler options to increase the
compiler's memory allocation limit, as the hugehelp.c won't compile
due to "too long puts string".
With SSL: With SSL:
@@ -197,8 +199,8 @@ Win32
Then run 'nmake vc' in curl's root directory. Then run 'nmake vc' in curl's root directory.
If you want to compile with zlib support, you will need to build If you want to compile with zlib support, you will need to build
zlib (http://www.gzip.org/zlib/) as well. Please read the zlib zlib (http://www.gzip.org/zlib/) as well. Please read the zlib
documentation on how to compile zlib. Define the ZLIB_PATH environment documentation on how to compile zlib. Define the ZLIB_PATH environment
variable to the location of zlib.h and zlib.lib, for example: variable to the location of zlib.h and zlib.lib, for example:
set ZLIB_PATH=c:\zlib-1.2.1 set ZLIB_PATH=c:\zlib-1.2.1
@@ -227,7 +229,7 @@ Win32
'nmake vc-ssl-dll' creates the libcurl dynamic library and 'nmake vc-ssl-dll' creates the libcurl dynamic library and
links curl.exe against libcurl and OpenSSL dynamically. links curl.exe against libcurl and OpenSSL dynamically.
This executable requires libcurl.dll and the OpenSSL DLLs This executable requires libcurl.dll and the OpenSSL DLLs
at runtime. at runtime.
Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support. Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
Microsoft / Borland style Microsoft / Borland style
@@ -239,27 +241,27 @@ Win32
Using Borland C++ compiler version 5.5.1 (available as free download Using Borland C++ compiler version 5.5.1 (available as free download
from Borland's site) from Borland's site)
--------------------------------------------------------------------- ---------------------------------------------------------------------
compile openssl compile openssl
Make sure you include the paths to curl/include and openssl/inc32 in Make sure you include the paths to curl/include and openssl/inc32 in
your bcc32.cnf file your bcc32.cnf file
eg : -I"c:\Bcc55\include;c:\path_curl\include;c:\path_openssl\inc32" eg : -I"c:\Bcc55\include;c:\path_curl\include;c:\path_openssl\inc32"
Check to make sure that all of the sources listed in lib/Makefile.b32 Check to make sure that all of the sources listed in lib/Makefile.b32
are present in the /path_to_curl/lib directory. (Check the src are present in the /path_to_curl/lib directory. (Check the src
directory for missing ones.) directory for missing ones.)
Make sure the environment variable "BCCDIR" is set to the install Make sure the environment variable "BCCDIR" is set to the install
location for the compiler eg : c:\Borland\BCC55 location for the compiler eg : c:\Borland\BCC55
command line: command line:
make -f /path_to_curl/lib/Makefile-ssl.b32 make -f /path_to_curl/lib/Makefile-ssl.b32
compile simplessl.c with appropriate links compile simplessl.c with appropriate links
c:\curl\docs\examples\> bcc32 -L c:\path_to_curl\lib\libcurl.lib c:\curl\docs\examples\> bcc32 -L c:\path_to_curl\lib\libcurl.lib
-L c:\borland\bcc55\lib\psdk\ws2_32.lib -L c:\borland\bcc55\lib\psdk\ws2_32.lib
-L c:\openssl\out32\libeay32.lib -L c:\openssl\out32\libeay32.lib
@@ -291,6 +293,13 @@ Win32
- Add defines to Project/Settings/C/C++/General/Preprocessor Definitions - Add defines to Project/Settings/C/C++/General/Preprocessor Definitions
in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project. in the curllib.dsw/curllib.dsp Visual C++ 6 IDE project.
Important (with SSL or not):
When building an application that uses the static libcurl library, you
must add '-DCURL_STATICLIB' to your CFLAGS. Otherwise the linker will
look for dynamic import symbols.
IBM OS/2 IBM OS/2
======== ========
@@ -361,9 +370,9 @@ VMS
+----+------------+-------------+---+ +----+------------+-------------+---+
With the Ctrl-bits an application can tell if part or the whole message has With the Ctrl-bits an application can tell if part or the whole message has
allready been printed from the program, DCL doesn't need to print it again. already been printed from the program, DCL doesn't need to print it again.
Facility - basicaly the program ID. A code assigned to the program Facility - basically the program ID. A code assigned to the program
the name can be fetched from external or internal message libraries the name can be fetched from external or internal message libraries
Errorcode - the errodes assigned by the application Errorcode - the errodes assigned by the application
Sev. - severity: Even = error, off = non error Sev. - severity: Even = error, off = non error
@@ -371,7 +380,7 @@ VMS
1 = Success 1 = Success
2 = Error 2 = Error
3 = Information 3 = Information
4 = Fatal 4 = Fatal
<5-7> reserved. <5-7> reserved.
This all presents itself with: This all presents itself with:
@@ -395,7 +404,7 @@ QNX
=== ===
(This section was graciously brought to us by David Bentham) (This section was graciously brought to us by David Bentham)
As QNX is targetted for resource constrained environments, the QNX headers As QNX is targeted for resource constrained environments, the QNX headers
set conservative limits. This includes the FD_SETSIZE macro, set by default set conservative limits. This includes the FD_SETSIZE macro, set by default
to 32. Socket descriptors returned within the CURL library may exceed this, to 32. Socket descriptors returned within the CURL library may exceed this,
resulting in memory faults/SIGSEGV crashes when passed into select(..) resulting in memory faults/SIGSEGV crashes when passed into select(..)
@@ -405,44 +414,6 @@ QNX
libcurl, by overriding CFLAGS during configure, example libcurl, by overriding CFLAGS during configure, example
# configure CFLAGS='-DFD_SETSIZE=64 -g -O2' # configure CFLAGS='-DFD_SETSIZE=64 -g -O2'
CROSS COMPILE
=============
(This section was graciously brought to us by Jim Duey, 23-oct-2001)
Download and unpack the cURL package. Version should be 7.9.1 or later.
'cd' to the new directory. (ie. curl-7.9.1-pre4)
Set environment variables to point to the cross-compile toolchain and call
configure with any options you need. Be sure and specify the '--host' and
'--build' parameters at configuration time. The following script is an
example of cross-compiling for the IBM 405GP PowerPC processor using the
toolchain from MonteVista for Hardhat Linux.
(begin script)
#! /bin/sh
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
export AR=ppc_405-ar
export AS=ppc_405-as
export LD=ppc_405-ld
export RANLIB=ppc_405-ranlib
export CC=ppc_405-gcc
export NM=ppc_405-nm
configure --target=powerpc-hardhat-linux \
--host=powerpc-hardhat-linux \
--build=i586-pc-linux-gnu \
--prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
--exec-prefix=/usr/local
(end script)
The '--prefix' parameter specifies where cURL will be installed. If
'configure' completes successfully, do 'make' and 'make install' as usual.
RISC OS RISC OS
======= =======
@@ -485,32 +456,106 @@ NetWare
- either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later. - either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
- gnu make and awk running on the platform you compile on; - gnu make and awk running on the platform you compile on;
native Win32 versions can be downloaded from: native Win32 versions can be downloaded from:
http://www.gknw.com/development/prgtools/ http://www.gknw.com/development/prgtools/
- recent Novell LibC SDK availabable from: - recent Novell LibC SDK available from:
http://developer.novell.com/ndk/libc.htm http://developer.novell.com/ndk/libc.htm
- optional zlib sources (at the moment only dynamic linking with zlib.imp); - optional zlib sources (at the moment only dynamic linking with zlib.imp);
sources with NetWare Makefile can be optained from: sources with NetWare Makefile can be obtained from:
http://www.gknw.com/mirror/zlib/ http://www.gknw.com/mirror/zlib/
- optional OpenSSL sources (version 0.9.8 or later which builds with BSD);
Set a search path to your compiler, linker and tools; if you want to have Set a search path to your compiler, linker and tools; on Linux make
zlib support then set the environment var ZLIB_PATH pointing to your zlib sure that the var OSTYPE contains the string 'linux'; and then type
sources, on Linux make sure the var OSTYPE contains the string 'linux'; 'make netware' from the top source directory; other tagets available
and finally type 'make netware' from the top source directory... are 'netware-ssl', 'netware-ssl-zlib', 'netware-zlib' and 'netware-ares';
if you need other combinations you can control the build with the
environment variables WITH_SSL, WITH_ZLIB, WITH_ARES and ENABLE_IPV6.
I found on some Linux systems (RH9) that OS detection didnt work although I found on some Linux systems (RH9) that OS detection didnt work although
a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it a 'set | grep OSTYPE' shows the var present and set; I simply overwrote it
with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...; with 'OSTYPE=linux-rh9-gnu' and the detection in the Makefile worked...
other options are currently not supported, although partly prepared.
The Ares lib builds arlready fine, and both test tools work fine at least
when build with CodeWarrior...; dont know yet why they fail when build with
gcc though; if you want to compile with Ares support then set an env var
WITH_ARES=1; I've not tested yet including libcares into curl.
Any help in testing appreciated! Any help in testing appreciated!
Buils automatically created 4 times a day from current CVS are here: Builds automatically created 8 times a day from current CVS are here:
http://www.gknw.com/mirror/curl/autobuilds/ http://www.gknw.com/mirror/curl/autobuilds/
the status of these buids can be viewed at the autobuild table: the status of these builds can be viewed at the autobuild table:
http://curl.haxx.se/auto/ http://curl.haxx.se/auto/
CROSS COMPILE
=============
(This section was graciously brought to us by Jim Duey, with additions by
Dan Fandrich)
Download and unpack the cURL package. Version should be 7.9.1 or later.
'cd' to the new directory. (e.g. cd curl-7.12.3)
Set environment variables to point to the cross-compile toolchain and call
configure with any options you need. Be sure and specify the '--host' and
'--build' parameters at configuration time. The following script is an
example of cross-compiling for the IBM 405GP PowerPC processor using the
toolchain from MonteVista for Hardhat Linux.
(begin script)
#! /bin/sh
export PATH=$PATH:/opt/hardhat/devkit/ppc/405/bin
export CPPFLAGS="-I/opt/hardhat/devkit/ppc/405/target/usr/include"
export AR=ppc_405-ar
export AS=ppc_405-as
export LD=ppc_405-ld
export RANLIB=ppc_405-ranlib
export CC=ppc_405-gcc
export NM=ppc_405-nm
./configure --target=powerpc-hardhat-linux \
--host=powerpc-hardhat-linux \
--build=i586-pc-linux-gnu \
--prefix=/opt/hardhat/devkit/ppc/405/target/usr/local \
--exec-prefix=/usr/local
(end script)
You may also need to provide a parameter like '--with-random=/dev/urandom'
to configure as it cannot detect the presence of a random number
generating device for a target system. The '--prefix' parameter
specifies where cURL will be installed. If 'configure' completes
successfully, do 'make' and 'make install' as usual.
In some cases, you may be able to simplify the above commands to as
little as:
./configure --host=ARCH-OS
There are a number of configure options that can be used to reduce the
size of libcurl for embedded applications where binary size is an
important factor. First, be sure to set the CFLAGS environment variable
when configuring with any compiler optimization flags to reduce the
size of the binary. For gcc, this would mean at minimum:
env CFLAGS='-Os' ./configure ...
Be sure to specify as many --disable- and --without- flags on the configure
command-line as you can to disable all the libcurl features that you
know your application is not going to need. Besides specifying the
--disable-PROTOCOL flags for all the types of URLs your application
will not use, here are some other flags that can reduce the size of the
library:
--disable-ares (disables support for the ARES DNS library)
--disable-cookies (disables support for HTTP cookies)
--disable-crypto-auth (disables HTTP cryptographic authentication)
--disable-ipv6 (disables support for IPv6)
--disable-verbose (eliminates debugging strings and error code strings)
--without-libidn (disables support for the libidn DNS library)
--without-ssl (disables support for SSL/TLS)
--without-zlib (disables support for on-the-fly decompression)
You may find that statically linking libcurl to your application will
result in a lower total size.
PORTS PORTS
===== =====
This is a probably incomplete list of known hardware and operating systems This is a probably incomplete list of known hardware and operating systems
@@ -531,31 +576,32 @@ PORTS
- MIPS IRIX 6.2, 6.5 - MIPS IRIX 6.2, 6.5
- MIPS Linux - MIPS Linux
- Pocket PC/Win CE 3.0 - Pocket PC/Win CE 3.0
- Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1 - Power AIX 3.2.5, 4.2, 4.3.1, 4.3.2, 5.1, 5.2
- PowerPC Darwin 1.0 - PowerPC Darwin 1.0
- PowerPC Linux - PowerPC Linux
- PowerPC Mac OS 9 - PowerPC Mac OS 9
- PowerPC Mac OS X - PowerPC Mac OS X
- SINIX-Z v5 - SINIX-Z v5
- Sparc Linux - Sparc Linux
- Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8 - Sparc Solaris 2.4, 2.5, 2.5.1, 2.6, 7, 8, 9, 10
- Sparc SunOS 4.1.X - Sparc SunOS 4.1.X
- StrongARM (and other ARM) RISC OS 3.1, 4.02 - StrongARM (and other ARM) RISC OS 3.1, 4.02
- StrongARM Linux 2.4 - StrongARM/ARM7/ARM9 Linux 2.4, 2.6
- StrongARM NetBSD 1.4.1 - StrongARM NetBSD 1.4.1
- Ultrix 4.3a - Ultrix 4.3a
- i386 BeOS - i386 BeOS
- i386 DOS - i386 DOS
- i386 Esix 4.1
- i386 FreeBSD - i386 FreeBSD
- i386 HURD - i386 HURD
- i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4 - i386 Linux 1.3, 2.0, 2.2, 2.3, 2.4, 2.6
- i386 NetBSD - i386 NetBSD
- i386 Novell NetWare - i386 Novell NetWare
- i386 OS/2 - i386 OS/2
- i386 OpenBSD - i386 OpenBSD
- i386 SCO unix - i386 SCO unix
- i386 Solaris 2.7 - i386 Solaris 2.7
- i386 Windows 95, 98, ME, NT, 2000 - i386 Windows 95, 98, ME, NT, 2000, XP, 2003
- i386 QNX 6 - i386 QNX 6
- i486 ncr-sysv4.3.03 (NCR MP-RAS) - i486 ncr-sysv4.3.03 (NCR MP-RAS)
- ia64 Linux 2.3.99 - ia64 Linux 2.3.99
@@ -563,36 +609,13 @@ PORTS
- m68k Linux - m68k Linux
- m68k OpenBSD - m68k OpenBSD
- m88k dg-dgux5.4R3.00 - m88k dg-dgux5.4R3.00
- s390 Linux - s390 Linux
- XScale/PXA250 Linux 2.4 - XScale/PXA250 Linux 2.4
OpenSSL Useful URLs
======= ===========
You'll find OpenSSL information at:
http://www.openssl.org
MingW32/Cygwin
==============
You'll find MingW32 and Cygwin information at:
http://www.mingw.org
OpenLDAP
========
You'll find OpenLDAP information at:
http://www.openldap.org
Zlib
====
You'll find Zlib information at:
http://www.gzip.org/zlib/
OpenSSL http://www.openssl.org
MingW http://www.mingw.org
OpenLDAP http://www.openldap.org
Zlib http://www.gzip.org/zlib/

View File

@@ -3,50 +3,102 @@ join in and help us correct one or more of these! Also be sure to check the
changelog of the current development status, as one or more of these problems changelog of the current development status, as one or more of these problems
may have been fixed since this was written! may have been fixed since this was written!
* To get HTTP Negotiate authentication to work fine, you need to provide a 25. When doing a CONNECT request with curl it doesn't properly handle if the
proxy closes the connection within the authentication "negotiation phase".
Like if you do HTTPS or similar over a proxy and you use perhaps
--proxy-anyauth. There's work in progress on this problem, and a recent
patch was posted here: http://curl.haxx.se/mail/lib-2005-08/0074.html
24. Harshal Pradhan's Use-after-free with libcurl+ares. This probably occurs
because there is a pending ares callback that gets called after the
connection struct has been freed in libcurl:
http://curl.haxx.se/mail/lib-2005-08/0022.html
Fixing this properly most likely requires a new c-ares function.
23. We don't support SOCKS for IPv6. We don't support FTPS over a SOCKS proxy.
We don't have any test cases for SOCKS proxy. We probably have even more
bugs and lack of features when a SOCKS proxy is used.
22. Sending files to a FTP server using curl on VMS, might lead to curl
complaining on "unaligned file size" on completion. The problem is related
to VMS file structures and the perceived file sizes stat() returns. A
possible fix would involve sending a "STRU VMS" command.
http://sourceforge.net/support/tracker.php?aid=1156287
21. FTP ASCII transfers do not follow RFC959. They don't convert the data
accordingly (not for sending nor for receiving). RFC 959 section 3.1.1.1
clearly describes how this should be done:
The sender converts the data from an internal character representation to
the standard 8-bit NVT-ASCII representation (see the Telnet
specification). The receiver will convert the data from the standard
form to his own internal form.
19. FTP 3rd party transfers with the multi interface doesn't work. Test:
define CURL_MULTIEASY, rebuild curl, run test case 230 - 232.
18. test case 57 has </test> that should be </client> but when corrected, the
test case fails!
16. FTP URLs passed to curl may contain NUL (0x00) in the RFC 1738 <user>,
<password>, and <fpath> components, encoded as "%00". The problem is that
curl_unescape does not detect this, but instead returns a shortened C
string. From a strict FTP protocol standpoint, NUL is a valid character
within RFC 959 <string>, so the way to handle this correctly in curl would
be to use a data structure other than a plain C string, one that can handle
embedded NUL characters. From a practical standpoint, most FTP servers
would not meaningfully support NUL characters within RFC 959 <string>,
anyway (e.g., UNIX pathnames may not contain NUL).
14. Test case 165 might fail on system which has libidn present, but with an
old iconv version (2.1.3 is a known bad version), since it doesn't recognize
the charset when named ISO8859-1. Changing the name to ISO-8859-1 makes the
test pass, but instead makes it fail on Solaris hosts that use its native
iconv.
13. curl version 7.12.2 fails on AIX if compiled with --enable-ares.
The workaround is to combine --enable-ares with --disable-shared
12. When connecting to a SOCKS proxy, the (connect) timeout is not properly
acknowledged after the actual TCP connect (during the SOCKS "negotiate"
phase). Pointed out by Lucas. Fix: need to select() and timeout properly.
11. Using configure --disable-[protocol] may cause 'make test' to fail for
tests using the disabled protocol(s).
10. To get HTTP Negotiate authentication to work fine, you need to provide a
(fake) user name (this concerns both curl and the lib) because the code (fake) user name (this concerns both curl and the lib) because the code
wrongly only considers authentication if there's a user name provided. wrongly only considers authentication if there's a user name provided.
Bug report #1004841. Bug report #1004841. How? http://curl.haxx.se/mail/lib-2004-08/0182.html
* If you use a very large amount of file descriptors (more than FD_SETSIZE) 9. --limit-rate using -d or -F does not work. This is because the limit logic
and then use libcurl, it might crash on its use of select() which then
stores data out of bounds. Bug report #948950.
* --limit-rate using -d or -F does not work. This is because the limit logic
is provided by the curl app in its read/write callbacks, and when doing is provided by the curl app in its read/write callbacks, and when doing
-d/-F the callbacks aren't used! Bug report #921395. -d/-F the callbacks aren't used! Bug report #921395.
* Doing resumed upload over HTTP does not work with '-C -', because curl 8. Doing resumed upload over HTTP does not work with '-C -', because curl
doesn't do a HEAD first to get the initial size. This needs to be done doesn't do a HEAD first to get the initial size. This needs to be done
manually for HTTP PUT resume to work, and then '-C [index]'. manually for HTTP PUT resume to work, and then '-C [index]'.
* CURLOPT_USERPWD and CURLOPT_PROXYUSERPWD have no way of providing user names 7. CURLOPT_USERPWD and CURLOPT_PROXYUSERPWD have no way of providing user names
that contain a colon. This can't be fixed easily in a backwards compatible that contain a colon. This can't be fixed easily in a backwards compatible
way without adding new options (and then, they should most probably allow way without adding new options (and then, they should most probably allow
setting user name and password separately). setting user name and password separately).
* libcurl ignores empty path parts in FTP URLs, whereas RFC1738 states that 6. libcurl ignores empty path parts in FTP URLs, whereas RFC1738 states that
such parts should be sent to the server as 'CWD ' (without an argument). such parts should be sent to the server as 'CWD ' (without an argument).
The only exception to this rule, is that we knowingly break this if the The only exception to this rule, is that we knowingly break this if the
empty part is first in the path, as then we use the double slashes to empty part is first in the path, as then we use the double slashes to
indicate that the user wants to reach the root dir (this exception SHALL indicate that the user wants to reach the root dir (this exception SHALL
remain even when this bug is fixed). remain even when this bug is fixed).
* libcurl doesn't treat the content-length of compressed data properly, as 5. libcurl doesn't treat the content-length of compressed data properly, as
it seems HTTP servers send the *uncompressed* length in that header and it seems HTTP servers send the *uncompressed* length in that header and
libcurl thinks of it as the *compressed* lenght. Some explanations are here: libcurl thinks of it as the *compressed* length. Some explanations are here:
http://curl.haxx.se/mail/lib-2003-06/0146.html http://curl.haxx.se/mail/lib-2003-06/0146.html
* Downloading 0 (zero) bytes files over FTP will not create a zero byte file 3. GOPHER transfers seem broken
locally, which is because libcurl doesn't call the write callback with zero
bytes. Explained here: http://curl.haxx.se/mail/archive-2003-04/0143.html
* IPv6 support on AIX 4.3.3 doesn't work due to a missing sockaddr_storage 2. If a HTTP server responds to a HEAD request and includes a body (thus
struct. It has been reported to work on AIX 5.1 though.
* GOPHER transfers seem broken
* If a HTTP server responds to a HEAD request and includes a body (thus
violating the RFC2616), curl won't wait to read the response but just stop violating the RFC2616), curl won't wait to read the response but just stop
reading and return back. If a second request (let's assume a GET) is then reading and return back. If a second request (let's assume a GET) is then
immediately made to the same server again, the connection will be re-used immediately made to the same server again, the connection will be re-used

View File

@@ -10,11 +10,11 @@ can lead to for end users.
I am not a lawyer and this is not legal advice! I am not a lawyer and this is not legal advice!
One common dilemma is that GPL[*]-licensed code is not allowed to be linked One common dilemma is that GPL[1]-licensed code is not allowed to be linked
with code licensed under the Original BSD license (with the announcement with code licensed under the Original BSD license (with the announcement
clause, unless there's a specified exception in the GPL-licensed module). You clause). You may still build your own copies that use them all, but
may still build your own copies that use them all, but distributing them as distributing them as binaries would be to violate the GPL license - unless you
binaries would be to violate the GPL license. This particular problem was accompany your license with an exception[2]. This particular problem was
addressed when the Modified BSD license was created, which does not have the addressed when the Modified BSD license was created, which does not have the
annoncement clause that collides with GPL. annoncement clause that collides with GPL.
@@ -27,21 +27,30 @@ libcurl http://curl.haxx.se/docs/copyright.html
OpenSSL http://www.openssl.org/source/license.html OpenSSL http://www.openssl.org/source/license.html
Uses an Original BSD-style license with an announement clause that (May be used for SSL/TLS support) Uses an Original BSD-style license
makes it "incompatible" with GPL. You are not allowed to ship binaries with an announement clause that makes it "incompatible" with GPL. You
that link with OpenSSL that includes GPL code (unless that specific are not allowed to ship binaries that link with OpenSSL that includes
GPL code includes an exception for OpenSSL - a habit that is growing GPL code (unless that specific GPL code includes an exception for
more and more common). OpenSSL - a habit that is growing more and more common). If OpenSSL's
licensing is a problem for you, consider using GnuTLS instead.
GnuTLS http://www.gnutls.org/
(May be used for SSL/TLS support) Uses the LGPL[3] license. If this is
a problem for you, consider using OpenSSL instead. Also note that
GnuTLS itself depends on and uses other libs (libgcrypt and
libgpg-error) and they too are LGPL- or GPL-licensed.
c-ares http://daniel.haxx.se/projects/c-ares/license.html c-ares http://daniel.haxx.se/projects/c-ares/license.html
Uses an MIT license that is very liberal and imposes no restrictions (Used for asynchronous name resolves) Uses an MIT license that is very
on any other library or part you may link with. liberal and imposes no restrictions on any other library or part you
may link with.
zlib http://www.gzip.org/zlib/zlib_license.html zlib http://www.gzip.org/zlib/zlib_license.html
Uses an MIT-style license that shouldn't collide with any other (Used for compressed Transfer-Encoding support) Uses an MIT-style
library. license that shouldn't collide with any other library.
krb4 krb4
@@ -51,33 +60,47 @@ krb4
of the code in libcurl that is written to deal with Kerberos4 likewise of the code in libcurl that is written to deal with Kerberos4 likewise
have such a license. have such a license.
GSSAPI MIT Kerberos http://web.mit.edu/kerberos/www/dist/
While nothing in particular says that a GSS/Kerberos5 library must use (May be used for GSS support) MIT licensed, that shouldn't collide
any particular license, the one I've used (Heimdal) is Original BSD- with any other parts.
licensed with the announcement clause.
Heimdal http://www.pdc.kth.se/heimdal/
(May be used for GSS support) Heimdal is Original BSD licensed with
the announcement clause.
GNU GSS http://www.gnu.org/software/gss/
(May be used for GSS support) GNU GSS is GPL licensed. Note that you
may not distribute binary curl packages that uses this if you build
curl to also link and use any Original BSD licensed libraries!
fbopenssl fbopenssl
Unclear license. Based on its name, I assume that it uses the OpenSSL (Used for SPNEGO support) Unclear license. Based on its name, I assume
license and thus shares the same issues as described for OpenSSL that it uses the OpenSSL license and thus shares the same issues as
above. described for OpenSSL above.
libidn http://www.gnu.org/licenses/lgpl.html libidn http://www.gnu.org/licenses/lgpl.html
Uses the GNU Lesser General Public License. LGPL is a variation of GPL (Used for IDNA support) Uses the GNU Lesser General Public
with slightly less aggressive "copyleft". This license requires more License. LGPL is a variation of GPL with slightly less aggressive
requirements to be met when distributing binaries, see the license for "copyleft". This license requires more requirements to be met when
details. Also note that if you distribute a binary that includes this distributing binaries, see the license for details. Also note that if
library, you must also include the full LGPL license text. Please you distribute a binary that includes this library, you must also
properly point out what parts of the distributed package that the include the full LGPL license text. Please properly point out what
license addresses. parts of the distributed package that the license addresses.
OpenLDAP http://www.openldap.org/software/release/license.html OpenLDAP http://www.openldap.org/software/release/license.html
Uses a Modified BSD-style license. Since libcurl uses OpenLDAP as a (Used for LDAP support) Uses a Modified BSD-style license. Since
shared library only, I have not heard of anyone that ships OpenLDAP libcurl uses OpenLDAP as a shared library only, I have not heard of
linked with libcurl in an app. anyone that ships OpenLDAP linked with libcurl in an app.
[*] = GPL - GNU General Public License: http://www.gnu.org/licenses/gpl.html [1] = GPL - GNU General Public License: http://www.gnu.org/licenses/gpl.html
[2] = http://www.fsf.org/licenses/gpl-faq.html#GPLIncompatibleLibs details on
how to write such an exception to the GPL
[3] = LGPL - GNU Lesser General Public License:
http://www.gnu.org/licenses/lgpl.html

View File

@@ -170,8 +170,8 @@ UPLOADING
curl -T - http://www.upload.com/myfile curl -T - http://www.upload.com/myfile
Note that the http server must've been configured to accept PUT before this Note that the http server must have been configured to accept PUT before
can be done successfully. this can be done successfully.
For other ways to do http data upload, see the POST section below. For other ways to do http data upload, see the POST section below.
@@ -299,6 +299,13 @@ POST (HTTP)
curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif" curl -F "docpicture=@dog.gif" -F "catpicture=@cat.gif"
To send a field value literally without interpreting a leading '@'
or '<', or an embedded ';type=', use --form-string instead of
-F. This is recommended when the value is obtained from a user or
some other unpredictable source. Under these circumstances, using
-F instead of --form-string would allow a user to trick curl into
uploading a file.
REFERRER REFERRER
A HTTP request has the option to include information about which address A HTTP request has the option to include information about which address
@@ -370,7 +377,7 @@ COOKIES
curl -b headers www.example.com curl -b headers www.example.com
While saving headers to a file is a working way to store cookies, it is While saving headers to a file is a working way to store cookies, it is
however error-prone and not the prefered way to do this. Instead, make curl however error-prone and not the preferred way to do this. Instead, make curl
save the incoming cookies using the well-known netscape cookie format like save the incoming cookies using the well-known netscape cookie format like
this: this:
@@ -388,7 +395,7 @@ COOKIES
file contents. In the above command, curl will parse the header and store file contents. In the above command, curl will parse the header and store
the cookies received from www.example.com. curl will send to the server the the cookies received from www.example.com. curl will send to the server the
stored cookies which match the request as it follows the location. The stored cookies which match the request as it follows the location. The
file "empty.txt" may be a non-existant file. file "empty.txt" may be a nonexistent file.
Alas, to both read and write cookies from a netscape cookie file, you can Alas, to both read and write cookies from a netscape cookie file, you can
set both -b and -c to use the same file: set both -b and -c to use the same file:
@@ -417,7 +424,7 @@ PROGRESS METER
Upload - the average transfer speed of the upload Upload - the average transfer speed of the upload
Time Total - expected time to complete the operation Time Total - expected time to complete the operation
Time Current - time passed since the invoke Time Current - time passed since the invoke
Time Left - expected time left to completetion Time Left - expected time left to completion
Curr.Speed - the average transfer speed the last 5 seconds (the first Curr.Speed - the average transfer speed the last 5 seconds (the first
5 seconds of a transfer is based on less time of course.) 5 seconds of a transfer is based on less time of course.)
@@ -437,14 +444,14 @@ SPEED LIMIT
curl -Y 3000 -y 60 www.far-away-site.com curl -Y 3000 -y 60 www.far-away-site.com
This can very well be used in combination with the overall time limit, so This can very well be used in combination with the overall time limit, so
that the above operatioin must be completed in whole within 30 minutes: that the above operation must be completed in whole within 30 minutes:
curl -m 1800 -Y 3000 -y 60 www.far-away-site.com curl -m 1800 -Y 3000 -y 60 www.far-away-site.com
Forcing curl not to transfer data faster than a given rate is also possible, Forcing curl not to transfer data faster than a given rate is also possible,
which might be useful if you're using a limited bandwidth connection and you which might be useful if you're using a limited bandwidth connection and you
don't want your transfer to use all of it (sometimes referred to as don't want your transfer to use all of it (sometimes referred to as
"bandwith throttle"). "bandwidth throttle").
Make curl transfer data no faster than 10 kilobytes per second: Make curl transfer data no faster than 10 kilobytes per second:
@@ -580,17 +587,17 @@ NETWORK INTERFACE
Get a web page from a server using a specified port for the interface: Get a web page from a server using a specified port for the interface:
curl --interface eth0:1 http://www.netscape.com/ curl --interface eth0:1 http://www.netscape.com/
or or
curl --interface 192.168.1.10 http://www.netscape.com/ curl --interface 192.168.1.10 http://www.netscape.com/
HTTPS HTTPS
Secure HTTP requires SSL libraries to be installed and used when curl is Secure HTTP requires SSL libraries to be installed and used when curl is
built. If that is done, curl is capable of retrieving and posting documents built. If that is done, curl is capable of retrieving and posting documents
using the HTTPS procotol. using the HTTPS protocol.
Example: Example:
@@ -765,7 +772,7 @@ NETRC
to specify name and password for commonly visited ftp sites in a file so to specify name and password for commonly visited ftp sites in a file so
that you don't have to type them in each time you visit those sites. You that you don't have to type them in each time you visit those sites. You
realize this is a big security risk if someone else gets hold of your realize this is a big security risk if someone else gets hold of your
passwords, so therefor most unix programs won't read this file unless it is passwords, so therefore most unix programs won't read this file unless it is
only readable by yourself (curl doesn't care though). only readable by yourself (curl doesn't care though).
Curl supports .netrc files if told so (using the -n/--netrc and Curl supports .netrc files if told so (using the -n/--netrc and
@@ -830,22 +837,22 @@ TELNET
to track when the login prompt is received and send the username and to track when the login prompt is received and send the username and
password accordingly. password accordingly.
PERSISTANT CONNECTIONS PERSISTENT CONNECTIONS
Specifying multiple files on a single command line will make curl transfer Specifying multiple files on a single command line will make curl transfer
all of them, one after the other in the specified order. all of them, one after the other in the specified order.
libcurl will attempt to use persistant connections for the transfers so that libcurl will attempt to use persistent connections for the transfers so that
the second transfer to the same host can use the same connection that was the second transfer to the same host can use the same connection that was
already initiated and was left open in the previous transfer. This greatly already initiated and was left open in the previous transfer. This greatly
decreases connection time for all but the first transfer and it makes a far decreases connection time for all but the first transfer and it makes a far
better use of the network. better use of the network.
Note that curl cannot use persistant connections for transfers that are used Note that curl cannot use persistent connections for transfers that are used
in subsequence curl invokes. Try to stuff as many URLs as possible on the in subsequence curl invokes. Try to stuff as many URLs as possible on the
same command line if they are using the same host, as that'll make the same command line if they are using the same host, as that'll make the
transfers faster. If you use a http proxy for file transfers, practicly transfers faster. If you use a http proxy for file transfers, practically
all transfers will be persistant. all transfers will be persistent.
MAILING LISTS MAILING LISTS

View File

@@ -17,7 +17,7 @@ CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES)
EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \ EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \ README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \
KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \ KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \
$(PDFPAGES) LICENSE-MIXING README.netware $(PDFPAGES) LICENSE-MIXING README.netware DISTRO-DILEMMA
MAN2HTML= roffit < $< >$@ MAN2HTML= roffit < $< >$@

View File

@@ -32,7 +32,41 @@ server, do one of the following:
configure with the --with-ca-bundle option pointing out the path of your configure with the --with-ca-bundle option pointing out the path of your
choice. choice.
If you're using the curl command line tool, you can specify your own CA To do this, you need to get the CA cert for your server in PEM format and
then append that to your CA cert bundle.
If you use Internet Explorer, this is one way to get extract the CA cert
for a particular server:
o View the certificate by double-clicking the padlock
o Find out where the CA certificate is kept (Certificate>
Authority Information Access>URL)
o Get a copy of the crt file using curl
o Convert it from crt to PEM using the openssl tool:
openssl x509 -inform DES -in yourdownloaded.crt \
-out outcert.pem -text
o Append the 'outcert.pem' to the CA cert bundle or use it stand-alone
as described below.
(Thanks to Frankie V for this description)
If you use the 'openssl' tool, this is one way to get extract the CA cert
for a particular server:
o openssl s_client -connect xxxxx.com:443 |tee logfile
o type "QUIT", followed by the "ENTER" key
o The certificate will have "BEGIN CERTIFICATE" and "END CERTIFICATE"
markers.
o If you want to see the data in the certificate, you can do: "openssl
x509 -inform PEM -in certfile -text -out certdata" where certfile is
the cert you extracted from logfile. Look in certdata.
o If you want to trust the certificate, you can append it to your
cert_bundle or use it stand-alone as described. Just remember that the
security is no better than the way you obtained the certificate.
(Thanks to Doug Kaufman for this description)
4. If you're using the curl command line tool, you can specify your own CA
cert path by setting the environment variable CURL_CA_BUNDLE to the path cert path by setting the environment variable CURL_CA_BUNDLE to the path
of your choice. of your choice.
@@ -45,7 +79,7 @@ server, do one of the following:
4. Windows Directory (e.g. C:\windows) 4. Windows Directory (e.g. C:\windows)
5. all directories along %PATH% 5. all directories along %PATH%
4. Get a better/different/newer CA cert bundle! One option is to extract the 5. Get a better/different/newer CA cert bundle! One option is to extract the
one a recent Mozilla browser uses, by following the instruction found one a recent Mozilla browser uses, by following the instruction found
here: here:
@@ -56,9 +90,3 @@ certificate that isn't signed by one of the certificates in the installed CA
cert bundle, will cause SSL to report an error ("certificate verify failed") cert bundle, will cause SSL to report an error ("certificate verify failed")
during the handshake and SSL will then refuse further communication with that during the handshake and SSL will then refuse further communication with that
server. server.
This procedure has been deemed The Right Thing even though it adds this extra
trouble for some users, since it adds security to a majority of the SSL
connections that previously weren't really secure. It turned out many people
were using previous versions of curl/libcurl without realizing the need for
the CA cert options to get truly secure SSL connections.

View File

@@ -1,100 +1,453 @@
This project has been alive for several years. Countless people have provided This project has been alive for many years. Countless people have provided
feedback that have improved curl. Here follows a (incomplete) list of people feedback that have improved curl. Here follows a list of people that have
that have contributed with non-trivial parts: contributed (a-z order).
Daniel Stenberg <daniel@haxx.se> If you have contributed but are missing here, please let us know!
Rafael Sagula <sagula@inf.ufrgs.br>
Sampo Kellomaki <sampo@iki.fi> Adrian Schuur
Linas Vepstas <linas@linas.org> Alan Pinstein
Bjorn Reese <breese@mail1.stofanet.dk> Albert Chin-A-Young
Johan Anderson <johan@homemail.com> Albert Choy
Kjell Ericson <Kjell.Ericson@haxx.se> Aleksandar Milivojevic
Troy Engel <tengel@sonic.net> Alex aka WindEagle
Ryan Nelson <ryan@inch.com> Alex Neblett
Bj<EFBFBD>rn Stenberg <bjorn@haxx.se> Alex Suykov
Angus Mackay <amackay@gus.ml.org> Alexander Kourakos
Eric Young <eay@cryptsoft.com> Alexander Krasnostavsky
Simon Dick <simond@totally.irrelevant.org> Alexander Zhuravlev
Oren Tirosh <oren@monty.hishome.net> Alexis Carvalho
Steven G. Johnson <stevenj@alum.mit.edu> Andi Jahja
Gilbert Ramirez Jr. <gram@verdict.uthscsa.edu> Andr<EFBFBD>s Garc<72>a
Andr<EFBFBD>s Garc<72>a <ornalux@redestb.es> Andreas Damm
Douglas E. Wegscheid <wegscd@whirlpool.com> Andreas Olsson
Mark Butler <butlerm@xmission.com> Andreas Rieke
Eric Thelin <eric@generation-i.com> Andres Garcia
Marc Boucher <marc@mbsi.ca> Andrew Bushnell
Greg Onufer <Greg.Onufer@Eng.Sun.COM> Andrew Francis
Doug Kaufman <dkaufman@rahul.net> Andrew Fuller
David Eriksson <david@2good.com> Andy Cedilnik
Ralph Beckmann <rabe@uni-paderborn.de> Andy Serpa
T. Yamada <tai@imasy.or.jp> Angus Mackay
Lars J. Aas <larsa@sim.no> Antoine Calando
J<EFBFBD>rn Hartroth <Joern.Hartroth@computer.org> Anton Kalmykov
Matthew Clarke <clamat@van.maves.ca> Arkadiusz Miskiewicz
Linus Nielsen Feltzing <linus@haxx.se> Augustus Saunders
Felix von Leitner <felix@convergence.de> Avery Fay
Dan Zitter <dzitter@zitter.net> Ben Greear
Jongki Suwandi <Jongki.Suwandi@eng.sun.com> Benjamin Gerard
Chris Maltby <chris@aurema.com> Bertrand Demiddelaer
Ron Zapp <rzapper@yahoo.com> Bj<EFBFBD>rn Stenberg
Paul Marquis <pmarquis@iname.com> Bjorn Reese
Ellis Pritchard <ellis@citria.com> Bob Schader
Damien Adant <dams@usa.net> Brad Burdick
Chris <cbayliss@csc.come> Brent Beardsley
Marco G. Salvagno <mgs@whiz.cjb.net> Brian Akins
Paul Marquis <pmarquis@iname.com> Brian R Duffy
David LeBlanc <dleblanc@qnx.com> Bruce Mitchener
Rich Gray at Plus Technologies Bryan Henderson
Luong Dinh Dung <u8luong@lhsystems.hu> Bryan Henderson
Torsten Foertsch <torsten.foertsch@gmx.net> Bryan Kemp
Kristian K<>hntopp <kris@koehntopp.de> Caolan McNamara
Fred Noz <FNoz@siac.com> Casey O'Donnell
Caolan McNamara <caolan@csn.ul.ie> Chih-Chung Chang
Albert Chin-A-Young <china@thewrittenword.com> Chris "Bob Bob"
Stephen Kick <skick@epicrealm.com> Chris Combes
Martin Hedenfalk <mhe@stacken.kth.se> Chris Gaukroger
Richard Prescott <rip at step.polymtl.ca> Chris Maltby
Jason S. Priebe <priebe@wral-tv.com> Christian Kurz
T. Bharath <TBharath@responsenetworks.com> Christian Robottom Reis
Alexander Kourakos <awk@users.sourceforge.net> Christophe Demory
James Griffiths <griffiths_james@yahoo.com> Christophe Legry
Loic Dachary <loic@senga.org> Christopher R. Palmer
Robert Weaver <robert.weaver@sabre.com> Clarence Gardner
Ingo Ralf Blum <ingoralfblum@ingoralfblum.com> Clifford Wolf
Jun-ichiro itojun Hagino <itojun@iijlab.net> Cody Jones
Frederic Lepied <flepied@mandrakesoft.com> Colin Watson
Georg Horn <horn@koblenz-net.de> Colm Buckley
Cris Bailiff <c.bailiff@awayweb.com> Cory Nelson
Sterling Hughes <sterling@designmultimedia.com> Craig Davison
S. Moonesamy Craig Markwardt
Ingo Wilken <iw@WWW.Ecce-Terram.DE> Cris Bailiff
Pawel A. Gajda <mis@k2.net.pl> Cyrill Osterwalder
Damien Adant
Dan Becker
Dan C
Dan Fandrich
Dan Torop
Dan Zitter
Daniel at touchtunes
Daniel Stenberg
Dave Dribin
Dave Halbakken
Dave Hamilton
Dave May
David Byron
David Cohen
David Eriksson
David Houlder
David Hull
David J Meyer
David James
David Kimdon
David LeBlanc
David Odin
David Phillips
David Shaw
David Tarendash
David Thiel
Detlef Schmier
Diego Casorran
Dimitris Sarris
Dinar
Dirk Eddelbuettel
Dirk Manske
Dolbneff A.V
Domenico Andreoli
Dominick Meglio
Doug Kaufman
Doug Porter
Douglas E. Wegscheid
Douglas R. Horner
Dustin Boswell
Dylan Ellicott
Dylan Salisbury
Early Ehlinger
Edin Kadribasic
Ellis Pritchard
Emiliano Ida
Enrico Scholz
Enrik Berkhan
Eric Cooper
Eric Lavigne
Eric Melville
Eric Rautman
Eric Thelin
Eric Vergnaud
Eric Young
Erick Nuwendam
Erwan Legrand
Erwin Authried
Evan Jordan
Fabrizio Ammollo
Fedor Karpelevitch
Felix von Leitner
Florian Schoppmann
Forrest Cahoon
Frank Keeney
Frank Ticheler
Fred New
Fred Noz
Frederic Lepied
G<EFBFBD>nter Knauf
G<EFBFBD>tz Babin-Ebell
Gautam Mani
Gaz Iqbal
Georg Horn
Georg Huettenegger
Georg Wicherski
Gerd v. Egidy
Gerhard Herre
Giaslas Georgios
Gilad
Gilbert Ramirez Jr.
Gisle Vanem
Giuseppe Attardi
Giuseppe D'Ambrosio
Glen Nakamura
Glen Scott
Greg Hewgill
Greg Onufer
Grigory Entin
Guenole Bescon
Guillaume Arluison
Gustaf Hui
Gwenole Beauchesne
Hamish Mackenzie
Hanno Kranzhoff
Hans Steegers
Hardeep Singh
Harshal Pradhan
Heikki Korpela
Henrik Storner
Hzhijun
Ian Ford
Ian Gulliver
Ian Wilkes
Ignacio Vazquez-Abrams
Ilguiz Latypov
Ingo Ralf Blum
Ingo Wilken
J<EFBFBD>rg Mueller-Tolk
J<EFBFBD>rn Hartroth
Jacky Lam
Jacob Meuser
James Bursa
James Clancy
James Cone
James Gallagher
James Griffiths
James MacMillan
Jamie Lokier
Jamie Wilkinson
Jason S. Priebe
Jean-Claude Chauve
Jean-Louis Lemaire
Jean-Marc Ranger
Jean-Philippe Barrette-LaPierre
Jeff Lawson
Jeff Phillips
Jeff Pohlmeyer
Jeffrey Pohlmeyer
Jeremy Friesner
Jesper Jensen
Jesse Noller
Jim Drash
Joe Halpin
Joel Chen
Johan Anderson
Johan Nilsson
John Crow
John Janssen
John Lask
John McGowan
Jon Grubbs
Jon Travis
Jon Turner
Jonas Forsman
Jonatan Lander
Jonathan Hseu
Jongki Suwandi
Josh Kapell
Juan F. Codagnone
Juan Ignacio Herv<72>s
Juergen Wilke
Jukka Pihl
Julian Noble
Jun-ichiro itojun Hagino
Jurij Smakov
Kai Sommerfeld
Kai-Uwe Rommel
Kang-Jin Lee
Karol Pietrzak
Keith MacDonald
Keith McGuigan
Ken Hirsch
Ken Rastatter
Kevin Fisk
Kevin Roth
Kimmo Kinnunen
Kjell Ericson
Kjetil Jacobsen
Klevtsov Vadim
Kris Kennaway
Krishnendu Majumdar
Kristian K<>hntopp
Kyle Sallee
Lachlan O'Dea
Larry Campbell
Larry Fahnoe
Lars Gustafsson
Lars J. Aas
Lars Nilsson
Lars Torben Wilson
Legoff Vincent
Lehel Bernadt
Len Krause
Linas Vepstas
Ling Thio
Linus Nielsen Feltzing
Loic Dachary
Loren Kirkby
Luca Altea
Luca Alteas
Lucas Adamski
Lukasz Czekierda
Luke Call
Luong Dinh Dung
Maciej W. Rozycki
Marc Boucher
Marcelo Juchem
Marcin Konicki
Marco G. Salvagno
Marcus Webster
Mario Schroeder
Mark Butler
Markus Moeller
Markus Oberhumer
Martijn Koster
Martin C. Martin
Martin Hedenfalk
Marty Kuhrt
Maruko
Massimiliano Ziccardi
Mathias Axelsson
Mats Lidell
Matt Veenstra
Matthew Blain
Matthew Clarke
Maurice Barnum
Mekonikum
Mettgut Jamalla
Michael Benedict
Michael Curtis
Michael Mealling
Michal Bonino
Mihai Ionescu
Mike Bytnar
Mike Dobbs
Miklos Nemeth
Mitz Wark
Mohamed Lrhazi
Mohun Biswas
Moonesamy
Nathan O'Sullivan
Naveen Noel
Neil Dunbar
Neil Spring
Nic Roets
Nick Gimbrone
Nick Humfrey
Nico Baggus
Nicolas Berloquin
Nicolas Croiset
Niels van Tongeren
Nikita Schmidt
nk
Nodak Sodak
Oren Tirosh
P R Schaffner
Patrick Bihan-Faou Patrick Bihan-Faou
Nico Baggus <Nico.Baggus@mail.ing.nl> Patrick Smith
Paul Harrington
Paul Marquis
Paul Moore
Paul Nolan
Pavel Cenek
Pavel Orehov
Pawel A. Gajda
Pedro Neves
Pete Su
Peter Bray
Peter Forret
Peter Pentchev
Peter Sylvester
Peter Todd
Peter Verhas
Peter Wullinger
Peteris Krumins
Phil Karn
Philip Gladstone
Philippe Hameau
Philippe Raoult
Pierre
Puneet Pawaia
Rafael Sagula
Ralph Beckmann
Ralph Mitchell
Ramana Mokkapati
Randy McMurchy
Reinout van Schouwen
Renaud Chaillat
Renaud Duhaut
Rene Bernhardt
Rene Rebe
Ricardo Cadime
Rich Gray
Richard Archer
Richard Atterer
Richard Bramante
Richard Clayton
Richard Cooper
Richard Gorton
Richard Prescott
Rick Jones
Rick Richardson
Rob Stanzel
Robert D. Young
Robert Olson
Robert Weaver
Robin Kay
Rodney Simmons
Roland Krikava
Roland Zimmermann
Roman Koifman
Ron Zapp
Rosimildo da Silva
Roy Shan
Rune Kleveland
Ryan Nelson
S<EFBFBD>bastien Willemijns
S. Moonesamy
Salvador D<>vila
Salvatore Sorrentino
Sampo Kellomaki
Samuel D<>az Garc<72>a
Samuel Listopad
Sander Gates
Saul good
Sebastien Willemijns
Sergio Ballestrero Sergio Ballestrero
Andrew Francis <locust@familyhealth.com.au> Seshubabu Pasam
Tomasz Lacki <Tomasz.Lacki@primark.pl> Shard
Georg Huettenegger <georg@ist.org> Shawn Poulson
John Lask <johnlask@hotmail.com> Siddhartha Prakash Jain
Eric Lavigne <erlavigne@wanadoo.fr> Simon Dick
Marcus Webster <marcus.webster@phocis.com> Simon Liu
G<EFBFBD>tz Babin-Ebell <babin<69>ebell@trustcenter.de> Spiridonoff A.V
Andreas Damm <andreas-sourceforge@radab.org> Stadler Stephan
Jacky Lam <sylam@emsoftltd.com> Stefan Ulrich
James Gallagher <jgallagher@gso.uri.edu> Stephan Bergmann
Kjetil Jacobsen <kjetilja@cs.uit.no> Stephen Kick
Markus F.X.J. Oberhumer <markus@oberhumer.com> Stephen More
Miklos Nemeth <mnemeth@kfkisystems.com> Sterling Hughes
Kevin Roth <kproth@users.sourceforge.net> Steve Green
Ralph Mitchell <rmitchell@eds.com> Steve Lhomme
Dan Fandrich <dan@coneharvesters.com> Steve Marx
Jean-Philippe Barrette-LaPierre <jpb@rrette.com> Steve Oliphant
Richard Bramante <RBramante@on.com> Steven Bazyl
Daniel Kouril <kouril@ics.muni.cz> Steven G. Johnson
Dirk Manske <dm@nettraffic.de> Stoned Elipot
David Meyer <meyer@paracel.com> Sven Neuhaus
Dominick Meglio <codemstr@ptd.net> swalkaus at yahoo.com
Gisle Vanem <gvanem@broadpark.no> T. Bharath
Giuseppe Attardi <attardi@di.unipi.it> T. Yamada
Tor Arntsen <tor@spacetec.no> Thomas Schwinge
David Byron <DByron@everdreamcorp.com> Thomas Tonino
Tim Baker
Tim Bartley
Tim Costello
Tim Sneddon
Toby Peterson
Todd Kulesza
Tom Benoist
Tom Lee
Tom Mattison
Tom Moers
Tom Zerucha
Tomas Pospisek
Tomas Szepe
Tomasz Lacki
Tommy Tam
Ton Voon
Tor Arntsen
Torsten Foertsch
Toshiyuki Maezawa
Traian Nicolescu
Troels Walsted Hansen
Troy Engel
Tupone Alfredo
Ulrich Zadow
Vincent Bronner
Vincent Penquerc'h
Vincent Sanders
Vojtech Janota
Vojtech Minarik
Walter J. Mack
Wayne Haigh
Werner Koch
Wesley Laxton
Wez Furlong
Wilfredo Sanchez
Wojciech Zwiefka
Yarram Sunil
Zvi Har'El

132
docs/TODO
View File

@@ -15,10 +15,10 @@ TODO
LIBCURL LIBCURL
* Introduce an interface to libcurl that allows applications to easier get to * Introduce an interface to libcurl that allows applications to easier get to
know what cookies that are received. Pushing interface that calls a know what cookies that are received. CURLINFO_COOKIELIST to get a
callback on each received cookie? Querying interface that asks about curl_slist with cookies (netscape/mozilla cookie file formatted), and
existing cookies? We probably need both. Enable applications to modify CURLOPT_COOKIELIST to set a list of cookies (using the same format).
existing cookies as well. http://curl.haxx.se/dev/COOKIES http://curl.haxx.se/mail/lib-2004-12/0195.html
* Introduce another callback interface for upload/download that makes one * Introduce another callback interface for upload/download that makes one
less copy of data and thus a faster operation. less copy of data and thus a faster operation.
@@ -26,18 +26,28 @@ TODO
* More data sharing. curl_share_* functions already exist and work, and they * More data sharing. curl_share_* functions already exist and work, and they
can be extended to share more. For example, enable sharing of the ares can be extended to share more. For example, enable sharing of the ares
channel. channel and the connection cache.
* Introduce a new error code indicating authentication problems (for proxy * Introduce a new error code indicating authentication problems (for proxy
CONNECT error 407 for example). This cannot be an error code, we must not CONNECT error 407 for example). This cannot be an error code, we must not
return informational stuff as errors, consider a new info returned by return informational stuff as errors, consider a new info returned by
curl_easy_getinfo() #845941 curl_easy_getinfo() #845941
* Option to set the SO_KEEPALIVE socket option to make libcurl notice and * Use 'struct lifreq' and SIOCGLIFADDR instead of 'struct ifreq' and
disconnect very long time idle connections. SIOCGIFADDR on newer Solaris versions as they claim the latter is obsolete.
To support ipv6 interface addresses properly.
* Add the following to curl_easy_getinfo(): GET_HTTP_IP, GET_FTP_IP and
GET_FTP_DATA_IP. Return a string with the used IP. Suggested by Alan.
* Add option that changes the interval in which the progress callback is
called at most.
LIBCURL - multi interface LIBCURL - multi interface
* Add a curl_multi_fdset() alternative. this allows apps to avoid the
FD_SETSIZE problem with select().
* Add curl_multi_timeout() to make libcurl's ares-functionality better. * Add curl_multi_timeout() to make libcurl's ares-functionality better.
* Make sure we don't ever loop because of non-blocking sockets return * Make sure we don't ever loop because of non-blocking sockets return
@@ -51,22 +61,34 @@ TODO
ready to accept read data. Today libcurl feeds the data as soon as it is ready to accept read data. Today libcurl feeds the data as soon as it is
available for reading, no matter what. available for reading, no matter what.
* Add curl_multi_socket() and family to the multi interface that gets file
descriptors, as an alternative to the curl_multi_fdset(). This is necessary
to allow apps to properly avoid the FD_SETSIZE problem.
* Make curl_easy_perform() a wrapper-function that simply creates a multi
handle, adds the easy handle to it, runs curl_multi_perform() until the
transfer is done, then detach the easy handle, destroy the multi handle and
return the easy handle's return code. This will thus make everything
internally use and assume the multi interface. The select()-loop should use
curl_multi_socket().
DOCUMENTATION DOCUMENTATION
* More and better * More and better
FTP FTP
* Make the detection of (bad) %0d and %0a codes in FTP url parts earlier in
the process to avoid doing a resolve and connect in vain.
* Support GSS/Kerberos 5 for ftp file transfer. This will allow user * Support GSS/Kerberos 5 for ftp file transfer. This will allow user
authentication and file encryption. Possible libraries and example clients authentication and file encryption. Possible libraries and example clients
are available from MIT or Heimdal. Requsted by Markus Moeller. are available from MIT or Heimdal. Requsted by Markus Moeller.
* Optimize the way libcurl uses CWD on each new request over a persistent
connection (on FTP) even if it doesn't have to.
* REST fix for servers not behaving well on >2GB requests. This should fail * REST fix for servers not behaving well on >2GB requests. This should fail
if the server doesn't set the pointer to the requested index. The tricky if the server doesn't set the pointer to the requested index. The tricky
part is to figure out if the server did the right thing or not. (impossible?) part is to figure out if the server did the right thing or
not.
* Support the most common FTP proxies, Philip Newton provided a list * Support the most common FTP proxies, Philip Newton provided a list
allegedly from ncftp: allegedly from ncftp:
@@ -93,6 +115,10 @@ TODO
This could possibly be implemented using the multi interface to queue This could possibly be implemented using the multi interface to queue
requests and the response data. requests and the response data.
* When doing CONNECT to a HTTP proxy, libcurl always uses HTTP/1.0. This has
never been reported as causing trouble to anyone, but should be considered
to use the HTTP version the user has chosen.
TELNET TELNET
* Reading input (to send to the remote server) on stdin is a crappy solution * Reading input (to send to the remote server) on stdin is a crappy solution
@@ -111,31 +137,50 @@ TODO
* Evaluate/apply Gertjan van Wingerde's SSL patches: * Evaluate/apply Gertjan van Wingerde's SSL patches:
http://curl.haxx.se/mail/lib-2004-03/0087.html http://curl.haxx.se/mail/lib-2004-03/0087.html
* If you really want to improve the SSL situation, you should probably have a * "Look at SSL cafile - quick traces look to me like these are done on every
look at SSL cafile loading as well - quick traces look to me like these are request as well, when they should only be necessary once per ssl context
done on every request as well, when they should only be necessary once per (or once per handle)". The major improvement we can rather easily do is to
ssl context (or once per handle). Even better would be to support the SSL make sure we don't create and kill a new SSL "context" for every request,
CAdir option - instead of loading all of the root CA certs for every but instead make one for every connection and re-use that SSL context in
request, this option allows you to only read the CA chain that is actually the same style connections are re-used. It will make us use slightly more
required (into the cache)... memory but it will libcurl do less creations and deletions of SSL contexts.
* Add an interface to libcurl that enables "session IDs" to get * Add an interface to libcurl that enables "session IDs" to get
exported/imported. Cris Bailiff said: "OpenSSL has functions which can exported/imported. Cris Bailiff said: "OpenSSL has functions which can
serialise the current SSL state to a buffer of your choice, and serialise the current SSL state to a buffer of your choice, and
recover/reset the state from such a buffer at a later date - this is used recover/reset the state from such a buffer at a later date - this is used
by mod_ssl for apache to implement and SSL session ID cache". This whole by mod_ssl for apache to implement and SSL session ID cache".
idea might become moot if we enable the 'data sharing' as mentioned in the
LIBCURL label above.
* OpenSSL supports a callback for customised verification of the peer * OpenSSL supports a callback for customised verification of the peer
certificate, but this doesn't seem to be exposed in the libcurl APIs. Could certificate, but this doesn't seem to be exposed in the libcurl APIs. Could
it be? There's so much that could be done if it were! (brought by Chris it be? There's so much that could be done if it were! (brought by Chris
Clark) Clark)
* Make curl's SSL layer option capable of using other free SSL libraries. * Make curl's SSL layer capable of using other free SSL libraries. Such as
Such as the Mozilla Security Services Mozilla Security Services
(http://www.mozilla.org/projects/security/pki/nss/) and GNUTLS (http://www.mozilla.org/projects/security/pki/nss/), MatrixSSL
(http://gnutls.hellug.gr/) (http://www.matrixssl.org/) or yaSSL (http://yassl.com/). At least the
latter two could be alternatives for those looking to reduce the footprint
of libcurl built with OpenSSL or GnuTLS.
* Peter Sylvester's patch for SRP on the TLS layer.
Awaits OpenSSL support for this, no need to support this in libcurl before
there's an OpenSSL release that does it.
* make the configure --with-ssl option first check for OpenSSL and then for
GnuTLS if OpenSSL wasn't detected.
GnuTLS
* Get NTLM working using the functions provided by libgcrypt, since GnuTLS
already depends on that to function. Not strictly SSL/TLS related, but
hey... Another option is to get available DES and MD4 source code from the
cryptopp library. They are fine license-wise, but are C++.
* SSL engine stuff?
* Work out a common method with Peter Sylvester's OpenSSL-patch for SRP
on the TLS to provide name and password
LDAP LDAP
@@ -143,8 +188,35 @@ TODO
lib/ldap.c source file and get moved to the main network code so that the lib/ldap.c source file and get moved to the main network code so that the
multi interface and friends will work for LDAP as well. multi interface and friends will work for LDAP as well.
NEW PROTOCOLS
* TFTP - RFC1350 (protocol) and RFC3617 (URI format)
Dan Fandrich: I wrote a tftp protocol module as part of the I-Boot
bootloader under a BSD-style license with attribution clause
http://download.intrinsyc.com/supported/tools/i-boot-lite/i-boot-lite-1.8/src/libs/net/tftp.c
* RTSP - RFC2326 (protocol - very HTTP-like, also contains URL description)
* SFTP/SCP/SSH (no RFCs for protocol nor URI/URL format). An implementation
should most probably use an existing ssh library, such as OpenSSH.
* RSYNC (no RFCs for protocol nor URI/URL format). An implementation should
most probably use an existing rsync library, such as librsync.
CLIENT CLIENT
* "curl --sync http://example.com/feed[1-100].rss" or
"curl --sync http://example.net/{index,calendar,history}.html"
Downloads a range or set of URLs using the remote name, but only if the
remote file is newer than the local file. A Last-Modified HTTP date header
should also be used to set the mod date on the downloaded file.
(idea from "Brianiac")
* Globbing support for -d and -F, as in 'curl -d "name=foo[0-9]" URL'.
Requested by Dane Jensen and others. This is easily scripted though.
* Add an option that prevents cURL from overwiting existing local files. When * Add an option that prevents cURL from overwiting existing local files. When
used, and there already is an existing file with the target file name used, and there already is an existing file with the target file name
(either -O or -o), a number should be appended (and increased if already (either -O or -o), a number should be appended (and increased if already
@@ -182,7 +254,7 @@ TODO
command line. Possibly by letting ':' separate options between URLs, command line. Possibly by letting ':' separate options between URLs,
similar to this: similar to this:
curl --data foo --url url.com : curl --data foo --url url.com : \
--url url2.com : \ --url url2.com : \
--url url3.com --data foo3 --url url3.com --data foo3
@@ -194,15 +266,12 @@ TODO
* Consider extending 'roffit' to produce decent ASCII output, and use that * Consider extending 'roffit' to produce decent ASCII output, and use that
instead of (g)nroff when building src/hugehelp.c instead of (g)nroff when building src/hugehelp.c
TEST SUITE TEST SUITE
* Make the test servers able to serve multiple running test suites. Like if * Make the test servers able to serve multiple running test suites. Like if
two users run 'make test' at once. two users run 'make test' at once.
* Make runtests.pl capable of changing port numbers for the servers. This was
the intention from the start, but in practise it is now hard.
* If perl wasn't found by the configure script, don't attempt to run the * If perl wasn't found by the configure script, don't attempt to run the
tests but explain something nice why it doesn't. tests but explain something nice why it doesn't.
@@ -229,3 +298,6 @@ TODO
They will instead become curlx_ - alternatives. That makes the curl app They will instead become curlx_ - alternatives. That makes the curl app
still capable of building with them from source. still capable of building with them from source.
* Remove support for CURLOPT_FAILONERROR, it has gotten too kludgy and weird
internally. Let the app judge success or not for itself.

View File

@@ -1,7 +1,5 @@
Online: http://curl.haxx.se/docs/httpscripting.shtml Online: http://curl.haxx.se/docs/httpscripting.html
Author: Daniel Stenberg <daniel@haxx.se> Date: December 9, 2004
Date: November 6, 2001
Version: 0.6
The Art Of Scripting HTTP Requests Using Curl The Art Of Scripting HTTP Requests Using Curl
============================================= =============================================
@@ -139,11 +137,11 @@ Version: 0.6
you need to replace that space with %20 etc. Failing to comply with this you need to replace that space with %20 etc. Failing to comply with this
will most likely cause your data to be received wrongly and messed up. will most likely cause your data to be received wrongly and messed up.
4.3 FILE UPLOAD POST 4.3 File Upload POST
Back in late 1995 they defined a new way to post data over HTTP. It was Back in late 1995 they defined an additional way to post data over HTTP. It
documented in the RFC 1867, why this method sometimes is referred to as is documented in the RFC 1867, why this method sometimes is referred to as
a RFC1867-posting. RFC1867-posting.
This method is mainly designed to better support file uploads. A form that 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: allows a user to upload a file could be written like this in HTML:
@@ -160,7 +158,7 @@ Version: 0.6
curl -F upload=@localfilename -F press=OK [URL] curl -F upload=@localfilename -F press=OK [URL]
4.4 HIDDEN FIELDS 4.4 Hidden Fields
A very common way for HTML based application to pass state information 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 between pages is to add hidden fields to the forms. Hidden fields are
@@ -181,7 +179,7 @@ Version: 0.6
curl -d "birthyear=1905&press=OK&person=daniel" [URL] curl -d "birthyear=1905&press=OK&person=daniel" [URL]
4.5 FIGURE OUT WHAT A POST LOOKS LIKE 4.5 Figure Out What A POST Looks Like
When you're about fill in a form and send to a server by using curl instead When you're about fill in a form and send to a server by using curl instead
of a browser, you're of course very interested in sending a POST exactly the of a browser, you're of course very interested in sending a POST exactly the
@@ -204,7 +202,7 @@ Version: 0.6
curl -T uploadfile www.uploadhttp.com/receive.cgi curl -T uploadfile www.uploadhttp.com/receive.cgi
6. AUTHENTICATION 6. Authentication
Authentication is the ability to tell the server your username and password 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 so that it can verify that you're allowed to do the request you're doing. The
@@ -229,31 +227,31 @@ Version: 0.6
curl -U proxyuser:proxypassword curl.haxx.se curl -U proxyuser:proxypassword curl.haxx.se
If your proxy requires the authentication to be done using the NTLM method, If your proxy requires the authentication to be done using the NTLM method,
use --proxy-ntlm. use --proxy-ntlm, if it requires Digest use --proxy-digest.
If you use any one these user+password options but leave out the password If you use any one these user+password options but leave out the password
part, curl will prompt for the password interactively. part, curl will prompt for the password interactively.
Do note that when a program is run, its parameters are possible to see when Do note that when a program is run, its parameters might be possible to see
listing the running processes of the system. Thus, other users may be able to when listing the running processes of the system. Thus, other users may be
watch your passwords if you pass them as plain command line options. There able to watch your passwords if you pass them as plain command line
are ways to circumvent this. options. There are ways to circumvent this.
7. REFERER 7. Referer
A HTTP request may include a 'referer' field, which can be used to tell from A HTTP request may include a 'referer' field (yes it is misspelled), which
which URL the client got to this particular resource. Some programs/scripts can be used to tell from which URL the client got to this particular
check the referer field of requests to verify that this wasn't arriving from resource. Some programs/scripts check the referer field of requests to verify
an external site or an unknown page. While this is a stupid way to check that this wasn't arriving from an external site or an unknown page. While
something so easily forged, many scripts still do it. Using curl, you can put this is a stupid way to check something so easily forged, many scripts still
anything you want in the referer-field and thus more easily be able to fool do it. Using curl, you can put anything you want in the referer-field and
the server into serving your request. thus more easily be able to fool the server into serving your request.
Use curl to set the referer field with: Use curl to set the referer field with:
curl -e http://curl.haxx.se daniel.haxx.se curl -e http://curl.haxx.se daniel.haxx.se
8. USER AGENT 8. User Agent
Very similar to the referer field, all HTTP requests may set the 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 field. It names what user agent (client) that is being used. Many
@@ -275,7 +273,7 @@ Version: 0.6
curl -A "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL] curl -A "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]
9. REDIRECTS 9. Redirects
When a resource is requested from a server, the reply from the server may 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 include a hint about where the browser should go next to find this page, or a
@@ -294,7 +292,7 @@ Version: 0.6
page, you can safely use -L and -d/-F together. Curl will only use POST in 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. the first request, and then revert to GET in the following operations.
10. COOKIES 10. Cookies
The way the web browsers do "client side state control" is by using The way the web browsers do "client side state control" is by using
cookies. Cookies are just names with associated contents. The cookies are cookies. Cookies are just names with associated contents. The cookies are
@@ -366,7 +364,7 @@ Version: 0.6
curl https://that.secure.server.com curl https://that.secure.server.com
11.1 CERTIFICATES 11.1 Certificates
In the HTTPS world, you use certificates to validate that you are the one 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 you you claim to be, as an addition to normal passwords. Curl supports
@@ -379,11 +377,67 @@ Version: 0.6
curl -E mycert.pem https://that.secure.server.com curl -E mycert.pem https://that.secure.server.com
curl also tries to verify that the server is who it claims to be, by curl also tries to verify that the server is who it claims to be, by
verifying the server's certificate against a CA cert bundle. Failing the verifying the server's certificate against a locally stored CA cert
verification will cause curl to deny the connection. You must then use -k in bundle. Failing the verification will cause curl to deny the connection. You
case you want to tell curl to ignore that the server can't be verified. must then use -k in case you want to tell curl to ignore that the server
can't be verified.
12. REFERENCES More about server certificate verification and ca cert bundles can be read
in the SSLCERTS document, available online here:
http://curl.haxx.se/docs/sslcerts.html
12. Custom Request Elements
Doing fancy stuff, you may need to add or change elements of a single curl
request.
For example, you can change the POST request to a PROPFIND and send the data
as "Content-Type: text/xml" (instead of the default Content-Type) like this:
curl -d "<xml>" -H "Content-Type: text/xml" -X PROPFIND url.com
You can delete a default header by providing one without content. Like you
can ruin the request by chopping off the Host: header:
curl -H "Host:" http://mysite.com
You can add headers the same way. Your server may want a "Destination:"
header, and you can add it:
curl -H "Destination: http://moo.com/nowhere" http://url.com
13. Debug
Many times when you run curl on a site, you'll notice that the site doesn't
seem to respond the same way to your curl requests as it does to your
browser's.
Then you need to start making your curl requests more similar to your
browser's requests:
* Use the --trace-ascii option to store fully detailed logs of the requests
for easier analyzing and better understanding
* Make sure you check for and use cookies when needed (both reading with -b
and writing with -c)
* Set user-agent to one like a recent popular browser does
* Set referer like it is set by the browser
* If you use POST, make sure you send all the fields and in the same order as
the browser does it. (See chapter 4.5 above)
A very good helper to make sure you do this right, is the LiveHTTPHeader tool
that lets you view all headers you send and receive with Mozilla/Firefox
(even when using HTTPS).
A more raw approach is to capture the HTTP traffic on the network with tools
such as ethereal or tcpdump and check what headers that were sent and
received by the browser. (HTTPS makes this technique inefficient.)
14. References
RFC 2616 is a must to read if you want in-depth understanding of the HTTP RFC 2616 is a must to read if you want in-depth understanding of the HTTP
protocol. protocol.

View File

@@ -20,7 +20,7 @@ Version Numbers and Releases
N is pre-release number N is pre-release number
One of these numbers will get bumped in each new release. The numbers to the One of these numbers will get bumped in each new release. The numbers to the
right of a bumped number will be reset to zero. If Z is zero, it is not right of a bumped number will be reset to zero. If Z is zero, it may not be
included in the version number. The pre release number is only included in included in the version number. The pre release number is only included in
pre releases (they're never used in public, official, releases). pre releases (they're never used in public, official, releases).
@@ -49,7 +49,7 @@ Version Numbers and Releases
As a service to any application that might want to support new libcurl As a service to any application that might want to support new libcurl
features while still being able to build with older versions, all releases features while still being able to build with older versions, all releases
have the libcurl version stored in the curl/curl.h file using a static have the libcurl version stored in the curl/curlver.h file using a static
numbering scheme that can be used for comparison. The version number is numbering scheme that can be used for comparison. The version number is
defined as: defined as:
@@ -62,3 +62,6 @@ Version Numbers and Releases
This 6-digit hexadecimal number does not show pre-release number, and it is This 6-digit hexadecimal number does not show pre-release number, and it is
always a greater number in a more recent release. It makes comparisons with always a greater number in a more recent release. It makes comparisons with
greater than and less than work. greater than and less than work.
This number is also available as three separate defines:
LIBCURL_VERSION_MAJOR, LIBCURL_VERSION_MINOR and LIBCURL_VERSION_PATCH.

View File

@@ -1,8 +1,27 @@
.\" You can view this file with: .\" **************************************************************************
.\" nroff -man curl-config.1 .\" * _ _ ____ _
.\" Written by Daniel Stenberg .\" * Project ___| | | | _ \| |
.\" * / __| | | | |_) | |
.\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____|
.\" *
.\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" *
.\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms
.\" * are also available at http://curl.haxx.se/docs/copyright.html.
.\" *
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
.\" * copies of the Software, and permit persons to whom the Software is
.\" * furnished to do so, under the terms of the COPYING file.
.\" *
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
.\" * KIND, either express or implied.
.\" *
.\" * $Id$
.\" **************************************************************************
.\" .\"
.TH curl-config 1 "8 Oct 2002" "Curl 7.10" "curl-config manual" .TH curl-config 1 "25 Jan 2004" "Curl 7.13.0" "curl-config manual"
.SH NAME .SH NAME
curl-config \- Get information about a libcurl installation curl-config \- Get information about a libcurl installation
.SH SYNOPSIS .SH SYNOPSIS
@@ -32,13 +51,20 @@ to link your application with libcurl.
This is the prefix used when libcurl was installed. Libcurl is then installed This is the prefix used when libcurl was installed. Libcurl is then installed
in $prefix/lib and its header files are installed in $prefix/include and so in $prefix/lib and its header files are installed in $prefix/include and so
on. The prefix is set with "configure --prefix". on. The prefix is set with "configure --prefix".
.IP "--protocols"
Lists what particular protocols the installed libcurl was built to support. At
the time of writing, this list may include HTTP, HTTPS, FTP, FTPS, GOPHER,
FILE, TELNET, LDAP, DICT. Do not assume any particular order. The protocols
will be listed using uppercase and are separated by newlines. There may be
none, one or several protocols in the list. (Added in 7.13.0)
.IP "--version" .IP "--version"
Outputs version information about the installed libcurl. Outputs version information about the installed libcurl.
.IP "--vernum" .IP "--vernum"
Outputs version information about the installed libcurl, in numerical mode. Outputs version information about the installed libcurl, in numerical mode.
This outputs the version number, in hexadecimal, with 8 bits for each part; This outputs the version number, in hexadecimal, with 8 bits for each part;
major, minor, patch. So that libcurl 7.7.4 would appear as 070704 and libcurl major, minor, patch. So that libcurl 7.7.4 would appear as 070704 and libcurl
12.13.14 would appear as 0c0d0e... 12.13.14 would appear as 0c0d0e... Note that the initial zero might be
omitted.
.SH "EXAMPLES" .SH "EXAMPLES"
What linker options do I need when I link with libcurl? What linker options do I need when I link with libcurl?

View File

@@ -5,7 +5,7 @@
.\" * | (__| |_| | _ <| |___ .\" * | (__| |_| | _ <| |___
.\" * \___|\___/|_| \_\_____| .\" * \___|\___/|_| \_\_____|
.\" * .\" *
.\" * Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al. .\" * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
.\" * .\" *
.\" * This software is licensed as described in the file COPYING, which .\" * This software is licensed as described in the file COPYING, which
.\" * you should have received as part of this distribution. The terms .\" * you should have received as part of this distribution. The terms
@@ -21,7 +21,7 @@
.\" * $Id$ .\" * $Id$
.\" ************************************************************************** .\" **************************************************************************
.\" .\"
.TH curl 1 "3 May 2004" "Curl 7.12" "Curl Manual" .TH curl 1 "12 Aug 2005" "Curl 7.14.1" "Curl Manual"
.SH NAME .SH NAME
curl \- transfer a URL curl \- transfer a URL
.SH SYNOPSIS .SH SYNOPSIS
@@ -91,6 +91,11 @@ network round-trip. This is used instead of setting a specific authentication
method, which you can do with \fI--basic\fP, \fI--digest\fP, \fI--ntlm\fP, and method, which you can do with \fI--basic\fP, \fI--digest\fP, \fI--ntlm\fP, and
\fI--negotiate\fP. (Added in 7.10.6) \fI--negotiate\fP. (Added in 7.10.6)
Note that using --anyauth is not recommended if you do uploads from stdin,
since it may require data to be sent twice and then the client must be able to
rewind. If the need should arise when uploading from stdin, the upload
operation will fail.
If this option is used several times, the following occurrences make no If this option is used several times, the following occurrences make no
difference. difference.
.IP "-b/--cookie <name=data>" .IP "-b/--cookie <name=data>"
@@ -115,9 +120,9 @@ using \fI-D/--dump-header\fP!
If this option is set more than once, the last one will be the one that's If this option is set more than once, the last one will be the one that's
used. used.
.IP "-B/--use-ascii" .IP "-B/--use-ascii"
Use ASCII transfer when getting an FTP file or LDAP info. For FTP, this can Enable ASCII transfer when using FTP or LDAP. For FTP, this can also be
also be enforced by using an URL that ends with ";type=A". This option causes enforced by using an URL that ends with ";type=A". This option causes data
data sent to stdout to be in text mode for win32 systems. sent to stdout to be in text mode for win32 systems.
If this option is used twice, the second one will disable ASCII usage. If this option is used twice, the second one will disable ASCII usage.
.IP "--basic" .IP "--basic"
@@ -160,12 +165,12 @@ won't fail or even report an error clearly. Using -v will get a warning
displayed, but that is the only visible feedback you get about this possibly displayed, but that is the only visible feedback you get about this possibly
lethal situation. lethal situation.
If this option is used several times, the last specfied file name will be If this option is used several times, the last specified file name will be
used. used.
.IP "-C/--continue-at <offset>" .IP "-C/--continue-at <offset>"
Continue/Resume a previous file transfer at the given offset. The given offset Continue/Resume a previous file transfer at the given offset. The given offset
is the exact number of bytes that will be skipped counted from the beginning is the exact number of bytes that will be skipped counted from the beginning
of the source file before it is transfered to the destination. If used with of the source file before it is transferred to the destination. If used with
uploads, the ftp server command SIZE will not be used by curl. uploads, the ftp server command SIZE will not be used by curl.
Use "-C -" to tell curl to automatically find out where/how to resume the Use "-C -" to tell curl to automatically find out where/how to resume the
@@ -236,7 +241,7 @@ active FTP transfers. Curl will normally always first attempt to use EPRT,
then LPRT before using PORT, but with this option, it will use PORT right then LPRT before using PORT, but with this option, it will use PORT right
away. EPRT and LPRT are extensions to the original FTP protocol, may not work away. EPRT and LPRT are extensions to the original FTP protocol, may not work
on all servers but enable more functionality in a better way than the on all servers but enable more functionality in a better way than the
traditional PORT command. (Aded in 7.10.5) traditional PORT command. (Added in 7.10.5)
If this option is used several times, each occurrence will toggle this on/off. If this option is used several times, each occurrence will toggle this on/off.
.IP "--disable-epsv" .IP "--disable-epsv"
@@ -262,9 +267,14 @@ If this option is used several times, the last one will be used.
be set with the \fI-H/--header\fP flag of course. When used with be set with the \fI-H/--header\fP flag of course. When used with
\fI-L/--location\fP you can append ";auto" to the referer URL to make curl \fI-L/--location\fP you can append ";auto" to the referer URL to make curl
automatically set the previous URL when it follows a Location: header. The 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. \&";auto" string can be used alone, even if you don't set an initial referer.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "--engine <name>"
Select the OpenSSL crypto engine to use for cipher
operations. Use \fI--engine list\fP to print a list of build-time supported
engines. Note that not all (or none) of the engines may be available at
run-time.
.IP "--environment" .IP "--environment"
(RISC OS ONLY) Sets a range of environment variables, using the names the -w (RISC OS ONLY) Sets a range of environment variables, using the names the -w
option supports, to easier allow extraction of useful information after having option supports, to easier allow extraction of useful information after having
@@ -320,6 +330,12 @@ document stating so (which often also describes why and more). This flag will
prevent curl from outputting that and fail silently instead. prevent curl from outputting that and fail silently instead.
If this option is used twice, the second will again disable silent failure. If this option is used twice, the second will again disable silent failure.
.IP "--ftp-account [data]"
(FTP) When an FTP server asks for "account data" after user name and password
has been provided, this data is sent off using the ACCT command. (Added in
7.13.0)
If this option is used twice, the second will override the previous use.
.IP "--ftp-create-dirs" .IP "--ftp-create-dirs"
(FTP) When an FTP URL/operation uses a path that doesn't currently exist on (FTP) When an FTP URL/operation uses a path that doesn't currently exist on
the server, the standard behavior of curl is to fail. Using this option, curl the server, the standard behavior of curl is to fail. Using this option, curl
@@ -327,20 +343,20 @@ will instead attempt to create missing directories. (Added in 7.10.7)
If this option is used twice, the second will again disable silent failure. If this option is used twice, the second will again disable silent failure.
.IP "--ftp-pasv" .IP "--ftp-pasv"
(FTP) Use PASV when transfering. PASV is the internal default behavior, but (FTP) Use PASV when transferring. PASV is the internal default behavior, but
using this option can be used to override a previos --ftp-port option. (Added using this option can be used to override a previous --ftp-port option. (Added
in 7.11.0) in 7.11.0)
If this option is used twice, the second will again disable silent failure. If this option is used twice, the second will again disable silent failure.
.IP "--ftp-ssl" .IP "--ftp-ssl"
(FTP) Make the FTP connection switch to use SSL/TLS. (Added in 7.11.0) (FTP) Make the FTP connection switch to use SSL/TLS. (Added in 7.11.0)
If this option is used twice, the second will again disable silent failure. If this option is used twice, the second will again disable this.
.IP "-F/--form <name=content>" .IP "-F/--form <name=content>"
(HTTP) This lets curl emulate a filled in form in which a user has pressed the (HTTP) This lets curl emulate a filled in form in which a user has pressed the
submit button. This causes curl to POST data using the content-type submit button. This causes curl to POST data using the Content-Type
multipart/form-data according to RFC1867. This enables uploading of binary multipart/form-data according to RFC1867. This enables uploading of binary
files etc. To force the 'content' part to be be a file, prefix the file name files etc. To force the 'content' part to be a file, prefix the file name
with an @ sign. To just get the content part from a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name
with the letter <. The difference between @ and < is then that @ makes a file with the letter <. The difference between @ and < is then that @ makes a file
get attached in the post as a file upload, while the < makes a text field and get attached in the post as a file upload, while the < makes a text field and
@@ -352,17 +368,32 @@ input:
\fBcurl\fP -F password=@/etc/passwd www.mypasswords.com \fBcurl\fP -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 instead of a file, use - where the file
name should've been. This goes for both @ and < constructs. name should've been. This goes for both @ and < constructs.
You can also tell curl what Content-Type to use for the file upload part, by You can also tell curl what Content-Type to use by using 'type=', in a manner
using 'type=', in a manner similar to: similar to:
\fBcurl\fP -F "web=@index.html;type=text/html" url.com \fBcurl\fP -F "web=@index.html;type=text/html" url.com
or
\fBcurl\fP -F "name=daniel;type=text/foo" url.com
You can also explicitly change the name field of an file upload part by
setting filename=, like this:
\fBcurl\fP -F "file=@localfile;filename=nameinpost" url.com
See further examples and details in the MANUAL. See further examples and details in the MANUAL.
This option can be used multiple times. This option can be used multiple times.
.IP "--form-string <name=string>"
(HTTP) Similar to \fI--form\fP except that the value string for the named
parameter is used literally. Leading \&'@' and \&'<' characters, and the
\&';type=' string in the value have no special meaning. Use this in preference
to \fI--form\fP if there's any possibility that the string value may
accidentally trigger the \&'@' or \&'<' features of \fI--form\fP.
.IP "-g/--globoff" .IP "-g/--globoff"
This option switches off the "URL globbing parser". When you set this option, This option switches off the "URL globbing parser". When you set this option,
you can specify URLs that contain the letters {}[] without having them being you can specify URLs that contain the letters {}[] without having them being
@@ -390,9 +421,19 @@ 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 internal header with one without content on the right side of the colon will
prevent that header from appearing. prevent that header from appearing.
curl will make sure that each header you add/replace get sent with the proper
end of line marker, you should thus \fBnot\fP add that as a part of the header
content: do not add newlines or carriage returns they will only mess things up
for you.
See also the \fI-A/--user-agent\fP and \fI-e/--referer\fP options. See also the \fI-A/--user-agent\fP and \fI-e/--referer\fP options.
This option can be used multiple times to add/replace/remove multiple headers. This option can be used multiple times to add/replace/remove multiple headers.
.IP "--ignore-content-length"
(HTTP)
Ignore the Content-Length header. This is particularly useful for servers
running Apache 1.x, which will report incorrect Content-Length for files
larger than 2 gigabytes.
.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
@@ -416,7 +457,7 @@ time only.
If this option is used twice, the second will again disable header only. If this option is used twice, the second will again disable header only.
.IP "-j/--junk-session-cookies" .IP "-j/--junk-session-cookies"
(HTTP) When curl is told to read cookies from a given file, this option will (HTTP) When curl is told to read cookies from a given file, this option will
make it discard all "session cookies". This will basicly have the same effect make it discard all "session cookies". This will basically have the same effect
as if a new session is started. Typical browsers always discard session as if a new session is started. Typical browsers always discard session
cookies when they're closed down. (Added in 7.9.7) cookies when they're closed down. (Added in 7.9.7)
@@ -444,7 +485,7 @@ If this option is used several times, the last one will be used.
should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use should be one of 'clear', 'safe', 'confidential' or 'private'. Should you use
a level that is not one of these, 'private' will instead be used. a level that is not one of these, 'private' will instead be used.
This option requiures that the library was built with kerberos4 support. This This option requires that the library was built with kerberos4 support. This
is not very common. Use \fI-V/--version\fP to see if your curl supports it. is not very common. Use \fI-V/--version\fP to see if your curl supports it.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
@@ -466,6 +507,20 @@ line. So, it could look similar to this:
url = "http://curl.haxx.se/docs/" url = "http://curl.haxx.se/docs/"
This option can be used multiple times. This option can be used multiple times.
When curl is invoked, it always (unless \fI-q\fP is used) checks for a default
config file and uses it if found. The default config file is checked for in
the following places in this order:
1) curl tries to find the "home dir": It first checks for the CURL_HOME and
then the HOME environment variables. Failing that, it uses getpwuid() on
unix-like systems (which returns the home dir given the current user in your
system). On Windows, it then checks for the APPDATA variable, or as a last
resort the '%USERPROFILE%\Application Data'.
2) On windows, if there is no _curlrc file in the home dir, it checks for one
in the same dir the executable curl is placed. On unix-like systems, it will
simply try to load .curlrc from the determined home dir.
.IP "--limit-rate <speed>" .IP "--limit-rate <speed>"
Specify the maximum transfer rate you want curl to use. This feature is useful Specify the maximum transfer rate you want curl to use. This feature is useful
if you have a limited pipe and you'd like your transfer not use your entire if you have a limited pipe and you'd like your transfer not use your entire
@@ -554,12 +609,12 @@ Very similar to \fI--netrc\fP, but this option makes the .netrc usage
\fBoptional\fP and not mandatory as the \fI--netrc\fP does. \fBoptional\fP and not mandatory as the \fI--netrc\fP does.
.IP "--negotiate" .IP "--negotiate"
(HTTP) Enables GSS-Negotiate authentication. The GSS-Negotiate method was (HTTP) Enables GSS-Negotiate authentication. The GSS-Negotiate method was
designed by Microsoft and is used in their web aplications. It is primarily designed by Microsoft and is used in their web applications. It is primarily
meant as a support for Kerberos5 authentication but may be also used along meant as a support for Kerberos5 authentication but may be also used along
with another authentication methods. For more information see IETF draft with another authentication methods. For more information see IETF draft
draft-brezak-spnego-http-04.txt. (Added in 7.10.6) draft-brezak-spnego-http-04.txt. (Added in 7.10.6)
This option requiures that the library was built with GSSAPI support. This is This option requires that the library was built with GSSAPI support. This is
not very common. Use \fI-V/--version\fP to see if your version supports not very common. Use \fI-V/--version\fP to see if your version supports
GSS-Negotiate. GSS-Negotiate.
@@ -583,7 +638,7 @@ authentication method instead. Such as Digest. (Added in 7.10.6)
If you want to enable NTLM for your proxy authentication, then use If you want to enable NTLM for your proxy authentication, then use
\fI--proxy-ntlm\fP. \fI--proxy-ntlm\fP.
This option requiures that the library was built with SSL support. Use This option requires that the library was built with SSL support. Use
\fI-V/--version\fP to see if your curl supports NTLM. \fI-V/--version\fP to see if your curl supports NTLM.
If this option is used several times, the following occurrences make no If this option is used several times, the following occurrences make no
@@ -608,11 +663,21 @@ dynamically.
Write output to a local file named like the remote file we get. (Only the file Write output to a local file named like the remote file we get. (Only the file
part of the remote file is used, the path is cut off.) part of the remote file is used, the path is cut off.)
The remote file name to use for saving is extracted from the given URL.
Nothing else
You may use this option as many times as you have number of URLs. You may use this option as many times as you have number of URLs.
.IP "--pass <phrase>" .IP "--pass <phrase>"
(SSL) Pass phrase for the private key (SSL) Pass phrase for the private key
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "--proxy-anyauth"
Tells curl to pick a suitable authentication method when communicating with
the given proxy. This will cause an extra request/response round-trip. Added
in curl 7.13.2.
If this option is used twice, the second will again disable the proxy use-any
authentication.
.IP "--proxy-basic" .IP "--proxy-basic"
Tells curl to use HTTP Basic authentication when communicating with the given Tells curl to use HTTP Basic authentication when communicating with the given
proxy. Use \fI--basic\fP for enabling HTTP Basic with a remote host. Basic is proxy. Use \fI--basic\fP for enabling HTTP Basic with a remote host. Basic is
@@ -659,13 +724,16 @@ If this option is used several times, the last one will be used. Disable the
use of PORT with \fI--ftp-pasv\fP. Disable the attempt to use the EPRT command use of PORT with \fI--ftp-pasv\fP. Disable the attempt to use the EPRT command
instead of PORT by using \fI--disable-eprt\fP. EPRT is really PORT++. instead of PORT by using \fI--disable-eprt\fP. EPRT is really PORT++.
.IP "-q" .IP "-q"
If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP If used as the first parameter on the command line, the \fIcurlrc\fP config
file will not be read and used as a config file. file will not be read and used. See the \fI-K/--config\fP for details on the
.IP "-Q/--quote <comand>" default config file search path.
.IP "-Q/--quote <command>"
(FTP) Send an arbitrary command to the remote FTP server. Quote commands are (FTP) Send an arbitrary command to the remote FTP server. Quote commands are
sent BEFORE the transfer is taking place. To make commands take place after a sent BEFORE the transfer is taking place (just after the initial PWD command
successful transfer, prefix them with a dash '-'. You may specify any amount to be exact). To make commands take place after a successful transfer, prefix
of commands to be run before and after the transfer. If the server returns them with a dash '-'. To make commands get sent after libcurl has changed
working directory, just before the transfer command(s), prefix the command
with '+'. You may specify any amount of commands. If the server returns
failure for one of the commands, the entire operation will be aborted. You failure for one of the commands, the entire operation will be aborted. You
must send syntactically correct FTP commands as RFC959 defines. must send syntactically correct FTP commands as RFC959 defines.
@@ -719,6 +787,37 @@ remote file, and if that is available make the local file get that same
timestamp. timestamp.
If this option is used twice, the second time disables this again. If this option is used twice, the second time disables this again.
.IP "--retry <num>"
If a transient error is returned when curl tries to perform a transfer, it
will retry this number of times before giving up. Setting the number to 0
makes curl do no retries (which is the default). Transient error means either:
a timeout, an FTP 5xx response code or an HTTP 5xx response code.
When curl is about to retry a transfer, it will first wait one second and then
for all forthcoming retries it will double the waiting time until it reaches
10 minutes which then will be the delay between the rest of the retries. By
using \fI--retry-delay\fP you disable this exponential backoff algorithm. See
also \fI--retry-max-time\fP to limit the total time allowed for
retries. (Option added in 7.12.3)
If this option is used multiple times, the last occurrence decide the amount.
.IP "--retry-delay <seconds>"
Make curl sleep this amount of time between each retry when a transfer has
failed with a transient error (it changes the default backoff time algorithm
between retries). This option is only interesting if \fI--retry\fP is also
used. Setting this delay to zero will make curl use the default backoff time.
(Option added in 7.12.3)
If this option is used multiple times, the last occurrence decide the amount.
.IP "--retry-max-time <seconds>"
The retry timer is reset before the first transfer attempt. Retries will be
done as usual (see \fI--retry\fP) as long as the timer hasn't reached this
given limit. Notice that if the timer hasn't reached the limit, the request
will be made and while performing, it may take longer than this given time
period. To limit a single request\'s maximum time, use \fI-m/--max-time\fP.
Set this option to zero to not timeout retries. (Option added in 7.12.3)
If this option is used multiple times, the last occurrence decide the amount.
.IP "-s/--silent" .IP "-s/--silent"
Silent mode. Don't show progress meter or error messages. Makes Silent mode. Don't show progress meter or error messages. Makes
Curl mute. Curl mute.
@@ -746,7 +845,7 @@ If this option is used several times, the last one will be used.
Turn on the TCP_NODELAY option. See the \fIcurl_easy_setopt(3)\fP man page for Turn on the TCP_NODELAY option. See the \fIcurl_easy_setopt(3)\fP man page for
details about this option. (Added in 7.11.2) details about this option. (Added in 7.11.2)
If this option is used several times, each occurance toggles this on/off. If this option is used several times, each occurrence toggles this on/off.
.IP "-t/--telnet-option <OPT=val>" .IP "-t/--telnet-option <OPT=val>"
Pass options to the telnet protocol. Supported options are: Pass options to the telnet protocol. Supported options are:
@@ -796,8 +895,14 @@ to read for untrained humans.
If this option is used several times, the last one will be used. (Added in If this option is used several times, the last one will be used. (Added in
7.9.7) 7.9.7)
.IP "--trace-time"
Prepends a time stamp to each trace or verbose line that curl displays.
If this option is used several times, each occurrence will toggle it on/off.
(Added in 7.14.0 )
.IP "-u/--user <user:password>" .IP "-u/--user <user:password>"
Specify user and password to use for server authentication. Specify user and password to use for server authentication. Overrides
\fI-n/--netrc\fP and \fI--netrc-optional\fP.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "-U/--proxy-user <user:password>" .IP "-U/--proxy-user <user:password>"
@@ -812,11 +917,11 @@ This option may be used any number of times. To control where this URL is
written, use the \fI-o/--output\fP or the \fI-O/--remote-name\fP options. written, use the \fI-o/--output\fP or the \fI-O/--remote-name\fP options.
.IP "-v/--verbose" .IP "-v/--verbose"
Makes the fetching more verbose/talkative. Mostly usable for debugging. Lines Makes the fetching more verbose/talkative. Mostly usable for debugging. Lines
starting with '>' means data sent by curl, '<' means data received by curl starting with '>' means "header data" sent by curl, '<' means "header data"
that is hidden in normal cases and lines starting with '*' means additional received by curl that is hidden in normal cases and lines starting with '*'
info provided by curl. means additional info provided by curl.
Note that if you want to see HTTP headers in the output, \fI-i/--include\fP Note that if you only want HTTP headers in the output, \fI-i/--include\fP
might be option you're looking for. might be option you're looking for.
If you think this option still doesn't give you enough details, consider using If you think this option still doesn't give you enough details, consider using
@@ -844,27 +949,30 @@ HTTPS and FTPS are supported.
.IP "libz" .IP "libz"
Automatic decompression of compressed files over HTTP is supported. Automatic decompression of compressed files over HTTP is supported.
.IP "NTLM" .IP "NTLM"
NTLM authenticaion is supported. NTLM authentication is supported.
.IP "GSS-Negotiate" .IP "GSS-Negotiate"
Negotiate authenticaion is supported. Negotiate authentication is supported.
.IP "Debug" .IP "Debug"
This curl uses a libcurl built with Debug. This enables more error-tracking This curl uses a libcurl built with Debug. This enables more error-tracking
and memory debugging etc. For curl-developers only! and memory debugging etc. For curl-developers only!
.IP "AsynchDNS" .IP "AsynchDNS"
This curl uses asynchronous name resolves. This curl uses asynchronous name resolves.
.IP "SPNEGO" .IP "SPNEGO"
SPNEGO Negotiate authenticaion is supported. SPNEGO Negotiate authentication is supported.
.IP "Largefile" .IP "Largefile"
This curl supports transfers of large files, files larger than 2GB. This curl supports transfers of large files, files larger than 2GB.
.IP "IDN" .IP "IDN"
This curl supports IDN - international domain names. This curl supports IDN - international domain names.
.IP "SSPI"
SSPI is supported. If you use NTLM and set a blank user name, curl will
authenticate with your current user and password.
.RE .RE
.IP "-w/--write-out <format>" .IP "-w/--write-out <format>"
Defines what to display after a completed and successful operation. The format Defines what to display on stdout after a completed and successful
is a string that may contain plain text mixed with any number of variables. The operation. The format is a string that may contain plain text mixed with any
string can be specified as "string", to get read from a particular file you number of variables. The string can be specified as "string", to get read from
specify it "@filename" and to tell curl to read the format from stdin you a particular file you specify it "@filename" and to tell curl to read the
write "@-". format from stdin you write "@-".
The variables present in the output format will be substituted by the value or The variables present in the output format will be substituted by the value or
text that curl thinks fit, as described below. All variables are specified text that curl thinks fit, as described below. All variables are specified
@@ -886,6 +994,10 @@ to follow location: headers.
.B http_code .B http_code
The numerical code that was found in the last retrieved HTTP(S) page. The numerical code that was found in the last retrieved HTTP(S) page.
.TP .TP
.B http_connect
The numerical code that was found in the last response (from a proxy) to a
curl CONNECT request. (Added in 7.12.4)
.TP
.B time_total .B time_total
The total time, in seconds, that the full operation lasted. The time will be The total time, in seconds, that the full operation lasted. The time will be
displayed with millisecond resolution. displayed with millisecond resolution.
@@ -903,9 +1015,15 @@ The time, in seconds, it took from the start until the file transfer is just
about to begin. This includes all pre-transfer commands and negotiations that about to begin. This includes all pre-transfer commands and negotiations that
are specific to the particular protocol(s) involved. are specific to the particular protocol(s) involved.
.TP .TP
.B time_redirect
The time, in seconds, it took for all redirection steps include name lookup,
connect, pretransfer and transfer before final transaction was
started. time_redirect shows the complete execution time for multiple
redirections. (Added in 7.12.3)
.TP
.B time_starttransfer .B time_starttransfer
The time, in seconds, it took from the start until the first byte is just about The time, in seconds, it took from the start until the first byte is just about
to be transfered. This includes time_pretransfer and also the time the to be transferred. This includes time_pretransfer and also the time the
server needs to calculate the result. server needs to calculate the result.
.TP .TP
.B size_download .B size_download
@@ -928,6 +1046,12 @@ The average upload speed that curl measured for the complete upload.
.TP .TP
.B content_type .B content_type
The Content-Type of the requested document, if there was any. (Added in 7.9.5) The Content-Type of the requested document, if there was any. (Added in 7.9.5)
.TP
.B num_connects
Number of new connects made in the recent transfer. (Added in 7.12.3)
.TP
.B num_redirects
Number of redirects that were followed in the request. (Added in 7.12.3)
.RE .RE
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
@@ -940,16 +1064,20 @@ use. If there's an environment variable setting a proxy, you can set proxy to
\&"" to override it. \&"" to override it.
\fBNote\fP that all operations that are performed over a HTTP proxy will \fBNote\fP that all operations that are performed over a HTTP proxy will
transparantly be converted to HTTP. It means that certain protocol specific transparently be converted to HTTP. It means that certain protocol specific
operations might not be available. This is not the case if you can tunnel operations might not be available. This is not the case if you can tunnel
through the proxy, as done with the \fI-p/--proxytunnel\fP option. through the proxy, as done with the \fI-p/--proxytunnel\fP option.
Starting with 7.14.1, the proxy host can be specified the exact same way as
the proxy environment variables, include protocol prefix (http://) and
embedded user + password.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "-X/--request <command>" .IP "-X/--request <command>"
(HTTP) (HTTP) Specifies a custom request method to use when communicating with the
Specifies a custom request to use when communicating with the HTTP server. HTTP server. The specified request will be used instead of the method
The specified request will be used instead of the standard GET. Read the otherwise used (which defaults to GET). Read the HTTP 1.1 specification for
HTTP 1.1 specification for details and explanations. details and explanations.
(FTP) (FTP)
Specifies a custom FTP command to use instead of LIST when doing file lists Specifies a custom FTP command to use instead of LIST when doing file lists
@@ -972,22 +1100,18 @@ not set.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "-z/--time-cond <date expression>" .IP "-z/--time-cond <date expression>"
(HTTP) (HTTP) Request a file that has been modified later than the given time and
Request to get a file that has been modified later than the given time and
date, or one that has been modified before that time. The date expression can 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)" \fIcurl_getdate(3)\fP man pages 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
than the specified date/time. than the specified date/time.
If this option is used several times, the last one will be used. If this option is used several times, the last one will be used.
.IP "-Z/--max-redirs <num>" .IP "--max-redirs <num>"
Set maximum number of redirection-followings allowed. If \fI-L/--location\fP Set maximum number of redirection-followings allowed. If \fI-L/--location\fP
is used, this option can be used to prevent curl from following redirections is used, this option can be used to prevent curl from following redirections
\&"in absurdum". \&"in absurdum".
@@ -1005,6 +1129,17 @@ Forces curl to use SSL version 2 when negotiating with a remote SSL server.
.IP "-3/--sslv3" .IP "-3/--sslv3"
(HTTPS) (HTTPS)
Forces curl to use SSL version 3 when negotiating with a remote SSL server. Forces curl to use SSL version 3 when negotiating with a remote SSL server.
.IP "--3p-quote"
(FTP) Specify arbitrary commands to send to the source server. See the
\fI-Q/--quote\fP option for details. (Added in 7.13.0)
.IP "--3p-url"
(FTP) Activates a FTP 3rd party transfer. Specifies the source URL to get a
file from, while the "normal" URL will be used as target URL, the file that
will be written/created.
Note that not all FTP server allow 3rd party transfers. (Added in 7.13.0)
.IP "--3p-user"
(FTP) Specify user:password for the source URL transfer. (Added in 7.13.0)
.IP "-4/--ipv4" .IP "-4/--ipv4"
If libcurl is capable of resolving an address to multiple IP versions (which If libcurl is capable of resolving an address to multiple IP versions (which
it is if it is ipv6-capable), this option tells libcurl to resolve names to it is if it is ipv6-capable), this option tells libcurl to resolve names to
@@ -1077,7 +1212,7 @@ FTP can't reconnect. Couldn't connect to the host we got in the 227-line.
.IP 17 .IP 17
FTP couldn't set binary. Couldn't change transfer method to binary. FTP couldn't set binary. Couldn't change transfer method to binary.
.IP 18 .IP 18
Partial file. Only a part of the file was transfered. Partial file. Only a part of the file was transferred.
.IP 19 .IP 19
FTP couldn't download/access the given file, the RETR (or similar) command FTP couldn't download/access the given file, the RETR (or similar) command
failed. failed.
@@ -1186,5 +1321,5 @@ http://curl.haxx.se
ftp://ftp.sunet.se/pub/www/utilities/curl/ ftp://ftp.sunet.se/pub/www/utilities/curl/
.SH "SEE ALSO" .SH "SEE ALSO"
.BR ftp (1), .BR ftp (1),
.BR wget (1), .BR wget (1)
.BR snarf (1)

View File

@@ -9,7 +9,9 @@ EXTRA_DIST = README curlgtk.c sepheaders.c simple.c postit2.c \
ftpupload.c httpput.c simplessl.c ftpgetresp.c http-post.c \ ftpupload.c httpput.c simplessl.c ftpgetresp.c http-post.c \
post-callback.c multi-app.c multi-double.c multi-single.c \ post-callback.c multi-app.c multi-double.c multi-single.c \
multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \ multi-post.c fopen.c simplepost.c makefile.dj curlx.c https.c \
multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c multi-debugcallback.c fileupload.c getinfo.c ftp3rdparty.c debug.c \
anyauthput.c htmltitle.cc htmltidy.c opensslthreadlock.c \
cookie_interface.c cacertinmem.c
all: all:
@echo "done" @echo "done"

View File

@@ -1,4 +1,8 @@
EXAMPLES _ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
| (__| |_| | _ <| |___
\___|\___/|_| \_\_____|
This directory is for libcurl programming examples. They are meant to show This directory is for libcurl programming examples. They are meant to show
some simple steps on how you can build your own application to take full some simple steps on how you can build your own application to take full
@@ -7,6 +11,8 @@ advantage of libcurl.
If you end up with other small but still useful example sources, please mail If you end up with other small but still useful example sources, please mail
them for submission in future packages and on the web site. them for submission in future packages and on the web site.
BUILDING
The Makefile.example is an example makefile that could be used to build these The Makefile.example is an example makefile that could be used to build these
examples. Just edit the file according to your system and requirements first. examples. Just edit the file according to your system and requirements first.
@@ -23,3 +29,36 @@ want you do reorganize them like:
applications/experiments. Even if the examples in this directory use that site applications/experiments. Even if the examples in this directory use that site
as an example URL at some places, it doesn't mean that the URLs work or that as an example URL at some places, it doesn't mean that the URLs work or that
we expect you to actually torture our web site with your tests! Thanks. we expect you to actually torture our web site with your tests! Thanks.
EXAMPLES
anyauthput.c - HTTP PUT using "any" authentication method
curlgtk.c - download using a GTK progress bar
curlx.c - getting file info from the remote cert data
debug.c - showing how to use the debug callback
fileupload.c - uploading to a file:// URL
fopen.c - fopen() layer that supports opening URLs and files
ftp3rdparty.c - FTP 3rd party transfer
ftpget.c - simple getting a file from FTP
ftpgetresp.c - get the response strings from the FTP server
ftpupload.c - upload a file to a FTP server
getinfo.c - get the Content-Type from the recent transfer
getinmemory.c - download a file to memory only
htmltitle.cc - download a HTML file and extract the <title> tag from a HTML
page using libxml
http-post.c - HTTP POST
httpput.c - HTTP PUT a local file
https.c - simple HTTPS transfer
multi-app.c - a multi-interface app
multi-debugcallback.c - a multi-interface app using the debug callback
multi-double.c - a multi-interface app doing two simultaneous transfers
multi-post.c - a multi-interface app doing a multipart formpost
multi-single.c - a multi-interface app getting a single file
multithread.c - an example using multi-treading transfering multiple files
persistant.c - request two URLs with a persistant connection
post-callback.c - send a HTTP POST using a callback
postit2.c - send a HTTP multipart formpost
sepheaders.c - download headers to a separate file
simple.c - the most simple download a URL source
simplepost.c - HTTP POST
simplessl.c - HTTPS example with certificates many options set

35
docs/examples/adddocsref.pl Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/perl
# pass files as argument(s)
my $docroot="http://curl.haxx.se/libcurl/c";
for $f (@ARGV) {
open(NEW, ">$f.new");
open(F, "<$f");
while(<F>) {
my $l = $_;
if($l =~ /\/* $docroot/) {
# just ignore preciously added refs
}
elsif($l =~ /^( *).*curl_easy_setopt\([^,]*, *([^ ,]*) *,/) {
my ($prefix, $anc) = ($1, $2);
$anc =~ s/_//g;
print NEW "$prefix/* $docroot/curl_easy_setopt.html#$anc */\n";
print NEW $l;
}
elsif($l =~ /^( *).*(curl_([^\(]*))\(/) {
my ($prefix, $func) = ($1, $2);
print NEW "$prefix/* $docroot/$func.html */\n";
print NEW $l;
}
else {
print NEW $l;
}
}
close(F);
close(NEW);
system("mv $f $f.org");
system("mv $f.new $f");
}

135
docs/examples/anyauthput.c Normal file
View File

@@ -0,0 +1,135 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*/
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <curl/curl.h>
#if LIBCURL_VERSION_NUM < 0x070c03
#error "upgrade your libcurl to no less than 7.12.3"
#endif
/*
* This example shows a HTTP PUT operation with authentiction using "any"
* type. It PUTs a file given as a command line argument to the URL also given
* on the command line.
*
* Since libcurl 7.12.3, using "any" auth and POST/PUT requires a set ioctl
* function.
*
* This example also uses its own read callback.
*/
/* ioctl callback function */
static curlioerr my_ioctl(CURL *handle, curliocmd cmd, void *userp)
{
int fd = (int)userp;
(void)handle; /* not used in here */
switch(cmd) {
case CURLIOCMD_RESTARTREAD:
/* mr libcurl kindly asks as to rewind the read data stream to start */
if(-1 == lseek(fd, 0, SEEK_SET))
/* couldn't rewind */
return CURLIOE_FAILRESTART;
break;
default: /* ignore unknown commands */
return CURLIOE_UNKNOWNCMD;
}
return CURLIOE_OK; /* success! */
}
/* read callback function, fread() look alike */
size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
{
size_t retcode;
int fd = (int)stream;
retcode = read(fd, ptr, size * nmemb);
fprintf(stderr, "*** We read %d bytes from file\n", retcode);
return retcode;
}
int main(int argc, char **argv)
{
CURL *curl;
CURLcode res;
int hd ;
struct stat file_info;
char *file;
char *url;
if(argc < 3)
return 1;
file= argv[1];
url = argv[2];
/* get the file size of the local file */
hd = open(file, O_RDONLY) ;
fstat(hd, &file_info);
/* In windows, this will init the winsock stuff */
curl_global_init(CURL_GLOBAL_ALL);
/* get a curl handle */
curl = curl_easy_init();
if(curl) {
/* we want to use our own read function */
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
/* which file to upload */
curl_easy_setopt(curl, CURLOPT_READDATA, hd);
/* set the ioctl function */
curl_easy_setopt(curl, CURLOPT_IOCTLFUNCTION, my_ioctl);
/* pass the file descriptor to the ioctl callback as well */
curl_easy_setopt(curl, CURLOPT_IOCTLDATA, hd);
/* enable "uploading" (which means PUT when doing HTTP) */
curl_easy_setopt(curl, CURLOPT_UPLOAD, TRUE) ;
/* specify target URL, and note that this URL should also include a file
name, not only a directory (as you can do with GTP uploads) */
curl_easy_setopt(curl,CURLOPT_URL, url);
/* and give the size of the upload, this supports large file sizes
on systems that have general support for it */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_info.st_size);
/* tell libcurl we can use "any" auth, which lets the lib pick one, but it
also costs one extra round-trip and possibly sending of all the PUT
data twice!!! */
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
/* set user name and password for the authentication */
curl_easy_setopt(curl, CURLOPT_USERPWD, "user:password");
/* Now run off and do what you've been told! */
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
}
close(hd); /* close the local file */
curl_global_cleanup();
return 0;
}

138
docs/examples/cacertinmem.c Normal file
View File

@@ -0,0 +1,138 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* $Id$
*
* Example using a "in core" PEM certificate to retrieve a https page.
* Written by Theo Borm
*/
/* on a netBSD system with OPENSSL& LIBCURL installed from
* pkgsrc (using default paths) this program can be compiled using:
* gcc -I/usr/pkg/include -L/usr/pkg/lib -lcurl -Wl,-R/usr/pkg/lib -lssl
* -lcrypto -lz -o curlcacerttest curlcacerttest.c
* on other operating systems you may want to change paths to headers
* and libraries
*/
#include <openssl/ssl.h>
#include <curl/curl.h>
#include <stdio.h>
size_t writefunction( void *ptr, size_t size, size_t nmemb, void *stream)
{
fwrite(ptr,size,nmemb,stream);
return(nmemb*size);
}
static CURLcode sslctx_function(CURL * curl, void * sslctx, void * parm)
{
X509_STORE * store;
X509 * cert=NULL;
BIO * bio;
char * mypem = /* www.cacert.org */
"-----BEGIN CERTIFICATE-----\n"\
"MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\n"\
"IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\n"\
"IENlcnQgU2lnbmluZyBBdXRob3JpdHkxITAfBgkqhkiG9w0BCQEWEnN1cHBvcnRA\n"\
"Y2FjZXJ0Lm9yZzAeFw0wMzAzMzAxMjI5NDlaFw0zMzAzMjkxMjI5NDlaMHkxEDAO\n"\
"BgNVBAoTB1Jvb3QgQ0ExHjAcBgNVBAsTFWh0dHA6Ly93d3cuY2FjZXJ0Lm9yZzEi\n"\
"MCAGA1UEAxMZQ0EgQ2VydCBTaWduaW5nIEF1dGhvcml0eTEhMB8GCSqGSIb3DQEJ\n"\
"ARYSc3VwcG9ydEBjYWNlcnQub3JnMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC\n"\
"CgKCAgEAziLA4kZ97DYoB1CW8qAzQIxL8TtmPzHlawI229Z89vGIj053NgVBlfkJ\n"\
"8BLPRoZzYLdufujAWGSuzbCtRRcMY/pnCujW0r8+55jE8Ez64AO7NV1sId6eINm6\n"\
"zWYyN3L69wj1x81YyY7nDl7qPv4coRQKFWyGhFtkZip6qUtTefWIonvuLwphK42y\n"\
"fk1WpRPs6tqSnqxEQR5YYGUFZvjARL3LlPdCfgv3ZWiYUQXw8wWRBB0bF4LsyFe7\n"\
"w2t6iPGwcswlWyCR7BYCEo8y6RcYSNDHBS4CMEK4JZwFaz+qOqfrU0j36NK2B5jc\n"\
"G8Y0f3/JHIJ6BVgrCFvzOKKrF11myZjXnhCLotLddJr3cQxyYN/Nb5gznZY0dj4k\n"\
"epKwDpUeb+agRThHqtdB7Uq3EvbXG4OKDy7YCbZZ16oE/9KTfWgu3YtLq1i6L43q\n"\
"laegw1SJpfvbi1EinbLDvhG+LJGGi5Z4rSDTii8aP8bQUWWHIbEZAWV/RRyH9XzQ\n"\
"QUxPKZgh/TMfdQwEUfoZd9vUFBzugcMd9Zi3aQaRIt0AUMyBMawSB3s42mhb5ivU\n"\
"fslfrejrckzzAeVLIL+aplfKkQABi6F1ITe1Yw1nPkZPcCBnzsXWWdsC4PDSy826\n"\
"YreQQejdIOQpvGQpQsgi3Hia/0PsmBsJUUtaWsJx8cTLc6nloQsCAwEAAaOCAc4w\n"\
"ggHKMB0GA1UdDgQWBBQWtTIb1Mfz4OaO873SsDrusjkY0TCBowYDVR0jBIGbMIGY\n"\
"gBQWtTIb1Mfz4OaO873SsDrusjkY0aF9pHsweTEQMA4GA1UEChMHUm9vdCBDQTEe\n"\
"MBwGA1UECxMVaHR0cDovL3d3dy5jYWNlcnQub3JnMSIwIAYDVQQDExlDQSBDZXJ0\n"\
"IFNpZ25pbmcgQXV0aG9yaXR5MSEwHwYJKoZIhvcNAQkBFhJzdXBwb3J0QGNhY2Vy\n"\
"dC5vcmeCAQAwDwYDVR0TAQH/BAUwAwEB/zAyBgNVHR8EKzApMCegJaAjhiFodHRw\n"\
"czovL3d3dy5jYWNlcnQub3JnL3Jldm9rZS5jcmwwMAYJYIZIAYb4QgEEBCMWIWh0\n"\
"dHBzOi8vd3d3LmNhY2VydC5vcmcvcmV2b2tlLmNybDA0BglghkgBhvhCAQgEJxYl\n"\
"aHR0cDovL3d3dy5jYWNlcnQub3JnL2luZGV4LnBocD9pZD0xMDBWBglghkgBhvhC\n"\
"AQ0ESRZHVG8gZ2V0IHlvdXIgb3duIGNlcnRpZmljYXRlIGZvciBGUkVFIGhlYWQg\n"\
"b3ZlciB0byBodHRwOi8vd3d3LmNhY2VydC5vcmcwDQYJKoZIhvcNAQEEBQADggIB\n"\
"ACjH7pyCArpcgBLKNQodgW+JapnM8mgPf6fhjViVPr3yBsOQWqy1YPaZQwGjiHCc\n"\
"nWKdpIevZ1gNMDY75q1I08t0AoZxPuIrA2jxNGJARjtT6ij0rPtmlVOKTV39O9lg\n"\
"18p5aTuxZZKmxoGCXJzN600BiqXfEVWqFcofN8CCmHBh22p8lqOOLlQ+TyGpkO/c\n"\
"gr/c6EWtTZBzCDyUZbAEmXZ/4rzCahWqlwQ3JNgelE5tDlG+1sSPypZt90Pf6DBl\n"\
"Jzt7u0NDY8RD97LsaMzhGY4i+5jhe1o+ATc7iwiwovOVThrLm82asduycPAtStvY\n"\
"sONvRUgzEv/+PDIqVPfE94rwiCPCR/5kenHA0R6mY7AHfqQv0wGP3J8rtsYIqQ+T\n"\
"SCX8Ev2fQtzzxD72V7DX3WnRBnc0CkvSyqD/HMaMyRa+xMwyN2hzXwj7UfdJUzYF\n"\
"CpUCTPJ5GhD22Dp1nPMd8aINcGeGG7MW9S/lpOt5hvk9C8JzC6WZrG/8Z7jlLwum\n"\
"GCSNe9FINSkYQKyTYOGWhlC0elnYjyELn8+CkcY7v2vcB5G5l1YjqrZslMZIBjzk\n"\
"zk6q5PYvCdxTby78dOs6Y5nCpqyJvKeyRKANihDjbPIky/qbn3BHLt4Ui9SyIAmW\n"\
"omTxJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD\n"\
"-----END CERTIFICATE-----\n";
/* get a BIO */
bio=BIO_new_mem_buf(mypem, -1);
/* use it to read the PEM formatted certificate from memory into an X509
* structure that SSL can use
*/
PEM_read_bio_X509(bio, &cert, 0, NULL);
if (cert == NULL)
printf("PEM_read_bio_X509 failed...\n");
/* get a pointer to the X509 certificate store (which may be empty!) */
store=SSL_CTX_get_cert_store((SSL_CTX *)sslctx);
/* add our certificate to this store */
if (X509_STORE_add_cert(store, cert)==0)
printf("error adding certificate\n");
/* all set to go */
return CURLE_OK ;
}
int main(void)
{
CURL * ch;
CURLcode rv;
rv=curl_global_init(CURL_GLOBAL_ALL);
ch=curl_easy_init();
rv=curl_easy_setopt(ch,CURLOPT_VERBOSE, 0);
rv=curl_easy_setopt(ch,CURLOPT_HEADER, 0);
rv=curl_easy_setopt(ch,CURLOPT_NOPROGRESS, 1);
rv=curl_easy_setopt(ch,CURLOPT_NOSIGNAL, 1);
rv=curl_easy_setopt(ch,CURLOPT_WRITEFUNCTION, *writefunction);
rv=curl_easy_setopt(ch,CURLOPT_WRITEDATA, stdout);
rv=curl_easy_setopt(ch,CURLOPT_HEADERFUNCTION, *writefunction);
rv=curl_easy_setopt(ch,CURLOPT_WRITEHEADER, stderr);
rv=curl_easy_setopt(ch,CURLOPT_SSLCERTTYPE,"PEM");
rv=curl_easy_setopt(ch,CURLOPT_SSL_VERIFYPEER,1);
rv=curl_easy_setopt(ch, CURLOPT_URL, "https://www.cacert.org/");
/* first try: retrieve page without cacerts' certificate -> will fail
*/
rv=curl_easy_perform(ch);
if (rv==CURLE_OK)
printf("*** transfer succeeded ***\n");
else
printf("*** transfer failed ***\n");
/* second try: retrieve page using cacerts' certificate -> will succeed
* load the certificate by installing a function doing the nescessary
* "modifications" to the SSL CONTEXT just before link init
*/
rv=curl_easy_setopt(ch,CURLOPT_SSL_CTX_FUNCTION, *sslctx_function);
rv=curl_easy_perform(ch);
if (rv==CURLE_OK)
printf("*** transfer succeeded ***\n");
else
printf("*** transfer failed ***\n");
curl_easy_cleanup(ch);
curl_global_cleanup();
}

View File

@@ -0,0 +1,110 @@
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* This example shows usage of simple cookie interface.
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <time.h>
#include <curl/curl.h>
static void
print_cookies(CURL *curl)
{
CURLcode res;
struct curl_slist *cookies;
struct curl_slist *nc;
int i;
printf("Cookies, curl knows:\n");
res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies);
if (res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n", curl_easy_strerror(res));
exit(1);
}
nc = cookies, i = 1;
while (nc) {
printf("[%d]: %s\n", i, nc->data);
nc = nc->next;
i++;
}
if (i == 1) {
printf("(none)\n");
}
curl_slist_free_all(cookies);
}
int
main(void)
{
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (curl) {
char nline[256];
curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com/"); /* google.com sets "PREF" cookie */
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* just to start the cookie engine */
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}
print_cookies(curl);
printf("Erasing curl's knowledge of cookies!\n");
curl_easy_setopt(curl, CURLOPT_COOKIELIST, "ALL");
print_cookies(curl);
printf("-----------------------------------------------\n"
"Setting a cookie \"PREF\" via cookie interface:\n");
#ifdef WIN32
#define snprintf _snprintf
#endif
/* Netscape format cookie */
snprintf(nline, 256, "%s\t%s\t%s\t%s\t%u\t%s\t%s",
".google.com", "TRUE", "/", "FALSE", time(NULL) + 31337, "PREF", "hello google, i like you very much!");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
if (res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res));
return 1;
}
/* HTTP-header style cookie */
snprintf(nline, 256,
"Set-Cookie: OLD_PREF=3d141414bf4209321; "
"expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com");
res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline);
if (res != CURLE_OK) {
fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res));
return 1;
}
print_cookies(curl);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res));
return 1;
}
}
else {
fprintf(stderr, "Curl init failed!\n");
return 1;
}
curl_global_cleanup();
return 0;
}

View File

@@ -42,7 +42,7 @@ int my_progress_func(GtkWidget *Bar,
return 0; return 0;
} }
void *curl_thread(void *ptr) void *my_thread(void *ptr)
{ {
CURL *curl; CURL *curl;
CURLcode res; CURLcode res;
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
gtk_container_add(GTK_CONTAINER(Frame2), Bar); gtk_container_add(GTK_CONTAINER(Frame2), Bar);
gtk_widget_show_all(Window); gtk_widget_show_all(Window);
if (!g_thread_create(&curl_thread, argv[1], FALSE, NULL) != 0) if (!g_thread_create(&my_thread, argv[1], FALSE, NULL) != 0)
g_warning("can't create the thread"); g_warning("can't create the thread");

View File

@@ -1,12 +1,12 @@
/* /*
curlx.c Authors: Peter Sylvester, Jean-Paul Merlin curlx.c Authors: Peter Sylvester, Jean-Paul Merlin
This is a little program to demonstrate the usage of This is a little program to demonstrate the usage of
- an ssl initialisation callback setting a user key and trustbases - an ssl initialisation callback setting a user key and trustbases
coming from a pkcs12 file coming from a pkcs12 file
- using an ssl application callback to find a URI in the - using an ssl application callback to find a URI in the
certificate presented during ssl session establishment. certificate presented during ssl session establishment.
*/ */
@@ -20,13 +20,13 @@
* *
* 1. Redistributions of source code must retain the above copyright * 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, the following disclaimer, * notice, this list of conditions, the following disclaimer,
* and the original OpenSSL and SSLeay Licences below. * and the original OpenSSL and SSLeay Licences below.
* *
* 2. Redistributions in binary form must reproduce the above copyright * 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions, the following disclaimer * notice, this list of conditions, the following disclaimer
* and the original OpenSSL and SSLeay Licences below in * and the original OpenSSL and SSLeay Licences below in
* the documentation and/or other materials provided with the * the documentation and/or other materials provided with the
* distribution. * distribution.
* *
* 3. All advertising materials mentioning features or use of this * 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgments: * software must display the following acknowledgments:
@@ -95,38 +95,38 @@
#include <openssl/ssl.h> #include <openssl/ssl.h>
static char *curlx_usage[]={ static char *curlx_usage[]={
"usage: curlx args\n", "usage: curlx args\n",
" -p12 arg - tia file ", " -p12 arg - tia file ",
" -envpass arg - environement variable which content the tia private key password", " -envpass arg - environement variable which content the tia private key password",
" -out arg - output file (response)- default stdout", " -out arg - output file (response)- default stdout",
" -in arg - input file (request)- default stdin", " -in arg - input file (request)- default stdin",
" -connect arg - URL of the server for the connection ex: www.openevidenve.org", " -connect arg - URL of the server for the connection ex: www.openevidenve.org",
" -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query", " -mimetype arg - MIME type for data in ex : application/timestamp-query or application/dvcs -default application/timestamp-query",
" -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none", " -acceptmime arg - MIME type acceptable for the response ex : application/timestamp-response or application/dvcs -default none",
" -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping", " -accesstype arg - an Object identifier in an AIA/SIA method, e.g. AD_DVCS or ad_timestamping",
NULL NULL
}; };
/* /*
./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS ./curlx -p12 psy.p12 -envpass XX -in request -verbose -accesstype AD_DVCS
-mimetype application/dvcs -acceptmime application/dvcs -out response -mimetype application/dvcs -acceptmime application/dvcs -out response
*/ */
/* This is a context that we pass to all callbacks */ /* This is a context that we pass to all callbacks */
typedef struct sslctxparm_st { typedef struct sslctxparm_st {
unsigned char * p12file ; unsigned char * p12file ;
const char * pst ; const char * pst ;
PKCS12 * p12 ; PKCS12 * p12 ;
EVP_PKEY * pkey ; EVP_PKEY * pkey ;
X509 * usercert ; X509 * usercert ;
STACK_OF(X509) * ca ; STACK_OF(X509) * ca ;
CURL * curl; CURL * curl;
BIO * errorbio; BIO * errorbio;
int accesstype ; int accesstype ;
int verbose; int verbose;
} sslctxparm; } sslctxparm;
@@ -134,33 +134,35 @@ typedef struct sslctxparm_st {
static char *i2s_ASN1_IA5STRING( ASN1_IA5STRING *ia5) static char *i2s_ASN1_IA5STRING( ASN1_IA5STRING *ia5)
{ {
char *tmp; char *tmp;
if(!ia5 || !ia5->length) return NULL; if(!ia5 || !ia5->length)
tmp = OPENSSL_malloc(ia5->length + 1); return NULL;
memcpy(tmp, ia5->data, ia5->length); tmp = OPENSSL_malloc(ia5->length + 1);
tmp[ia5->length] = 0; memcpy(tmp, ia5->data, ia5->length);
return tmp; tmp[ia5->length] = 0;
return tmp;
} }
/* A conveniance routine to get an access URI. */ /* A conveniance routine to get an access URI. */
static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype) { static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype) {
int i; int i;
STACK_OF(ACCESS_DESCRIPTION) * accessinfo ; STACK_OF(ACCESS_DESCRIPTION) * accessinfo ;
accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ; accessinfo = X509_get_ext_d2i(cert, extensiontype, NULL, NULL) ;
if (!sk_ACCESS_DESCRIPTION_num(accessinfo)) return NULL; if (!sk_ACCESS_DESCRIPTION_num(accessinfo))
for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) { return NULL;
ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i); for (i = 0; i < sk_ACCESS_DESCRIPTION_num(accessinfo); i++) {
if (OBJ_obj2nid(ad->method) == type) { ACCESS_DESCRIPTION * ad = sk_ACCESS_DESCRIPTION_value(accessinfo, i);
if (ad->location->type == GEN_URI) { if (OBJ_obj2nid(ad->method) == type) {
return i2s_ASN1_IA5STRING(ad->location->d.ia5); if (ad->location->type == GEN_URI) {
} return i2s_ASN1_IA5STRING(ad->location->d.ia5);
return NULL; }
} return NULL;
} }
return NULL; }
return NULL;
} }
/* This is an application verification call back, it does not /* This is an application verification call back, it does not
@@ -169,312 +171,336 @@ static unsigned char *my_get_ext(X509 * cert, const int type, int extensiontype)
the URL to be used in the POST. the URL to be used in the POST.
*/ */
static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg) { static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg)
sslctxparm * p = (sslctxparm *) arg; {
int ok; sslctxparm * p = (sslctxparm *) arg;
int ok;
if (p->verbose > 2) BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n"); if (p->verbose > 2)
if ((ok= X509_verify_cert(ctx)) && ctx->cert) { BIO_printf(p->errorbio,"entering ssl_app_verify_callback\n");
unsigned char * accessinfo ;
if (p->verbose > 1) X509_print_ex(p->errorbio,ctx->cert,0,0); if ((ok= X509_verify_cert(ctx)) && ctx->cert) {
if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) { unsigned char * accessinfo ;
if (p->verbose) BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n",accessinfo); if (p->verbose > 1)
curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); X509_print_ex(p->errorbio,ctx->cert,0,0);
} else if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_info_access)) {
if (p->verbose) BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n",accessinfo); if (accessinfo = my_get_ext(ctx->cert,p->accesstype ,NID_sinfo_access)) {
curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo); if (p->verbose)
} BIO_printf(p->errorbio,"Setting URL from SIA to: %s\n", accessinfo);
}
if (p->verbose > 2) BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n",ok); curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
return(ok); }
else if (accessinfo = my_get_ext(ctx->cert,p->accesstype,
NID_info_access)) {
if (p->verbose)
BIO_printf(p->errorbio,"Setting URL from AIA to: %s\n", accessinfo);
curl_easy_setopt(p->curl, CURLOPT_URL,accessinfo);
}
}
if (p->verbose > 2)
BIO_printf(p->errorbio,"leaving ssl_app_verify_callback with %d\n", ok);
return(ok);
} }
/* This is an example of an curl SSL initialisation call back. The callback sets: /* This is an example of an curl SSL initialisation call back. The callback sets:
- a private key and certificate - a private key and certificate
- a trusted ca certificate - a trusted ca certificate
- a preferred cipherlist - a preferred cipherlist
- an application verification callback (the function above) - an application verification callback (the function above)
*/ */
static CURLcode sslctxfun(CURL * curl, void * sslctx, void * parm) { static CURLcode sslctxfun(CURL * curl, void * sslctx, void * parm) {
sslctxparm * p = (sslctxparm *) parm;
SSL_CTX * ctx = (SSL_CTX *) sslctx ;
if (!SSL_CTX_use_certificate(ctx,p->usercert)) { sslctxparm * p = (sslctxparm *) parm;
BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err; SSL_CTX * ctx = (SSL_CTX *) sslctx ;
}
if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) {
BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err;
}
if (!SSL_CTX_check_private_key(ctx)) {
BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err;
}
SSL_CTX_set_quiet_shutdown(ctx,1);
SSL_CTX_set_cipher_list(ctx,"RC4-MD5");
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
X509_STORE_add_cert(ctx->cert_store,sk_X509_value(p->ca,sk_X509_num(p->ca)-1)); if (!SSL_CTX_use_certificate(ctx,p->usercert)) {
BIO_printf(p->errorbio, "SSL_CTX_use_certificate problem\n"); goto err;
}
if (!SSL_CTX_use_PrivateKey(ctx,p->pkey)) {
BIO_printf(p->errorbio, "SSL_CTX_use_PrivateKey\n"); goto err;
}
SSL_CTX_set_verify_depth(ctx,2); if (!SSL_CTX_check_private_key(ctx)) {
BIO_printf(p->errorbio, "SSL_CTX_check_private_key\n"); goto err;
SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,NULL); }
SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm); SSL_CTX_set_quiet_shutdown(ctx,1);
SSL_CTX_set_cipher_list(ctx,"RC4-MD5");
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
X509_STORE_add_cert(ctx->cert_store,sk_X509_value(p->ca,
return CURLE_OK ; sk_X509_num(p->ca)-1));
err:
ERR_print_errors(p->errorbio); SSL_CTX_set_verify_depth(ctx,2);
return CURLE_SSL_CERTPROBLEM;
SSL_CTX_set_verify(ctx,SSL_VERIFY_PEER,NULL);
SSL_CTX_set_cert_verify_callback(ctx, ssl_app_verify_callback, parm);
return CURLE_OK ;
err:
ERR_print_errors(p->errorbio);
return CURLE_SSL_CERTPROBLEM;
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
BIO* in=NULL; BIO* in=NULL;
BIO* out=NULL; BIO* out=NULL;
char * outfile = NULL;
char * outfile = NULL; char * infile = NULL ;
char * infile = NULL ;
int tabLength=100; int tabLength=100;
char *binaryptr; char *binaryptr;
char* mimetype; char* mimetype;
char* mimetypeaccept=NULL; char* mimetypeaccept=NULL;
char* contenttype; char* contenttype;
char** pp; char** pp;
unsigned char* hostporturl = NULL; unsigned char* hostporturl = NULL;
binaryptr=(char*)malloc(tabLength); binaryptr=(char*)malloc(tabLength);
BIO * p12bio ; BIO * p12bio ;
char **args = argv + 1; char **args = argv + 1;
unsigned char * serverurl; unsigned char * serverurl;
sslctxparm p; sslctxparm p;
char *response; char *response;
p.verbose = 0; p.verbose = 0;
CURLcode res; CURLcode res;
struct curl_slist * headers=NULL; struct curl_slist * headers=NULL;
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE); p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
curl_global_init(CURL_GLOBAL_DEFAULT); curl_global_init(CURL_GLOBAL_DEFAULT);
/* we need some more for the P12 decoding */
OpenSSL_add_all_ciphers(); /* we need some more for the P12 decoding */
OpenSSL_add_all_digests();
ERR_load_crypto_strings(); OpenSSL_add_all_ciphers();
OpenSSL_add_all_digests();
ERR_load_crypto_strings();
int badarg=0; int badarg=0;
while (*args && *args[0] == '-') { while (*args && *args[0] == '-') {
if (!strcmp (*args, "-in")) { if (!strcmp (*args, "-in")) {
if (args[1]) { if (args[1]) {
infile=*(++args); infile=*(++args);
} else badarg=1; } else badarg=1;
} else if (!strcmp (*args, "-out")) { } else if (!strcmp (*args, "-out")) {
if (args[1]) { if (args[1]) {
outfile=*(++args); outfile=*(++args);
} else badarg=1; } else badarg=1;
} else if (!strcmp (*args, "-p12")) { } else if (!strcmp (*args, "-p12")) {
if (args[1]) { if (args[1]) {
p.p12file = *(++args); p.p12file = *(++args);
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-envpass") == 0) { } else if (strcmp(*args,"-envpass") == 0) {
if (args[1]) { if (args[1]) {
p.pst = getenv(*(++args)); p.pst = getenv(*(++args));
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-connect") == 0) { } else if (strcmp(*args,"-connect") == 0) {
if (args[1]) { if (args[1]) {
hostporturl = *(++args); hostporturl = *(++args);
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-mimetype") == 0) { } else if (strcmp(*args,"-mimetype") == 0) {
if (args[1]) { if (args[1]) {
mimetype = *(++args); mimetype = *(++args);
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-acceptmime") == 0) { } else if (strcmp(*args,"-acceptmime") == 0) {
if (args[1]) { if (args[1]) {
mimetypeaccept = *(++args); mimetypeaccept = *(++args);
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-accesstype") == 0) { } else if (strcmp(*args,"-accesstype") == 0) {
if (args[1]) { if (args[1]) {
if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1; if ((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args,0))) == 0) badarg=1;
} else badarg=1; } else badarg=1;
} else if (strcmp(*args,"-verbose") == 0) { } else if (strcmp(*args,"-verbose") == 0) {
p.verbose++; p.verbose++;
} else badarg=1; } else badarg=1;
args++; args++;
} }
if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1;
if (badarg) {
for (pp=curlx_usage; (*pp != NULL); pp++)
BIO_printf(p.errorbio,"%s\n",*pp);
BIO_printf(p.errorbio,"\n");
goto err;
}
if (mimetype==NULL || mimetypeaccept == NULL) badarg = 1;
if (badarg) {
/* set input */ for (pp=curlx_usage; (*pp != NULL); pp++)
BIO_printf(p.errorbio,"%s\n",*pp);
if ((in=BIO_new(BIO_s_file())) == NULL) { BIO_printf(p.errorbio,"\n");
BIO_printf(p.errorbio, "Error setting input bio\n"); goto err;
goto err; }
} else if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT);
else if (BIO_read_filename(in,infile) <= 0) {
BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
BIO_free(in);
goto err;
}
/* set output */
if ((out=BIO_new(BIO_s_file())) == NULL) {
BIO_printf(p.errorbio, "Error setting output bio.\n");
goto err;
} else if (outfile == NULL)
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
else if (BIO_write_filename(out,outfile) <= 0) {
BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
BIO_free(out);
goto err;
}
p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
if (!(p.curl = curl_easy_init())) {
BIO_printf(p.errorbio, "Cannot init curl lib\n");
goto err;
}
if (!(p12bio = BIO_new_file(p.p12file , "rb"))) { /* set input */
BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); goto err;
}
if (!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) {
BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err;
}
p.ca= NULL;
if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) {
BIO_printf(p.errorbio,"Invalid P12 structure in %s\n", p.p12file); goto err;
}
if (sk_X509_num(p.ca) <= 0) { if ((in=BIO_new(BIO_s_file())) == NULL) {
BIO_printf(p.errorbio,"No trustworthy CA given.%s\n", p.p12file); goto err; BIO_printf(p.errorbio, "Error setting input bio\n");
} goto err;
} else if (infile == NULL)
BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT);
else if (BIO_read_filename(in,infile) <= 0) {
BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
BIO_free(in);
goto err;
}
if (p.verbose > 1) X509_print_ex(p.errorbio,p.usercert,0,0); /* set output */
/* determine URL to go */ if ((out=BIO_new(BIO_s_file())) == NULL) {
BIO_printf(p.errorbio, "Error setting output bio.\n");
goto err;
} else if (outfile == NULL)
BIO_set_fp(out,stdout,BIO_NOCLOSE|BIO_FP_TEXT);
else if (BIO_write_filename(out,outfile) <= 0) {
BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
BIO_free(out);
goto err;
}
if (hostporturl) {
serverurl=(char*) malloc(9+strlen(hostporturl));
sprintf(serverurl,"https://%s",hostporturl);
} else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */
if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) {
BIO_printf(p.errorbio,"no service URL in user cert cherching in others certificats\n");
int j=0;
int find=0;
for (j=0;j<sk_X509_num(p.ca);j++) {
if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_info_access))) break;
if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,NID_sinfo_access))) break;
}
}
}
if (!serverurl) { p.errorbio = BIO_new_fp (stderr, BIO_NOCLOSE);
BIO_printf(p.errorbio, "no service URL in certificats, check '-accesstype (AD_DVCS | ad_timestamping)' or use '-connect'\n"); goto err;
}
if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
curl_easy_setopt(p.curl, CURLOPT_URL, serverurl);
/* Now specify the POST binary data */
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); if (!(p.curl = curl_easy_init())) {
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength); BIO_printf(p.errorbio, "Cannot init curl lib\n");
goto err;
/* pass our list of custom made headers */ }
contenttype=(char*) malloc(15+strlen(mimetype));
sprintf(contenttype,"Content-type: %s",mimetype);
headers = curl_slist_append(headers,contenttype);
curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers);
if (p.verbose) BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
{ if (!(p12bio = BIO_new_file(p.p12file , "rb"))) {
FILE *outfp; BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file); goto err;
BIO_get_fp(out,&outfp); }
curl_easy_setopt(p.curl, CURLOPT_FILE,outfp); if (!(p.p12 = d2i_PKCS12_bio (p12bio, NULL))) {
} BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file); goto err;
}
res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ; p.ca= NULL;
if (!(PKCS12_parse (p.p12, p.pst, &(p.pkey), &(p.usercert), &(p.ca) ) )) {
BIO_printf(p.errorbio,"Invalid P12 structure in %s\n", p.p12file); goto err;
}
if (res != CURLE_OK) if (sk_X509_num(p.ca) <= 0) {
BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res); BIO_printf(p.errorbio,"No trustworthy CA given.%s\n", p.p12file); goto err;
}
curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p);
{ if (p.verbose > 1)
int lu; int i=0; X509_print_ex(p.errorbio,p.usercert,0,0);
while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) {
i+=lu;
if (i== tabLength) {
tabLength+=100;
binaryptr=(char*)realloc(binaryptr,tabLength); /* should be more careful */
}
}
tabLength = i;
}
/* Now specify the POST binary data */
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr); /* determine URL to go */
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
if (hostporturl) {
/* Perform the request, res will get the return code */ serverurl=(char*) malloc(9+strlen(hostporturl));
sprintf(serverurl,"https://%s",hostporturl);
}
else if (p.accesstype != 0) { /* see whether we can find an AIA or SIA for a given access type */
if (!(serverurl = my_get_ext(p.usercert,p.accesstype,NID_info_access))) {
BIO_printf(p.errorbio,"no service URL in user cert "
"cherching in others certificats\n");
int j=0;
int find=0;
for (j=0;j<sk_X509_num(p.ca);j++) {
if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,
NID_info_access)))
break;
if ((serverurl = my_get_ext(sk_X509_value(p.ca,j),p.accesstype,
NID_sinfo_access)))
break;
}
}
}
BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform", res = curl_easy_perform(p.curl)); if (!serverurl) {
{ BIO_printf(p.errorbio, "no service URL in certificats,"
int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response); " check '-accesstype (AD_DVCS | ad_timestamping)'"
if( mimetypeaccept && p.verbose) " or use '-connect'\n");
if(!strcmp(mimetypeaccept,response)) goto err;
BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n",response); }
else
BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable mime type, it is %s instead of %s\n",response,mimetypeaccept);
}
/*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/ if (p.verbose)
BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
curl_easy_setopt(p.curl, CURLOPT_URL, serverurl);
/* Now specify the POST binary data */
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
/* pass our list of custom made headers */
contenttype=(char*) malloc(15+strlen(mimetype));
sprintf(contenttype,"Content-type: %s",mimetype);
headers = curl_slist_append(headers,contenttype);
curl_easy_setopt(p.curl, CURLOPT_HTTPHEADER, headers);
if (p.verbose)
BIO_printf(p.errorbio, "Service URL: <%s>\n", serverurl);
{
FILE *outfp;
BIO_get_fp(out,&outfp);
curl_easy_setopt(p.curl, CURLOPT_FILE,outfp);
}
res = curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_FUNCTION, sslctxfun) ;
if (res != CURLE_OK)
BIO_printf(p.errorbio,"%d %s=%d %d\n", __LINE__, "CURLOPT_SSL_CTX_FUNCTION",CURLOPT_SSL_CTX_FUNCTION,res);
curl_easy_setopt(p.curl, CURLOPT_SSL_CTX_DATA, &p);
{
int lu; int i=0;
while ((lu = BIO_read (in,&binaryptr[i],tabLength-i)) >0 ) {
i+=lu;
if (i== tabLength) {
tabLength+=100;
binaryptr=(char*)realloc(binaryptr,tabLength); /* should be more careful */
}
}
tabLength = i;
}
/* Now specify the POST binary data */
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDS, binaryptr);
curl_easy_setopt(p.curl, CURLOPT_POSTFIELDSIZE,tabLength);
/* Perform the request, res will get the return code */
BIO_printf(p.errorbio,"%d %s %d\n", __LINE__, "curl_easy_perform",
res = curl_easy_perform(p.curl));
{
int result =curl_easy_getinfo(p.curl,CURLINFO_CONTENT_TYPE,&response);
if( mimetypeaccept && p.verbose)
if(!strcmp(mimetypeaccept,response))
BIO_printf(p.errorbio,"the response has a correct mimetype : %s\n",
response);
else
BIO_printf(p.errorbio,"the reponse doesn\'t has an acceptable "
"mime type, it is %s instead of %s\n",
response,mimetypeaccept);
}
/*** code d'erreur si accept mime ***, egalement code return HTTP != 200 ***/
/* free the header list*/ /* free the header list*/
curl_slist_free_all(headers); curl_slist_free_all(headers);
/* always cleanup */ /* always cleanup */
curl_easy_cleanup(p.curl); curl_easy_cleanup(p.curl);
BIO_free(in); BIO_free(in);
BIO_free(out); BIO_free(out);
return (EXIT_SUCCESS); return (EXIT_SUCCESS);
err: BIO_printf(p.errorbio,"error");
err: BIO_printf(p.errorbio,"error"); exit(1);
exit(1);
} }

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