Compare commits
219 Commits
pre-aifix
...
curl-7_12_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
da30242640 | ||
![]() |
811edcde18 | ||
![]() |
4934e6471b | ||
![]() |
9dbd6659dc | ||
![]() |
5ddad4cdb3 | ||
![]() |
338c2da24f | ||
![]() |
b5cafc0b83 | ||
![]() |
c50ced6cc2 | ||
![]() |
f4783bda27 | ||
![]() |
b55507c8a7 | ||
![]() |
827a805966 | ||
![]() |
e23ba31eb9 | ||
![]() |
02c6fde11e | ||
![]() |
d003f6e125 | ||
![]() |
1dfff2487f | ||
![]() |
4ff9cd39c5 | ||
![]() |
9c4ffcc250 | ||
![]() |
6b5a04cf83 | ||
![]() |
55e61c092e | ||
![]() |
de6ab3de22 | ||
![]() |
5e1eb58e5a | ||
![]() |
d892a4dc23 | ||
![]() |
496ea65f39 | ||
![]() |
6577b15d08 | ||
![]() |
f2e35fad27 | ||
![]() |
81c48aa43d | ||
![]() |
0cfa9b52ae | ||
![]() |
48b92c163f | ||
![]() |
b7575b39c4 | ||
![]() |
ae2f002b44 | ||
![]() |
89c312691e | ||
![]() |
1d23affbc5 | ||
![]() |
26ffaa263b | ||
![]() |
ca5e6160b7 | ||
![]() |
6d60ff6ea1 | ||
![]() |
43ae26f146 | ||
![]() |
3e01f70468 | ||
![]() |
b9f1dd7691 | ||
![]() |
a7bed4fc7c | ||
![]() |
7ca49dc91d | ||
![]() |
645ee8a42a | ||
![]() |
115dd6f095 | ||
![]() |
0e03165467 | ||
![]() |
6574f4106e | ||
![]() |
8e7fcd9ee1 | ||
![]() |
ad63e1e698 | ||
![]() |
d784526dae | ||
![]() |
79d480e1e7 | ||
![]() |
b3b2ba31f7 | ||
![]() |
7f78bc3c6d | ||
![]() |
f508f30fb6 | ||
![]() |
d20a05161a | ||
![]() |
6769ab2797 | ||
![]() |
85867cbe94 | ||
![]() |
5e8d3988a2 | ||
![]() |
1cd0a08575 | ||
![]() |
efd71af2a1 | ||
![]() |
2ea80c29fa | ||
![]() |
e3fc0d5e78 | ||
![]() |
33f42aacca | ||
![]() |
c85bf83e88 | ||
![]() |
060b6ce148 | ||
![]() |
35618b4712 | ||
![]() |
cd2e99e980 | ||
![]() |
0359ae8f40 | ||
![]() |
972d39234f | ||
![]() |
798349fce6 | ||
![]() |
9612fda886 | ||
![]() |
4b217efb84 | ||
![]() |
555cfb3059 | ||
![]() |
c0d1d6926c | ||
![]() |
fca8fcec3e | ||
![]() |
6844d5dcad | ||
![]() |
d759e97166 | ||
![]() |
cbfc737d79 | ||
![]() |
ab64bf6fb1 | ||
![]() |
0b0d20021c | ||
![]() |
932a6f6b77 | ||
![]() |
1318760ad2 | ||
![]() |
15a403a98d | ||
![]() |
a92b7c1b16 | ||
![]() |
0c54013ee3 | ||
![]() |
ca5d1e7a8d | ||
![]() |
40a39e2270 | ||
![]() |
982530b186 | ||
![]() |
fadc08445a | ||
![]() |
783381c163 | ||
![]() |
5f26bee7c8 | ||
![]() |
2be57d0833 | ||
![]() |
6e6748f051 | ||
![]() |
a8d544d9b3 | ||
![]() |
5f1490e1bd | ||
![]() |
2c3e557b5c | ||
![]() |
08df4b8971 | ||
![]() |
11f58ea896 | ||
![]() |
15f3b4b6d1 | ||
![]() |
35270e50c2 | ||
![]() |
8c975657e7 | ||
![]() |
03cb3b9db1 | ||
![]() |
19ad942739 | ||
![]() |
3cf452b923 | ||
![]() |
2a6f9aa155 | ||
![]() |
570455b21d | ||
![]() |
dccdf9e66c | ||
![]() |
dd4d5bb1e0 | ||
![]() |
842e4aaa0d | ||
![]() |
ebb09cd9c4 | ||
![]() |
9a6df07d3d | ||
![]() |
c59c429a69 | ||
![]() |
69f9d0c916 | ||
![]() |
56edbe3804 | ||
![]() |
94c4a18541 | ||
![]() |
bdcf8d626d | ||
![]() |
576b40b1b0 | ||
![]() |
954575a19d | ||
![]() |
47bbe36725 | ||
![]() |
1a8f7e830c | ||
![]() |
dfc85b7291 | ||
![]() |
1457b80617 | ||
![]() |
dba40b35f2 | ||
![]() |
e9d95f1a25 | ||
![]() |
67e40a2b16 | ||
![]() |
25f5f14d35 | ||
![]() |
dfda9cc007 | ||
![]() |
e39b29fc48 | ||
![]() |
4c17ba4fc0 | ||
![]() |
4511f7ac50 | ||
![]() |
b9f76f11bb | ||
![]() |
17841a20e3 | ||
![]() |
d90d40b5d1 | ||
![]() |
d2e6a0583a | ||
![]() |
b2c9277e66 | ||
![]() |
31c332af93 | ||
![]() |
90af60a6ef | ||
![]() |
80c7566203 | ||
![]() |
efb1fdbec8 | ||
![]() |
bada8cc259 | ||
![]() |
c3a076176e | ||
![]() |
2cda3070d5 | ||
![]() |
728bed8c98 | ||
![]() |
6e72ea7442 | ||
![]() |
a4aac27fd3 | ||
![]() |
5b8816dcb7 | ||
![]() |
fc0df97278 | ||
![]() |
592658e874 | ||
![]() |
5a70e42428 | ||
![]() |
e4caa98901 | ||
![]() |
c211a7c685 | ||
![]() |
7876c078bc | ||
![]() |
aedadfc779 | ||
![]() |
2046a6b9e5 | ||
![]() |
d1d53b2bbf | ||
![]() |
950aa1c743 | ||
![]() |
a9572bf88a | ||
![]() |
5a93f50394 | ||
![]() |
60af1cbcc2 | ||
![]() |
8952ef933b | ||
![]() |
b350d5da59 | ||
![]() |
6df3bf3644 | ||
![]() |
35840a2c5c | ||
![]() |
090b89cc76 | ||
![]() |
f05d47ddd6 | ||
![]() |
fcfd4bef2d | ||
![]() |
18dc8fbc26 | ||
![]() |
d9ceee1c75 | ||
![]() |
097281f459 | ||
![]() |
087748c48e | ||
![]() |
e35187741b | ||
![]() |
574e911375 | ||
![]() |
ce945bd2f0 | ||
![]() |
8efa6f407d | ||
![]() |
85bd4621db | ||
![]() |
6c3759d78d | ||
![]() |
4af08a19f8 | ||
![]() |
c14650caec | ||
![]() |
c7a9e07909 | ||
![]() |
185baf036b | ||
![]() |
3523613826 | ||
![]() |
782ade7223 | ||
![]() |
ba40eccc90 | ||
![]() |
4191741fb6 | ||
![]() |
7a52f44bd4 | ||
![]() |
efa5485744 | ||
![]() |
c81ac51e5c | ||
![]() |
fd17cf2e3c | ||
![]() |
d4b0999415 | ||
![]() |
03f8ec89db | ||
![]() |
f633ab688b | ||
![]() |
808621ab22 | ||
![]() |
6ed5feda2b | ||
![]() |
964066c0de | ||
![]() |
a913e93667 | ||
![]() |
a7b99fc463 | ||
![]() |
6f252f4704 | ||
![]() |
b596c34bed | ||
![]() |
b0cd96478c | ||
![]() |
387ec712e6 | ||
![]() |
f2a99d7d74 | ||
![]() |
8b6b15dccc | ||
![]() |
bbb72b7b6b | ||
![]() |
785bad388b | ||
![]() |
cf10df6c68 | ||
![]() |
5b55dcbfbb | ||
![]() |
e7dbbd16a5 | ||
![]() |
62f0457961 | ||
![]() |
8879b57b73 | ||
![]() |
e49a6feabb | ||
![]() |
feb2dd2835 | ||
![]() |
5e34f3dc01 | ||
![]() |
0031d76f2a | ||
![]() |
00ee738fdd | ||
![]() |
8d0a823124 | ||
![]() |
9729df1756 | ||
![]() |
cdb419d65e | ||
![]() |
d6f9a41539 | ||
![]() |
1daa258b8a | ||
![]() |
560c257bd0 | ||
![]() |
d7aae417b1 | ||
![]() |
c39858aac0 |
143
CHANGES
143
CHANGES
@@ -6,6 +6,149 @@
|
||||
|
||||
Changelog
|
||||
|
||||
Version 7.12.1 (10 August 2004)
|
||||
|
||||
Daniel (10 August 2004)
|
||||
- In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input is
|
||||
already UTF-8 encoded. This made the certificate verification fail if the
|
||||
remote server used a certificate with the name UTF-8 encoded.
|
||||
|
||||
Work-around brought by Alexis S. L. Carvalho.
|
||||
|
||||
Daniel (9 August 2004)
|
||||
- I fixed the configure script for krb4 to use -lcom_err as well, as I started
|
||||
to get link problems with it unless I did that on my Solaris 2.7 box. I
|
||||
don't understand why I started to get problems with this now!
|
||||
|
||||
Daniel (5 August 2004)
|
||||
- Enrico Scholz fixed the HTTP-Negotiate service name to be uppercase as
|
||||
reported in bug report #1004105
|
||||
|
||||
Daniel (4 August 2004)
|
||||
- Gisle Vanem provided a fix for the multi interface and connecting to a host
|
||||
using multiple IP (bad) addresses.
|
||||
|
||||
- Dylan Salisbury made libcurl no longer accept cookies set to a TLD only (it
|
||||
previously allowed that on the seven three-letter domains).
|
||||
|
||||
Daniel (31 July 2004)
|
||||
- Joel Chen reported that the digest code assumed quotes around the contents a
|
||||
bit too much.
|
||||
|
||||
Daniel (28 July 2004)
|
||||
- Bertrand Demiddelaer fixed the host name to get setup properly even when a
|
||||
connection is re-used, when a proxy is in use. Previously the wrong Host:
|
||||
header could get sent when re-using a proxy connection to a different target
|
||||
host.
|
||||
|
||||
- Fixed Brian Akins' reported problems with duplicate Host: headers on re-used
|
||||
connections. If you attempted to replace the Host: header in the second
|
||||
request, you got two such headers!
|
||||
|
||||
- src/Makefile.am now includes the Makefile.inc file to get info about files
|
||||
|
||||
Daniel (26 July 2004)
|
||||
- Made "curl [URL] -o name#2" work as expected. If there's no globbing for the
|
||||
#-number, it will simply be used as #2 in the file name.
|
||||
|
||||
- Bertrand Demiddelaer fixed testing with valgrind 2.1.x and added two missing
|
||||
newlines in the cookie informationals.
|
||||
|
||||
Daniel (24 July 2004)
|
||||
- I fixed the autobuilds with ares, since they now need to have buildconf run
|
||||
in the ares dir before the configure script is run.
|
||||
|
||||
- Added Casey O'Donnell's curl_easy_reset() function. It has a proto in
|
||||
curl/curl.h but we have no man page yet.
|
||||
|
||||
Daniel (20 July 2004)
|
||||
- Added buildconf and buildconf.bat to the release archives, since they are
|
||||
handy for rebuilding curl when using a daily snapshot (and not a pure CVS
|
||||
checkout).
|
||||
|
||||
Daniel (16 July 2004)
|
||||
- As suggested by Toby Peterson, libcurl now ignores Content-Length data if the
|
||||
given size is a negative number. Test case 178 verifies this.
|
||||
|
||||
Daniel (14 July 2004)
|
||||
- G<>nter Knauf has made the Netware builds do without the config-netware.h
|
||||
files, so they are now removed from the dist packages.
|
||||
|
||||
- G<>nter Knauf made curl and libcurl build with Borland again.
|
||||
|
||||
- Andres Garcia fixed the common test 505 failures on windows.
|
||||
|
||||
Daniel (6 July 2004)
|
||||
- Andr<64>s Garc<72>a found out why the windows tests failed on file:// "uploads".
|
||||
|
||||
Daniel (2 July 2004)
|
||||
- Andr<64>s Garc<72>a reported a curl_share_cleanup() crash that occurs when no
|
||||
lock/unlock callbacks have been set and the share is cleaned up.
|
||||
|
||||
Daniel (1 July 2004)
|
||||
- When using curl --trace or --trace-ascii, no trace messages that were sent
|
||||
by curl_easy_cleanup() were included in the trace file. This made the
|
||||
message "Closing connection #0" never appear in trace dumps.
|
||||
|
||||
Daniel (30 June 2004)
|
||||
- Niels van Tongeren found that setting CURLOPT_NOBODY to TRUE doesn't disable
|
||||
a previously set POST request, making a very odd request get sent (unless
|
||||
you disabled the POST) a HEAD request with a POST request-body. I've now
|
||||
made CURLOPT_NOBODY enforce a proper HEAD. Added test case 514 for this.
|
||||
|
||||
Daniel (29 June 2004)
|
||||
- G<>nter Knauf made the testcurl.pl script capable of using a custom setup
|
||||
file to easier run multiple autobuilds on the same source tree.
|
||||
|
||||
- Gisle fixed the djgpp build and fixed a memory problem in some of the
|
||||
reorged name resolved code.
|
||||
|
||||
- Fixed code to allow connects done using the multi interface to attempt the
|
||||
next IP when connecting to a host that resolves to multiple IPs and a
|
||||
connect attempt fails.
|
||||
|
||||
Daniel (27 June 2004)
|
||||
- Based on Rob Stanzel's bug report #979480, I wrote a configure check that
|
||||
checks if poll() can be used to wait on NULL as otherwise select() should be
|
||||
used to do it. The select() usage was also fixed according to his report.
|
||||
|
||||
Mac OS X 10.3 says "poll() functionality for Mac OS X is implemented via an
|
||||
emulation layer on top of select(), not in the kernel directly. It is
|
||||
recommended that programs running under OS X 10.3 prefer select() over
|
||||
poll(). Configure scripts should look for the _POLL_EMUL_H_ define (instead
|
||||
of _POLL_H_ or _SYS_POLL_H_) and avoid implementations where poll is not
|
||||
implemented in the kernel."
|
||||
|
||||
Yes, we can probably use select() on most platforms but today I prefered to
|
||||
leave the code unaltered.
|
||||
|
||||
Daniel (24 June 2004)
|
||||
- The standard curl_version() string now only includes version info about
|
||||
involved libraries and not about particular features. Thus it will no longer
|
||||
include info about ipv6 nor GSS. That info is of course still available in
|
||||
the feature bitmask curl_version_info() offers.
|
||||
|
||||
- Replaced all occurances of sprintf() with snprintf(). This is mostly because
|
||||
it is "A Good Thing" rather than actually fixing any known problem. This
|
||||
will help preventing future possible mistakes to cause buffer overflows.
|
||||
|
||||
- Major reorganization in the host resolve code (again). This time, I've
|
||||
modified the code to now always use a linked list of Curl_addrinfo structs
|
||||
to return resolved info in, no matter what resolver method or support that
|
||||
is available on the platform. It makes it a lot easier to write code that
|
||||
uses or depends on resolved data.
|
||||
|
||||
Internally, this means amongst other things that we can stop doing the weird
|
||||
"increase buffer size until it works" trick when resolving hosts on
|
||||
ipv4-only with gethostbyname_r(), we support socks even on libcurls built
|
||||
with ipv6 enabled (but only to socks servers that resolve to an ipv4
|
||||
address) and we no longer deep-copy or relocate hostent structs (we create
|
||||
Curl_addrinfo chains instead).
|
||||
|
||||
The new "hostent to Curl_addrinfo" converter function is named Curl_he2ai()
|
||||
and is slightly naive and simple, yet I believe it is functional enough to
|
||||
work for libcurl.
|
||||
|
||||
Daniel (22 June 2004)
|
||||
- David Cohen pointed out that RFC2109 says clients should allow cookies to
|
||||
contain least 4096 bytes while libcurl only allowed 2047. I raised the limit
|
||||
|
6
CVS-INFO
6
CVS-INFO
@@ -15,12 +15,6 @@ Compile and build instructions follow below.
|
||||
CHANGES.0 contains ancient changes.
|
||||
CHANGES.$year contains changes for the particular year.
|
||||
|
||||
tests/memanalyze.pl
|
||||
is for analyzing the output generated by curl if -DCURLDEBUG
|
||||
is used when compiling (run configure with --enable-debug)
|
||||
|
||||
buildconf builds the makefiles and configure stuff
|
||||
|
||||
Makefile.dist is included as the root Makefile in distribution archives
|
||||
|
||||
perl/ is a subdirectory with various perl scripts
|
||||
|
@@ -23,8 +23,8 @@
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
EXTRA_DIST = CHANGES COPYING maketgz reconf Makefile.dist \
|
||||
curl-config.in curl-style.el sample.emacs RELEASE-NOTES
|
||||
EXTRA_DIST = CHANGES COPYING maketgz reconf Makefile.dist curl-config.in \
|
||||
curl-style.el sample.emacs RELEASE-NOTES buildconf buildconf.bat
|
||||
|
||||
bin_SCRIPTS = curl-config
|
||||
|
||||
|
@@ -30,8 +30,28 @@ ssl:
|
||||
make
|
||||
|
||||
borland:
|
||||
cd lib & make -f Makefile.b32
|
||||
cd src & make -f Makefile.b32
|
||||
cd lib
|
||||
make -f Makefile.b32
|
||||
cd ..\src
|
||||
make -f Makefile.b32
|
||||
|
||||
borland-ssl:
|
||||
cd lib
|
||||
make -f Makefile.b32 WITH_SSL=1
|
||||
cd ..\src
|
||||
make -f Makefile.b32 WITH_SSL=1
|
||||
|
||||
borland-ssl-zlib:
|
||||
cd lib
|
||||
make -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1
|
||||
cd ..\src
|
||||
make -f Makefile.b32 WITH_SSL=1 WITH_ZLIB=1
|
||||
|
||||
borland-clean:
|
||||
cd lib
|
||||
make -f Makefile.b32 clean
|
||||
cd ..\src
|
||||
make -f Makefile.b32 clean
|
||||
|
||||
mingw32:
|
||||
cd lib & make -f Makefile.m32 ZLIB=1
|
||||
@@ -51,12 +71,24 @@ vc:
|
||||
cd ..\src
|
||||
nmake /f Makefile.vc6
|
||||
|
||||
vc-zlib:
|
||||
cd lib
|
||||
nmake /f Makefile.vc6 cfg=release-zlib
|
||||
cd ..\src
|
||||
nmake /f Makefile.vc6 cfg=release-zlib
|
||||
|
||||
vc-ssl:
|
||||
cd lib
|
||||
nmake /f Makefile.vc6 cfg=release-ssl
|
||||
cd ..\src
|
||||
nmake /f Makefile.vc6 cfg=release-ssl
|
||||
|
||||
vc-ssl-zlib:
|
||||
cd lib
|
||||
nmake /f Makefile.vc6 cfg=release-ssl-zlib
|
||||
cd ..\src
|
||||
nmake /f Makefile.vc6 cfg=release-ssl-zlib
|
||||
|
||||
vc-ssl-dll:
|
||||
cd lib
|
||||
nmake /f Makefile.vc6 cfg=release-ssl-dll
|
||||
|
@@ -5,9 +5,15 @@ Curl and libcurl 7.12.1
|
||||
Available command line options: 96
|
||||
Available curl_easy_setopt() options: 120
|
||||
Number of public functions in libcurl: 36
|
||||
Amount of public web site mirrors: 12
|
||||
Number of known libcurl bindings: 26
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o the version string now only contains info about (sub) package versions,
|
||||
while for example krb4 and ipv6 now only are available as 'features'
|
||||
o added curl_easy_reset()
|
||||
o socks proxy support even when libcurl is built ipv6-enabled
|
||||
o read callbacks can stop the transfer by returning CURL_READFUNC_ABORT
|
||||
o libcurl-tutorial.3 is the new man page formerly known as libcurl-the-guide
|
||||
o additional SSL trace data might be sent to the debug callback using two new
|
||||
@@ -18,34 +24,60 @@ This release includes the following changes:
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o UTF-8 encoded certificate names can now be verified properly
|
||||
o krb4 link problem
|
||||
o HTTP Negotiate service name now provided in uppercase
|
||||
o no longer accepts any cookies with domain set to just a TLD
|
||||
o HTTP Digest properties without quotes in the header
|
||||
o bad Host: header case on re-used connections over proxy
|
||||
o duplicate Host: header case on re-used connections
|
||||
o curl -o name#[num] now works when no globbing for [num] exists
|
||||
o test suite runs fine with valgrind 2.1.x
|
||||
o negative Content-Length is ignored
|
||||
o test 505 runs fine on windows
|
||||
o curl_share_cleanup() crash
|
||||
o --trace files now get the final info lines too
|
||||
o multi interface connects fine to multi-IP resolving hosts
|
||||
o --limit-rate works on Mac OS X (and other systems with bad poll()s)
|
||||
o cookies can now hold 4999 bytes of content
|
||||
o HTTP POST/PUT with NTLM/Digest/Negotiate to a URL returning 3XX
|
||||
o HTTPS POST/PUT over a proxy requiring NTLM/Digest/Negotiate works now
|
||||
o HTTPS POST/PUT over a proxy requiring NTLM/Digest/Negotiate
|
||||
o less restrictive libidn requirements, 0.4.1 or later is fine
|
||||
o fixed HTTP POST or PUT with Digest/Negotiate/NTLM selected but the server
|
||||
o HTTP POST or PUT with Digest/Negotiate/NTLM selected but the server
|
||||
didn't require any authentication
|
||||
o win32 file:// transfer free memory bug
|
||||
o configure --disable-http builds a libcurl without HTTP support
|
||||
o CURLOPT_FILETIME had wrong type, it expects a long argument
|
||||
o builds fine with Borland on Windows again
|
||||
o the msvc curllib.dsp now builds the libcurl.lib file again
|
||||
o builds fine on VMS again
|
||||
o builds fine on NetWare again
|
||||
o CURLOPT_FILETIME had wrong type in curl.h, it expects a long argument
|
||||
o builds fine with Borland on Windows
|
||||
o the msvc curllib.dsp now builds the libcurl.lib file
|
||||
o builds fine on VMS
|
||||
o builds fine on NetWare
|
||||
o HTTP Digest authentication with proxies uses correct user name + password
|
||||
o now builds fine with lcc-win32
|
||||
o builds fine with lcc-win32
|
||||
|
||||
Other curl-related news since the previous public release:
|
||||
|
||||
o James Hu took over after Kevin Roth as maintainer of the curl package on
|
||||
cygwin. Many saludos to Kevin for a work well done during many years.
|
||||
o Gambas binding for libcurl: http://gambas.sf.net/
|
||||
o pycurl 7.12.0 was released http://pycurl.sf.net/
|
||||
o Gambas binding: http://gambas.sf.net
|
||||
o pycurl 7.12.0 was released http://pycurl.sf.net
|
||||
o wxWidgets binding: http://homepage.mac.com/codonnell/wxcurldav/
|
||||
o New Austrian curl web mirror: http://curl.gds.tuwien.ac.at
|
||||
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
|
||||
advice from friends like these:
|
||||
|
||||
Gisle Vanem, Vincent Bronner, Alexander Krasnostavsky, Chris Gaukroger,
|
||||
G<>nter Knauf, Marty Kuhrt, Kjetil Jacobsen, Steven Bazyl, Seshubabu Pasam,
|
||||
Luca Alteas, Jean-Louis Lemaire, David Byron, David Cohen
|
||||
Luca Alteas, Jean-Louis Lemaire, David Byron, David Cohen, Rob Stanzel,
|
||||
Niels van Tongeren, Andr<64>s Garc<72>a, Toby Peterson, Casey O'Donnell, Brian
|
||||
Akins, Bertrand Demiddelaer, Joel Chen, Dylan Salisbury, Enrico Scholz,
|
||||
Alexis Carvalho
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
14
TODO-RELEASE
14
TODO-RELEASE
@@ -1,17 +1,9 @@
|
||||
Issues not sorted in any particular order.
|
||||
UNASSIGNED means that no person has publicly stated to work on the issue.
|
||||
|
||||
To get fixed in 7.12.1 (planned release: August 2004)
|
||||
======================
|
||||
|
||||
35 - Fix multi interface when connecting to host with multiple IP addresses:
|
||||
http://curl.haxx.se/mail/lib-2004-06/0163.html and
|
||||
http://curl.haxx.se/mail/lib-2004-06/0167.html
|
||||
UNASSIGNED
|
||||
|
||||
* Bugfixes reported until late July
|
||||
|
||||
To get fixed in 7.12.2 (planned release: December 2004)
|
||||
======================
|
||||
|
||||
36. Fix HTTP Negotiate authentication so that no bogus user name needs to be
|
||||
provided to activate it.
|
||||
|
||||
Bugfixes reported until late November
|
||||
|
52
ares/CHANGES
52
ares/CHANGES
@@ -1,5 +1,57 @@
|
||||
Changelog for the c-ares project
|
||||
|
||||
* July 24
|
||||
|
||||
- Made the lib get built static only if --enable-debug is used.
|
||||
|
||||
- Gisle Vanem fixed:
|
||||
|
||||
Basically in loops like handle_errors(), 'query->next' was assigned a local
|
||||
variable and then query was referenced after the memory was freed by
|
||||
next_server(). I've changed that so next_server() and end_query() returns
|
||||
the next query. So callers should use this ret-value.
|
||||
|
||||
The next problem was that 'server->tcp_buffer_pos' had a random value at
|
||||
entry to 1st recv() (luckily causing Winsock to return ENOBUFS).
|
||||
|
||||
I've also added a ares_writev() for Windows to streamline the code a bit
|
||||
more.
|
||||
|
||||
* July 20
|
||||
- Fixed a few variable return types for some system calls. Made configure
|
||||
check for ssize_t to make it possible to use that when receiving the send()
|
||||
error code. This is necessary to prevent compiler warnings on some systems.
|
||||
|
||||
- Made configure create config.h, and all source files now include setup.h that
|
||||
might include the proper config.h (or a handicrafted alternative).
|
||||
|
||||
- Switched to 'ares_socket_t' type for sockets in ares, since Windows don't
|
||||
use 'int' for that.
|
||||
|
||||
- automake-ified and libool-ified c-ares. Now it builds libcares as a shared
|
||||
lib on most platforms if wanted. (This bloated the size of the release
|
||||
archive with another 200K!)
|
||||
|
||||
- Makefile.am now uses Makefile.inc for the c sources, h headers and man
|
||||
pages, to make it easier for other makefiles to use the exact same set of
|
||||
files.
|
||||
|
||||
- Adjusted 'maketgz' to use the new automake magic when building distribution
|
||||
archives.
|
||||
|
||||
- Anyone desires HTML and/or PDF versions of the man pages in the release
|
||||
archives?
|
||||
|
||||
* July 3
|
||||
- G<>nter Knauf made c-ares build and run on Novell Netware.
|
||||
|
||||
* July 1
|
||||
- Gisle Vanem provided Makefile.dj to build with djgpp, added a few more djgpp
|
||||
fixes and made ares not use 'errno' to provide further info on Windows.
|
||||
|
||||
* June 30
|
||||
- Gisle Vanem made it build with djgpp and run fine with the Watt-32 stack.
|
||||
|
||||
* June 10
|
||||
- Gisle Vanem's init patch for Windows:
|
||||
|
||||
|
@@ -10,6 +10,9 @@ maketgz
|
||||
aclocal.m4
|
||||
acinclude.m4
|
||||
Makefile.in
|
||||
Makefile.dj
|
||||
Makefile.m32
|
||||
Makefile.netware
|
||||
install-sh
|
||||
mkinstalldirs
|
||||
configure
|
||||
|
57
ares/Makefile.am
Normal file
57
ares/Makefile.am
Normal file
@@ -0,0 +1,57 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
lib_LTLIBRARIES = libcares.la
|
||||
|
||||
man_MANS = $(MANPAGES)
|
||||
|
||||
MSVCFILES = vc/adig/adig.dep vc/adig/adig.dsp vc/adig/adig.mak \
|
||||
vc/adig/adig.plg vc/vc.dsw vc/ahost/ahost.dep vc/ahost/ahost.dsp \
|
||||
vc/ahost/ahost.mak vc/ahost/ahost.plg vc/areslib/areslib.dep \
|
||||
vc/areslib/areslib.dsp vc/areslib/areslib.mak vc/areslib/areslib.plg
|
||||
|
||||
# adig and ahost are just sample programs and thus not mentioned with the
|
||||
# regular sources and headers
|
||||
EXTRA_DIST = CHANGES README.cares Makefile.inc adig.c ahost.c $(man_MANS) \
|
||||
$(MSVCFILES)
|
||||
|
||||
|
||||
VER=-version-info 0:0:0
|
||||
# This flag accepts an argument of the form current[:revision[:age]]. So,
|
||||
# passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
|
||||
# 1.
|
||||
#
|
||||
# If either revision or age are omitted, they default to 0. Also note that age
|
||||
# must be less than or equal to the current interface number.
|
||||
#
|
||||
# Here are a set of rules to help you update your library version information:
|
||||
#
|
||||
# 1.Start with version information of 0:0:0 for each libtool library.
|
||||
#
|
||||
# 2.Update the version information only immediately before a public release of
|
||||
# your software. More frequent updates are unnecessary, and only guarantee
|
||||
# that the current interface number gets larger faster.
|
||||
#
|
||||
# 3.If the library source code has changed at all since the last update, then
|
||||
# increment revision (c:r+1:a)
|
||||
#
|
||||
# 4.If any interfaces have been added, removed, or changed since the last
|
||||
# update, increment current, and set revision to 0. (c+1:r=0:a)
|
||||
#
|
||||
# 5.If any interfaces have been added since the last public release, then
|
||||
# increment age. (c:r:a+1)
|
||||
#
|
||||
# 6.If any interfaces have been removed since the last public release, then
|
||||
# set age to 0. (c:r:a=0)
|
||||
#
|
||||
|
||||
libcares_la_LDFLAGS = $(VER)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
||||
|
||||
# where to install the c-ares headers
|
||||
libcares_ladir = $(includedir)
|
||||
# what headers to install on 'make install':
|
||||
libcares_la_HEADERS = ares.h ares_version.h
|
56
ares/Makefile.dj
Normal file
56
ares/Makefile.dj
Normal file
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# c-ares Makefile for djgpp/gcc/Watt-32
|
||||
# By Gisle Vanem <giva@bgnett.no> 2004.
|
||||
#
|
||||
.SUFFIXES: .exe
|
||||
|
||||
WATT32_ROOT = $(subst \,/,$(WATT_ROOT))
|
||||
|
||||
CC = gcc
|
||||
CFLAGS = -O2 -Wall -DWATT32 -Dselect=select_s -I$(WATT32_ROOT)/inc
|
||||
LDFLAGS = -s
|
||||
EX_LIBS = $(WATT32_ROOT)/lib/libwatt.a
|
||||
|
||||
SOURCE = ares_cancel.c ares_destroy.c ares_expand_name.c ares_expand_string.c ares_fds.c \
|
||||
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 \
|
||||
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 \
|
||||
ares_version.c
|
||||
|
||||
OBJ_DIR = djgpp
|
||||
|
||||
OBJECTS = $(addprefix $(OBJ_DIR)/, $(SOURCE:.c=.o))
|
||||
|
||||
|
||||
all: $(OBJ_DIR) libcares.a ahost.exe adig.exe
|
||||
@echo Welcome to c-ares.
|
||||
|
||||
$(OBJ_DIR):
|
||||
- mkdir $(OBJ_DIR)
|
||||
|
||||
libcares.a: $(OBJECTS)
|
||||
ar rs $@ $?
|
||||
|
||||
ahost.exe: ahost.c libcares.a
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
|
||||
|
||||
adig.exe: adig.c libcares.a
|
||||
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(EX_LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJECTS) libcares.a
|
||||
|
||||
vclean realclean: clean
|
||||
rm -f ahost.exe adig.exe depend.dj
|
||||
- rmdir $(OBJ_DIR)
|
||||
|
||||
$(OBJ_DIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
@echo
|
||||
|
||||
depend:
|
||||
$(CC) -MM $(CFLAGS) $(SOURCE) | \
|
||||
sed -e 's/^\([a-zA-Z0-9_-]*\.o:\)/$$(OBJ_DIR)\/\1/' > depend.dj
|
||||
|
||||
-include depend.dj
|
@@ -1,79 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
SHELL=/bin/sh
|
||||
INSTALL=@INSTALL@
|
||||
RANLIB=@RANLIB@
|
||||
VPATH=@srcdir@
|
||||
srcdir=@srcdir@
|
||||
top_srcdir=@top_srcdir@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
mandir=@mandir@
|
||||
|
||||
LIB=libcares.a
|
||||
CC=@CC@
|
||||
CPPFLAGS=@CPPFLAGS@
|
||||
CFLAGS=@CFLAGS@ ${WARN_CFLAGS} ${ERROR_CFLAGS}
|
||||
DEFS=@DEFS@
|
||||
LDFLAGS=@LDFLAGS@
|
||||
LIBS=@LIBS@
|
||||
ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${DEFS}
|
||||
OBJS= ares__close_sockets.o ares__get_hostent.o ares__read_line.o \
|
||||
ares_destroy.o ares_expand_name.o ares_fds.o \
|
||||
ares_free_hostent.o ares_free_string.o ares_gethostbyaddr.o \
|
||||
ares_gethostbyname.o ares_init.o ares_mkquery.o ares_parse_a_reply.o \
|
||||
ares_parse_ptr_reply.o ares_process.o ares_query.o ares_search.o \
|
||||
ares_send.o ares_strerror.o ares_timeout.o ares_version.o \
|
||||
ares_expand_string.o ares_cancel.o
|
||||
|
||||
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_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_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \
|
||||
ares_version.3 ares_cancel.3
|
||||
|
||||
$(LIB): ${OBJS}
|
||||
ar cru $@ ${OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
all: $(LIB) demos
|
||||
|
||||
demos: adig ahost
|
||||
|
||||
tags:
|
||||
etags *.[ch]
|
||||
|
||||
adig: adig.o $(LIB)
|
||||
${CC} ${LDFLAGS} -o $@ adig.o $(LIB) ${LIBS}
|
||||
|
||||
ahost: ahost.o $(LIB)
|
||||
${CC} ${LDFLAGS} -o $@ ahost.o $(LIB) ${LIBS}
|
||||
|
||||
${OBJS}: ares.h ares_dns.h ares_private.h
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${ALL_CFLAGS} $<
|
||||
|
||||
check:
|
||||
|
||||
install:
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
|
||||
${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
|
||||
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
|
||||
chmod u-w ${DESTDIR}${libdir}/$(LIB)
|
||||
${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/ares_version.h ${DESTDIR}${includedir}
|
||||
(for man in $(MANPAGES); do \
|
||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
||||
done)
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} $(LIB) adig.o adig ahost.o ahost
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status Makefile
|
15
ares/Makefile.inc
Normal file
15
ares/Makefile.inc
Normal file
@@ -0,0 +1,15 @@
|
||||
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_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_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
|
||||
|
||||
HHEADERS = ares.h ares_private.h setup.h ares_dns.h ares_version.h nameser.h
|
||||
|
||||
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_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_query.3 ares_search.3 ares_send.3 ares_strerror.3 ares_timeout.3 \
|
||||
ares_version.3 ares_cancel.3
|
75
ares/Makefile.m32
Normal file
75
ares/Makefile.m32
Normal file
@@ -0,0 +1,75 @@
|
||||
#############################################################
|
||||
# $Id$
|
||||
#
|
||||
## Makefile for building libcares.a with MingW32 (GCC-3.2)
|
||||
## Use: make -f Makefile.m32 [demos]
|
||||
##
|
||||
## Quick hack by Guenter; comments to: /dev/nul
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RANLIB = ranlib
|
||||
STRIP = strip -g
|
||||
#RM = rm -f
|
||||
|
||||
########################################################
|
||||
## Nothing more to do below this line!
|
||||
|
||||
LIB=libcares.a
|
||||
CC=gcc
|
||||
#CPPFLAGS=@CPPFLAGS@
|
||||
WARN_FLAGS=-Wall
|
||||
CFLAGS=-O2
|
||||
CFLAGS+=${WARN_CFLAGS} ${ERROR_CFLAGS}
|
||||
DEFS=-DMINGW32
|
||||
LDFLAGS=-s
|
||||
LIBS=-lwsock32
|
||||
ALL_CFLAGS=${CPPFLAGS} ${CFLAGS} ${DEFS}
|
||||
|
||||
MANPAGES := $(patsubst %.c,%.o,$(wildcard ares_*.3))
|
||||
|
||||
OBJS := $(patsubst %.c,%.o,$(wildcard ares_*.c))
|
||||
OBJS += windows_port.o
|
||||
|
||||
$(LIB): ${OBJS}
|
||||
ar cru $@ ${OBJS}
|
||||
${RANLIB} $@
|
||||
|
||||
all: $(LIB) demos
|
||||
|
||||
demos: adig.exe ahost.exe
|
||||
|
||||
tags:
|
||||
etags *.[ch]
|
||||
|
||||
adig.exe: adig.o $(LIB)
|
||||
${CC} ${LDFLAGS} -o $@ adig.o $(LIB) ${LIBS}
|
||||
|
||||
ahost.exe: ahost.o $(LIB)
|
||||
${CC} ${LDFLAGS} -o $@ ahost.o $(LIB) ${LIBS}
|
||||
|
||||
${OBJS}: ares.h ares_dns.h ares_private.h
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${ALL_CFLAGS} $<
|
||||
|
||||
check:
|
||||
|
||||
install:
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${includedir}
|
||||
${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man3
|
||||
${INSTALL} -m 644 $(LIB) ${DESTDIR}${libdir}
|
||||
${RANLIB} ${DESTDIR}${libdir}/$(LIB)
|
||||
chmod u-w ${DESTDIR}${libdir}/$(LIB)
|
||||
${INSTALL} -m 444 ${srcdir}/ares.h ${DESTDIR}${includedir}
|
||||
${INSTALL} -m 444 ${srcdir}/ares_version.h ${DESTDIR}${includedir}
|
||||
(for man in $(MANPAGES); do \
|
||||
${INSTALL} -m 444 ${srcdir}/$${man} ${DESTDIR}${mandir}/man3; \
|
||||
done)
|
||||
|
||||
clean:
|
||||
rm -f ${OBJS} $(LIB) adig.o adig.exe ahost.o ahost.exe
|
||||
|
||||
distclean: clean
|
||||
rm -f config.cache config.log config.status Makefile
|
317
ares/Makefile.netware
Normal file
317
ares/Makefile.netware
Normal file
@@ -0,0 +1,317 @@
|
||||
#################################################################
|
||||
#
|
||||
## Makefile for building libares.lib (NetWare version - gnu make)
|
||||
## Use: make -f Makefile.netware
|
||||
##
|
||||
## Comments to: Guenter Knauf <eflash@gmx.net>
|
||||
#
|
||||
#################################################################
|
||||
|
||||
# Edit the path below to point to the base of your Novell NDK.
|
||||
ifndef NDKBASE
|
||||
NDKBASE = c:/novell
|
||||
endif
|
||||
|
||||
ifndef INSTDIR
|
||||
INSTDIR = ../curl-$(LIBCURL_VERSION_STR)-bin-nw
|
||||
endif
|
||||
|
||||
# Edit the vars below to change NLM target settings.
|
||||
TARGETS = adig.nlm ahost.nlm
|
||||
LTARGET = libcares.lib
|
||||
VERSION = $(LIBCARES_VERSION)
|
||||
COPYR = Copyright (c) 1996 - 2004, Daniel Stenberg, <daniel@haxx.se>
|
||||
DESCR = cURL $(subst .def,,$(notdir $@)) $(LIBCARES_VERSION_STR) - http://curl.haxx.se
|
||||
MTSAFE = YES
|
||||
STACK = 64000
|
||||
SCREEN = none
|
||||
#EXPORTS =
|
||||
# Comment the line below if you dont want to load protected automatically.
|
||||
#LDRING = 3
|
||||
|
||||
# Edit the var below to point to your lib architecture.
|
||||
ifndef LIBARCH
|
||||
LIBARCH = LIBC
|
||||
endif
|
||||
|
||||
# must be equal to DEBUG or NDEBUG
|
||||
DB = NDEBUG
|
||||
# DB = DEBUG
|
||||
# DB = CURLDEBUG
|
||||
# Optimization: -O<n> or debugging: -g
|
||||
ifeq ($(DB),NDEBUG)
|
||||
OPT = -O2
|
||||
OBJDIR = release
|
||||
else
|
||||
OPT = -g
|
||||
OBJDIR = debug
|
||||
endif
|
||||
|
||||
# Include the version info retrieved from curlver.h
|
||||
-include $(OBJDIR)/version.inc
|
||||
|
||||
# The following line defines your compiler.
|
||||
ifdef METROWERKS
|
||||
CC = mwccnlm
|
||||
else
|
||||
CC = gcc
|
||||
endif
|
||||
YACC = bison -y
|
||||
CP = cp -afv
|
||||
# RM = rm -f
|
||||
# if you want to mark the target as MTSAFE you will need a tool for
|
||||
# generating the xdc data for the linker; here's a minimal tool:
|
||||
# http://www.gknw.com/development/prgtools/mkxdc.zip
|
||||
MPKXDC = mkxdc
|
||||
|
||||
# Global flags for all compilers
|
||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
|
||||
|
||||
ifeq ($(CC),mwccnlm)
|
||||
LD = mwldnlm
|
||||
LDFLAGS = -nostdlib $(PRELUDE) $(OBJS) $(<:.def=.o) -o $@ -commandfile
|
||||
AR = mwldnlm
|
||||
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
|
||||
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
|
||||
CFLAGS += -relax_pointers
|
||||
#CFLAGS += -w on
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||
CFLAGS += -align 4
|
||||
else
|
||||
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
|
||||
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
|
||||
CFLAGS += -align 1
|
||||
endif
|
||||
else
|
||||
LD = nlmconv
|
||||
LDFLAGS = -T
|
||||
AR = ar
|
||||
ARFLAGS = -cq
|
||||
CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return
|
||||
CFLAGS += -Wall -Wno-format # -pedantic
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
||||
else
|
||||
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
||||
endif
|
||||
endif
|
||||
|
||||
NDK_ROOT = $(NDKBASE)/ndk
|
||||
SDK_CLIB = $(NDK_ROOT)/nwsdk
|
||||
SDK_LIBC = $(NDK_ROOT)/libc
|
||||
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
|
||||
INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
# CFLAGS += -D__ANSIC__
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
|
||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||
CFLAGS += -DNETDB_USE_INTERNET
|
||||
endif
|
||||
CFLAGS += -I. $(INCLUDES)
|
||||
|
||||
ifeq ($(MTSAFE),YES)
|
||||
XDCOPT = -n
|
||||
endif
|
||||
ifeq ($(MTSAFE),NO)
|
||||
XDCOPT = -u
|
||||
endif
|
||||
|
||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
||||
DL = '
|
||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
||||
endif
|
||||
|
||||
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(wildcard ares_*.c))
|
||||
|
||||
.PHONY: lib nlm prebuild dist install clean
|
||||
|
||||
lib: prebuild $(LTARGET)
|
||||
|
||||
nlm: prebuild $(TARGETS)
|
||||
|
||||
prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h arpa/nameser.h
|
||||
|
||||
dist: all
|
||||
-$(RM) $(OBJS) $(OBJDIR)/*.map $(OBJDIR)/*.ncv
|
||||
-$(RM) $(OBJDIR)/*.def $(OBJDIR)/*.xdc $(OBJDIR)/version.inc
|
||||
|
||||
install: $(INSTDIR) all
|
||||
@$(CP) *.nlm $(INSTDIR)
|
||||
@$(CP) ../CHANGES $(INSTDIR)
|
||||
@$(CP) ../COPYING $(INSTDIR)
|
||||
@$(CP) ../README $(INSTDIR)
|
||||
@$(CP) ../RELEASE-NOTES $(INSTDIR)
|
||||
|
||||
clean:
|
||||
-$(RM) $(LTARGET) $(TARGETS) config.h
|
||||
-$(RM) -r $(OBJDIR)
|
||||
-$(RM) -r arpa
|
||||
|
||||
%.lib: $(OBJS)
|
||||
@echo Creating $@
|
||||
@-$(RM) $@
|
||||
@$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
%.nlm: $(OBJDIR)/%.def $(OBJDIR)/%.o $(OBJDIR)/%.xdc $(OBJS)
|
||||
@echo Linking $@
|
||||
@-$(RM) $@
|
||||
@$(LD) $(LDFLAGS) $<
|
||||
|
||||
$(INSTDIR):
|
||||
@mkdir $(INSTDIR)
|
||||
|
||||
$(OBJDIR):
|
||||
@mkdir $(OBJDIR)
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(OBJDIR)/version.inc: ares_version.h $(OBJDIR)
|
||||
@echo Creating $@
|
||||
@awk -f ../packages/NetWare/get_ver.awk $< > $@
|
||||
|
||||
$(OBJDIR)/%.xdc: Makefile.netware
|
||||
@echo Creating $@
|
||||
@$(MPKXDC) $(XDCOPT) $@
|
||||
|
||||
$(OBJDIR)/%.def: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)# DEF file for linking with $(LD)$(DL) > $@
|
||||
@echo $(DL)# Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)# All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)#$(DL) >> $@
|
||||
@echo $(DL)copyright "$(COPYR)"$(DL) >> $@
|
||||
@echo $(DL)description "$(DESCR)"$(DL) >> $@
|
||||
@echo $(DL)version $(VERSION)$(DL) >> $@
|
||||
ifdef NLMTYPE
|
||||
@echo $(DL)type $(NLMTYPE)$(DL) >> $@
|
||||
endif
|
||||
ifdef STACK
|
||||
@echo $(DL)stack $(STACK)$(DL) >> $@
|
||||
endif
|
||||
ifdef SCREEN
|
||||
@echo $(DL)screenname "$(SCREEN)"$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)screenname "DEFAULT"$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(DB),DEBUG)
|
||||
@echo $(DL)debug$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)threadname "$^"$(DL) >> $@
|
||||
ifdef XDCOPT
|
||||
@echo $(DL)xdcdata $(@:.def=.xdc)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),0)
|
||||
@echo $(DL)flag_on 16$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LDRING),3)
|
||||
@echo $(DL)flag_on 512$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)start _Prelude$(DL) >> $@
|
||||
@echo $(DL)exit _Stop$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/clib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/threads.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/nlmlib.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_CLIB)/imports/socklib.imp$(DL) >> $@
|
||||
@echo $(DL)module clib$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)flag_on 64$(DL) >> $@
|
||||
@echo $(DL)pseudopreemption$(DL) >> $@
|
||||
@echo $(DL)start _LibCPrelude$(DL) >> $@
|
||||
@echo $(DL)exit _LibCPostlude$(DL) >> $@
|
||||
@echo $(DL)check _LibCCheckUnload$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/libc.imp$(DL) >> $@
|
||||
@echo $(DL)import @$(SDK_LIBC)/imports/netware.imp$(DL) >> $@
|
||||
@echo $(DL)module libc$(DL) >> $@
|
||||
endif
|
||||
ifdef MODULES
|
||||
@echo $(DL)module $(MODULES)$(DL) >> $@
|
||||
endif
|
||||
ifdef EXPORTS
|
||||
@echo $(DL)export $(EXPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifdef IMPORTS
|
||||
@echo $(DL)import $(IMPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LD),nlmconv)
|
||||
@echo $(DL)input $(OBJS)$(DL) >> $@
|
||||
@echo $(DL)input $(PRELUDE)$(DL) >> $@
|
||||
@echo $(DL)output $(notdir $(@:.def=.nlm))$(DL) >> $@
|
||||
endif
|
||||
|
||||
config.h: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* $@ for NetWare target.$(DL) > $@
|
||||
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
|
||||
@echo $(DL)#define PACKAGE_BUGREPORT "curl-bug@haxx.se"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
|
||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
||||
ifdef NW_WINSOCK
|
||||
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
|
||||
endif
|
||||
ifdef OLD_NOVELLSDK
|
||||
@echo $(DL)#define socklen_t int$(DL) >> $@
|
||||
endif
|
||||
|
||||
arpa/nameser.h: nameser.h
|
||||
@echo Fix missing header $@
|
||||
@-mkdir arpa
|
||||
@$(CP) $< arpa
|
||||
|
||||
|
@@ -1,3 +1,6 @@
|
||||
Major changes since:
|
||||
* see the CHANGES file
|
||||
|
||||
Major changes in release 1.1.1:
|
||||
* ares should now compile as C++ code (no longer uses reserved word
|
||||
"class").
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _AIX
|
||||
#if defined(_AIX) || defined(NETWARE)
|
||||
/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish
|
||||
libc5-based Linux systems. Only include it on system that are known to
|
||||
require it! */
|
||||
|
@@ -13,6 +13,8 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#ifdef WIN32
|
||||
#else
|
||||
@@ -42,14 +44,14 @@ void ares__close_sockets(struct server_state *server)
|
||||
server->tcp_lenbuf_pos = 0;
|
||||
|
||||
/* Close the TCP and UDP sockets. */
|
||||
if (server->tcp_socket != -1)
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
closesocket(server->tcp_socket);
|
||||
server->tcp_socket = -1;
|
||||
server->tcp_socket = ARES_SOCKET_BAD;
|
||||
}
|
||||
if (server->udp_socket != -1)
|
||||
if (server->udp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
closesocket(server->udp_socket);
|
||||
server->udp_socket = -1;
|
||||
server->udp_socket = ARES_SOCKET_BAD;
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -1,18 +1,17 @@
|
||||
/* Copyright 1998 by the Massachusetts Institute of Technology.
|
||||
/* Copyright (C) 2004 by Daniel Stenberg et al
|
||||
*
|
||||
* 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"
|
||||
* 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 <stdlib.h>
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdlib.h>
|
||||
#include "ares.h"
|
||||
#include "ares_private.h"
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -37,13 +38,13 @@ int ares_fds(ares_channel channel, fd_set *read_fds, fd_set *write_fds)
|
||||
for (i = 0; i < channel->nservers; i++)
|
||||
{
|
||||
server = &channel->servers[i];
|
||||
if (server->udp_socket != -1)
|
||||
if (server->udp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
FD_SET(server->udp_socket, read_fds);
|
||||
if (server->udp_socket >= nfds)
|
||||
nfds = server->udp_socket + 1;
|
||||
}
|
||||
if (server->tcp_socket != -1)
|
||||
if (server->tcp_socket != ARES_SOCKET_BAD)
|
||||
{
|
||||
FD_SET(server->tcp_socket, read_fds);
|
||||
if (server->qhead)
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdlib.h>
|
||||
#include "ares.h"
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -151,6 +152,12 @@ static int file_lookup(struct in_addr *addr, struct hostent **host)
|
||||
strcat(PATH_HOSTS, PATH_HOSTS_9X);
|
||||
}
|
||||
|
||||
#elif defined(WATT32)
|
||||
extern const char *_w32_GetHostsFile (void);
|
||||
const char *PATH_HOSTS = _w32_GetHostsFile();
|
||||
|
||||
if (!PATH_HOSTS)
|
||||
return ARES_ENOTFOUND;
|
||||
#endif
|
||||
|
||||
fp = fopen(PATH_HOSTS, "r");
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -224,6 +225,12 @@ static int file_lookup(const char *name, struct hostent **host)
|
||||
strcat(PATH_HOSTS, PATH_HOSTS_9X);
|
||||
}
|
||||
|
||||
#elif defined(WATT32)
|
||||
extern const char *_w32_GetHostsFile (void);
|
||||
const char *PATH_HOSTS = _w32_GetHostsFile();
|
||||
|
||||
if (!PATH_HOSTS)
|
||||
return ARES_ENOTFOUND;
|
||||
#endif
|
||||
|
||||
fp = fopen(PATH_HOSTS, "r");
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -127,8 +128,8 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
|
||||
for (i = 0; i < channel->nservers; i++)
|
||||
{
|
||||
server = &channel->servers[i];
|
||||
server->udp_socket = -1;
|
||||
server->tcp_socket = -1;
|
||||
server->udp_socket = ARES_SOCKET_BAD;
|
||||
server->tcp_socket = ARES_SOCKET_BAD;
|
||||
server->tcp_lenbuf_pos = 0;
|
||||
server->tcp_buffer = NULL;
|
||||
server->qhead = NULL;
|
||||
@@ -506,6 +507,24 @@ DhcpNameServer
|
||||
free(resolvers);
|
||||
}
|
||||
|
||||
#elif defined(WATT32)
|
||||
int i;
|
||||
|
||||
sock_init();
|
||||
for (i = 0; def_nameservers[i]; i++)
|
||||
;
|
||||
if (i == 0)
|
||||
return ARES_SUCCESS; /* use localhost DNS server */
|
||||
|
||||
nservers = i;
|
||||
servers = calloc(sizeof(*servers), i);
|
||||
if (!servers)
|
||||
return ARES_ENOMEM;
|
||||
|
||||
for (i = 0; def_nameservers[i]; i++)
|
||||
servers[i].addr.s_addr = htonl(def_nameservers[i]);
|
||||
status = ARES_EOF;
|
||||
|
||||
#else
|
||||
{
|
||||
char *p;
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -27,6 +27,14 @@
|
||||
#define closesocket(x) close(x)
|
||||
#endif
|
||||
|
||||
#ifdef WATT32
|
||||
#include <tcp.h>
|
||||
#include <sys/ioctl.h>
|
||||
#undef closesocket
|
||||
#define closesocket(s) close_s(s)
|
||||
#define writev(s,v,c) writev_s(s,v,c)
|
||||
#endif
|
||||
|
||||
#define DEFAULT_TIMEOUT 5
|
||||
#define DEFAULT_TRIES 4
|
||||
#ifndef INADDR_NONE
|
||||
@@ -42,7 +50,16 @@
|
||||
#define DHCPNAMESERVER "DhcpNameServer"
|
||||
#define PATH_HOSTS_NT "\\drivers\\etc\\hosts"
|
||||
#define PATH_HOSTS_9X "\\hosts"
|
||||
|
||||
|
||||
#elif defined(WATT32)
|
||||
|
||||
#define PATH_RESOLV_CONF "/dev/ENV/etc/resolv.conf"
|
||||
|
||||
#elif defined(NETWARE)
|
||||
|
||||
#define PATH_RESOLV_CONF "sys:/etc/resolv.cfg"
|
||||
#define PATH_HOSTS "sys:/etc/hosts"
|
||||
|
||||
#else
|
||||
|
||||
#define PATH_RESOLV_CONF "/etc/resolv.conf"
|
||||
@@ -65,8 +82,8 @@ struct send_request {
|
||||
|
||||
struct server_state {
|
||||
struct in_addr addr;
|
||||
int udp_socket;
|
||||
int tcp_socket;
|
||||
ares_socket_t udp_socket;
|
||||
ares_socket_t tcp_socket;
|
||||
|
||||
/* Mini-buffer for reading the length word */
|
||||
unsigned char tcp_lenbuf[2];
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -35,6 +36,12 @@
|
||||
#include "ares_dns.h"
|
||||
#include "ares_private.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define GET_ERRNO() WSAGetLastError()
|
||||
#else
|
||||
#define GET_ERRNO() errno
|
||||
#endif
|
||||
|
||||
static void write_tcp_data(ares_channel channel, fd_set *write_fds,
|
||||
time_t now);
|
||||
static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now);
|
||||
@@ -44,12 +51,12 @@ static void process_timeouts(ares_channel channel, time_t now);
|
||||
static void process_answer(ares_channel channel, unsigned char *abuf,
|
||||
int alen, int whichserver, int tcp, int now);
|
||||
static void handle_error(ares_channel channel, int whichserver, time_t now);
|
||||
static void 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_udp_socket(ares_channel channel, struct server_state *server);
|
||||
static int same_questions(const unsigned char *qbuf, int qlen,
|
||||
const unsigned char *abuf, int alen);
|
||||
static void 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);
|
||||
|
||||
/* Something interesting happened on the wire, or there was a timeout.
|
||||
@@ -74,13 +81,16 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
|
||||
struct server_state *server;
|
||||
struct send_request *sendreq;
|
||||
struct iovec *vec;
|
||||
int i, n, count;
|
||||
int i;
|
||||
ssize_t scount;
|
||||
int wcount;
|
||||
size_t n;
|
||||
|
||||
for (i = 0; i < channel->nservers; i++)
|
||||
{
|
||||
/* Make sure server has data to send and is selected in write_fds. */
|
||||
server = &channel->servers[i];
|
||||
if (!server->qhead || server->tcp_socket == -1
|
||||
if (!server->qhead || server->tcp_socket == ARES_SOCKET_BAD
|
||||
|| !FD_ISSET(server->tcp_socket, write_fds))
|
||||
continue;
|
||||
|
||||
@@ -89,16 +99,10 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
|
||||
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
|
||||
n++;
|
||||
|
||||
#ifdef WIN32
|
||||
vec = NULL;
|
||||
#else
|
||||
/* Allocate iovecs so we can send all our data at once. */
|
||||
vec = malloc(n * sizeof(struct iovec));
|
||||
#endif
|
||||
if (vec)
|
||||
{
|
||||
#ifdef WIN32
|
||||
#else
|
||||
/* Fill in the iovecs and send. */
|
||||
n = 0;
|
||||
for (sendreq = server->qhead; sendreq; sendreq = sendreq->next)
|
||||
@@ -107,21 +111,21 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
|
||||
vec[n].iov_len = sendreq->len;
|
||||
n++;
|
||||
}
|
||||
count = writev(server->tcp_socket, vec, n);
|
||||
wcount = writev(server->tcp_socket, vec, n);
|
||||
free(vec);
|
||||
if (count < 0)
|
||||
if (wcount < 0)
|
||||
{
|
||||
handle_error(channel, i, now);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Advance the send queue by as many bytes as we sent. */
|
||||
while (count)
|
||||
while (wcount)
|
||||
{
|
||||
sendreq = server->qhead;
|
||||
if ((size_t)count >= sendreq->len)
|
||||
if ((size_t)wcount >= sendreq->len)
|
||||
{
|
||||
count -= sendreq->len;
|
||||
wcount -= sendreq->len;
|
||||
server->qhead = sendreq->next;
|
||||
if (server->qhead == NULL)
|
||||
server->qtail = NULL;
|
||||
@@ -129,28 +133,27 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendreq->data += count;
|
||||
sendreq->len -= count;
|
||||
sendreq->data += wcount;
|
||||
sendreq->len -= wcount;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Can't allocate iovecs; just send the first request. */
|
||||
sendreq = server->qhead;
|
||||
|
||||
count = send(server->tcp_socket, sendreq->data, sendreq->len, 0);
|
||||
scount = send(server->tcp_socket, sendreq->data, sendreq->len, 0);
|
||||
|
||||
if (count < 0)
|
||||
if (scount < 0)
|
||||
{
|
||||
handle_error(channel, i, now);
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Advance the send queue by as many bytes as we sent. */
|
||||
if ((size_t)count == sendreq->len)
|
||||
if ((size_t)scount == sendreq->len)
|
||||
{
|
||||
server->qhead = sendreq->next;
|
||||
if (server->qhead == NULL)
|
||||
@@ -159,8 +162,8 @@ static void write_tcp_data(ares_channel channel, fd_set *write_fds, time_t now)
|
||||
}
|
||||
else
|
||||
{
|
||||
sendreq->data += count;
|
||||
sendreq->len -= count;
|
||||
sendreq->data += scount;
|
||||
sendreq->len -= scount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,7 +182,8 @@ static void read_tcp_data(ares_channel channel, fd_set *read_fds, time_t now)
|
||||
{
|
||||
/* Make sure the server has a socket and is selected in read_fds. */
|
||||
server = &channel->servers[i];
|
||||
if (server->tcp_socket == -1 || !FD_ISSET(server->tcp_socket, read_fds))
|
||||
if (server->tcp_socket == ARES_SOCKET_BAD ||
|
||||
!FD_ISSET(server->tcp_socket, read_fds))
|
||||
continue;
|
||||
|
||||
if (server->tcp_lenbuf_pos != 2)
|
||||
@@ -251,7 +255,8 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
|
||||
/* Make sure the server has a socket and is selected in read_fds. */
|
||||
server = &channel->servers[i];
|
||||
|
||||
if (server->udp_socket == -1 || !FD_ISSET(server->udp_socket, read_fds))
|
||||
if (server->udp_socket == ARES_SOCKET_BAD ||
|
||||
!FD_ISSET(server->udp_socket, read_fds))
|
||||
continue;
|
||||
|
||||
count = recv(server->udp_socket, buf, sizeof(buf), 0);
|
||||
@@ -273,7 +278,7 @@ static void process_timeouts(ares_channel channel, time_t now)
|
||||
if (query->timeout != 0 && now >= query->timeout)
|
||||
{
|
||||
query->error_status = ARES_ETIMEOUT;
|
||||
next_server(channel, query, now);
|
||||
next = next_server(channel, query, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +354,7 @@ static void process_answer(ares_channel channel, unsigned char *abuf,
|
||||
|
||||
static void handle_error(ares_channel channel, int whichserver, time_t now)
|
||||
{
|
||||
struct query *query;
|
||||
struct query *query, *next;
|
||||
|
||||
/* Reset communications with this server. */
|
||||
ares__close_sockets(&channel->servers[whichserver]);
|
||||
@@ -357,17 +362,19 @@ static void handle_error(ares_channel channel, int whichserver, time_t now)
|
||||
/* Tell all queries talking to this server to move on and not try
|
||||
* this server again.
|
||||
*/
|
||||
for (query = channel->queries; query; query = query->next)
|
||||
|
||||
for (query = channel->queries; query; query = next)
|
||||
{
|
||||
next = query->next;
|
||||
if (query->server == whichserver)
|
||||
{
|
||||
query->skip_server[whichserver] = 1;
|
||||
next_server(channel, query, now);
|
||||
next = next_server(channel, query, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void 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)
|
||||
{
|
||||
/* Advance to the next server or try. */
|
||||
query->server++;
|
||||
@@ -378,7 +385,7 @@ static void next_server(ares_channel channel, struct query *query, time_t now)
|
||||
if (!query->skip_server[query->server])
|
||||
{
|
||||
ares__send_query(channel, query, now);
|
||||
return;
|
||||
return (query->next);
|
||||
}
|
||||
}
|
||||
query->server = 0;
|
||||
@@ -387,7 +394,7 @@ static void next_server(ares_channel channel, struct query *query, time_t now)
|
||||
if (query->using_tcp)
|
||||
break;
|
||||
}
|
||||
end_query(channel, query, query->error_status, NULL, 0);
|
||||
return end_query(channel, query, query->error_status, NULL, 0);
|
||||
}
|
||||
|
||||
void ares__send_query(ares_channel channel, struct query *query, time_t now)
|
||||
@@ -401,7 +408,7 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
|
||||
/* Make sure the TCP socket for this server is set up and queue
|
||||
* a send request.
|
||||
*/
|
||||
if (server->tcp_socket == -1)
|
||||
if (server->tcp_socket == ARES_SOCKET_BAD)
|
||||
{
|
||||
if (open_tcp_socket(channel, server) == -1)
|
||||
{
|
||||
@@ -410,9 +417,12 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
|
||||
return;
|
||||
}
|
||||
}
|
||||
sendreq = malloc(sizeof(struct send_request));
|
||||
sendreq = calloc(sizeof(struct send_request), 1);
|
||||
if (!sendreq)
|
||||
{
|
||||
end_query(channel, query, ARES_ENOMEM, NULL, 0);
|
||||
return;
|
||||
}
|
||||
sendreq->data = query->tcpbuf;
|
||||
sendreq->len = query->tcplen;
|
||||
sendreq->next = NULL;
|
||||
@@ -425,7 +435,7 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (server->udp_socket == -1)
|
||||
if (server->udp_socket == ARES_SOCKET_BAD)
|
||||
{
|
||||
if (open_udp_socket(channel, server) == -1)
|
||||
{
|
||||
@@ -448,17 +458,18 @@ void ares__send_query(ares_channel channel, struct query *query, time_t now)
|
||||
|
||||
static int open_tcp_socket(ares_channel channel, struct server_state *server)
|
||||
{
|
||||
int s, flags;
|
||||
ares_socket_t s;
|
||||
int flags;
|
||||
struct sockaddr_in sockin;
|
||||
|
||||
/* Acquire a socket. */
|
||||
s = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (s == -1)
|
||||
if (s == ARES_SOCKET_BAD)
|
||||
return -1;
|
||||
|
||||
/* Set the socket non-blocking. */
|
||||
|
||||
#ifdef WIN32
|
||||
#if defined(WIN32) || defined(WATT32)
|
||||
flags = 1;
|
||||
ioctlsocket(s, FIONBIO, &flags);
|
||||
#else
|
||||
@@ -466,41 +477,44 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
|
||||
|
||||
if (flags == -1)
|
||||
{
|
||||
close(s);
|
||||
closesocket(s);
|
||||
return -1;
|
||||
}
|
||||
flags |= O_NONBLOCK;
|
||||
if (fcntl(s, F_SETFL, flags) == -1)
|
||||
{
|
||||
close(s);
|
||||
closesocket(s);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Connect to the server. */
|
||||
memset(&sockin, 0, sizeof(sockin));
|
||||
sockin.sin_family = AF_INET;
|
||||
sockin.sin_addr = server->addr;
|
||||
sockin.sin_port = channel->tcp_port;
|
||||
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1
|
||||
&& errno != EINPROGRESS)
|
||||
{
|
||||
if (connect(s, (struct sockaddr *) &sockin, sizeof(sockin)) == -1) {
|
||||
int err = GET_ERRNO();
|
||||
|
||||
if (err != EINPROGRESS && err != EWOULDBLOCK) {
|
||||
closesocket(s);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
server->tcp_buffer_pos = 0;
|
||||
server->tcp_socket = s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int open_udp_socket(ares_channel channel, struct server_state *server)
|
||||
{
|
||||
int s;
|
||||
ares_socket_t s;
|
||||
struct sockaddr_in sockin;
|
||||
|
||||
/* Acquire a socket. */
|
||||
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s == -1)
|
||||
if (s == ARES_SOCKET_BAD)
|
||||
return -1;
|
||||
|
||||
/* Connect to the server. */
|
||||
@@ -597,10 +611,10 @@ static int same_questions(const unsigned char *qbuf, int qlen,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void 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)
|
||||
{
|
||||
struct query **q;
|
||||
struct query **q, *next;
|
||||
int i;
|
||||
|
||||
query->callback(query->arg, status, abuf, alen);
|
||||
@@ -610,6 +624,10 @@ static void end_query(ares_channel channel, struct query *query, int status,
|
||||
break;
|
||||
}
|
||||
*q = query->next;
|
||||
if (*q)
|
||||
next = (*q)->next;
|
||||
else
|
||||
next = NULL;
|
||||
free(query->tcpbuf);
|
||||
free(query->skip_server);
|
||||
free(query);
|
||||
@@ -622,4 +640,5 @@ static void end_query(ares_channel channel, struct query *query, int status,
|
||||
for (i = 0; i < channel->nservers; i++)
|
||||
ares__close_sockets(&channel->servers[i]);
|
||||
}
|
||||
return (next);
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <assert.h>
|
||||
#include "ares.h"
|
||||
|
||||
|
@@ -13,6 +13,7 @@
|
||||
* without express or implied warranty.
|
||||
*/
|
||||
|
||||
#include "setup.h"
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "setup.h"
|
||||
#include "ares_version.h"
|
||||
|
||||
const char *ares_version(int *version)
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
libtoolize --copy --automake --force
|
||||
aclocal
|
||||
autoheader
|
||||
autoconf
|
||||
automake --add-missing
|
||||
|
1388
ares/config.guess
vendored
1388
ares/config.guess
vendored
File diff suppressed because it is too large
Load Diff
1489
ares/config.sub
vendored
1489
ares/config.sub
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,17 +1,22 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(ares_init.c)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_MAINTAINER_MODE
|
||||
AM_INIT_AUTOMAKE(c-ares, CVS)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
case $host_os in
|
||||
solaris*)
|
||||
AC_DEFINE(ETC_INET)
|
||||
AC_DEFINE(ETC_INET, 1, [if a /etc/inet dir is being used])
|
||||
;;
|
||||
esac
|
||||
|
||||
# check for ssize_t
|
||||
AC_CHECK_TYPE(ssize_t, ,
|
||||
AC_DEFINE(ssize_t, int, [the signed version of size_t]))
|
||||
|
||||
AC_SEARCH_LIBS(gethostbyname, nsl)
|
||||
AC_SEARCH_LIBS(socket, socket)
|
||||
|
||||
@@ -30,6 +35,9 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
||||
;;
|
||||
*) AC_MSG_RESULT(yes)
|
||||
|
||||
dnl when doing the debug stuff, use static library only
|
||||
AC_DISABLE_SHARED
|
||||
|
||||
dnl Checks for standard header files, to make memdebug.h inclusions bettter
|
||||
AC_HEADER_STDC
|
||||
|
||||
@@ -45,12 +53,14 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
dnl check for a few basic system headers we need
|
||||
dnl AC_CHECK_HEADERS(
|
||||
dnl sys/types.h \
|
||||
dnl sys/time.h \
|
||||
dnl sys/select.h \
|
||||
dnl sys/socket.h \
|
||||
dnl )
|
||||
AC_CHECK_HEADERS(
|
||||
sys/types.h \
|
||||
sys/time.h \
|
||||
sys/select.h \
|
||||
sys/socket.h \
|
||||
)
|
||||
|
||||
AC_OUTPUT(Makefile)
|
||||
|
93
ares/maketgz
93
ares/maketgz
@@ -2,8 +2,6 @@
|
||||
|
||||
$version = $ARGV[0];
|
||||
|
||||
$name="c-ares";
|
||||
|
||||
if($version eq "") {
|
||||
print "Enter version number!\n";
|
||||
exit;
|
||||
@@ -15,86 +13,25 @@ if(!-f "ares.h") {
|
||||
}
|
||||
|
||||
if(!-f "configure") {
|
||||
`autoconf`;
|
||||
print "running buildconf\n";
|
||||
`./buildconf`;
|
||||
}
|
||||
print "adding $version in the configure.ac file\n";
|
||||
`sed -e 's/AM_INIT_AUTOMAKE(c-ares, CVS)/AM_INIT_AUTOMAKE(c-ares, $version)/' < configure.ac > configure.ac-rel`;
|
||||
|
||||
@files=`find . -name FILES`;
|
||||
# now make a new configure script with this
|
||||
print "makes a new configure script\n";
|
||||
`autoconf configure.ac-rel >configure`;
|
||||
|
||||
my @entries;
|
||||
# now run this new configure to get a fine makefile
|
||||
print "running configure\n";
|
||||
`./configure`;
|
||||
|
||||
sub dirpart {
|
||||
my ($file)=@_;
|
||||
my @p=split("/", $file);
|
||||
$p[$#p]=""; # blank the last one
|
||||
my $dir=join("/", @p);
|
||||
# now make the actual tarball
|
||||
print "running make dist\n";
|
||||
`make dist`;
|
||||
|
||||
$dir =~ s/^\.\///; # cut off ./ beginnings
|
||||
|
||||
$dir =~ s/\/$//; # off / trailers
|
||||
|
||||
if(!$dir) {
|
||||
$dir = ".";
|
||||
}
|
||||
|
||||
return $dir;
|
||||
}
|
||||
|
||||
sub add {
|
||||
my ($file)=@_;
|
||||
|
||||
my $dir=dirpart($file);
|
||||
|
||||
open(FILE, "<$file");
|
||||
while(<FILE>) {
|
||||
if($_ =~ /^ *\#/) {
|
||||
next;
|
||||
}
|
||||
chomp;
|
||||
push @entries, "$dir/$_";
|
||||
}
|
||||
close(FILE);
|
||||
}
|
||||
|
||||
for(@files) {
|
||||
chomp;
|
||||
add($_);
|
||||
}
|
||||
|
||||
sub mkalldir {
|
||||
my ($dir) = @_;
|
||||
|
||||
my @parts = split("/", $dir);
|
||||
|
||||
#print "IN: $dir\n";
|
||||
|
||||
my $sub="";
|
||||
for(@parts) {
|
||||
#print "PART: $_\n";
|
||||
|
||||
$sub .= "$_";
|
||||
if($_ eq "") {
|
||||
next;
|
||||
}
|
||||
mkdir($sub, 0777);
|
||||
#print "make $sub\n";
|
||||
$sub .= "/";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for(@entries) {
|
||||
my $dir = dirpart("$name-$version/$_");
|
||||
# print "Create $dir\n";
|
||||
mkalldir($dir);
|
||||
# print "Copy $_ to $dir\n";
|
||||
`cp -p $_ $dir`;
|
||||
}
|
||||
|
||||
# make a tarball
|
||||
`tar -cf $name-$version.tar $name-$version`;
|
||||
# gzip the tarball
|
||||
`gzip -9 $name-$version.tar`;
|
||||
# remove the dir
|
||||
`rm -rf $name-$version`;
|
||||
print "removing temporary configure.ac file\n";
|
||||
`rm configure.ac-rel`;
|
||||
|
||||
print "NOTE: now cvs tag this release!\n";
|
||||
|
@@ -4,13 +4,18 @@
|
||||
/* Windows-only header file provided by liren@vivisimo.com to make his Windows
|
||||
port build */
|
||||
|
||||
#ifndef NETWARE
|
||||
#include <windows.h>
|
||||
#include <process.h> /* for the _getpid() proto */
|
||||
#endif /* !NETWARE */
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef NETWARE
|
||||
|
||||
#define MAXHOSTNAMELEN 256
|
||||
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
|
||||
/* Structure for scatter/gather I/O. */
|
||||
struct iovec
|
||||
@@ -21,11 +26,16 @@ struct iovec
|
||||
|
||||
#define getpid() _getpid()
|
||||
|
||||
int ares_writev (SOCKET s, const struct iovec *vector, size_t count);
|
||||
#define writev(s,vect,count) ares_writev(s,vect,count)
|
||||
|
||||
struct timezone { int dummy; };
|
||||
|
||||
int ares_gettimeofday(struct timeval *tv, struct timezone *tz);
|
||||
#define gettimeofday(tv,tz) ares_gettimeofday(tv,tz)
|
||||
|
||||
#endif /* !NETWARE */
|
||||
|
||||
#define NS_CMPRSFLGS 0xc0
|
||||
|
||||
|
||||
@@ -211,7 +221,7 @@ typedef enum __ns_rcode {
|
||||
#define T_MAILA ns_t_maila
|
||||
#define T_ANY ns_t_any
|
||||
|
||||
#ifndef __MINGW32__
|
||||
#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);
|
||||
|
45
ares/setup.h
Normal file
45
ares/setup.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#ifndef ARES_SETUP_H
|
||||
#define ARES_SETUP_H
|
||||
|
||||
/* Copyright (C) 2004 by Daniel Stenberg et al
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#else
|
||||
/* simple work-around for now, for systems without configure support */
|
||||
#define ssize_t int
|
||||
#endif
|
||||
|
||||
/* Recent autoconf versions define these symbols in config.h. We don't want
|
||||
them (since they collide with the libcurl ones when we build
|
||||
--enable-debug) so we undef them again here. */
|
||||
#undef PACKAGE_STRING
|
||||
#undef PACKAGE_TARNAME
|
||||
#undef PACKAGE_VERSION
|
||||
#undef PACKAGE_BUGREPORT
|
||||
#undef PACKAGE_NAME
|
||||
#undef VERSION
|
||||
#undef PACKAGE
|
||||
|
||||
/* now typedef our socket type */
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
typedef SOCKET ares_socket_t;
|
||||
#define ARES_SOCKET_BAD INVALID_SOCKET
|
||||
#else
|
||||
typedef int ares_socket_t;
|
||||
#define ARES_SOCKET_BAD -1
|
||||
#endif
|
||||
|
||||
#endif /* ARES_SETUP_H */
|
@@ -1,7 +1,12 @@
|
||||
#include "setup.h"
|
||||
|
||||
#ifdef WIN32 /* only do the following on windows */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#include "nameser.h"
|
||||
|
||||
@@ -26,8 +31,8 @@ ares_strcasecmp(const char *a, const char *b)
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ares_gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
int
|
||||
ares_gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
LARGE_INTEGER li;
|
||||
@@ -40,24 +45,47 @@ ares_gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||
li.LowPart = ft.dwLowDateTime;
|
||||
li.HighPart = ft.dwHighDateTime;
|
||||
t = li.QuadPart; /* In 100-nanosecond intervals */
|
||||
//t -= EPOCHFILETIME; /* Offset to the Epoch time */
|
||||
#if 0
|
||||
t -= EPOCHFILETIME; /* Offset to the Epoch time */
|
||||
#endif
|
||||
t /= 10; /* In microseconds */
|
||||
tv->tv_sec = (long)(t / 1000000);
|
||||
tv->tv_usec = (long)(t % 1000000);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
tz->tz_minuteswest = _timezone / 60;
|
||||
tz->tz_dsttime = _daylight;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
ares_writev (SOCKET s, const struct iovec *vector, size_t count)
|
||||
{
|
||||
char *buffer, *bp;
|
||||
size_t i, bytes = 0;
|
||||
|
||||
/* Find the total number of bytes to write
|
||||
*/
|
||||
for (i = 0; i < count; i++)
|
||||
bytes += vector[i].iov_len;
|
||||
|
||||
if (bytes == 0) /* not an error */
|
||||
return (0);
|
||||
|
||||
/* Allocate a temporary buffer to hold the data
|
||||
*/
|
||||
buffer = bp = (char*) alloca (bytes);
|
||||
if (!buffer)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* Copy the data into buffer.
|
||||
*/
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
memcpy (bp, vector[i].iov_base, vector[i].iov_len);
|
||||
bp += vector[i].iov_len;
|
||||
}
|
||||
return send (s, (const void*)buffer, bytes, 0);
|
||||
}
|
||||
#endif /* WIN32 builds only */
|
||||
|
33
configure.ac
33
configure.ac
@@ -4,7 +4,7 @@ dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ(2.57)
|
||||
|
||||
dnl We don't know the version number "staticly" so we use a dash here
|
||||
AC_INIT(curl, [-], [curl-bug@haxx.se])
|
||||
AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
|
||||
|
||||
dnl configure script copyright
|
||||
AC_COPYRIGHT([Copyright (c) 1998 - 2004 Daniel Stenberg, <daniel@haxx.se>
|
||||
@@ -87,7 +87,7 @@ dnl check for cygwin stuff
|
||||
AC_LIBTOOL_WIN32_DLL
|
||||
|
||||
dnl libtool setup
|
||||
AM_PROG_LIBTOOL
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_MSG_CHECKING([if we need -no-undefined])
|
||||
case $host in
|
||||
@@ -560,7 +560,7 @@ then
|
||||
AC_CHECK_HEADERS(krb.h)
|
||||
|
||||
dnl we found the required libraries, add to LIBS
|
||||
LIBS="-lkrb -ldes $LIBS"
|
||||
LIBS="-lkrb -lcom_err -ldes $LIBS"
|
||||
|
||||
dnl Check for function krb_get_our_ip_for_realm
|
||||
dnl this is needed for NAT networks
|
||||
@@ -1014,7 +1014,7 @@ else
|
||||
CURL_CHECK_GETHOSTBYNAME_R()
|
||||
|
||||
dnl dig around for gethostbyaddr_r()
|
||||
CURL_CHECK_GETHOSTBYADDR_R()
|
||||
dnl CURL_CHECK_GETHOSTBYADDR_R()
|
||||
fi
|
||||
|
||||
dnl poke around for inet_ntoa_r()
|
||||
@@ -1201,6 +1201,31 @@ if test "$ac_cv_func_sigsetjmp" != "yes"; then
|
||||
)
|
||||
fi
|
||||
|
||||
dnl poll() might be badly emulated, as in Mac OS X 10.3 (and other BSDs?) and
|
||||
dnl to find out we make an extra check here!
|
||||
if test "$ac_cv_func_poll" = "yes"; then
|
||||
AC_MSG_CHECKING([if poll works with NULL inputs])
|
||||
AC_RUN_IFELSE([
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* make this return 0 == timeout since there's nothing to read from */
|
||||
return poll((void *)0, 0, 10 /*ms*/);
|
||||
}
|
||||
],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll]),
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(cross-compiling assumes yes)
|
||||
AC_DEFINE(HAVE_POLL_FINE, 1, [If you have a fine poll])
|
||||
) dnl end of AC_RUN_IFELSE
|
||||
fi
|
||||
|
||||
|
||||
|
||||
AC_PATH_PROG( PERL, perl, ,
|
||||
$PATH:/usr/local/bin/perl:/usr/bin/:/usr/local/bin )
|
||||
AC_SUBST(PERL)
|
||||
|
@@ -28,7 +28,7 @@
|
||||
(setq tab-width 8
|
||||
indent-tabs-mode nil ; Use spaces. Not tabs.
|
||||
comment-column 40
|
||||
c-font-lock-extra-types (append '("bool" "CURL" "CURLcode" "ssize_t" "size_t" "socklen_t" "fd_set" "time_t" "curl_off_t" "curl_socket_t" "in_addr_t" "CURLSHcode" "CURLMcode"))
|
||||
c-font-lock-extra-types (append '("bool" "CURL" "CURLcode" "ssize_t" "size_t" "socklen_t" "fd_set" "time_t" "curl_off_t" "curl_socket_t" "in_addr_t" "CURLSHcode" "CURLMcode" "Curl_addrinfo"))
|
||||
)
|
||||
;; keybindings for C, C++, and Objective-C. We can put these in
|
||||
;; c-mode-base-map because of inheritance ...
|
||||
|
90
docs/FAQ
90
docs/FAQ
@@ -1,4 +1,4 @@
|
||||
Updated: March 16, 2004 (http://curl.haxx.se/docs/faq.html)
|
||||
Updated: August 10, 2004 (http://curl.haxx.se/docs/faq.html)
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
@@ -19,8 +19,8 @@ FAQ
|
||||
|
||||
2. Install Related Problems
|
||||
2.1 configure doesn't find OpenSSL even when it is installed
|
||||
2.1.1. native linker doesn't find OpenSSL
|
||||
2.1.2. only the libssl lib is missing
|
||||
2.1.1 native linker doesn't find OpenSSL
|
||||
2.1.2 only the libssl lib is missing
|
||||
2.2 Does curl work/build with other SSL libraries?
|
||||
2.3 Where can I find a copy of LIBEAY32.DLL?
|
||||
2.4 Does cURL support Socks (RFC 1928) ?
|
||||
@@ -70,6 +70,7 @@ FAQ
|
||||
5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ?
|
||||
5.6 What about Keep-Alive or persistent connections?
|
||||
5.7 Link errors when building libcurl on Windows!
|
||||
5.8 libcurl.so.3: open failed: No such file or directory
|
||||
|
||||
6. License Issues
|
||||
6.1 I have a GPL program, can I use the libcurl library?
|
||||
@@ -223,11 +224,11 @@ FAQ
|
||||
|
||||
2. Install Related Problems
|
||||
|
||||
2.1. configure doesn't find OpenSSL even when it is installed
|
||||
2.1 configure doesn't find OpenSSL even when it is installed
|
||||
|
||||
This may be because of several reasons.
|
||||
|
||||
2.1.1. native linker doesn't find openssl
|
||||
2.1.1 native linker doesn't find openssl
|
||||
|
||||
Affected platforms:
|
||||
Solaris (native cc compiler)
|
||||
@@ -249,7 +250,7 @@ FAQ
|
||||
|
||||
Solution submitted by: Bob Allison <allisonb@users.sourceforge.net>
|
||||
|
||||
2.1.2. only the libssl lib is missing
|
||||
2.1.2 only the libssl lib is missing
|
||||
|
||||
If all include files and the libcrypto lib is present, with only the
|
||||
libssl being missing according to configure, this is mostly likely because
|
||||
@@ -262,14 +263,14 @@ FAQ
|
||||
configure. Make sure that you remove the config.cache file before you
|
||||
rerun configure with the new flags.
|
||||
|
||||
2.2. Does curl work/build with other SSL libraries?
|
||||
2.2 Does curl work/build with other SSL libraries?
|
||||
|
||||
Curl has been written to use OpenSSL, although there should not be much
|
||||
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
|
||||
patch!
|
||||
|
||||
2.3. Where can I find a copy of LIBEAY32.DLL?
|
||||
2.3 Where can I find a copy of LIBEAY32.DLL?
|
||||
|
||||
That is an OpenSSL binary built for Windows.
|
||||
|
||||
@@ -278,14 +279,14 @@ FAQ
|
||||
accurate and up-to-date pointers to recent OpenSSL DLLs and other binary
|
||||
packages.
|
||||
|
||||
2.4. Does cURL support Socks (RFC 1928) ?
|
||||
2.4 Does cURL support Socks (RFC 1928) ?
|
||||
|
||||
Yes, SOCKS5 is supported when curl is built with IPv6 support disabled.
|
||||
Yes, SOCKS5 is supported.
|
||||
|
||||
|
||||
3. Usage problems
|
||||
|
||||
3.1. curl: (1) SSL is disabled, https: not supported
|
||||
3.1 curl: (1) SSL is disabled, https: not supported
|
||||
|
||||
If you get this output when trying to get anything from a https:// server,
|
||||
it means that the configure script couldn't find all libs and include files
|
||||
@@ -300,13 +301,13 @@ FAQ
|
||||
Also, check out the other paragraph in this FAQ labeled "configure doesn't
|
||||
find OpenSSL even when it is installed".
|
||||
|
||||
3.2. How do I tell curl to resume a transfer?
|
||||
3.2 How do I tell curl to resume a transfer?
|
||||
|
||||
Curl supports resumed transfers both ways on both FTP and HTTP.
|
||||
|
||||
Try the -C option.
|
||||
|
||||
3.3. Why doesn't my posting using -F work?
|
||||
3.3 Why doesn't my posting using -F work?
|
||||
|
||||
You can't simply use -F or -d at your choice. The web server that will
|
||||
receive your post assumes one of the formats. If the form you're trying to
|
||||
@@ -320,7 +321,7 @@ FAQ
|
||||
through the mailing list archives for old postings and questions regarding
|
||||
this.
|
||||
|
||||
3.4. How do I tell curl to run custom FTP commands?
|
||||
3.4 How do I tell curl to run custom FTP commands?
|
||||
|
||||
You can tell curl to perform optional commands both before and/or after a
|
||||
file transfer. Study the -Q/--quote option.
|
||||
@@ -329,13 +330,13 @@ FAQ
|
||||
FTP commands without transferring anything. Therefore you must always specify
|
||||
a URL to transfer to/from even when doing custom FTP commands.
|
||||
|
||||
3.5. How can I disable the Pragma: nocache header?
|
||||
3.5 How can I disable the Pragma: nocache header?
|
||||
|
||||
You can change all internally generated headers by adding a replacement with
|
||||
the -H/--header option. By adding a header with empty contents you safely
|
||||
disable that one. Use -H "Pragma:" to disable that specific header.
|
||||
|
||||
3.6. Does curl support ASP, XML, XHTML or HTML version Y?
|
||||
3.6 Does curl support ASP, XML, XHTML or HTML version Y?
|
||||
|
||||
To curl, all contents are alike. It doesn't matter how the page was
|
||||
generated. It may be ASP, PHP, Perl, shell-script, SSI or plain
|
||||
@@ -344,7 +345,7 @@ FAQ
|
||||
|
||||
See also item 3.14 regarding javascript.
|
||||
|
||||
3.7. Can I use curl to delete/rename a file through FTP?
|
||||
3.7 Can I use curl to delete/rename a file through FTP?
|
||||
|
||||
Yes. You specify custom FTP commands with -Q/--quote.
|
||||
|
||||
@@ -456,15 +457,16 @@ FAQ
|
||||
3.15 Can I do recursive fetches with curl?
|
||||
|
||||
No. curl itself has no code that performs recursive operations, such as
|
||||
those performed by wget.
|
||||
those performed by wget and similar tools.
|
||||
|
||||
There exist wrapper scripts with that functionality (for example the
|
||||
curlmirror perl script), and you can write programs based on libcurl to do
|
||||
it, but the command line tool curl itself cannot.
|
||||
|
||||
|
||||
4. Running Problems
|
||||
|
||||
4.1. Problems connecting to SSL servers.
|
||||
4.1 Problems connecting to SSL servers.
|
||||
|
||||
It took a very long time before we could sort out why curl had problems to
|
||||
connect to certain SSL servers when using SSLeay or OpenSSL v0.9+. The
|
||||
@@ -479,7 +481,7 @@ FAQ
|
||||
There have also been examples where the remote server didn't like the SSLv2
|
||||
request and instead you had to force curl to use SSLv3 with -3/--sslv3.
|
||||
|
||||
4.2. Why do I get problems when I use & or % in the URL?
|
||||
4.2 Why do I get problems when I use & or % in the URL?
|
||||
|
||||
In general unix shells, the & letter is treated special and when used, it
|
||||
runs the specified command in the background. To safely send the & as a part
|
||||
@@ -497,7 +499,7 @@ FAQ
|
||||
pass in a POST using -d/--data you must encode it as '%25' (which then also
|
||||
needs the %-letter doubled on Windows machines).
|
||||
|
||||
4.3. How can I use {, }, [ or ] to specify multiple URLs?
|
||||
4.3 How can I use {, }, [ or ] to specify multiple URLs?
|
||||
|
||||
Because those letters have a special meaning to the shell, and to be used in
|
||||
a URL specified to curl you must quote them.
|
||||
@@ -511,7 +513,7 @@ FAQ
|
||||
|
||||
curl -g 'www.site.com/weirdname[].html'
|
||||
|
||||
4.4. Why do I get downloaded data even though the web page doesn't exist?
|
||||
4.4 Why do I get downloaded data even though the web page doesn't exist?
|
||||
|
||||
Curl asks remote servers for the page you specify. If the page doesn't exist
|
||||
at the server, the HTTP protocol defines how the server should respond and
|
||||
@@ -562,14 +564,14 @@ FAQ
|
||||
slash. Try the same operation again _with_ the trailing URL, or use the
|
||||
-L/--location option to follow the redirection.
|
||||
|
||||
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
|
||||
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
|
||||
ahead and repeat this!
|
||||
|
||||
4.7. How do I keep user names and passwords secret in Curl command lines?
|
||||
4.7 How do I keep user names and passwords secret in Curl command lines?
|
||||
|
||||
This problem has two sides:
|
||||
|
||||
@@ -603,7 +605,7 @@ FAQ
|
||||
If there is a bug, read the BUGS document first. Then report it as described
|
||||
in there.
|
||||
|
||||
4.9. Curl can't authenticate to the server that requires NTLM?
|
||||
4.9 Curl can't authenticate to the server that requires NTLM?
|
||||
|
||||
This is supported in curl 7.10.6 or later. No earlier curl version knows
|
||||
of this magic.
|
||||
@@ -651,9 +653,10 @@ FAQ
|
||||
Details are also in the SSLCERTS file in the release archives, found online
|
||||
here: http://curl.haxx.se/docs/sslcerts.html
|
||||
|
||||
|
||||
5. libcurl Issues
|
||||
|
||||
5.1. Is libcurl thread-safe?
|
||||
5.1 Is libcurl thread-safe?
|
||||
|
||||
Yes.
|
||||
|
||||
@@ -687,7 +690,7 @@ FAQ
|
||||
size_t
|
||||
WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data)
|
||||
{
|
||||
register int realsize = size * nmemb;
|
||||
size_t realsize = size * nmemb;
|
||||
struct MemoryStruct *mem = (struct MemoryStruct *)data;
|
||||
|
||||
mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1);
|
||||
@@ -743,6 +746,27 @@ FAQ
|
||||
|
||||
(Provided by Andrew Francis)
|
||||
|
||||
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
|
||||
with a shared version of libcurl and your run-time linker (ld.so) couldn't
|
||||
find the shared library named libcurl.so.3.
|
||||
|
||||
You need to make sure that ld.so finds libcurl.so.3. You can do that
|
||||
multiple ways, and it differs somewhat between different operating systems,
|
||||
but they are usually:
|
||||
|
||||
* Add an option to the linker command line that specify the hard-coded path
|
||||
the run-time linker should check for the lib (usually -R)
|
||||
|
||||
* Set an environment variable (LD_LIBRARY_PATH for example) where ld.so
|
||||
should check for libs
|
||||
|
||||
* Adjust the system's config to check for libs in the directory where you've
|
||||
put the dir (like Linux's /etc/ld.so.conf)
|
||||
|
||||
'man ld.so' and 'man ld' will tell you more details
|
||||
|
||||
|
||||
6. License Issues
|
||||
|
||||
@@ -751,32 +775,32 @@ FAQ
|
||||
is just a brief summary for the cases we get the most questions. (Parts of
|
||||
this section was much enhanced by Bjorn Reese.)
|
||||
|
||||
6.1. I have a GPL program, can I use the libcurl library?
|
||||
6.1 I have a GPL program, can I use the libcurl library?
|
||||
|
||||
Yes!
|
||||
|
||||
Since libcurl may be distributed under the MIT/X derivate license, it can be
|
||||
used together with GPL in any software.
|
||||
|
||||
6.2. I have a closed-source program, can I use the libcurl library?
|
||||
6.2 I have a closed-source program, can I use the libcurl library?
|
||||
|
||||
Yes!
|
||||
|
||||
libcurl does not put any restrictions on the program that uses the library.
|
||||
|
||||
6.3. I have a BSD licensed program, can I use the libcurl library?
|
||||
6.3 I have a BSD licensed program, can I use the libcurl library?
|
||||
|
||||
Yes!
|
||||
|
||||
libcurl does not put any restrictions on the program that uses the library.
|
||||
|
||||
6.4. I have a program that uses LGPL libraries, can I use libcurl?
|
||||
6.4 I have a program that uses LGPL libraries, can I use libcurl?
|
||||
|
||||
Yes!
|
||||
|
||||
The LGPL license doesn't clash with other licenses.
|
||||
|
||||
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?
|
||||
|
||||
Yes!
|
||||
|
||||
@@ -784,7 +808,7 @@ FAQ
|
||||
the sources, on the condition that the copyright texts in the sources are
|
||||
left intact.
|
||||
|
||||
6.6. Can you please change the curl/libcurl license to XXXX?
|
||||
6.6 Can you please change the curl/libcurl license to XXXX?
|
||||
|
||||
No.
|
||||
|
||||
|
11
docs/HISTORY
11
docs/HISTORY
@@ -128,3 +128,14 @@ December 2003, full-fledged SSL for FTP is supported.
|
||||
January 2004: curl 7.11.0 introduced large file support.
|
||||
|
||||
June 2004: curl 7.12.0 introduced IDN support. 10 official web mirrors.
|
||||
|
||||
August 2004:
|
||||
Curl and libcurl 7.12.1
|
||||
|
||||
Public curl release number: 82
|
||||
Releases counted from the very beginning: 109
|
||||
Available command line options: 96
|
||||
Available curl_easy_setopt() options: 120
|
||||
Number of public functions in libcurl: 36
|
||||
Amount of public web site mirrors: 12
|
||||
Number of known libcurl bindings: 26
|
||||
|
95
docs/INSTALL
95
docs/INSTALL
@@ -189,28 +189,33 @@ Win32
|
||||
Microsoft command line style
|
||||
----------------------------
|
||||
|
||||
Run the 'vcvars32.bat' file to get a proper environment. The
|
||||
vcvars32.bat file is part of the Microsoft development environment and
|
||||
you may find it in 'C:\Program Files\Microsoft Visual Studio\vc98\bin'
|
||||
provided that you installed Visual C/C++ 6 in the default directory.
|
||||
|
||||
Then run 'nmake vc' in curl's root directory.
|
||||
|
||||
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
|
||||
documentation on how to compile zlib. Define the ZLIB_PATH environment
|
||||
variable to the location of zlib.h and zlib.lib, for example:
|
||||
|
||||
set ZLIB_PATH=c:\zlib-1.2.1
|
||||
|
||||
Then run 'nmake vc-zlib' in curl's root directory.
|
||||
|
||||
If you want to compile with SSL support you need the OpenSSL package.
|
||||
Please read the OpenSSL documentation on how to compile and install
|
||||
the OpenSSL libraries. The build process of OpenSSL generates the
|
||||
libeay32.dll and ssleay32.dll files in the out32dll subdirectory in
|
||||
the OpenSSL home directory. OpenSSL static libraries (libeay32.lib,
|
||||
ssleay32.lib, RSAglue.lib) are created in the out32 subdirectory.
|
||||
|
||||
Run the 'vcvars32.bat' file to get a proper environment. The
|
||||
vcvars32.bat file is part of the Microsoft development environment and
|
||||
you may find it in 'C:\Program Files\Microsoft Visual Studio\vc98\bin'
|
||||
provided that you installed Visual C/C++ 6 in the default directory.
|
||||
|
||||
Before running nmake define the OPENSSL_PATH environment variable with
|
||||
the root/base directory of OpenSSL, for example:
|
||||
|
||||
set OPENSSL_PATH=c:\openssl-0.9.7a
|
||||
|
||||
lib/Makefile.vc6 depends on zlib (http://www.gzip.org/zlib/) as well.
|
||||
Please read the zlib documentation on how to compile zlib. Define the
|
||||
ZLIB_PATH environment variable to the location of zlib.h and zlib.lib,
|
||||
for example:
|
||||
|
||||
set ZLIB_PATH=c:\zlib-1.1.4
|
||||
set OPENSSL_PATH=c:\openssl-0.9.7d
|
||||
|
||||
Then run 'nmake vc-ssl' or 'nmake vc-ssl-dll' in curl's root
|
||||
directory. 'nmake vc-ssl' will create a libcurl static and dynamic
|
||||
@@ -219,10 +224,11 @@ Win32
|
||||
version is a standalone executable not requiring any DLL at
|
||||
runtime. This make method requires that you have the static OpenSSL
|
||||
libraries available in OpenSSL's out32 subdirectory.
|
||||
'nmake vc-ssl-dll' creates the libcurl dynamic library and
|
||||
links curl.exe against libcurl and OpenSSL dynamically.
|
||||
This executable requires libcurl.dll and the OpenSSL DLLs
|
||||
at runtime.
|
||||
'nmake vc-ssl-dll' creates the libcurl dynamic library and
|
||||
links curl.exe against libcurl and OpenSSL dynamically.
|
||||
This executable requires libcurl.dll and the OpenSSL DLLs
|
||||
at runtime.
|
||||
Run 'nmake vc-ssl-zlib' to build with both ssl and zlib support.
|
||||
|
||||
Microsoft / Borland style
|
||||
-------------------------
|
||||
@@ -361,12 +367,12 @@ VMS
|
||||
the name can be fetched from external or internal message libraries
|
||||
Errorcode - the errodes assigned by the application
|
||||
Sev. - severity: Even = error, off = non error
|
||||
0 = Warning
|
||||
1 = Success
|
||||
2 = Error
|
||||
3 = Information
|
||||
4 = Fatal
|
||||
<5-7> reserved.
|
||||
0 = Warning
|
||||
1 = Success
|
||||
2 = Error
|
||||
3 = Information
|
||||
4 = Fatal
|
||||
<5-7> reserved.
|
||||
|
||||
This all presents itself with:
|
||||
%<FACILITY>-<SeV>-<Errorname>, <Error message>
|
||||
@@ -379,7 +385,7 @@ VMS
|
||||
|
||||
This was all compiled with:
|
||||
|
||||
Compaq C V6.2-003 on OpenVMS Alpha V7.1-1H2
|
||||
Compaq C V6.2-003 on OpenVMS Alpha V7.1-1H2
|
||||
|
||||
So far for porting notes as of:
|
||||
13-jul-2001
|
||||
@@ -472,6 +478,39 @@ AmigaOS
|
||||
you can find a precompiled package at http://amiga.sourceforge.net/OpenSSL/
|
||||
|
||||
|
||||
NetWare
|
||||
=======
|
||||
|
||||
To compile curl.nlm / libcurl.nlm you need:
|
||||
- either any gcc / nlmconv, or CodeWarrior 7 PDK 4 or later.
|
||||
- gnu make and awk running on the platform you compile on;
|
||||
native Win32 versions can be downloaded from:
|
||||
http://www.gknw.com/development/prgtools/
|
||||
- recent Novell LibC SDK availabable from:
|
||||
http://developer.novell.com/ndk/libc.htm
|
||||
- optional zlib sources (at the moment only dynamic linking with zlib.imp);
|
||||
sources with NetWare Makefile can be optained from:
|
||||
http://www.gknw.com/mirror/zlib/
|
||||
|
||||
Set a search path to your compiler, linker and tools; if you want to have
|
||||
zlib support then set the environment var ZLIB_PATH pointing to your zlib
|
||||
sources, on Linux make sure the var OSTYPE contains the string 'linux';
|
||||
and finally type 'make netware' from the top source directory...
|
||||
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
|
||||
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!
|
||||
Buils automatically created 4 times a day from current CVS are here:
|
||||
http://www.gknw.com/mirror/curl/autobuilds/
|
||||
the status of these buids can be viewed at the autobuild table:
|
||||
http://curl.haxx.se/auto/
|
||||
|
||||
|
||||
PORTS
|
||||
=====
|
||||
This is a probably incomplete list of known hardware and operating systems
|
||||
@@ -549,3 +588,11 @@ OpenLDAP
|
||||
|
||||
http://www.openldap.org
|
||||
|
||||
Zlib
|
||||
====
|
||||
|
||||
You'll find Zlib information at:
|
||||
|
||||
http://www.gzip.org/zlib/
|
||||
|
||||
|
||||
|
@@ -3,6 +3,11 @@ join in and help us correct one or more of these! Also be sure to check the
|
||||
changelog of the current development status, as one or more of these problems
|
||||
may have been fixed since this was written!
|
||||
|
||||
* 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
|
||||
wrongly only considers authentication if there's a user name provided.
|
||||
Bug report #1004841.
|
||||
|
||||
* If you use a very large amount of file descriptors (more than FD_SETSIZE)
|
||||
and then use libcurl, it might crash on its use of select() which then
|
||||
stores data out of bounds. Bug report #948950.
|
||||
@@ -41,9 +46,6 @@ may have been fixed since this was written!
|
||||
|
||||
* GOPHER transfers seem broken
|
||||
|
||||
* configure --disable-http is not fully supported. All other protocols seem
|
||||
to work to disable.
|
||||
|
||||
* If a HTTP server responds to a HEAD request and includes a body (thus
|
||||
violating the RFC2616), curl won't wait to read the response but just stop
|
||||
reading and return back. If a second request (let's assume a GET) is then
|
||||
|
@@ -17,7 +17,7 @@ CLEANFILES = $(GENHTMLPAGES) $(PDFPAGES)
|
||||
EXTRA_DIST = MANUAL BUGS CONTRIBUTE FAQ FEATURES INTERNALS SSLCERTS \
|
||||
README.win32 RESOURCES TODO TheArtOfHttpScripting THANKS VERSIONS \
|
||||
KNOWN_BUGS BINDINGS $(man_MANS) $(HTMLPAGES) HISTORY INSTALL \
|
||||
$(PDFPAGES) LICENSE-MIXING
|
||||
$(PDFPAGES) LICENSE-MIXING README.netware
|
||||
|
||||
MAN2HTML= roffit < $< >$@
|
||||
|
||||
|
27
docs/README.netware
Normal file
27
docs/README.netware
Normal file
@@ -0,0 +1,27 @@
|
||||
_ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
README.netware
|
||||
|
||||
Read the README file first.
|
||||
|
||||
Curl has been successfully compiled with gcc / nlmconv on different flavours
|
||||
of Linux as well as with the official Metrowerks CodeWarrior compiler.
|
||||
While not being the main development target, a continously growing share of
|
||||
curl users are NetWare-based, specially also consuming the lib from PHP.
|
||||
|
||||
The unix-style man pages are tricky to read on windows, so therefore are all
|
||||
those pages converted to HTML as well as pdf, and included in the release
|
||||
archives.
|
||||
|
||||
The main curl.1 man page is also "built-in" in the command line tool. Use a
|
||||
command line similar to this in order to extract a separate text file:
|
||||
|
||||
curl -M >manual.txt
|
||||
|
||||
Read the INSTALL file for instructions how to compile curl self.
|
||||
|
||||
|
@@ -1,32 +1,30 @@
|
||||
Peer SSL Certificate Verification
|
||||
=================================
|
||||
|
||||
Since version 7.10, libcurl performs peer SSL certificate verification by
|
||||
default. This is done by installing a default CA cert bundle on 'make install'
|
||||
(or similar), that CA bundle package is used by default on operations against
|
||||
SSL servers.
|
||||
libcurl performs peer SSL certificate verification by default. This is done by
|
||||
installing a default CA cert bundle on 'make install' (or similar), that CA
|
||||
bundle package is used by default on operations against SSL servers.
|
||||
|
||||
Alas, if you communicate with HTTPS servers using certificates that are signed
|
||||
by CAs present in the bundle, you will not notice any changed behavior and you
|
||||
will seamlessly get a higher security level on your SSL connections since you
|
||||
can be sure that the remote server really is the one it claims to be.
|
||||
If you communicate with HTTPS or FTPS servers using certificates that are
|
||||
signed by CAs present in the bundle, you can be sure that the remote server
|
||||
really is the one it claims to be.
|
||||
|
||||
If the remote server uses a self-signed certificate, if you don't install
|
||||
curl's CA cert bundle, if the server uses a certificate signed by a CA that
|
||||
isn't included in the bundle or if the remoste host is an imposter
|
||||
impersonating your favourite site, and you want to transfer files from this
|
||||
isn't included in the bundle or if the remote host is an impostor
|
||||
impersonating your favorite site, and you want to transfer files from this
|
||||
server, do one of the following:
|
||||
|
||||
1. Tell libcurl to *not* verify the peer. With libcurl you disable with with
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
|
||||
With the curl command tool, you disable this with -k/--insecure.
|
||||
With the curl command line tool, you disable this with -k/--insecure.
|
||||
|
||||
2. Get a CA certificate that can verify the remote server and use the proper
|
||||
option to point out this CA cert for verification when connecting. For
|
||||
libcurl hackers: curl_easy_setopt(curl, CURLOPT_CAPATH, capath);
|
||||
|
||||
With the curl command tool: --cacert [file]
|
||||
With the curl command line tool: --cacert [file]
|
||||
|
||||
3. Add the CA cert for your server to the existing default CA cert bundle.
|
||||
The default path of the CA bundle installed with the curl package is:
|
||||
@@ -34,8 +32,27 @@ server, do one of the following:
|
||||
configure with the --with-ca-bundle option pointing out the path of your
|
||||
choice.
|
||||
|
||||
Neglecting to use one of the above menthods when dealing with a server using a
|
||||
certficate that isn't signed by one of the certficates in the installed CA
|
||||
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
|
||||
of your choice.
|
||||
|
||||
If you're using the curl command line tool on Windows, curl will search
|
||||
for a CA cert file named "curl-ca-bundle.crt" in these directories and in
|
||||
this order:
|
||||
1. application's directory
|
||||
2. current working directory
|
||||
3. Windows System directory (e.g. C:\windows\system32)
|
||||
4. Windows Directory (e.g. C:\windows)
|
||||
5. all directories along %PATH%
|
||||
|
||||
4. 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
|
||||
here:
|
||||
|
||||
http://curl.haxx.se/docs/caextract.html
|
||||
|
||||
Neglecting to use one of the above methods when dealing with a server using a
|
||||
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")
|
||||
during the handshake and SSL will then refuse further communication with that
|
||||
server.
|
||||
@@ -45,4 +62,3 @@ 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.
|
||||
|
||||
|
23
docs/TODO
23
docs/TODO
@@ -36,10 +36,6 @@ TODO
|
||||
* Option to set the SO_KEEPALIVE socket option to make libcurl notice and
|
||||
disconnect very long time idle connections.
|
||||
|
||||
* When posting multipart forms, we should _not_ create the whole data chunk
|
||||
in memory before the upload starts but do it in a "streaming" manner to
|
||||
allow uploads that are way larger than the amount of system memory.
|
||||
|
||||
LIBCURL - multi interface
|
||||
|
||||
* Add curl_multi_timeout() to make libcurl's ares-functionality better.
|
||||
@@ -61,6 +57,10 @@ TODO
|
||||
|
||||
FTP
|
||||
|
||||
* Support GSS/Kerberos 5 for ftp file transfer. This will allow user
|
||||
authentication and file encryption. Possible libraries and example clients
|
||||
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.
|
||||
|
||||
@@ -89,9 +89,6 @@ TODO
|
||||
|
||||
HTTP
|
||||
|
||||
* GSS-Negotiate support for HTTP proxies. They only work on direct
|
||||
connections to the server.
|
||||
|
||||
* Pipelining. Sending multiple requests before the previous one(s) are done.
|
||||
This could possibly be implemented using the multi interface to queue
|
||||
requests and the response data.
|
||||
@@ -182,14 +179,14 @@ TODO
|
||||
http://curl.haxx.se/mail/archive-2003-11/0091.html (Kevin Roth suggested)
|
||||
|
||||
* Provide a way to make options bound to a specific URL among several on the
|
||||
command line. Possibly by adding a new option that separates options
|
||||
between URLs, similar to this:
|
||||
command line. Possibly by letting ':' separate options between URLs,
|
||||
similar to this:
|
||||
|
||||
curl --data foo --url url.com --optionseparator
|
||||
--url url2.com --optionseparator \
|
||||
curl --data foo --url url.com :
|
||||
--url url2.com : \
|
||||
--url url3.com --data foo3
|
||||
|
||||
(--optionseparator used to show my point, it would need a better name)
|
||||
(More details: http://curl.haxx.se/mail/archive-2004-07/0133.html)
|
||||
|
||||
The example would do a POST-GET-POST combination on a single command line.
|
||||
|
||||
@@ -222,6 +219,8 @@ TODO
|
||||
|
||||
* remove obsolete defines from curl/curl.h
|
||||
|
||||
* make several functions use size_t instead of int in their APIs
|
||||
|
||||
* remove the following functions from the public API:
|
||||
curl_getenv
|
||||
curl_mprintf (and variations)
|
||||
|
@@ -370,11 +370,11 @@ Version: 0.6
|
||||
|
||||
In the HTTPS world, you use certificates to validate that you are the one
|
||||
you you claim to be, as an addition to normal passwords. Curl supports
|
||||
client-side certificates. All certificates are locked with a PIN-code, why
|
||||
you need to enter the unlock-code before the certificate can be used by
|
||||
curl. The PIN-code can be specified on the command line or if not, entered
|
||||
interactively when curl queries for it. Use a certificate with curl on a
|
||||
HTTPS server like:
|
||||
client-side certificates. All certificates are locked with a pass phrase,
|
||||
which you need to enter before the certificate can be used by curl. The pass
|
||||
phrase can be specified on the command line or if not, entered interactively
|
||||
when curl queries for it. Use a certificate with curl on a HTTPS server
|
||||
like:
|
||||
|
||||
curl -E mycert.pem https://that.secure.server.com
|
||||
|
||||
|
13
docs/curl.1
13
docs/curl.1
@@ -662,13 +662,12 @@ instead of PORT by using \fI--disable-eprt\fP. EPRT is really PORT++.
|
||||
If used as the first parameter on the command line, the \fI$HOME/.curlrc\fP
|
||||
file will not be read and used as a config file.
|
||||
.IP "-Q/--quote <comand>"
|
||||
(FTP) Send an arbitrary command to the remote FTP server, by using the QUOTE
|
||||
command of the server. Not all servers support this command, and the set of
|
||||
QUOTE commands are server specific! Quote commands are sent BEFORE the
|
||||
transfer is taking place. To make commands take place after a successful
|
||||
transfer, prefix them with a dash '-'. You may specify any amount of commands
|
||||
to be run before and after the transfer. If the server returns failure for one
|
||||
of the commands, the entire operation will be aborted.
|
||||
(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
|
||||
successful transfer, prefix them with a dash '-'. You may specify any amount
|
||||
of commands to be run before and after the transfer. If the server returns
|
||||
failure for one of the commands, the entire operation will be aborted. You
|
||||
must send syntactically correct FTP commands as RFC959 defines.
|
||||
|
||||
This option can be used multiple times.
|
||||
.IP "--random-file <file>"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
include ../../packages/DOS/common.dj
|
||||
|
||||
CFLAGS += -I../../include
|
||||
CFLAGS += -I../../include -DFALSE=0 -DTRUE=1
|
||||
|
||||
LIBS = ../../lib/libcurl.a
|
||||
|
||||
@@ -15,14 +15,16 @@ endif
|
||||
|
||||
LIBS += $(WATT32_ROOT)/lib/libwatt.a $(ZLIB_ROOT)/libz.a
|
||||
|
||||
PROGRAMS = fopen.exe ftpget.exe ftpgetre.exe ftpuploa.exe getinmem.exe \
|
||||
http-pos.exe httpput.exe multi-ap.exe multi-do.exe \
|
||||
multi-po.exe multi-si.exe persista.exe post-cal.exe \
|
||||
postit2.exe sepheade.exe simple.exe simpless.exe
|
||||
PROGRAMS = fopen.exe ftpget.exe ftpgetresp.exe ftpupload.exe \
|
||||
getinmemory.exe http-post.exe httpput.exe multi-app.exe \
|
||||
multi-double.exe multi-post.exe multi-single.exe \
|
||||
persistant.exe post-callback.exe postit2.exe \
|
||||
sepheaders.exe simple.exe simplessl.exe https.exe \
|
||||
ftp3rdparty.exe getinfo.exe
|
||||
|
||||
all: $(PROGRAMS)
|
||||
|
||||
.c.exe:
|
||||
%.exe: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
|
||||
@echo
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,7 @@ man_MANS = curl_easy_cleanup.3 curl_easy_getinfo.3 curl_easy_init.3 \
|
||||
curl_share_init.3 curl_share_setopt.3 libcurl.3 libcurl-easy.3 \
|
||||
libcurl-multi.3 libcurl-share.3 libcurl-errors.3 curl_easy_strerror.3 \
|
||||
curl_multi_strerror.3 curl_share_strerror.3 curl_global_init_mem.3 \
|
||||
libcurl-tutorial.3
|
||||
libcurl-tutorial.3 curl_easy_reset.3
|
||||
|
||||
HTMLPAGES = curl_easy_cleanup.html curl_easy_getinfo.html \
|
||||
curl_easy_init.html curl_easy_perform.html curl_easy_setopt.html \
|
||||
@@ -32,7 +32,7 @@ HTMLPAGES = curl_easy_cleanup.html curl_easy_getinfo.html \
|
||||
libcurl.html libcurl-multi.html libcurl-easy.html libcurl-share.html \
|
||||
libcurl-errors.html curl_easy_strerror.html curl_multi_strerror.html \
|
||||
curl_share_strerror.html curl_global_init_mem.html \
|
||||
libcurl-tutorial.html
|
||||
libcurl-tutorial.html curl_easy_reset.html
|
||||
|
||||
PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \
|
||||
curl_easy_init.pdf curl_easy_perform.pdf curl_easy_setopt.pdf \
|
||||
@@ -47,7 +47,8 @@ PDFPAGES = curl_easy_cleanup.pdf curl_easy_getinfo.pdf \
|
||||
curl_share_init.pdf curl_share_setopt.pdf libcurl.pdf \
|
||||
libcurl-multi.pdf libcurl-easy.pdf libcurl-share.pdf \
|
||||
libcurl-errors.pdf curl_easy_strerror.pdf curl_multi_strerror.pdf \
|
||||
curl_share_strerror.pdf curl_global_init_mem.pdf libcurl-tutorial.pdf
|
||||
curl_share_strerror.pdf curl_global_init_mem.pdf libcurl-tutorial.pdf \
|
||||
curl_easy_reset.pdf
|
||||
|
||||
CLEANFILES = $(HTMLPAGES) $(PDFPAGES)
|
||||
|
||||
|
24
docs/libcurl/curl_easy_reset.3
Normal file
24
docs/libcurl/curl_easy_reset.3
Normal file
@@ -0,0 +1,24 @@
|
||||
.\" $Id$
|
||||
.\"
|
||||
.TH curl_easy_reset 3 "31 July 2004" "libcurl 7.12.1" "libcurl Manual"
|
||||
.SH NAME
|
||||
curl_easy_reset - reset all options of a libcurl session handle
|
||||
.SH SYNOPSIS
|
||||
.B #include <curl/curl.h>
|
||||
|
||||
.BI "void curl_easy_reset(CURL *"handle ");"
|
||||
|
||||
.SH DESCRIPTION
|
||||
Re-initializes all options previously set on a specified CURL handle to the
|
||||
default values. This puts back the handle to the same state as it was in when
|
||||
it was just created with \fIcurl_easy_init(3)\fP.
|
||||
|
||||
It does not change the following information kept in the handle: live
|
||||
connections, the Session ID cache, the DNS cache, the cookies and shares.
|
||||
|
||||
This function was added in libcurl 7.12.1.
|
||||
.SH RETURN VALUE
|
||||
Nothing
|
||||
.SH "SEE ALSO"
|
||||
.BR curl_easy_init "(3)," curl_easy_cleanup "(3)," curl_easy_setopt "(3)
|
||||
|
@@ -721,6 +721,8 @@ when doing an ftp directory listing. This is useful for doing DELETE or other
|
||||
more or less obscure HTTP requests. Don't do this at will, make sure your
|
||||
server supports the command first.
|
||||
|
||||
Restore to the internal default by setting this to NULL.
|
||||
|
||||
\fBNOTE:\fP Many people have wrongly used this option to replace the entire
|
||||
request with their own, including multiple headers and POST contents. While
|
||||
that might work in many cases, it will cause libcurl to send invalid requests
|
||||
|
@@ -24,6 +24,7 @@
|
||||
<br><a href="curl_easy_getinfo.html">curl_easy_getinfo</A>
|
||||
<br><a href="curl_easy_init.html">curl_easy_init</A>
|
||||
<br><a href="curl_easy_perform.html">curl_easy_perform</A>
|
||||
<br><a href="curl_easy_reset.html">curl_easy_reset</A>
|
||||
<br><a href="curl_easy_setopt.html">curl_easy_setopt</A>
|
||||
<br><a href="curl_easy_strerror.html">curl_easy_strerror</A>
|
||||
<br><a href="curl_escape.html">curl_escape</A>
|
||||
|
@@ -8,16 +8,11 @@ libcurl-multi \- how to use the multi interface
|
||||
.SH DESCRIPTION
|
||||
This is an overview on how to use the libcurl multi interface in your C
|
||||
programs. There are specific man pages for each function mentioned in
|
||||
here. There's also the \fIlibcurl-tutorial(3)f\P man page for a complete
|
||||
here. There's also the \fIlibcurl-tutorial(3)\fP man page for a complete
|
||||
tutorial to programming with libcurl and the \fIlibcurl-easy(3)\fP man page
|
||||
for an overview of the libcurl easy interface.
|
||||
|
||||
All functions in the multi interface are prefixed with curl_multi.
|
||||
.SH "PLEASE NOTICE"
|
||||
The multi interface is a rather new member of the libcurl family. It has not
|
||||
yet been very widely used. It may still be a few more bugs lurking in there
|
||||
than we are used to. That said, it might also just work in every aspect you
|
||||
try it. Please report all bugs and oddities you see.
|
||||
.SH "OBJECTIVES"
|
||||
The multi interface introduces several new abilities that the easy interface
|
||||
refuses to offer. They are mainly:
|
||||
|
@@ -188,24 +188,27 @@ similar to this:
|
||||
You can control what data your function get in the forth argument by setting
|
||||
another property:
|
||||
|
||||
curl_easy_setopt(easyhandle, CURLOPT_FILE, &internal_struct);
|
||||
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA, &internal_struct);
|
||||
|
||||
Using that property, you can easily pass local data between your application
|
||||
and the function that gets invoked by libcurl. libcurl itself won't touch the
|
||||
data you pass with CURLOPT_FILE.
|
||||
data you pass with CURLOPT_WRITEDATA.
|
||||
|
||||
libcurl offers its own default internal callback that'll take care of the data
|
||||
if you don't set the callback with CURLOPT_WRITEFUNCTION. It will then simply
|
||||
output the received data to stdout. You can have the default callback write
|
||||
the data to a different file handle by passing a 'FILE *' to a file opened for
|
||||
writing with the CURLOPT_FILE option.
|
||||
writing with the CURLOPT_WRITEDATA option.
|
||||
|
||||
Now, we need to take a step back and have a deep breath. Here's one of those
|
||||
rare platform-dependent nitpicks. Did you spot it? On some platforms[2],
|
||||
libcurl won't be able to operate on files opened by the program. Thus, if you
|
||||
use the default callback and pass in a an open file with CURLOPT_FILE, it will
|
||||
crash. You should therefore avoid this to make your program run fine virtually
|
||||
everywhere.
|
||||
use the default callback and pass in a an open file with CURLOPT_WRITEDATA, it
|
||||
will crash. You should therefore avoid this to make your program run fine
|
||||
virtually everywhere.
|
||||
|
||||
(CURLOPT_WRITEDATA was formerly known as CURLOPT_FILE. Both names still work
|
||||
and do the same thing).
|
||||
|
||||
There are of course many more options you can set, and we'll get back to a few
|
||||
of them later. Let's instead continue to the actual transfer:
|
||||
@@ -568,24 +571,20 @@ CURLOPT_PROGRESSDATA. libcurl won't touch it.
|
||||
There's basically only one thing to keep in mind when using C++ instead of C
|
||||
when interfacing libcurl:
|
||||
|
||||
"The Callbacks Must Be Plain C"
|
||||
The callbacks CANNOT be non-static class member functions
|
||||
|
||||
So if you want a write callback set in libcurl, you should put it within
|
||||
\&'extern'. Similar to this:
|
||||
Example C++ code:
|
||||
|
||||
.nf
|
||||
extern "C" {
|
||||
size_t write_data(void *ptr, size_t size, size_t nmemb,
|
||||
void *ourpointer)
|
||||
class AClass {
|
||||
static size_t write_data(void *ptr, size_t size, size_t nmemb,
|
||||
void *ourpointer)
|
||||
{
|
||||
/* do what you want with the data */
|
||||
}
|
||||
}
|
||||
.fi
|
||||
|
||||
This will of course effectively turn the callback code into C. There won't be
|
||||
any "this" pointer available etc.
|
||||
|
||||
.SH "Proxies"
|
||||
|
||||
What "proxy" means according to Merriam-Webster: "a person authorized to act
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#ifndef __CURL_EASY_H
|
||||
#define __CURL_EASY_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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.
|
||||
@@ -61,6 +61,19 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
|
||||
*/
|
||||
CURL* curl_easy_duphandle(CURL *curl);
|
||||
|
||||
/*
|
||||
* NAME curl_easy_reset()
|
||||
*
|
||||
* DESCRIPTION
|
||||
*
|
||||
* Re-initializes a CURL handle to the default values. This puts back the
|
||||
* handle to the same state as it was in when it was just created.
|
||||
*
|
||||
* It does keep: live connections, the Session ID cache, the DNS cache and the
|
||||
* cookies.
|
||||
*/
|
||||
void curl_easy_reset(CURL *curl);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -24,16 +24,16 @@ AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
DSP = curllib.dsp
|
||||
|
||||
EXTRA_DIST = getdate.y Makefile.b32 Makefile.b32.resp Makefile.m32 \
|
||||
EXTRA_DIST = getdate.y Makefile.b32 Makefile.m32 \
|
||||
Makefile.vc6 Makefile.riscos libcurl.def $(DSP) curllib.dsw \
|
||||
config-vms.h config-win32.h config-riscos.h config-mac.h config.h.in \
|
||||
ca-bundle.crt README.encoding README.memoryleak README.ares \
|
||||
README.curlx makefile.dj config.dj libcurl.framework.make \
|
||||
libcurl.plist libcurl.rc config-amigaos.h amigaos.c amigaos.h \
|
||||
makefile.amiga config-netware.h Makefile.netware nwlib.c libcurl.imp \
|
||||
makefile.amiga Makefile.netware nwlib.c libcurl.imp \
|
||||
msvcproj.head msvcproj.foot
|
||||
|
||||
CLEANFILES = $(DSP)
|
||||
CLEANFILES = $(DSP) getdate.c
|
||||
|
||||
lib_LTLIBRARIES = libcurl.la
|
||||
|
||||
@@ -85,24 +85,8 @@ endif
|
||||
|
||||
libcurl_la_LDFLAGS = $(UNDEF) $(VERSION) $(MIMPURE)
|
||||
|
||||
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
|
||||
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
|
||||
if2ip.h speedcheck.h urldata.h getdate.h ldap.h ssluse.h escape.h \
|
||||
telnet.h getinfo.h strequal.h security.h krb4.h memdebug.h \
|
||||
inet_ntoa_r.h http_chunks.h strtok.h connect.h llist.h hash.h \
|
||||
content_encoding.h share.h md5.h http_digest.h http_negotiate.h \
|
||||
http_ntlm.h ca-bundle.h inet_pton.h strtoofft.h strerror.h \
|
||||
inet_ntop.h curlx.h memory.h setup.h transfer.h
|
||||
|
||||
CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
|
||||
getdate.c ldap.c ssluse.c version.c getenv.c escape.c mprintf.c \
|
||||
telnet.c netrc.c getinfo.c transfer.c strequal.c easy.c security.c \
|
||||
krb4.c memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c \
|
||||
multi.c content_encoding.c share.c http_digest.c md5.c \
|
||||
http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \
|
||||
hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \
|
||||
inet_ntop.c
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
libcurl_la_SOURCES = $(CSOURCES) $(HHEADERS)
|
||||
|
||||
|
181
lib/Makefile.b32
181
lib/Makefile.b32
@@ -1,90 +1,91 @@
|
||||
############################################################
|
||||
# $Id$
|
||||
#
|
||||
# Makefile.b32 - Borland's C++ Compiler 5.X
|
||||
#
|
||||
# 'lib' directory
|
||||
#
|
||||
# Requires 'Makefile.b32.resp'
|
||||
#
|
||||
# Written by Jaepil Kim, pit@paradise.net.nz
|
||||
############################################################
|
||||
|
||||
# Setup environment
|
||||
CXX = bcc32
|
||||
RM = del
|
||||
LIB = tlib
|
||||
TOPDIR = ..
|
||||
CURNTDIR = .
|
||||
CXXFLAGS = -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu \
|
||||
-w-pro -tWM
|
||||
|
||||
# If you build without SSL support, remove "-DUSE_SSLEAY" from the line below.
|
||||
DEFINES = -DLIBCURL_BIGENDIAN=0 -DNDEBUG -DWIN32 -DCONSOLE -DMBCS \
|
||||
-DUSE_SSLEAY
|
||||
INCDIRS = -I$(CURNTDIR);$(TOPDIR)\include\
|
||||
|
||||
# 'BCCDIR' has to be set up in your c:\autoexec.bat
|
||||
# i.e. SET BCCDIR = c:\Borland\BCC55
|
||||
# where c:\Borland\BCC55 is the compiler is installed
|
||||
LINKLIB = $(BCCDIR)\lib\psdk\ws2_32.lib
|
||||
LIBCURLLIB = libcurl.lib
|
||||
|
||||
.SUFFIXES: .c
|
||||
|
||||
SOURCES = \
|
||||
base64.c \
|
||||
md5.c \
|
||||
cookie.c \
|
||||
transfer.c \
|
||||
escape.c \
|
||||
formdata.c \
|
||||
ftp.c \
|
||||
http.c \
|
||||
http_chunks.c \
|
||||
http_digest.c \
|
||||
http_ntlm.c \
|
||||
ldap.c \
|
||||
dict.c \
|
||||
telnet.c \
|
||||
getdate.c \
|
||||
getenv.c \
|
||||
hostip.c \
|
||||
if2ip.c \
|
||||
mprintf.c \
|
||||
netrc.c \
|
||||
progress.c \
|
||||
sendf.c \
|
||||
inet_pton.c \
|
||||
speedcheck.c \
|
||||
ssluse.c \
|
||||
timeval.c \
|
||||
url.c \
|
||||
file.c \
|
||||
getinfo.c \
|
||||
version.c \
|
||||
easy.c \
|
||||
strequal.c \
|
||||
strtok.c \
|
||||
strtoofft.c \
|
||||
connect.c \
|
||||
hash.c \
|
||||
share.c \
|
||||
llist.c \
|
||||
multi.c \
|
||||
content_encoding.c
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.obj)
|
||||
|
||||
.c.obj:
|
||||
$(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $<
|
||||
|
||||
all: $(LIBCURLLIB)
|
||||
|
||||
clean:
|
||||
-$(RM) $(LIBCURLLIB)
|
||||
-$(RM) *.obj
|
||||
|
||||
$(LIBCURLLIB): $(LINKLIB) $(OBJECTS) Makefile.b32.resp
|
||||
-$(RM) $(LIBCURLLIB)
|
||||
$(LIB) $(LIBCURLLIB) @Makefile.b32.resp
|
||||
############################################################
|
||||
# $Id$
|
||||
#
|
||||
# Makefile.b32 - Borland's C++ Compiler 5.X
|
||||
#
|
||||
# 'lib' directory
|
||||
#
|
||||
# 'BCCDIR' has to be set up to point to the base directory
|
||||
# of the compiler, i.e. SET BCCDIR = c:\Borland\BCC55
|
||||
# where c:\Borland\BCC55 is the compiler is installed
|
||||
#
|
||||
# Written by Jaepil Kim, pit@paradise.net.nz
|
||||
############################################################
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
!ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.1
|
||||
!endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
!ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.7d
|
||||
!endif
|
||||
|
||||
# Set libcurl's name
|
||||
LIBCURLLIB = libcurl.lib
|
||||
LIBCURLDLL = libcurl.dll
|
||||
|
||||
# Setup environment
|
||||
CXX = bcc32
|
||||
LD = bcc32
|
||||
CP = copy
|
||||
RM = del
|
||||
LIB = tlib
|
||||
TOPDIR = ..
|
||||
CURNTDIR = .
|
||||
|
||||
CXXFLAGS = -q -5 -O2 -w-aus -w-ccc -w-csu -w-par -w-pia -w-rch -w-inl -w-ngu -w-pro -tWM
|
||||
LIBFLAGS = /C /P32
|
||||
LDFLAGS = -q -lq -laa -tWD
|
||||
|
||||
INCDIRS = -I$(CURNTDIR);$(TOPDIR)/include
|
||||
LINKLIB = $(BCCDIR)/lib/cw32mt.lib
|
||||
|
||||
# If you build with SSL support, set WITH_SSL=1
|
||||
DEFINES = -DLIBCURL_BIGENDIAN=0 -DNDEBUG -DWIN32 -D_CONSOLE -D_MBCS
|
||||
!ifdef WITH_ZLIB
|
||||
DEFINES = $(DEFINES) -DHAVE_LIBZ -DHAVE_ZLIB_H
|
||||
INCDIRS = $(INCDIRS);$(ZLIB_PATH)
|
||||
# LINKLIB = $(LINKLIB) $(ZLIB_PATH)/zlib.lib
|
||||
!endif
|
||||
!ifdef WITH_SSL
|
||||
DEFINES = $(DEFINES) -DUSE_SSLEAY
|
||||
INCDIRS = $(INCDIRS);$(OPENSSL_PATH)/inc32;$(OPENSSL_PATH)/inc32/openssl
|
||||
# LINKLIB = $(LINKLIB) $(OPENSSL_PATH)/out32/ssleay32.lib $(OPENSSL_PATH)/out32/libeay32.lib
|
||||
!endif
|
||||
|
||||
.autodepend
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
!include Makefile.inc
|
||||
|
||||
OBJECTS = $(CSOURCES:.c=.obj)
|
||||
|
||||
.c.obj:
|
||||
$(CXX) -c $(INCDIRS) $(CXXFLAGS) $(DEFINES) $<
|
||||
|
||||
all: $(LIBCURLLIB)
|
||||
|
||||
clean:
|
||||
-$(RM) $(LIBCURLLIB)
|
||||
-$(RM) *.obj
|
||||
-$(RM) getdate.c
|
||||
|
||||
$(LIBCURLLIB): $(OBJECTS)
|
||||
@-$(RM) $@
|
||||
$(LIB) $(LIBFLAGS) $@ @&&!
|
||||
+$(**: = &^
|
||||
+)
|
||||
!
|
||||
|
||||
$(LIBCURLDLL): $(OBJECTS) $(LINKLIB)
|
||||
@-$(RM) $@
|
||||
$(LD) $(LDFLAGS) -e$@ $**
|
||||
|
||||
getdate.c: getdate.c.cvs
|
||||
@echo Creating $@
|
||||
@-$(RM) getdate.y
|
||||
@$(CP) $** $@
|
||||
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
+base64.obj &
|
||||
+md5.obj &
|
||||
+cookie.obj &
|
||||
+transfer.obj &
|
||||
+escape.obj &
|
||||
+formdata.obj &
|
||||
+ftp.obj &
|
||||
+http.obj &
|
||||
+http_chunks.obj &
|
||||
+http_digest.obj &
|
||||
+ldap.obj &
|
||||
+dict.obj &
|
||||
+telnet.obj &
|
||||
+getdate.obj &
|
||||
+getenv.obj &
|
||||
+getpass.obj &
|
||||
+hostip.obj &
|
||||
+if2ip.obj &
|
||||
+mprintf.obj &
|
||||
+netrc.obj &
|
||||
+progress.obj &
|
||||
+sendf.obj &
|
||||
+speedcheck.obj &
|
||||
+ssluse.obj &
|
||||
+timeval.obj &
|
||||
+url.obj &
|
||||
+file.obj &
|
||||
+getinfo.obj &
|
||||
+version.obj &
|
||||
+easy.obj &
|
||||
+strequal.obj &
|
||||
+strtok.obj &
|
||||
+strtoofft.obj &
|
||||
+connect.obj &
|
||||
+hash.obj &
|
||||
+share.obj &
|
||||
+llist.obj &
|
||||
+multi.obj &
|
||||
+content_encoding.obj
|
22
lib/Makefile.inc
Normal file
22
lib/Makefile.inc
Normal file
@@ -0,0 +1,22 @@
|
||||
# ./lib/Makefile.inc
|
||||
|
||||
CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
|
||||
cookie.c http.c sendf.c ftp.c url.c dict.c if2ip.c speedcheck.c \
|
||||
getdate.c ldap.c ssluse.c version.c getenv.c escape.c mprintf.c \
|
||||
telnet.c netrc.c getinfo.c transfer.c strequal.c easy.c security.c \
|
||||
krb4.c memdebug.c http_chunks.c strtok.c connect.c llist.c hash.c \
|
||||
multi.c content_encoding.c share.c http_digest.c md5.c \
|
||||
http_negotiate.c http_ntlm.c inet_pton.c strtoofft.c strerror.c \
|
||||
hostares.c hostasyn.c hostip4.c hostip6.c hostsyn.c hostthre.c \
|
||||
inet_ntop.c
|
||||
|
||||
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h base64.h hostip.h \
|
||||
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
|
||||
if2ip.h speedcheck.h urldata.h getdate.h ldap.h ssluse.h escape.h \
|
||||
telnet.h getinfo.h strequal.h security.h krb4.h memdebug.h \
|
||||
inet_ntoa_r.h http_chunks.h strtok.h connect.h llist.h hash.h \
|
||||
content_encoding.h share.h md5.h http_digest.h http_negotiate.h \
|
||||
http_ntlm.h ca-bundle.h inet_pton.h strtoofft.h strerror.h \
|
||||
inet_ntop.h curlx.h memory.h setup.h transfer.h
|
||||
|
||||
|
@@ -1,19 +1,26 @@
|
||||
#############################################################
|
||||
# $Id$
|
||||
#
|
||||
## Makefile for building libcurl.a with MingW32 (GCC-3.2) and
|
||||
## optionally OpenSSL (0.9.7)
|
||||
##
|
||||
## Use: make -f Makefile.m32
|
||||
##
|
||||
## Comments to: Troy Engel <tengel@sonic.net> or
|
||||
## Joern Hartroth <hartroth@acm.org>
|
||||
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.7d
|
||||
endif
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.1
|
||||
endif
|
||||
|
||||
CC = gcc
|
||||
AR = ar
|
||||
RM = rm -f
|
||||
RANLIB = ranlib
|
||||
STRIP = strip -g
|
||||
OPENSSL_PATH = ../../openssl-0.9.7d
|
||||
ZLIB_PATH = ../../zlib-1.2.1
|
||||
|
||||
########################################################
|
||||
## Nothing more to do below this line!
|
||||
@@ -32,38 +39,13 @@ ifdef ZLIB
|
||||
endif
|
||||
COMPILE = $(CC) $(INCLUDES) $(CFLAGS)
|
||||
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
libcurl_a_OBJECTS := $(patsubst %.c,%.o,$(strip $(CSOURCES)))
|
||||
|
||||
libcurl_a_LIBRARIES = libcurl.a
|
||||
|
||||
libcurl_a_SOURCES = arpa_telnet.h file.c netrc.h timeval.c base64.c \
|
||||
file.h hostip.c progress.c timeval.h base64.h formdata.c hostip.h \
|
||||
progress.h cookie.c formdata.h http.c sendf.c cookie.h ftp.c \
|
||||
http.h sendf.h url.c dict.c ftp.h if2ip.c speedcheck.c url.h \
|
||||
dict.h getdate.c if2ip.h speedcheck.h urldata.h transfer.c getdate.h \
|
||||
ldap.c ssluse.c version.c transfer.h getenv.c \
|
||||
ldap.h ssluse.h escape.c getenv.h mprintf.c telnet.c escape.h \
|
||||
netrc.c telnet.h getinfo.c strequal.c strequal.h easy.c \
|
||||
security.h security.c krb4.h krb4.c memdebug.h memdebug.c \
|
||||
inet_ntoa_r.h http_chunks.h http_chunks.c \
|
||||
strtok.c connect.c hash.c llist.c multi.c share.c share.h \
|
||||
content_encoding.h content_encoding.c http_digest.h http_digest.c \
|
||||
http_negotiate.c http_negotiate.h http_ntlm.c http_ntlm.h md5.h \
|
||||
md5.c strtoofft.c inet_pton.c strerror.c hostares.c hostasyn.c \
|
||||
hostip4.c hostip6.c hostsyn.c hostthre.c inet_ntop.c
|
||||
|
||||
libcurl_a_OBJECTS = file.o timeval.o base64.o hostip.o progress.o \
|
||||
formdata.o cookie.o http.o sendf.o ftp.o url.o dict.o if2ip.o \
|
||||
speedcheck.o getdate.o transfer.o ldap.o ssluse.o version.o \
|
||||
getenv.o escape.o mprintf.o telnet.o netrc.o getinfo.o \
|
||||
strequal.o easy.o security.o krb4.o memdebug.o http_chunks.o \
|
||||
strtok.o connect.o hash.o llist.o multi.o share.o \
|
||||
content_encoding.o http_digest.o http_negotiate.o http_ntlm.o md5.o \
|
||||
strtoofft.o inet_pton.o strerror.o hostares.o hostasyn.o hostip4.o \
|
||||
hostip6.o hostsyn.o hostthre.o inet_ntop.o
|
||||
|
||||
LIBRARIES = $(libcurl_a_LIBRARIES)
|
||||
SOURCES = $(libcurl_a_SOURCES)
|
||||
OBJECTS = $(libcurl_a_OBJECTS)
|
||||
|
||||
libcurl_a_DEPENDENCIES = $(strip $(CSOURCES) $(HHEADERS))
|
||||
|
||||
all: libcurl.a libcurl.dll libcurldll.a
|
||||
|
||||
|
@@ -11,11 +11,19 @@
|
||||
ifndef NDKBASE
|
||||
NDKBASE = c:/novell
|
||||
endif
|
||||
INSTDIR = ..\curl-$(LIBCURL_VERSION_STR)-bin-nw
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
#ZLIB_PATH = ../../zlib-1.2.1
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.7d
|
||||
endif
|
||||
|
||||
ifndef INSTDIR
|
||||
INSTDIR = ../curl-$(LIBCURL_VERSION_STR)-bin-nw
|
||||
endif
|
||||
|
||||
# Edit the vars below to change NLM target settings.
|
||||
TARGET = libcurl
|
||||
VERSION = $(LIBCURL_VERSION)
|
||||
@@ -53,6 +61,7 @@ ifdef METROWERKS
|
||||
else
|
||||
CC = gcc
|
||||
endif
|
||||
YACC = bison -y
|
||||
CP = cp -afv
|
||||
# RM = rm -f
|
||||
# if you want to mark the target as MTSAFE you will need a tool for
|
||||
@@ -61,21 +70,19 @@ CP = cp -afv
|
||||
MPKXDC = mkxdc
|
||||
|
||||
# Global flags for all compilers
|
||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -nostdinc
|
||||
CFLAGS = $(OPT) -D$(DB) -DNETWARE -DHAVE_CONFIG_H -nostdinc
|
||||
|
||||
ifeq ($(CC),mwccnlm)
|
||||
LD = mwldnlm
|
||||
LDFLAGS = -nostdlib $(PRELUDE) $(OBJDIR)/*.o -o $(OBJDIR)/$(TARGET).nlm -commandfile
|
||||
LDFLAGS = -nostdlib $(PRELUDE) $(OBJL) -o $(TARGET).nlm -commandfile
|
||||
AR = mwldnlm
|
||||
ARFLAGS = -type library -w nocmdline $(OBJDIR)/*.o -o
|
||||
ARFLAGS = -type library -w nocmdline $(OBJS) -o
|
||||
CFLAGS += -msgstyle gcc -gccinc -inline off -opt nointrinsics -proc 586
|
||||
CFLAGS += -relax_pointers
|
||||
#CFLAGS += -w on
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.o
|
||||
CFLAGS += -align 4
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
# CFLAGS += -D__ANSIC__
|
||||
else
|
||||
PRELUDE = "$(METROWERKS)/Novell Support/libraries/runtime/prelude.obj"
|
||||
# CFLAGS += -include "$(METROWERKS)/Novell Support/headers/nlm_prefix.h"
|
||||
@@ -90,8 +97,6 @@ CFLAGS += -fno-builtin -fpack-struct -fpcc-struct-return
|
||||
CFLAGS += -Wall # -pedantic
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
PRELUDE = $(SDK_LIBC)/imports/libcpre.gcc.o
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
# CFLAGS += -D__ANSIC__
|
||||
else
|
||||
PRELUDE = $(SDK_CLIB)/imports/clibpre.gcc.o
|
||||
CFLAGS += -include $(NDKBASE)/nlmconv/genlm.h
|
||||
@@ -107,17 +112,26 @@ SDK_LDAP = $(NDK_ROOT)/cldapsdk/netware
|
||||
|
||||
INCLUDES = -I. -I../include
|
||||
|
||||
ifdef WITH_ARES
|
||||
INCLUDES += -I../ares
|
||||
LIBCARES = ../ares/libcares.lib
|
||||
endif
|
||||
ifdef ZLIB_PATH
|
||||
INCLUDES += -I$(ZLIB_PATH)
|
||||
CFLAGS += -DHAVE_ZLIB_H -DHAVE_LIBZ
|
||||
IMPORTS = @$(ZLIB_PATH)/nw/zlib.imp
|
||||
MODULES = libz.nlm
|
||||
endif
|
||||
ifdef SSL
|
||||
INCLUDES += -I$(OPENSSL_PATH)/outinc_nw_libc -I$(OPENSSL_PATH)/outinc_nw_libc/openssl
|
||||
LIBSSL = $(OPENSSL_PATH)/out_nw_libc/crypto.lib $(OPENSSL_PATH)/out_nw_libc/ssl.lib
|
||||
endif
|
||||
|
||||
ifeq ($(LIBARCH),LIBC)
|
||||
INCLUDES += -I$(SDK_LIBC)/include -I$(SDK_LIBC)/include/nks
|
||||
INCLUDES += -I$(SDK_LIBC)/include/winsock
|
||||
# INCLUDES += -I$(SDK_LDAP)/libc/inc
|
||||
CFLAGS += -D_POSIX_SOURCE
|
||||
# CFLAGS += -D__ANSIC__
|
||||
else
|
||||
INCLUDES += -I$(SDK_CLIB)/include/nlm -I$(SDK_CLIB)/include
|
||||
# INCLUDES += -I$(SDK_CLIB)/include/nlm/obsolete
|
||||
@@ -136,72 +150,26 @@ ifdef XDCOPT
|
||||
XDCDATA = $(OBJDIR)/$(TARGET).xdc
|
||||
endif
|
||||
|
||||
ifeq ($(OSTYPE),linux)
|
||||
ifeq ($(findstring linux,$(OSTYPE)),linux)
|
||||
DL = '
|
||||
#-include $(NDKBASE)/nlmconv/ncpfs.inc
|
||||
endif
|
||||
|
||||
OBJS = \
|
||||
$(OBJDIR)/file.o \
|
||||
$(OBJDIR)/timeval.o \
|
||||
$(OBJDIR)/base64.o \
|
||||
$(OBJDIR)/hostip.o \
|
||||
$(OBJDIR)/progress.o \
|
||||
$(OBJDIR)/formdata.o \
|
||||
$(OBJDIR)/cookie.o \
|
||||
$(OBJDIR)/http.o \
|
||||
$(OBJDIR)/sendf.o \
|
||||
$(OBJDIR)/ftp.o \
|
||||
$(OBJDIR)/url.o \
|
||||
$(OBJDIR)/dict.o \
|
||||
$(OBJDIR)/if2ip.o \
|
||||
$(OBJDIR)/speedcheck.o \
|
||||
$(OBJDIR)/getdate.o \
|
||||
$(OBJDIR)/transfer.o \
|
||||
$(OBJDIR)/ldap.o \
|
||||
$(OBJDIR)/ssluse.o \
|
||||
$(OBJDIR)/version.o \
|
||||
$(OBJDIR)/getenv.o \
|
||||
$(OBJDIR)/escape.o \
|
||||
$(OBJDIR)/mprintf.o \
|
||||
$(OBJDIR)/telnet.o \
|
||||
$(OBJDIR)/netrc.o \
|
||||
$(OBJDIR)/getinfo.o \
|
||||
$(OBJDIR)/strequal.o \
|
||||
$(OBJDIR)/easy.o \
|
||||
$(OBJDIR)/security.o \
|
||||
$(OBJDIR)/krb4.o \
|
||||
$(OBJDIR)/memdebug.o \
|
||||
$(OBJDIR)/http_chunks.o \
|
||||
$(OBJDIR)/strtok.o \
|
||||
$(OBJDIR)/connect.o \
|
||||
$(OBJDIR)/hash.o \
|
||||
$(OBJDIR)/llist.o \
|
||||
$(OBJDIR)/multi.o \
|
||||
$(OBJDIR)/share.o \
|
||||
$(OBJDIR)/content_encoding.o \
|
||||
$(OBJDIR)/http_digest.o \
|
||||
$(OBJDIR)/http_negotiate.o \
|
||||
$(OBJDIR)/http_ntlm.o \
|
||||
$(OBJDIR)/md5.o \
|
||||
$(OBJDIR)/strtoofft.o \
|
||||
$(OBJDIR)/strerror.o \
|
||||
$(OBJDIR)/hostares.o \
|
||||
$(OBJDIR)/hostasyn.o \
|
||||
$(OBJDIR)/hostip4.o \
|
||||
$(OBJDIR)/hostip6.o \
|
||||
$(OBJDIR)/hostsyn.o \
|
||||
$(OBJDIR)/hostthre.o \
|
||||
$(OBJDIR)/inet_ntop.o \
|
||||
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||
include Makefile.inc
|
||||
|
||||
OBJS := $(patsubst %.c,$(OBJDIR)/%.o,$(strip $(CSOURCES))) $(LIBCARES) $(LIBSSL)
|
||||
|
||||
OBJL = $(OBJS) $(OBJDIR)/nwlib.o
|
||||
|
||||
nlm: $(OBJDIR) $(OBJDIR)/version.inc $(OBJDIR)/$(TARGET).nlm
|
||||
|
||||
lib: $(OBJDIR) $(OBJDIR)/$(TARGET).lib
|
||||
|
||||
all: lib nlm
|
||||
|
||||
nlm: prebuild $(TARGET).nlm
|
||||
|
||||
lib: prebuild $(TARGET).lib
|
||||
|
||||
prebuild: $(OBJDIR) $(OBJDIR)/version.inc config.h ca-bundle.h getdate.c
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
# @echo Compiling $<
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
@@ -216,12 +184,14 @@ dist: all
|
||||
|
||||
install: $(INSTDIR) all
|
||||
@$(CP) $(TARGET).nlm $(INSTDIR)
|
||||
@$(CP) $(TARGET).lib $(INSTDIR)
|
||||
@$(CP) ../CHANGES $(INSTDIR)
|
||||
@$(CP) ../COPYING $(INSTDIR)
|
||||
@$(CP) ../README $(INSTDIR)
|
||||
@$(CP) ../RELEASE-NOTES $(INSTDIR)
|
||||
|
||||
clean:
|
||||
-$(RM) config.h ca-bundle.h y.tab.c getdate.c
|
||||
-$(RM) -r $(OBJDIR)
|
||||
|
||||
$(INSTDIR):
|
||||
@@ -230,15 +200,15 @@ $(INSTDIR):
|
||||
$(OBJDIR):
|
||||
@mkdir $(OBJDIR)
|
||||
|
||||
$(OBJDIR)/$(TARGET).lib: $(OBJS)
|
||||
$(TARGET).lib: $(OBJS)
|
||||
@echo Creating $@
|
||||
@-$(RM) $@
|
||||
@$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
$(OBJDIR)/$(TARGET).nlm: $(OBJL) $(OBJDIR)/$(TARGET).def $(XDCDATA)
|
||||
$(TARGET).nlm: $(OBJDIR)/$(TARGET).def $(OBJL) $(XDCDATA)
|
||||
@echo Linking $@
|
||||
@-$(RM) $@
|
||||
@$(LD) $(LDFLAGS) $(OBJDIR)/$(TARGET).def
|
||||
@$(LD) $(LDFLAGS) $<
|
||||
|
||||
$(OBJDIR)/%.xdc: Makefile.netware
|
||||
@echo Creating $@
|
||||
@@ -304,11 +274,100 @@ ifdef IMPORTS
|
||||
@echo $(DL)import $(IMPORTS)$(DL) >> $@
|
||||
endif
|
||||
ifeq ($(LD),nlmconv)
|
||||
@echo $(DL)input $(OBJS)$(DL) >> $@
|
||||
ifdef WITH_ARES
|
||||
@echo $(DL)input $(LIBCARES)$(DL) >> $@
|
||||
endif
|
||||
ifdef SSL
|
||||
@echo $(DL)input $(LIBSSL)$(DL) >> $@
|
||||
endif
|
||||
@echo $(DL)input $(OBJL)$(DL) >> $@
|
||||
@echo $(DL)input $(PRELUDE)$(DL) >> $@
|
||||
@echo $(DL)output $(TARGET).nlm$(DL) >> $@
|
||||
endif
|
||||
|
||||
config.h: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* $@ for NetWare target.$(DL) > $@
|
||||
@echo $(DL)** Do not edit this file - it is created by make!$(DL) >> $@
|
||||
@echo $(DL)** All your changes will be lost!!$(DL) >> $@
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
@echo $(DL)#define OS "i586-pc-NetWare"$(DL) >> $@
|
||||
@echo $(DL)#define VERSION "$(LIBCURL_VERSION_STR)"$(DL) >> $@
|
||||
@echo $(DL)#define PACKAGE_BUGREPORT "curl-bug@haxx.se"$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ARPA_INET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ASSERT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLFCN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_DLOPEN 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_ERR_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FCNTL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_FIONBIO 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETHOSTBYADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_GETTIMEOFDAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_ADDR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_NTOA 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INET_PTON 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_INTTYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIMITS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LONGLONG 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_MALLOC_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETINET_IN_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SELECT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SETJMP_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SIGNAL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SOCKET 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDINT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STDLIB_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRCASECMP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRDUP 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRFTIME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRING_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCAT 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRLCPY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_STRSTR 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_PARAM_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SELECT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_STAT_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TERMIOS_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_TIME_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNAME 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_UNISTD_H 1$(DL) >> $@
|
||||
@echo $(DL)#define RETSIGTYPE void$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_CURL_OFF_T 4$(DL) >> $@
|
||||
@echo $(DL)#define STDC_HEADERS 1$(DL) >> $@
|
||||
@echo $(DL)#define TIME_WITH_SYS_TIME 1$(DL) >> $@
|
||||
ifdef NW_WINSOCK
|
||||
@echo $(DL)#define HAVE_CLOSESOCKET 1$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define HAVE_SYS_TYPES_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKET_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_SYS_SOCKIO_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_NETDB_H 1$(DL) >> $@
|
||||
endif
|
||||
ifdef WITH_ARES
|
||||
@echo $(DL)#define USE_ARES 1$(DL) >> $@
|
||||
endif
|
||||
ifdef ZLIB_PATH
|
||||
@echo $(DL)#define HAVE_ZLIB_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIBZ 1$(DL) >> $@
|
||||
endif
|
||||
ifdef SSL
|
||||
@echo $(DL)#define USE_SSLEAY 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_X509_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_SSL_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_RSA_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_PEM_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_ERR_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_CRYPTO_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_OPENSSL_ENGINE_H 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIBSSL 1$(DL) >> $@
|
||||
@echo $(DL)#define HAVE_LIBCRYPTO 1$(DL) >> $@
|
||||
@echo $(DL)#define OPENSSL_NO_KRB5 1$(DL) >> $@
|
||||
endif
|
||||
ifdef OLD_NOVELLSDK
|
||||
@echo $(DL)#define socklen_t int$(DL) >> $@
|
||||
endif
|
||||
|
||||
ca-bundle.h: Makefile.netware
|
||||
@echo Creating $@
|
||||
@echo $(DL)/* Do not edit this file - it is created by make!$(DL) > $@
|
||||
@@ -316,11 +375,14 @@ ca-bundle.h: Makefile.netware
|
||||
@echo $(DL)*/$(DL) >> $@
|
||||
@echo $(DL)#define CURL_CA_BUNDLE getenv("CURL_CA_BUNDLE")$(DL) >> $@
|
||||
|
||||
getdate.c: getdate.c.cvs
|
||||
getdate.c:
|
||||
@echo Creating $@
|
||||
@-$(RM) getdate.y
|
||||
@$(CP) $< $@
|
||||
@$(CP) getdate.c.cvs $@
|
||||
|
||||
url.c: ca-bundle.h
|
||||
|
||||
$(LIBCARES):
|
||||
$(MAKE) -C ../ares -f Makefile.netware lib
|
||||
|
||||
|
||||
|
@@ -25,11 +25,11 @@
|
||||
LIB_NAME = libcurl
|
||||
LIB_NAME_DEBUG = libcurld
|
||||
!IFNDEF OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.7a
|
||||
OPENSSL_PATH = ../../openssl-0.9.7d
|
||||
!ENDIF
|
||||
|
||||
!IFNDEF ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.1.4
|
||||
ZLIB_PATH = ../../zlib-1.2.1
|
||||
!ENDIF
|
||||
|
||||
# Use the high resolution time by default. Comment this out to use low
|
||||
@@ -39,23 +39,23 @@ USEMM_LIBS = YES
|
||||
#############################################################
|
||||
## Nothing more to do below this line!
|
||||
|
||||
CCNODBG = cl.exe /MD /O2 /D "NDEBUG"
|
||||
CCDEBUG = cl.exe /MDd /Od /Gm /Zi /D "_DEBUG" /GZ
|
||||
CFLAGSSSL = /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
||||
CCNODBG = cl.exe /MD /O2 /D "NDEBUG"
|
||||
CCDEBUG = cl.exe /MDd /Od /Gm /Zi /D "_DEBUG" /GZ
|
||||
CFLAGSSSL = /D "USE_SSLEAY" /I "$(OPENSSL_PATH)/inc32" /I "$(OPENSSL_PATH)/inc32/openssl"
|
||||
CFLAGSZLIB = /D "HAVE_ZLIB_H" /D "HAVE_ZLIB" /D "HAVE_LIBZ" /I "$(ZLIB_PATH)"
|
||||
CFLAGS = /I "." /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS"
|
||||
LNKDLL = link.exe /DLL /def:libcurl.def
|
||||
LNKLIB = link.exe /lib
|
||||
LFLAGS = /nologo
|
||||
SSLLIBS = libeay32.lib ssleay32.lib
|
||||
CFLAGS = /I "." /I "../include" /nologo /W3 /GX /D "WIN32" /D "VC6" /D "_MBCS" /D "_LIB" /YX /FD /c /D "MSDOS"
|
||||
LNKDLL = link.exe /DLL /def:libcurl.def
|
||||
LNKLIB = link.exe /lib
|
||||
LFLAGS = /nologo
|
||||
SSLLIBS = libeay32.lib ssleay32.lib
|
||||
!IFDEF USEMM_LIBS
|
||||
WINLIBS = wsock32.lib winmm.lib
|
||||
WINLIBS = wsock32.lib winmm.lib
|
||||
!ELSE
|
||||
WINLIBS = wsock32.lib
|
||||
CFLAGS = $(CFLAGS) /D "WITHOUT_MM_LIB"
|
||||
WINLIBS = wsock32.lib
|
||||
CFLAGS = $(CFLAGS) /D "WITHOUT_MM_LIB"
|
||||
!ENDIF
|
||||
# RSAglue.lib was formerly needed in the SSLLIBS
|
||||
CFGSET = FALSE
|
||||
CFGSET = FALSE
|
||||
|
||||
######################
|
||||
# release
|
||||
|
24
lib/base64.c
24
lib/base64.c
@@ -160,22 +160,22 @@ size_t Curl_base64_encode(const char *inp, size_t insize, char **outptr)
|
||||
|
||||
switch(inputparts) {
|
||||
case 1: /* only one byte read */
|
||||
sprintf(output, "%c%c==",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]]);
|
||||
snprintf(output, 5, "%c%c==",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]]);
|
||||
break;
|
||||
case 2: /* two bytes read */
|
||||
sprintf(output, "%c%c%c=",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]],
|
||||
table64[obuf[2]]);
|
||||
snprintf(output, 5, "%c%c%c=",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]],
|
||||
table64[obuf[2]]);
|
||||
break;
|
||||
default:
|
||||
sprintf(output, "%c%c%c%c",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]],
|
||||
table64[obuf[2]],
|
||||
table64[obuf[3]] );
|
||||
snprintf(output, 5, "%c%c%c%c",
|
||||
table64[obuf[0]],
|
||||
table64[obuf[1]],
|
||||
table64[obuf[2]],
|
||||
table64[obuf[3]] );
|
||||
break;
|
||||
}
|
||||
output += 4;
|
||||
|
@@ -1,484 +0,0 @@
|
||||
/* lib/config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* to disable DICT */
|
||||
#undef CURL_DISABLE_DICT
|
||||
|
||||
/* to disable FILE */
|
||||
#undef CURL_DISABLE_FILE
|
||||
|
||||
/* to disable FTP */
|
||||
#undef CURL_DISABLE_FTP
|
||||
|
||||
/* to disable GOPHER */
|
||||
#undef CURL_DISABLE_GOPHER
|
||||
|
||||
/* to disable HTTP */
|
||||
#undef CURL_DISABLE_HTTP
|
||||
|
||||
/* to disable LDAP */
|
||||
#undef CURL_DISABLE_LDAP
|
||||
|
||||
/* to disable TELNET */
|
||||
#undef CURL_DISABLE_TELNET
|
||||
|
||||
/* Set to explicitly specify we don't want to use thread-safe functions */
|
||||
#undef DISABLED_THREADSAFE
|
||||
|
||||
/* your Entropy Gathering Daemon socket pathname */
|
||||
#undef EGD_SOCKET
|
||||
|
||||
/* Define if you want to enable IPv6 support */
|
||||
#undef ENABLE_IPV6
|
||||
|
||||
/* Define to 1 if you have the <alloca.h> header file. */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
|
||||
/* Define to 1 if you have the <assert.h> header file. */
|
||||
#define HAVE_ASSERT_H 1
|
||||
|
||||
/* Define to 1 if you have the `closesocket' function. */
|
||||
#undef HAVE_CLOSESOCKET
|
||||
|
||||
/* Define to 1 if you have the `CRYPTO_cleanup_all_ex_data' function. */
|
||||
#undef HAVE_CRYPTO_CLEANUP_ALL_EX_DATA
|
||||
|
||||
/* Define to 1 if you have the <crypto.h> header file. */
|
||||
#undef HAVE_CRYPTO_H
|
||||
|
||||
/* Define to 1 if you have the <des.h> header file. */
|
||||
#undef HAVE_DES_H
|
||||
|
||||
/* disabled non-blocking sockets */
|
||||
#undef HAVE_DISABLED_NONBLOCKING
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
/* XXX: #undef HAVE_DLFCN_H */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define to 1 if you have the `dlopen' function. */
|
||||
#define HAVE_DLOPEN 1
|
||||
|
||||
/* Define to 1 if you have the <err.h> header file. */
|
||||
#define HAVE_ERR_H 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#define HAVE_FCNTL_H 1
|
||||
|
||||
/* use FIONBIO for non-blocking sockets */
|
||||
/* XXX: #undef HAVE_FIONBIO */
|
||||
#define HAVE_FIONBIO 1
|
||||
|
||||
/* Define if getaddrinfo exists and works */
|
||||
#undef HAVE_GETADDRINFO
|
||||
|
||||
/* Define to 1 if you have the `geteuid' function. */
|
||||
#undef HAVE_GETEUID
|
||||
|
||||
/* Define to 1 if you have the `gethostbyaddr' function. */
|
||||
#define HAVE_GETHOSTBYADDR 1
|
||||
|
||||
/* Define to 1 if you have the `gethostbyaddr_r' function. */
|
||||
#undef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
/* gethostbyaddr_r() takes 5 args */
|
||||
#undef HAVE_GETHOSTBYADDR_R_5
|
||||
|
||||
/* gethostbyaddr_r() takes 7 args */
|
||||
#undef HAVE_GETHOSTBYADDR_R_7
|
||||
|
||||
/* gethostbyaddr_r() takes 8 args */
|
||||
#undef HAVE_GETHOSTBYADDR_R_8
|
||||
|
||||
/* Define to 1 if you have the `gethostbyname_r' function. */
|
||||
#undef HAVE_GETHOSTBYNAME_R
|
||||
|
||||
/* gethostbyname_r() takes 3 args */
|
||||
#undef HAVE_GETHOSTBYNAME_R_3
|
||||
|
||||
/* gethostbyname_r() takes 5 args */
|
||||
#undef HAVE_GETHOSTBYNAME_R_5
|
||||
|
||||
/* gethostbyname_r() takes 6 args */
|
||||
#undef HAVE_GETHOSTBYNAME_R_6
|
||||
|
||||
/* Define to 1 if you have the `getpass_r' function. */
|
||||
#undef HAVE_GETPASS_R
|
||||
|
||||
/* Define to 1 if you have the `getpwuid' function. */
|
||||
#undef HAVE_GETPWUID
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#define HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the `gmtime_r' function. */
|
||||
#undef HAVE_GMTIME_R
|
||||
|
||||
/* if you have the gssapi libraries */
|
||||
#undef HAVE_GSSAPI
|
||||
|
||||
/* if you have the Heimdal gssapi libraries */
|
||||
#undef HAVE_GSSHEIMDAL
|
||||
|
||||
/* if you have the MIT gssapi libraries */
|
||||
#undef HAVE_GSSMIT
|
||||
|
||||
/* Define to 1 if you have the `inet_addr' function. */
|
||||
#define HAVE_INET_ADDR 1
|
||||
|
||||
/* Define to 1 if you have the `inet_ntoa' function. */
|
||||
#define HAVE_INET_NTOA 1
|
||||
|
||||
/* Define to 1 if you have the `inet_ntoa_r' function. */
|
||||
#undef HAVE_INET_NTOA_R
|
||||
|
||||
/* inet_ntoa_r() is declared */
|
||||
#undef HAVE_INET_NTOA_R_DECL
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#define HAVE_INET_PTON 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* use ioctlsocket() for non-blocking sockets */
|
||||
#undef HAVE_IOCTLSOCKET
|
||||
|
||||
/* use Ioctlsocket() for non-blocking sockets */
|
||||
#undef HAVE_IOCTLSOCKET_CASE
|
||||
|
||||
/* Define to 1 if you have the <io.h> header file. */
|
||||
#undef HAVE_IO_H
|
||||
|
||||
/* if you have the Kerberos4 libraries (including -ldes) */
|
||||
#undef HAVE_KRB4
|
||||
|
||||
/* Define to 1 if you have the `krb_get_our_ip_for_realm' function. */
|
||||
#undef HAVE_KRB_GET_OUR_IP_FOR_REALM
|
||||
|
||||
/* Define to 1 if you have the <krb.h> header file. */
|
||||
#undef HAVE_KRB_H
|
||||
|
||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||
#undef HAVE_LIBCRYPTO
|
||||
|
||||
/* Define to 1 if you have the `dl' library (-ldl). */
|
||||
#undef HAVE_LIBDL
|
||||
|
||||
/* Define to 1 if you have the `nsl' library (-lnsl). */
|
||||
#undef HAVE_LIBNSL
|
||||
|
||||
/* Define to 1 if you have the `resolv' library (-lresolv). */
|
||||
#undef HAVE_LIBRESOLV
|
||||
|
||||
/* Define to 1 if you have the `resolve' library (-lresolve). */
|
||||
#undef HAVE_LIBRESOLVE
|
||||
|
||||
/* Define to 1 if you have the `socket' library (-lsocket). */
|
||||
#undef HAVE_LIBSOCKET
|
||||
|
||||
/* Define to 1 if you have the `ssl' library (-lssl). */
|
||||
#undef HAVE_LIBSSL
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#undef HAVE_LOCALTIME_R
|
||||
|
||||
/* if your compiler supports 'long long' */
|
||||
#define HAVE_LONGLONG 1
|
||||
|
||||
/* Define to 1 if you have the <malloc.h> header file. */
|
||||
#define HAVE_MALLOC_H 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#define HAVE_NETDB_H 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <net/if.h> header file. */
|
||||
#undef HAVE_NET_IF_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/crypto.h> header file. */
|
||||
#undef HAVE_OPENSSL_CRYPTO_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/engine.h> header file. */
|
||||
#undef HAVE_OPENSSL_ENGINE_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/err.h> header file. */
|
||||
#undef HAVE_OPENSSL_ERR_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/pem.h> header file. */
|
||||
#undef HAVE_OPENSSL_PEM_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/rsa.h> header file. */
|
||||
#undef HAVE_OPENSSL_RSA_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/ssl.h> header file. */
|
||||
#undef HAVE_OPENSSL_SSL_H
|
||||
|
||||
/* Define to 1 if you have the <openssl/x509.h> header file. */
|
||||
#undef HAVE_OPENSSL_X509_H
|
||||
|
||||
/* use O_NONBLOCK for non-blocking sockets */
|
||||
#undef HAVE_O_NONBLOCK
|
||||
|
||||
/* Define to 1 if you have the <pem.h> header file. */
|
||||
#undef HAVE_PEM_H
|
||||
|
||||
/* Define to 1 if you have the `perror' function. */
|
||||
#undef HAVE_PERROR
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the <pwd.h> header file. */
|
||||
#undef HAVE_PWD_H
|
||||
|
||||
/* Define to 1 if you have the `RAND_egd' function. */
|
||||
#undef HAVE_RAND_EGD
|
||||
|
||||
/* Define to 1 if you have the `RAND_screen' function. */
|
||||
#undef HAVE_RAND_SCREEN
|
||||
|
||||
/* Define to 1 if you have the `RAND_status' function. */
|
||||
#undef HAVE_RAND_STATUS
|
||||
|
||||
/* Define to 1 if you have the <rsa.h> header file. */
|
||||
#undef HAVE_RSA_H
|
||||
|
||||
/* Define to 1 if you have the `select' function. */
|
||||
#define HAVE_SELECT 1
|
||||
|
||||
/* Define to 1 if you have the <setjmp.h> header file. */
|
||||
#define HAVE_SETJMP_H 1
|
||||
|
||||
/* Define to 1 if you have the <sgtty.h> header file. */
|
||||
#undef HAVE_SGTTY_H
|
||||
|
||||
/* Define to 1 if you have the `sigaction' function. */
|
||||
#undef HAVE_SIGACTION
|
||||
|
||||
/* Define to 1 if you have the `siginterrupt' function. */
|
||||
#undef HAVE_SIGINTERRUPT
|
||||
|
||||
/* Define to 1 if you have the `signal' function. */
|
||||
#define HAVE_SIGNAL 1
|
||||
|
||||
/* If you have sigsetjmp */
|
||||
#undef HAVE_SIGSETJMP
|
||||
|
||||
/* Define to 1 if you have the `socket' function. */
|
||||
#define HAVE_SOCKET 1
|
||||
|
||||
/* use SO_NONBLOCK for non-blocking sockets */
|
||||
#undef HAVE_SO_NONBLOCK
|
||||
|
||||
/* Define this if you have the SPNEGO library fbopenssl */
|
||||
#undef HAVE_SPNEGO
|
||||
|
||||
/* Define to 1 if you have the <ssl.h> header file. */
|
||||
#undef HAVE_SSL_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the `strcasecmp' function. */
|
||||
#define HAVE_STRCASECMP 1
|
||||
|
||||
/* Define to 1 if you have the `strcmpi' function. */
|
||||
#undef HAVE_STRCMPI
|
||||
|
||||
/* Define to 1 if you have the `strdup' function. */
|
||||
#define HAVE_STRDUP 1
|
||||
|
||||
/* Define to 1 if you have the `strftime' function. */
|
||||
#define HAVE_STRFTIME 1
|
||||
|
||||
/* Define to 1 if you have the `stricmp' function. */
|
||||
#undef HAVE_STRICMP
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the `strlcat' function. */
|
||||
#define HAVE_STRLCAT 1
|
||||
|
||||
/* Define to 1 if you have the `strlcpy' function. */
|
||||
#define HAVE_STRLCPY 1
|
||||
|
||||
/* Define to 1 if you have the `strstr' function. */
|
||||
#define HAVE_STRSTR 1
|
||||
|
||||
/* Define to 1 if you have the `strtok_r' function. */
|
||||
#undef HAVE_STRTOK_R
|
||||
|
||||
/* Define to 1 if you have the `strtoll' function. */
|
||||
#undef HAVE_STRTOLL
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#define HAVE_SYS_PARAM_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#undef HAVE_SYS_POLL_H
|
||||
|
||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
||||
#define HAVE_SYS_SELECT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/sockio.h> header file. */
|
||||
#define HAVE_SYS_SOCKIO_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/utime.h> header file. */
|
||||
#undef HAVE_SYS_UTIME_H
|
||||
|
||||
/* Define to 1 if you have the `tcgetattr' function. */
|
||||
#undef HAVE_TCGETATTR
|
||||
|
||||
/* Define to 1 if you have the `tcsetattr' function. */
|
||||
#undef HAVE_TCSETATTR
|
||||
|
||||
/* Define to 1 if you have the <termios.h> header file. */
|
||||
#define HAVE_TERMIOS_H 1
|
||||
|
||||
/* Define to 1 if you have the <termio.h> header file. */
|
||||
#undef HAVE_TERMIO_H
|
||||
|
||||
/* Define to 1 if you have the <time.h> header file. */
|
||||
#define HAVE_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the `uname' function. */
|
||||
#define HAVE_UNAME 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define to 1 if you have the `utime' function. */
|
||||
#undef HAVE_UTIME
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
/* Define to 1 if you have the <winsock.h> header file. */
|
||||
#undef HAVE_WINSOCK_H
|
||||
|
||||
/* Define this symbol if your OS supports changing the contents of argv */
|
||||
#undef HAVE_WRITABLE_ARGV
|
||||
|
||||
/* Define to 1 if you have the <x509.h> header file. */
|
||||
#undef HAVE_X509_H
|
||||
|
||||
/* if you have the zlib.h header file - set from Makefile */
|
||||
/* #undef HAVE_ZLIB_H */
|
||||
|
||||
/* If zlib is available - set from Makefile */
|
||||
/* #undef HAVE_LIBZ */
|
||||
|
||||
/* need REENTRANT defined */
|
||||
#undef NEED_REENTRANT
|
||||
|
||||
/* cpu-machine-OS */
|
||||
#define OS "i586-pc-NetWare"
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* a suitable file to read random data from */
|
||||
#undef RANDOM_FILE
|
||||
|
||||
/* Define as the return type of signal handlers (`int' or `void'). */
|
||||
#define RETSIGTYPE void
|
||||
|
||||
/* Define to the type of arg 1 for `select'. */
|
||||
#undef SELECT_TYPE_ARG1
|
||||
|
||||
/* Define to the type of args 2, 3 and 4 for `select'. */
|
||||
#undef SELECT_TYPE_ARG234
|
||||
|
||||
/* Define to the type of arg 5 for `select'. */
|
||||
#undef SELECT_TYPE_ARG5
|
||||
|
||||
/* The size of a `curl_off_t', as computed by sizeof. */
|
||||
#define SIZEOF_CURL_OFF_T 4
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
/* XXX: #undef STDC_HEADERS */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
||||
/* Define if you want to enable ares support */
|
||||
#undef USE_ARES
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to 1 if on AIX 3.
|
||||
System headers sometimes define this.
|
||||
We just want to avoid a redefinition error message. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#undef _FILE_OFFSET_BITS
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#undef _LARGE_FILES
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* type to use in place of in_addr_t if not defined */
|
||||
#undef in_addr_t
|
||||
|
||||
/* Define to `unsigned' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
#define socklen_t int
|
||||
|
||||
/* the signed version of size_t */
|
||||
#undef ssize_t
|
||||
|
||||
|
@@ -39,7 +39,12 @@
|
||||
#undef SIZEOF_CURL_OFF_T
|
||||
#endif
|
||||
|
||||
/* Borland lacks _lseeki64(), so we don't support >2GB files */
|
||||
#ifdef __BORLANDC__
|
||||
#define SIZEOF_CURL_OFF_T 4
|
||||
#else
|
||||
#define SIZEOF_CURL_OFF_T 8
|
||||
#endif
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
@@ -232,6 +237,8 @@
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#define HAVE_IO_H 1
|
||||
#define HAVE_IOCTLSOCKET 1
|
||||
#define HAVE_INET_PTON 1
|
||||
#define HAVE_INET_NTOP 1
|
||||
#define HAVE_LONGLONG 1
|
||||
#define HAVE_MALLOC_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
@@ -89,7 +90,7 @@
|
||||
#define OPENSSL_NO_KRB5 1
|
||||
#endif
|
||||
|
||||
/* Because djgpp < 2.03 doesn't have snprintf() etc.
|
||||
/* Because djgpp <= 2.03 doesn't have snprintf() etc.
|
||||
*/
|
||||
#if (DJGPP_MINOR < 4)
|
||||
#define _MPRINTF_REPLACE
|
||||
|
364
lib/connect.c
364
lib/connect.c
@@ -103,6 +103,12 @@
|
||||
|
||||
static bool verifyconnect(curl_socket_t sockfd, int *error);
|
||||
|
||||
static curl_socket_t
|
||||
singleipconnect(struct connectdata *conn,
|
||||
Curl_addrinfo *ai, /* start connecting to this */
|
||||
long timeout_ms,
|
||||
bool *connected);
|
||||
|
||||
/*
|
||||
* Curl_ourerrno() returns the errno (or equivalent) on this platform to
|
||||
* hide platform specific for the function that calls this.
|
||||
@@ -213,7 +219,7 @@ int waitconnect(curl_socket_t sockfd, /* socket */
|
||||
FD_ZERO(&errfd);
|
||||
FD_SET(sockfd, &errfd);
|
||||
|
||||
interval.tv_sec = timeout_msec/1000;
|
||||
interval.tv_sec = (int)(timeout_msec/1000);
|
||||
timeout_msec -= interval.tv_sec*1000;
|
||||
|
||||
interval.tv_usec = timeout_msec*1000;
|
||||
@@ -330,10 +336,13 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
Curl_resolv_unlock(data, h);
|
||||
/* we don't need it anymore after this function has returned */
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
if( bind(sockfd, addr->ai_addr, addr->ai_addrlen) >= 0) {
|
||||
if( bind(sockfd, addr->ai_addr, (socklen_t)addr->ai_addrlen) >= 0) {
|
||||
/* we succeeded to bind */
|
||||
#ifdef ENABLE_IPV6
|
||||
struct sockaddr_in6 add;
|
||||
#else
|
||||
struct sockaddr_in add;
|
||||
#endif
|
||||
|
||||
bindworked = TRUE;
|
||||
|
||||
@@ -344,31 +353,7 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct sockaddr_in sa;
|
||||
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr, addr->h_addr, addr->h_length);
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_addr.s_addr = in;
|
||||
sa.sin_port = 0; /* get any port */
|
||||
|
||||
if( bind(sockfd, (struct sockaddr *)&sa, sizeof(sa)) >= 0) {
|
||||
/* we succeeded to bind */
|
||||
struct sockaddr_in add;
|
||||
|
||||
bindworked = TRUE;
|
||||
|
||||
size = sizeof(add);
|
||||
if(getsockname(sockfd, (struct sockaddr *) &add,
|
||||
(socklen_t *)&size)<0) {
|
||||
failf(data, "getsockname() failed");
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if(!bindworked) {
|
||||
failf(data, "%s", Curl_strerror(conn, Curl_ourerrno()));
|
||||
return CURLE_HTTP_PORT_FAILED;
|
||||
@@ -443,43 +428,75 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Used within the multi interface. Try next IP address, return TRUE if no
|
||||
more address exists */
|
||||
static bool trynextip(struct connectdata *conn,
|
||||
int sockindex,
|
||||
bool *connected)
|
||||
{
|
||||
curl_socket_t sockfd;
|
||||
Curl_addrinfo *ai;
|
||||
|
||||
if(sockindex != FIRSTSOCKET)
|
||||
return TRUE; /* no next */
|
||||
|
||||
/* try the next address */
|
||||
ai = conn->ip_addr->ai_next;
|
||||
|
||||
while (ai) {
|
||||
sockfd = singleipconnect(conn, ai, 0L, connected);
|
||||
if(sockfd != CURL_SOCKET_BAD) {
|
||||
/* store the new socket descriptor */
|
||||
conn->sock[sockindex] = sockfd;
|
||||
conn->ip_addr = ai;
|
||||
return FALSE;
|
||||
}
|
||||
ai = ai->ai_next;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_is_connected() is used from the multi interface to check if the
|
||||
* firstsocket has connected.
|
||||
*/
|
||||
|
||||
CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
curl_socket_t sockfd,
|
||||
int sockindex,
|
||||
bool *connected)
|
||||
{
|
||||
int rc;
|
||||
struct SessionHandle *data = conn->data;
|
||||
CURLcode code = CURLE_OK;
|
||||
curl_socket_t sockfd = conn->sock[sockindex];
|
||||
long allow = DEFAULT_CONNECT_TIMEOUT;
|
||||
long has_passed;
|
||||
|
||||
curlassert(sockindex >= FIRSTSOCKET && sockindex <= SECONDARYSOCKET);
|
||||
|
||||
*connected = FALSE; /* a very negative world view is best */
|
||||
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
/* there is a timeout set */
|
||||
/* Evaluate in milliseconds how much time that has passed */
|
||||
has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.start);
|
||||
|
||||
/* Evaluate in milliseconds how much time that has passed */
|
||||
long has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.start);
|
||||
|
||||
/* subtract the most strict timeout of the ones */
|
||||
if(data->set.timeout && data->set.connecttimeout) {
|
||||
if (data->set.timeout < data->set.connecttimeout)
|
||||
has_passed -= data->set.timeout*1000;
|
||||
else
|
||||
has_passed -= data->set.connecttimeout*1000;
|
||||
}
|
||||
else if(data->set.timeout)
|
||||
has_passed -= data->set.timeout*1000;
|
||||
/* subtract the most strict timeout of the ones */
|
||||
if(data->set.timeout && data->set.connecttimeout) {
|
||||
if (data->set.timeout < data->set.connecttimeout)
|
||||
allow = data->set.timeout*1000;
|
||||
else
|
||||
has_passed -= data->set.connecttimeout*1000;
|
||||
allow = data->set.connecttimeout*1000;
|
||||
}
|
||||
else if(data->set.timeout) {
|
||||
allow = data->set.timeout*1000;
|
||||
}
|
||||
else if(data->set.connecttimeout) {
|
||||
allow = data->set.connecttimeout*1000;
|
||||
}
|
||||
|
||||
if(has_passed > 0 ) {
|
||||
/* time-out, bail out, go home */
|
||||
failf(data, "Connection time-out");
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
}
|
||||
if(has_passed > allow ) {
|
||||
/* time-out, bail out, go home */
|
||||
failf(data, "Connection time-out after %ld ms", has_passed);
|
||||
return CURLE_OPERATION_TIMEOUTED;
|
||||
}
|
||||
if(conn->bits.tcpconnect) {
|
||||
/* we are connected already! */
|
||||
@@ -497,21 +514,27 @@ CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
return CURLE_OK;
|
||||
}
|
||||
/* nope, not connected for real */
|
||||
failf(data, "Connection failed");
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
infof(data, "Connection failed\n");
|
||||
if(trynextip(conn, sockindex, connected)) {
|
||||
code = CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
}
|
||||
else if(WAITCONN_TIMEOUT != rc) {
|
||||
int error = Curl_ourerrno();
|
||||
failf(data, "Failed connect to %s:%d; %s",
|
||||
conn->host.name, conn->port, Curl_strerror(conn,error));
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
/* nope, not connected */
|
||||
infof(data, "Connection failed\n");
|
||||
if(trynextip(conn, sockindex, connected)) {
|
||||
int error = Curl_ourerrno();
|
||||
failf(data, "Failed connect to %s:%d; %s",
|
||||
conn->host.name, conn->port, Curl_strerror(conn,error));
|
||||
code = CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If the connection failed here, we should attempt to connect to the "next
|
||||
* address" for the given host.
|
||||
*/
|
||||
|
||||
return CURLE_OK;
|
||||
return code;
|
||||
}
|
||||
|
||||
static void tcpnodelay(struct connectdata *conn,
|
||||
@@ -532,6 +555,95 @@ static void tcpnodelay(struct connectdata *conn,
|
||||
#endif
|
||||
}
|
||||
|
||||
/* singleipconnect() connects to the given IP only, and it may return without
|
||||
having connected if used from the multi interface. */
|
||||
static curl_socket_t
|
||||
singleipconnect(struct connectdata *conn,
|
||||
Curl_addrinfo *ai,
|
||||
long timeout_ms,
|
||||
bool *connected)
|
||||
{
|
||||
char addr_buf[128];
|
||||
int rc;
|
||||
int error;
|
||||
bool conected;
|
||||
struct SessionHandle *data = conn->data;
|
||||
curl_socket_t sockfd = socket(ai->ai_family, ai->ai_socktype,
|
||||
ai->ai_protocol);
|
||||
if (sockfd == CURL_SOCKET_BAD)
|
||||
return CURL_SOCKET_BAD;
|
||||
|
||||
*connected = FALSE; /* default is not connected */
|
||||
|
||||
Curl_printable_address(ai, addr_buf, sizeof(addr_buf));
|
||||
infof(data, " Trying %s... ", addr_buf);
|
||||
|
||||
if(data->set.tcp_nodelay)
|
||||
tcpnodelay(conn, sockfd);
|
||||
|
||||
if(conn->data->set.device) {
|
||||
/* user selected to bind the outgoing socket to a specified "device"
|
||||
before doing connect */
|
||||
CURLcode res = bindlocal(conn, sockfd);
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* set socket non-blocking */
|
||||
Curl_nonblock(sockfd, TRUE);
|
||||
|
||||
rc = connect(sockfd, ai->ai_addr, ai->ai_addrlen);
|
||||
|
||||
if(-1 == rc) {
|
||||
error = Curl_ourerrno();
|
||||
|
||||
switch (error) {
|
||||
case EINPROGRESS:
|
||||
case EWOULDBLOCK:
|
||||
#if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
|
||||
/* On some platforms EAGAIN and EWOULDBLOCK are the
|
||||
* same value, and on others they are different, hence
|
||||
* the odd #if
|
||||
*/
|
||||
case EAGAIN:
|
||||
#endif
|
||||
rc = waitconnect(sockfd, timeout_ms);
|
||||
break;
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect to %s: %s",
|
||||
addr_buf, Curl_strerror(conn,error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The 'WAITCONN_TIMEOUT == rc' comes from the waitconnect(), and not from
|
||||
connect(). We can be sure of this since connect() cannot return 1. */
|
||||
if((WAITCONN_TIMEOUT == rc) &&
|
||||
(data->state.used_interface == Curl_if_multi)) {
|
||||
/* Timeout when running the multi interface */
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
conected = verifyconnect(sockfd, &error);
|
||||
|
||||
if(!rc && conected) {
|
||||
/* we are connected, awesome! */
|
||||
*connected = TRUE; /* this is a true connect */
|
||||
infof(data, "connected\n");
|
||||
return sockfd;
|
||||
}
|
||||
else if(WAITCONN_TIMEOUT == rc)
|
||||
infof(data, "Timeout\n");
|
||||
else
|
||||
infof(data, "%s\n", Curl_strerror(conn, error));
|
||||
|
||||
/* connect failed or timed out */
|
||||
sclose(sockfd);
|
||||
|
||||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
/*
|
||||
* TCP connect to the given host with timeout, proxy or remote doesn't matter.
|
||||
* There might be more than one IP address to try out. Fill in the passed
|
||||
@@ -540,33 +652,30 @@ static void tcpnodelay(struct connectdata *conn,
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
struct Curl_dns_entry *remotehost, /* use this one */
|
||||
int port, /* connect to this */
|
||||
curl_socket_t *sockconn, /* the connected socket */
|
||||
Curl_ipconnect **addr, /* the one we used */
|
||||
Curl_addrinfo **addr, /* the one we used */
|
||||
bool *connected) /* really connected? */
|
||||
{
|
||||
struct SessionHandle *data = conn->data;
|
||||
curl_socket_t sockfd = CURL_SOCKET_BAD;
|
||||
int rc, error;
|
||||
int aliasindex;
|
||||
int num_addr;
|
||||
bool conected;
|
||||
char addr_buf[256];
|
||||
Curl_addrinfo *ai;
|
||||
Curl_addrinfo *curr_addr;
|
||||
|
||||
Curl_ipconnect *curr_addr;
|
||||
struct timeval after;
|
||||
struct timeval before = Curl_tvnow();
|
||||
|
||||
/*************************************************************
|
||||
* Figure out what maximum time we have left
|
||||
*************************************************************/
|
||||
long timeout_ms=300000; /* milliseconds, default to five minutes total */
|
||||
long timeout_ms= DEFAULT_CONNECT_TIMEOUT;
|
||||
long timeout_per_addr;
|
||||
|
||||
*connected = FALSE; /* default to not connected */
|
||||
|
||||
if(data->set.timeout || data->set.connecttimeout) {
|
||||
double has_passed;
|
||||
long has_passed;
|
||||
|
||||
/* Evaluate in milliseconds how much time that has passed */
|
||||
has_passed = Curl_tvdiff(Curl_tvnow(), data->progress.start);
|
||||
@@ -588,7 +697,7 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
timeout_ms = data->set.connecttimeout*1000;
|
||||
|
||||
/* subtract the passed time */
|
||||
timeout_ms -= (long)has_passed;
|
||||
timeout_ms -= has_passed;
|
||||
|
||||
if(timeout_ms < 0) {
|
||||
/* a precaution, no need to continue if time already is up */
|
||||
@@ -601,128 +710,27 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
||||
num_addr = Curl_num_addresses(remotehost->addr);
|
||||
timeout_per_addr = timeout_ms / num_addr;
|
||||
|
||||
ai = remotehost->addr;
|
||||
|
||||
/* Below is the loop that attempts to connect to all IP-addresses we
|
||||
* know for the given host. One by one until one IP succeedes.
|
||||
* know for the given host. One by one until one IP succeeds.
|
||||
*/
|
||||
#ifdef ENABLE_IPV6
|
||||
|
||||
if(data->state.used_interface == Curl_if_multi)
|
||||
/* don't hang when doing multi */
|
||||
timeout_per_addr = timeout_ms = 0;
|
||||
|
||||
/*
|
||||
* Connecting with a getaddrinfo chain
|
||||
* Connecting with a Curl_addrinfo chain
|
||||
*/
|
||||
(void)port; /* the port number is already included in the getaddrinfo
|
||||
struct */
|
||||
for (curr_addr = remotehost->addr, aliasindex=0; curr_addr;
|
||||
for (curr_addr = ai, aliasindex=0; curr_addr;
|
||||
curr_addr = curr_addr->ai_next, aliasindex++) {
|
||||
sockfd = socket(curr_addr->ai_family, curr_addr->ai_socktype,
|
||||
curr_addr->ai_protocol);
|
||||
if (sockfd == CURL_SOCKET_BAD) {
|
||||
timeout_per_addr += timeout_per_addr / (num_addr - aliasindex);
|
||||
continue;
|
||||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* Connecting with old style IPv4-only support
|
||||
*/
|
||||
curr_addr = (Curl_ipconnect*)remotehost->addr->h_addr_list[0];
|
||||
for(aliasindex=0; curr_addr;
|
||||
curr_addr=(Curl_ipconnect*)remotehost->addr->h_addr_list[++aliasindex]) {
|
||||
struct sockaddr_in serv_addr;
|
||||
/* start connecting to the IP curr_addr points to */
|
||||
sockfd = singleipconnect(conn, curr_addr, timeout_per_addr, connected);
|
||||
|
||||
/* create an IPv4 TCP socket */
|
||||
sockfd = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(CURL_SOCKET_BAD == sockfd) {
|
||||
failf(data, "couldn't create socket");
|
||||
return CURLE_COULDNT_CONNECT; /* big time error */
|
||||
}
|
||||
|
||||
/* nasty address work before connect can be made */
|
||||
memset((char *) &serv_addr, '\0', sizeof(serv_addr));
|
||||
memcpy((char *)&(serv_addr.sin_addr), curr_addr,
|
||||
sizeof(struct in_addr));
|
||||
serv_addr.sin_family = remotehost->addr->h_addrtype;
|
||||
serv_addr.sin_port = htons((unsigned short)port);
|
||||
#endif
|
||||
|
||||
|
||||
Curl_printable_address(curr_addr, addr_buf, sizeof(addr_buf));
|
||||
infof(data, " Trying %s... ", addr_buf);
|
||||
|
||||
if(data->set.tcp_nodelay)
|
||||
tcpnodelay(conn, sockfd);
|
||||
|
||||
if(conn->data->set.device) {
|
||||
/* user selected to bind the outgoing socket to a specified "device"
|
||||
before doing connect */
|
||||
CURLcode res = bindlocal(conn, sockfd);
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* set socket non-blocking */
|
||||
Curl_nonblock(sockfd, TRUE);
|
||||
|
||||
/* do not use #ifdef within the function arguments below, as connect() is
|
||||
a defined macro on some platforms and some compilers don't like to mix
|
||||
#ifdefs with macro usage! (AmigaOS is one such platform) */
|
||||
#ifdef ENABLE_IPV6
|
||||
rc = connect(sockfd, curr_addr->ai_addr, curr_addr->ai_addrlen);
|
||||
#else
|
||||
rc = connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr));
|
||||
#endif
|
||||
|
||||
if(-1 == rc) {
|
||||
error = Curl_ourerrno();
|
||||
|
||||
switch (error) {
|
||||
case EINPROGRESS:
|
||||
case EWOULDBLOCK:
|
||||
#if defined(EAGAIN) && EAGAIN != EWOULDBLOCK
|
||||
/* On some platforms EAGAIN and EWOULDBLOCK are the
|
||||
* same value, and on others they are different, hence
|
||||
* the odd #if
|
||||
*/
|
||||
case EAGAIN:
|
||||
#endif
|
||||
/* asynchronous connect, wait for connect or timeout */
|
||||
if(data->state.used_interface == Curl_if_multi)
|
||||
/* don't hang when doing multi */
|
||||
timeout_per_addr = timeout_ms = 0;
|
||||
|
||||
rc = waitconnect(sockfd, timeout_per_addr);
|
||||
break;
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect to %s (IP number %d): %s",
|
||||
addr_buf, aliasindex+1, Curl_strerror(conn,error));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* The 'WAITCONN_TIMEOUT == rc' comes from the waitconnect(), and not from
|
||||
connect(). We can be sure of this since connect() cannot return 1. */
|
||||
if((WAITCONN_TIMEOUT == rc) &&
|
||||
(data->state.used_interface == Curl_if_multi)) {
|
||||
/* Timeout when running the multi interface, we return here with a
|
||||
CURLE_OK return code. */
|
||||
rc = 0;
|
||||
if(sockfd != CURL_SOCKET_BAD)
|
||||
break;
|
||||
}
|
||||
|
||||
conected = verifyconnect(sockfd, &error);
|
||||
|
||||
if(!rc && conected) {
|
||||
/* we are connected, awesome! */
|
||||
*connected = TRUE; /* this is a true connect */
|
||||
break;
|
||||
}
|
||||
if(WAITCONN_TIMEOUT == rc)
|
||||
infof(data, "Timeout\n");
|
||||
else
|
||||
infof(data, "%s\n", Curl_strerror(conn, error));
|
||||
|
||||
/* connect failed or timed out */
|
||||
sclose(sockfd);
|
||||
sockfd = CURL_SOCKET_BAD;
|
||||
|
||||
/* get a new timeout for next attempt */
|
||||
after = Curl_tvnow();
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#ifndef __CONNECT_H
|
||||
#define __CONNECT_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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.
|
||||
@@ -27,16 +27,18 @@ int Curl_nonblock(curl_socket_t sockfd, /* operate on this */
|
||||
int nonblock /* TRUE or FALSE */);
|
||||
|
||||
CURLcode Curl_is_connected(struct connectdata *conn,
|
||||
curl_socket_t sockfd,
|
||||
int sockindex,
|
||||
bool *connected);
|
||||
|
||||
CURLcode Curl_connecthost(struct connectdata *conn,
|
||||
struct Curl_dns_entry *host, /* connect to this */
|
||||
int port, /* connect to this port number */
|
||||
curl_socket_t *sockconn, /* not set if error */
|
||||
Curl_ipconnect **addr, /* the one we used */
|
||||
Curl_addrinfo **addr, /* the one we used */
|
||||
bool *connected /* truly connected? */
|
||||
);
|
||||
|
||||
int Curl_ourerrno(void);
|
||||
|
||||
#define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */
|
||||
|
||||
#endif
|
||||
|
@@ -94,7 +94,7 @@ Curl_unencode_deflate_write(struct SessionHandle *data,
|
||||
|
||||
/* Set the compressed input when this function is called */
|
||||
z->next_in = (Bytef *)k->str;
|
||||
z->avail_in = nread;
|
||||
z->avail_in = (uInt)nread;
|
||||
|
||||
/* because the buffer size is fixed, iteratively decompress
|
||||
and transfer to the client via client_write. */
|
||||
@@ -251,7 +251,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
|
||||
switch (check_gzip_header((unsigned char *)k->str, nread, &hlen)) {
|
||||
case GZIP_OK:
|
||||
z->next_in = (Bytef *)k->str + hlen;
|
||||
z->avail_in = nread - hlen;
|
||||
z->avail_in = (uInt)(nread - hlen);
|
||||
k->zlib_init = 3; /* Inflating stream state */
|
||||
break;
|
||||
|
||||
@@ -263,7 +263,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
|
||||
* the first place, and it's even more unlikely for a transfer to fail
|
||||
* immediately afterwards, it should seldom be a problem.
|
||||
*/
|
||||
z->avail_in = nread;
|
||||
z->avail_in = (uInt)nread;
|
||||
z->next_in = malloc(z->avail_in);
|
||||
if (z->next_in == NULL) {
|
||||
return exit_zlib(z, &k->zlib_init, CURLE_OUT_OF_MEMORY);
|
||||
@@ -299,7 +299,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
|
||||
free(z->next_in);
|
||||
/* Don't point into the malloced block since we just freed it */
|
||||
z->next_in = (Bytef *)k->str + hlen + nread - z->avail_in;
|
||||
z->avail_in = z->avail_in - hlen;
|
||||
z->avail_in = (uInt)(z->avail_in - hlen);
|
||||
k->zlib_init = 3; /* Inflating stream state */
|
||||
break;
|
||||
|
||||
@@ -317,7 +317,7 @@ Curl_unencode_gzip_write(struct SessionHandle *data,
|
||||
else {
|
||||
/* Inflating stream state */
|
||||
z->next_in = (Bytef *)k->str;
|
||||
z->avail_in = nread;
|
||||
z->avail_in = (uInt)nread;
|
||||
}
|
||||
|
||||
if (z->avail_in == 0) {
|
||||
|
55
lib/cookie.c
55
lib/cookie.c
@@ -223,14 +223,9 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
|
||||
const char *domptr=whatptr;
|
||||
int dotcount=1;
|
||||
unsigned int i;
|
||||
|
||||
static const char *seventhree[]= {
|
||||
"com", "edu", "net", "org", "gov", "mil", "int"
|
||||
};
|
||||
|
||||
/* Count the dots, we need to make sure that there are THREE dots
|
||||
in the normal domains, or TWO in the seventhree-domains. */
|
||||
/* Count the dots, we need to make sure that there are enough
|
||||
of them. */
|
||||
|
||||
if('.' == whatptr[0])
|
||||
/* don't count the initial dot, assume it */
|
||||
@@ -244,13 +239,6 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
}
|
||||
} while(domptr);
|
||||
|
||||
for(i=0;
|
||||
i<sizeof(seventhree)/sizeof(seventhree[0]); i++) {
|
||||
if(tailmatch(seventhree[i], whatptr)) {
|
||||
dotcount++; /* we allow one dot less for these */
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* The original Netscape cookie spec defined that this domain name
|
||||
MUST have three dots (or two if one of the seven holy TLDs),
|
||||
but it seems that these kinds of cookies are in use "out there"
|
||||
@@ -261,7 +249,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
/* Received and skipped a cookie with a domain using too few
|
||||
dots. */
|
||||
badcookie=TRUE; /* mark this as a bad cookie */
|
||||
infof(data, "skipped cookie with illegal dotcount domain: %s",
|
||||
infof(data, "skipped cookie with illegal dotcount domain: %s\n",
|
||||
whatptr);
|
||||
}
|
||||
else {
|
||||
@@ -289,7 +277,7 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
is not a domain to which the current host belongs. Mark as
|
||||
bad. */
|
||||
badcookie=TRUE;
|
||||
infof(data, "skipped cookie with bad tailmatch domain: %s",
|
||||
infof(data, "skipped cookie with bad tailmatch domain: %s\n",
|
||||
whatptr);
|
||||
}
|
||||
}
|
||||
@@ -638,17 +626,15 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
struct CookieInfo *inc,
|
||||
bool newsession)
|
||||
{
|
||||
char line[MAX_COOKIE_LINE];
|
||||
struct CookieInfo *c;
|
||||
FILE *fp;
|
||||
bool fromfile=TRUE;
|
||||
|
||||
if(NULL == inc) {
|
||||
/* we didn't get a struct, create one */
|
||||
c = (struct CookieInfo *)malloc(sizeof(struct CookieInfo));
|
||||
c = (struct CookieInfo *)calloc(1, sizeof(struct CookieInfo));
|
||||
if(!c)
|
||||
return NULL; /* failed to get memory */
|
||||
memset(c, 0, sizeof(struct CookieInfo));
|
||||
c->filename = strdup(file?file:"none"); /* copy the name just in case */
|
||||
}
|
||||
else {
|
||||
@@ -669,20 +655,25 @@ struct CookieInfo *Curl_cookie_init(struct SessionHandle *data,
|
||||
if(fp) {
|
||||
char *lineptr;
|
||||
bool headerline;
|
||||
while(fgets(line, MAX_COOKIE_LINE, fp)) {
|
||||
if(checkprefix("Set-Cookie:", line)) {
|
||||
/* This is a cookie line, get it! */
|
||||
lineptr=&line[11];
|
||||
headerline=TRUE;
|
||||
}
|
||||
else {
|
||||
lineptr=line;
|
||||
headerline=FALSE;
|
||||
}
|
||||
while(*lineptr && isspace((int)*lineptr))
|
||||
lineptr++;
|
||||
|
||||
Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);
|
||||
char *line = (char *)malloc(MAX_COOKIE_LINE);
|
||||
if(line) {
|
||||
while(fgets(line, MAX_COOKIE_LINE, fp)) {
|
||||
if(checkprefix("Set-Cookie:", line)) {
|
||||
/* This is a cookie line, get it! */
|
||||
lineptr=&line[11];
|
||||
headerline=TRUE;
|
||||
}
|
||||
else {
|
||||
lineptr=line;
|
||||
headerline=FALSE;
|
||||
}
|
||||
while(*lineptr && isspace((int)*lineptr))
|
||||
lineptr++;
|
||||
|
||||
Curl_cookie_add(data, c, headerline, lineptr, NULL, NULL);
|
||||
}
|
||||
free(line); /* free the line buffer */
|
||||
}
|
||||
if(fromfile)
|
||||
fclose(fp);
|
||||
|
117
lib/easy.c
117
lib/easy.c
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
@@ -96,36 +96,36 @@ static void win32_cleanup(void)
|
||||
stack to allow networking */
|
||||
static CURLcode win32_init(void)
|
||||
{
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
wVersionRequested = MAKEWORD(2, 0);
|
||||
#else
|
||||
wVersionRequested = MAKEWORD(1, 1);
|
||||
#endif
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
|
||||
if (err != 0)
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
/* winsock.dll. */
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* Confirm that the Windows Sockets DLL supports what we need.*/
|
||||
/* Note that if the DLL supports versions greater */
|
||||
/* than wVersionRequested, it will still return */
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
|
||||
if (err != 0)
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
/* winsock.dll. */
|
||||
return CURLE_FAILED_INIT;
|
||||
|
||||
/* Confirm that the Windows Sockets DLL supports what we need.*/
|
||||
/* Note that if the DLL supports versions greater */
|
||||
/* than wVersionRequested, it will still return */
|
||||
/* wVersionRequested in wVersion. wHighVersion contains the */
|
||||
/* highest supported version. */
|
||||
|
||||
if ( LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
|
||||
HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
if ( LOBYTE( wsaData.wVersion ) != LOBYTE(wVersionRequested) ||
|
||||
HIBYTE( wsaData.wVersion ) != HIBYTE(wVersionRequested) ) {
|
||||
/* Tell the user that we couldn't find a useable */
|
||||
|
||||
/* winsock.dll. */
|
||||
WSACleanup();
|
||||
return CURLE_FAILED_INIT;
|
||||
/* winsock.dll. */
|
||||
WSACleanup();
|
||||
return CURLE_FAILED_INIT;
|
||||
}
|
||||
/* The Windows Sockets DLL is acceptable. Proceed. */
|
||||
return CURLE_OK;
|
||||
@@ -207,7 +207,7 @@ CURLcode curl_global_init(long flags)
|
||||
|
||||
initialized = 1;
|
||||
init_flags = flags;
|
||||
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ CURL *curl_easy_init(void)
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* curl_easy_setopt() is the external interface for setting options on an
|
||||
* easy handle.
|
||||
*/
|
||||
@@ -373,9 +373,9 @@ CURLcode curl_easy_perform(CURL *curl)
|
||||
screwed up and we should bail out! */
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return Curl_perform(data);
|
||||
}
|
||||
|
||||
@@ -522,3 +522,62 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
||||
|
||||
return outcurl;
|
||||
}
|
||||
|
||||
/*
|
||||
* curl_easy_reset() is an external interface that allows an app to re-
|
||||
* initialize a session handle to the default values.
|
||||
*/
|
||||
void curl_easy_reset(CURL *curl)
|
||||
{
|
||||
struct SessionHandle *data = (struct SessionHandle *)curl;
|
||||
|
||||
/* zero out UserDefined data: */
|
||||
memset(&data->set, 0, sizeof(struct UserDefined));
|
||||
|
||||
/* zero out Progress data: */
|
||||
memset(&data->progress, 0, sizeof(struct Progress));
|
||||
|
||||
/* The remainder of these calls have been taken from Curl_open() */
|
||||
|
||||
data->set.out = stdout; /* default output to stdout */
|
||||
data->set.in = stdin; /* default input from stdin */
|
||||
data->set.err = stderr; /* default stderr to stderr */
|
||||
|
||||
/* use fwrite as default function to store output */
|
||||
data->set.fwrite = (curl_write_callback)fwrite;
|
||||
|
||||
/* use fread as default function to read input */
|
||||
data->set.fread = (curl_read_callback)fread;
|
||||
|
||||
data->set.infilesize = -1; /* we don't know any size */
|
||||
|
||||
data->state.current_speed = -1; /* init to negative == impossible */
|
||||
|
||||
data->set.httpreq = HTTPREQ_GET; /* Default HTTP request */
|
||||
data->set.ftp_use_epsv = TRUE; /* FTP defaults to EPSV operations */
|
||||
data->set.ftp_use_eprt = TRUE; /* FTP defaults to EPRT operations */
|
||||
|
||||
data->set.dns_cache_timeout = 60; /* Timeout every 60 seconds by default */
|
||||
|
||||
/* make libcurl quiet by default: */
|
||||
data->set.hide_progress = TRUE; /* CURLOPT_NOPROGRESS changes these */
|
||||
|
||||
/* Set the default size of the SSL session ID cache */
|
||||
data->set.ssl.numsessions = 5;
|
||||
|
||||
data->set.proxyport = 1080;
|
||||
data->set.proxytype = CURLPROXY_HTTP; /* defaults to HTTP proxy */
|
||||
data->set.httpauth = CURLAUTH_BASIC; /* defaults to basic */
|
||||
data->set.proxyauth = CURLAUTH_BASIC; /* defaults to basic */
|
||||
|
||||
/*
|
||||
* libcurl 7.10 introduced SSL verification *by default*! This needs to be
|
||||
* switched off unless wanted.
|
||||
*/
|
||||
data->set.ssl.verifypeer = TRUE;
|
||||
data->set.ssl.verifyhost = 2;
|
||||
#ifdef CURL_CA_BUNDLE
|
||||
/* This is our prefered CA cert bundle since install time */
|
||||
data->set.ssl.CAfile = (char *)CURL_CA_BUNDLE;
|
||||
#endif
|
||||
}
|
||||
|
26
lib/escape.c
26
lib/escape.c
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
@@ -33,17 +33,21 @@
|
||||
#include <string.h>
|
||||
#include "memory.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
|
||||
/* The last #include file should be: */
|
||||
#include "memdebug.h"
|
||||
|
||||
char *curl_escape(const char *string, int length)
|
||||
char *curl_escape(const char *string, int inlength)
|
||||
{
|
||||
size_t alloc = (length?(size_t)length:strlen(string))+1;
|
||||
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
|
||||
char *ns;
|
||||
char *testing_ptr = NULL;
|
||||
unsigned char in;
|
||||
size_t newlen = alloc;
|
||||
int strindex=0;
|
||||
size_t length;
|
||||
|
||||
ns = malloc(alloc);
|
||||
if(!ns)
|
||||
@@ -68,7 +72,7 @@ char *curl_escape(const char *string, int length)
|
||||
ns = testing_ptr;
|
||||
}
|
||||
}
|
||||
sprintf(&ns[strindex], "%%%02X", in);
|
||||
snprintf(&ns[strindex], 4, "%%%02X", in);
|
||||
|
||||
strindex+=3;
|
||||
}
|
||||
@@ -93,10 +97,10 @@ char *curl_unescape(const char *string, int length)
|
||||
unsigned char in;
|
||||
int strindex=0;
|
||||
long hex;
|
||||
|
||||
|
||||
if( !ns )
|
||||
return NULL;
|
||||
|
||||
|
||||
while(--alloc > 0) {
|
||||
in = *string;
|
||||
if(('%' == in) && ishex(string[1]) && ishex(string[2])) {
|
||||
@@ -113,7 +117,7 @@ char *curl_unescape(const char *string, int length)
|
||||
string+=2;
|
||||
alloc-=2;
|
||||
}
|
||||
|
||||
|
||||
ns[strindex++] = in;
|
||||
string++;
|
||||
}
|
||||
|
15
lib/file.c
15
lib/file.c
@@ -180,10 +180,16 @@ CURLcode Curl_file_done(struct connectdata *conn,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
#if defined(WIN32) || defined(__EMX__)
|
||||
#define DIRSEP '\\'
|
||||
#else
|
||||
#define DIRSEP '/'
|
||||
#endif
|
||||
|
||||
static CURLcode file_upload(struct connectdata *conn)
|
||||
{
|
||||
struct FILEPROTO *file = conn->proto.file;
|
||||
char *dir = strchr(file->path, '/');
|
||||
char *dir = strchr(file->path, DIRSEP);
|
||||
FILE *fp;
|
||||
CURLcode res=CURLE_OK;
|
||||
struct SessionHandle *data = conn->data;
|
||||
@@ -300,13 +306,14 @@ CURLcode Curl_file(struct connectdata *conn)
|
||||
date. */
|
||||
if(conn->bits.no_body && data->set.include_header && fstated) {
|
||||
CURLcode result;
|
||||
sprintf(buf, "Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
|
||||
snprintf(buf, sizeof(data->state.buffer),
|
||||
"Content-Length: %" FORMAT_OFF_T "\r\n", expected_size);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
sprintf(buf, "Accept-ranges: bytes\r\n");
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH,
|
||||
(char *)"Accept-ranges: bytes\r\n", 0);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
|
@@ -846,7 +846,7 @@ static CURLcode AddFormDataf(struct FormData **formp,
|
||||
char s[4096];
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vsprintf(s, fmt, ap);
|
||||
vsnprintf(s, sizeof(s), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return AddFormData(formp, FORM_DATA, s, 0, size);
|
||||
@@ -1426,60 +1426,6 @@ int main()
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _OLD_FORM_DEBUG
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#if 0
|
||||
char *testargs[]={
|
||||
"name1 = data in number one",
|
||||
"name2 = number two data",
|
||||
"test = @upload"
|
||||
};
|
||||
#endif
|
||||
int i;
|
||||
char *nextarg;
|
||||
struct curl_httppost *httppost=NULL;
|
||||
struct curl_httppost *last_post=NULL;
|
||||
struct curl_httppost *post;
|
||||
int size;
|
||||
int nread;
|
||||
char buffer[4096];
|
||||
|
||||
struct FormData *form;
|
||||
struct Form formread;
|
||||
|
||||
for(i=1; i<argc; i++) {
|
||||
|
||||
if( FormParse( argv[i],
|
||||
&httppost,
|
||||
&last_post)) {
|
||||
fprintf(stderr, "Illegally formatted input field: '%s'!\n",
|
||||
argv[i]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
form=Curl_getFormData(httppost, &size);
|
||||
|
||||
Curl_FormInit(&formread, form);
|
||||
|
||||
do {
|
||||
nread = Curl_FormReader(buffer, 1, sizeof(buffer),
|
||||
(FILE *)&formread);
|
||||
|
||||
if(-1 == nread)
|
||||
break;
|
||||
fwrite(buffer, nread, 1, stderr);
|
||||
} while(1);
|
||||
|
||||
fprintf(stderr, "size: %d\n", size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#else /* CURL_DISABLE_HTTP */
|
||||
CURLFORMcode curl_formadd(struct curl_httppost **httppost,
|
||||
struct curl_httppost **last_post,
|
||||
|
236
lib/ftp.c
236
lib/ftp.c
@@ -93,6 +93,7 @@
|
||||
#include "connect.h"
|
||||
#include "strerror.h"
|
||||
#include "memory.h"
|
||||
#include "inet_ntop.h"
|
||||
|
||||
#if defined(HAVE_INET_NTOA_R) && !defined(HAVE_INET_NTOA_R_DECL)
|
||||
#include "inet_ntoa_r.h"
|
||||
@@ -931,8 +932,9 @@ CURLcode ftp_getfiletime(struct connectdata *conn, char *file)
|
||||
&year, &month, &day, &hour, &minute, &second)) {
|
||||
/* we have a time, reformat it */
|
||||
time_t secs=time(NULL);
|
||||
sprintf(buf, "%04d%02d%02d %02d:%02d:%02d GMT",
|
||||
year, month, day, hour, minute, second);
|
||||
snprintf(buf, sizeof(conn->data->state.buffer),
|
||||
"%04d%02d%02d %02d:%02d:%02d GMT",
|
||||
year, month, day, hour, minute, second);
|
||||
/* now, convert this into a time() value: */
|
||||
conn->data->info.filetime = curl_getdate(buf, &secs);
|
||||
}
|
||||
@@ -1022,121 +1024,13 @@ CURLcode ftp_getsize(struct connectdata *conn, char *file,
|
||||
*/
|
||||
static void
|
||||
ftp_pasv_verbose(struct connectdata *conn,
|
||||
Curl_ipconnect *addr,
|
||||
Curl_addrinfo *ai,
|
||||
char *newhost, /* ascii version */
|
||||
int port)
|
||||
{
|
||||
#ifndef ENABLE_IPV6
|
||||
/*****************************************************************
|
||||
*
|
||||
* IPv4-only code section
|
||||
*/
|
||||
|
||||
struct in_addr in;
|
||||
struct hostent * answer;
|
||||
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
char ntoa_buf[64];
|
||||
#endif
|
||||
/* The array size trick below is to make this a large chunk of memory
|
||||
suitably 8-byte aligned on 64-bit platforms. This was thoughtfully
|
||||
suggested by Philip Gladstone. */
|
||||
long bigbuf[9000 / sizeof(long)];
|
||||
|
||||
#if defined(HAVE_INET_ADDR)
|
||||
in_addr_t address;
|
||||
# if defined(HAVE_GETHOSTBYADDR_R)
|
||||
int h_errnop;
|
||||
# endif
|
||||
char *hostent_buf = (char *)bigbuf; /* get a char * to the buffer */
|
||||
|
||||
address = inet_addr(newhost);
|
||||
# ifdef HAVE_GETHOSTBYADDR_R
|
||||
|
||||
# ifdef HAVE_GETHOSTBYADDR_R_5
|
||||
/* AIX, Digital Unix (OSF1, Tru64) style:
|
||||
extern int gethostbyaddr_r(char *addr, size_t len, int type,
|
||||
struct hostent *htent, struct hostent_data *ht_data); */
|
||||
|
||||
/* Fred Noz helped me try this out, now it at least compiles! */
|
||||
|
||||
/* Bjorn Reese (November 28 2001):
|
||||
The Tru64 man page on gethostbyaddr_r() says that
|
||||
the hostent struct must be filled with zeroes before the call to
|
||||
gethostbyaddr_r().
|
||||
|
||||
... as must be struct hostent_data Craig Markwardt 19 Sep 2002. */
|
||||
|
||||
memset(hostent_buf, 0, sizeof(struct hostent)+sizeof(struct hostent_data));
|
||||
|
||||
if(gethostbyaddr_r((char *) &address,
|
||||
sizeof(address), AF_INET,
|
||||
(struct hostent *)hostent_buf,
|
||||
(struct hostent_data *)(hostent_buf + sizeof(*answer))))
|
||||
answer=NULL;
|
||||
else
|
||||
answer=(struct hostent *)hostent_buf;
|
||||
|
||||
# endif
|
||||
# ifdef HAVE_GETHOSTBYADDR_R_7
|
||||
/* Solaris and IRIX */
|
||||
answer = gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
|
||||
(struct hostent *)bigbuf,
|
||||
hostent_buf + sizeof(*answer),
|
||||
sizeof(bigbuf) - sizeof(*answer),
|
||||
&h_errnop);
|
||||
# endif
|
||||
# ifdef HAVE_GETHOSTBYADDR_R_8
|
||||
/* Linux style */
|
||||
if(gethostbyaddr_r((char *) &address, sizeof(address), AF_INET,
|
||||
(struct hostent *)hostent_buf,
|
||||
hostent_buf + sizeof(*answer),
|
||||
sizeof(bigbuf) - sizeof(*answer),
|
||||
&answer,
|
||||
&h_errnop))
|
||||
answer=NULL; /* error */
|
||||
# endif
|
||||
|
||||
# else
|
||||
(void)hostent_buf; /* avoid compiler warning */
|
||||
answer = gethostbyaddr((char *) &address, sizeof(address), AF_INET);
|
||||
# endif
|
||||
#else
|
||||
answer = NULL;
|
||||
#endif
|
||||
(void) memcpy(&in.s_addr, addr, sizeof (Curl_ipconnect));
|
||||
infof(conn->data, "Connecting to %s (%s) port %u\n",
|
||||
answer?answer->h_name:newhost,
|
||||
#if defined(HAVE_INET_NTOA_R)
|
||||
inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf)),
|
||||
#else
|
||||
inet_ntoa(in),
|
||||
#endif
|
||||
port);
|
||||
|
||||
#else
|
||||
/*****************************************************************
|
||||
*
|
||||
* IPv6-only code section
|
||||
*/
|
||||
char hbuf[NI_MAXHOST]; /* ~1KB */
|
||||
char nbuf[NI_MAXHOST]; /* ~1KB */
|
||||
char sbuf[NI_MAXSERV]; /* around 32 */
|
||||
(void)port; /* prevent compiler warning */
|
||||
if (getnameinfo(addr->ai_addr, addr->ai_addrlen,
|
||||
nbuf, sizeof(nbuf), sbuf, sizeof(sbuf), NIFLAGS)) {
|
||||
snprintf(nbuf, sizeof(nbuf), "?");
|
||||
snprintf(sbuf, sizeof(sbuf), "?");
|
||||
}
|
||||
|
||||
if (getnameinfo(addr->ai_addr, addr->ai_addrlen,
|
||||
hbuf, sizeof(hbuf), NULL, 0, 0)) {
|
||||
infof(conn->data, "Connecting to %s (%s) port %s\n", nbuf, newhost, sbuf);
|
||||
}
|
||||
else {
|
||||
infof(conn->data, "Connecting to %s (%s) port %s\n", hbuf, nbuf, sbuf);
|
||||
}
|
||||
#endif
|
||||
char buf[256];
|
||||
Curl_printable_address(ai, buf, sizeof(buf));
|
||||
infof(conn->data, "Connecting to %s (%s) port %d\n", newhost, buf, port);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@@ -1172,7 +1066,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
struct sockaddr *sa=(struct sockaddr *)&ss;
|
||||
unsigned char *ap;
|
||||
unsigned char *pp;
|
||||
char portmsgbuf[4096], tmp[4096];
|
||||
char portmsgbuf[1024], tmp[1024];
|
||||
|
||||
const char *mode[] = { "EPRT", "LPRT", "PORT", NULL };
|
||||
char **modep;
|
||||
@@ -1381,36 +1275,44 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
*
|
||||
*/
|
||||
struct sockaddr_in sa;
|
||||
struct Curl_dns_entry *h=NULL;
|
||||
unsigned short porttouse;
|
||||
char myhost[256] = "";
|
||||
bool sa_filled_in = FALSE;
|
||||
Curl_addrinfo *addr = NULL;
|
||||
unsigned short ip[4];
|
||||
|
||||
if(data->set.ftpport) {
|
||||
in_addr_t in;
|
||||
int rc;
|
||||
|
||||
/* First check if the given name is an IP address */
|
||||
in=inet_addr(data->set.ftpport);
|
||||
|
||||
if((in == CURL_INADDR_NONE) &&
|
||||
Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
|
||||
rc = Curl_resolv(conn, myhost, 0, &h);
|
||||
if(rc == CURLRESOLV_PENDING)
|
||||
rc = Curl_wait_for_resolv(conn, &h);
|
||||
}
|
||||
if(in != CURL_INADDR_NONE)
|
||||
/* this is an IPv4 address */
|
||||
addr = Curl_ip2addr(in, data->set.ftpport, 0);
|
||||
else {
|
||||
size_t len = strlen(data->set.ftpport);
|
||||
if(len>1) {
|
||||
rc = Curl_resolv(conn, data->set.ftpport, 0, &h);
|
||||
if(Curl_if2ip(data->set.ftpport, myhost, sizeof(myhost))) {
|
||||
/* The interface to IP conversion provided a dotted address */
|
||||
in=inet_addr(myhost);
|
||||
addr = Curl_ip2addr(in, myhost, 0);
|
||||
}
|
||||
else if(strlen(data->set.ftpport)> 1) {
|
||||
/* might be a host name! */
|
||||
struct Curl_dns_entry *h=NULL;
|
||||
int rc = Curl_resolv(conn, myhost, 0, &h);
|
||||
if(rc == CURLRESOLV_PENDING)
|
||||
rc = Curl_wait_for_resolv(conn, &h);
|
||||
}
|
||||
if(h)
|
||||
strcpy(myhost, data->set.ftpport); /* buffer overflow risk */
|
||||
}
|
||||
}
|
||||
if(! *myhost) {
|
||||
if(h) {
|
||||
addr = h->addr;
|
||||
/* when we return from this function, we can forget about this entry
|
||||
to we can unlock it now already */
|
||||
Curl_resolv_unlock(data, h);
|
||||
} /* (h) */
|
||||
} /* strlen */
|
||||
} /* CURL_INADDR_NONE */
|
||||
} /* data->set.ftpport */
|
||||
|
||||
if(!addr) {
|
||||
/* pick a suitable default here */
|
||||
|
||||
socklen_t sslen;
|
||||
@@ -1425,13 +1327,10 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
sa_filled_in = TRUE; /* the sa struct is filled in */
|
||||
}
|
||||
|
||||
if(h)
|
||||
/* when we return from here, we can forget about this */
|
||||
Curl_resolv_unlock(data, h);
|
||||
|
||||
if ( h || sa_filled_in) {
|
||||
if( (portsock = socket(AF_INET, SOCK_STREAM, 0)) != CURL_SOCKET_BAD ) {
|
||||
int size;
|
||||
if (addr || sa_filled_in) {
|
||||
portsock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if(CURL_SOCKET_BAD != portsock) {
|
||||
socklen_t size;
|
||||
|
||||
/* we set the secondary socket variable to this for now, it
|
||||
is only so that the cleanup function will close it in case
|
||||
@@ -1439,11 +1338,7 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
conn->sock[SECONDARYSOCKET] = portsock;
|
||||
|
||||
if(!sa_filled_in) {
|
||||
memset((char *)&sa, 0, sizeof(sa));
|
||||
memcpy((char *)&sa.sin_addr,
|
||||
h->addr->h_addr,
|
||||
h->addr->h_length);
|
||||
sa.sin_family = AF_INET;
|
||||
memcpy(&sa, addr->ai_addr, sizeof(sa));
|
||||
sa.sin_addr.s_addr = INADDR_ANY;
|
||||
}
|
||||
|
||||
@@ -1478,29 +1373,19 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
}
|
||||
}
|
||||
else {
|
||||
failf(data, "could't find my own IP address (%s)", myhost);
|
||||
failf(data, "could't find IP address to use");
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
}
|
||||
{
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
char ntoa_buf[64];
|
||||
#endif
|
||||
struct in_addr in;
|
||||
unsigned short ip[5];
|
||||
(void) memcpy(&in.s_addr,
|
||||
h?*h->addr->h_addr_list:(char *)&sa.sin_addr.s_addr,
|
||||
sizeof (in.s_addr));
|
||||
|
||||
#ifdef HAVE_INET_NTOA_R
|
||||
/* ignore the return code from inet_ntoa_r() as it is int or
|
||||
char * depending on system */
|
||||
inet_ntoa_r(in, ntoa_buf, sizeof(ntoa_buf));
|
||||
sscanf( ntoa_buf, "%hu.%hu.%hu.%hu",
|
||||
&ip[0], &ip[1], &ip[2], &ip[3]);
|
||||
#else
|
||||
sscanf( inet_ntoa(in), "%hu.%hu.%hu.%hu",
|
||||
&ip[0], &ip[1], &ip[2], &ip[3]);
|
||||
#endif
|
||||
if(sa_filled_in)
|
||||
Curl_inet_ntop(AF_INET, &((struct sockaddr_in *)&sa)->sin_addr,
|
||||
myhost, sizeof(myhost));
|
||||
else
|
||||
Curl_printable_address(addr, myhost, sizeof(myhost));
|
||||
|
||||
if(4 == sscanf(myhost, "%hu.%hu.%hu.%hu",
|
||||
&ip[0], &ip[1], &ip[2], &ip[3])) {
|
||||
|
||||
infof(data, "Telling server to connect to %d.%d.%d.%d:%d\n",
|
||||
ip[0], ip[1], ip[2], ip[3], porttouse);
|
||||
|
||||
@@ -1510,7 +1395,12 @@ CURLcode ftp_use_port(struct connectdata *conn)
|
||||
porttouse & 255);
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
}
|
||||
else
|
||||
return CURLE_FTP_PORT_FAILED;
|
||||
|
||||
Curl_freeaddrinfo(addr);
|
||||
|
||||
result = Curl_GetFTPResponse(&nread, conn, &ftpcode);
|
||||
if(result)
|
||||
@@ -1544,7 +1434,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
|
||||
int ftpcode; /* receive FTP response codes in this */
|
||||
CURLcode result;
|
||||
struct Curl_dns_entry *addr=NULL;
|
||||
Curl_ipconnect *conninfo;
|
||||
Curl_addrinfo *conninfo;
|
||||
int rc;
|
||||
|
||||
/*
|
||||
@@ -1617,7 +1507,8 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
|
||||
return CURLE_FTP_WEIRD_227_FORMAT;
|
||||
}
|
||||
|
||||
sprintf(newhost, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
snprintf(newhost, sizeof(newhost),
|
||||
"%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
|
||||
newhostp = newhost;
|
||||
newport = (port[0]<<8) + port[1];
|
||||
}
|
||||
@@ -1670,7 +1561,7 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
|
||||
* We don't want to rely on a former host lookup that might've expired
|
||||
* now, instead we remake the lookup here and now!
|
||||
*/
|
||||
rc = Curl_resolv(conn, conn->proxy.name, conn->port, &addr);
|
||||
rc = Curl_resolv(conn, conn->proxy.name, (int)conn->port, &addr);
|
||||
if(rc == CURLRESOLV_PENDING)
|
||||
rc = Curl_wait_for_resolv(conn, &addr);
|
||||
|
||||
@@ -1693,7 +1584,6 @@ CURLcode ftp_use_pasv(struct connectdata *conn,
|
||||
|
||||
result = Curl_connecthost(conn,
|
||||
addr,
|
||||
connectport,
|
||||
&conn->sock[SECONDARYSOCKET],
|
||||
&conninfo,
|
||||
connected);
|
||||
@@ -1800,7 +1690,7 @@ CURLcode Curl_ftp_nextconnect(struct connectdata *conn)
|
||||
if(readthisamountnow > BUFSIZE)
|
||||
readthisamountnow = BUFSIZE;
|
||||
|
||||
actuallyread =
|
||||
actuallyread = (curl_off_t)
|
||||
conn->fread(data->state.buffer, 1, (size_t)readthisamountnow,
|
||||
conn->fread_in);
|
||||
|
||||
@@ -2273,7 +2163,8 @@ CURLcode ftp_perform(struct connectdata *conn,
|
||||
result = ftp_getsize(conn, ftp->file, &filesize);
|
||||
|
||||
if(CURLE_OK == result) {
|
||||
sprintf(buf, "Content-Length: %" FORMAT_OFF_T "\r\n", filesize);
|
||||
snprintf(buf, sizeof(data->state.buffer),
|
||||
"Content-Length: %" FORMAT_OFF_T "\r\n", filesize);
|
||||
result = Curl_client_write(data, CLIENTWRITE_BOTH, buf, 0);
|
||||
if(result)
|
||||
return result;
|
||||
@@ -2771,9 +2662,8 @@ CURLcode ftp_regular_transfer(struct connectdata *conn)
|
||||
/* we skip empty path components, like "x//y" since the FTP command CWD
|
||||
requires a parameter and a non-existant parameter a) doesn't work on
|
||||
many servers and b) has no effect on the others. */
|
||||
ftp->dirs[ftp->dirdepth] = curl_unescape(cur_pos - absolute_dir,
|
||||
slash_pos - cur_pos +
|
||||
absolute_dir);
|
||||
int len = (int)(slash_pos - cur_pos + absolute_dir);
|
||||
ftp->dirs[ftp->dirdepth] = curl_unescape(cur_pos - absolute_dir, len);
|
||||
|
||||
if (!ftp->dirs[ftp->dirdepth]) { /* run out of memory ... */
|
||||
failf(data, "no memory");
|
||||
|
@@ -1756,7 +1756,7 @@ ToHour (Hours, Meridian)
|
||||
Hours = 0;
|
||||
return Hours + 12;
|
||||
default:
|
||||
abort ();
|
||||
break; /* used to do abort() here */
|
||||
}
|
||||
/* NOTREACHED - but make gcc happy! */
|
||||
return -1;
|
||||
|
53
lib/hash.c
53
lib/hash.c
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
@@ -47,7 +47,7 @@ hash_str(const char *key, size_t key_length)
|
||||
return h;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
hash_element_dtor(void *user, void *element)
|
||||
{
|
||||
curl_hash *h = (curl_hash *) user;
|
||||
@@ -70,7 +70,7 @@ Curl_hash_init(curl_hash *h, int slots, curl_hash_dtor dtor)
|
||||
|
||||
h->dtor = dtor;
|
||||
h->size = 0;
|
||||
h->slots = slots;
|
||||
h->slots = slots;
|
||||
|
||||
h->table = (curl_llist **) malloc(slots * sizeof(curl_llist *));
|
||||
if(h->table) {
|
||||
@@ -106,10 +106,10 @@ Curl_hash_alloc(int slots, curl_hash_dtor dtor)
|
||||
return h;
|
||||
}
|
||||
|
||||
static int
|
||||
static int
|
||||
hash_key_compare(char *key1, size_t key1_len, char *key2, size_t key2_len)
|
||||
{
|
||||
if (key1_len == key2_len &&
|
||||
if (key1_len == key2_len &&
|
||||
*key1 == *key2 &&
|
||||
memcmp(key1, key2, key1_len) == 0) {
|
||||
return 1;
|
||||
@@ -180,29 +180,6 @@ Curl_hash_add(curl_hash *h, char *key, size_t key_len, void *p)
|
||||
return NULL; /* failure */
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
Curl_hash_delete(curl_hash *h, char *key, size_t key_len)
|
||||
{
|
||||
curl_hash_element *he;
|
||||
curl_llist_element *le;
|
||||
curl_llist *l = FETCH_LIST(h, key, key_len);
|
||||
|
||||
for (le = l->head;
|
||||
le;
|
||||
le = le->next) {
|
||||
he = le->ptr;
|
||||
if (hash_key_compare(he->key, he->key_len, key, key_len)) {
|
||||
Curl_llist_remove(l, le, (void *) h);
|
||||
--h->size;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void *
|
||||
Curl_hash_pick(curl_hash *h, char *key, size_t key_len)
|
||||
{
|
||||
@@ -223,7 +200,7 @@ Curl_hash_pick(curl_hash *h, char *key, size_t key_len)
|
||||
}
|
||||
|
||||
#if defined(CURLDEBUG) && defined(AGGRESIVE_TEST)
|
||||
void
|
||||
void
|
||||
Curl_hash_apply(curl_hash *h, void *user,
|
||||
void (*cb)(void *user, void *ptr))
|
||||
{
|
||||
@@ -278,15 +255,7 @@ Curl_hash_clean_with_criterium(curl_hash *h, void *user,
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
int
|
||||
Curl_hash_count(curl_hash *h)
|
||||
{
|
||||
return h->size;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
void
|
||||
Curl_hash_destroy(curl_hash *h)
|
||||
{
|
||||
if (!h)
|
||||
|
10
lib/hash.h
10
lib/hash.h
@@ -1,10 +1,10 @@
|
||||
#ifndef __HASH_H
|
||||
#define __HASH_H
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -12,7 +12,7 @@
|
||||
* 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.
|
||||
|
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
@@ -204,7 +204,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
|
||||
store.tv_sec = (int)timeout/1000;
|
||||
store.tv_usec = (timeout%1000)*1000;
|
||||
|
||||
|
||||
FD_ZERO(&read_fds);
|
||||
FD_ZERO(&write_fds);
|
||||
nfds = ares_fds(data->state.areschannel, &read_fds, &write_fds);
|
||||
@@ -229,7 +229,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
|
||||
/* Operation complete, if the lookup was successful we now have the entry
|
||||
in the cache. */
|
||||
|
||||
|
||||
if(entry)
|
||||
*entry = conn->async.dns;
|
||||
|
||||
@@ -251,7 +251,7 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
cleaning up this connection properly */
|
||||
Curl_disconnect(conn);
|
||||
}
|
||||
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -273,10 +273,11 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
in_addr_t in = inet_addr(hostname);
|
||||
|
||||
*waitp = FALSE;
|
||||
|
||||
if (in != CURL_INADDR_NONE)
|
||||
|
||||
if (in != CURL_INADDR_NONE) {
|
||||
/* This is a dotted IP address 123.123.123.123-style */
|
||||
return Curl_ip2addr(in, hostname);
|
||||
return Curl_ip2addr(in, hostname, port);
|
||||
}
|
||||
|
||||
bufp = strdup(hostname);
|
||||
|
||||
@@ -290,8 +291,8 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
|
||||
/* areschannel is already setup in the Curl_open() function */
|
||||
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
|
||||
Curl_addrinfo_callback, conn);
|
||||
|
||||
Curl_addrinfo4_callback, conn);
|
||||
|
||||
*waitp = TRUE; /* please wait for the response */
|
||||
}
|
||||
return NULL; /* no struct yet */
|
||||
|
@@ -96,8 +96,8 @@
|
||||
**********************************************************************/
|
||||
#ifdef CURLRES_ASYNCH
|
||||
/*
|
||||
* Curl_addrinfo_callback() gets called by ares/gethostbyname_thread() when we
|
||||
* got the name resolved (or not!).
|
||||
* addrinfo_callback() gets called by ares, gethostbyname_thread() or
|
||||
* getaddrinfo_thread() when we got the name resolved (or not!).
|
||||
*
|
||||
* If the status argument is CURL_ASYNC_SUCCESS, we might need to copy the
|
||||
* address field since it might be freed when this function returns. This
|
||||
@@ -108,9 +108,9 @@
|
||||
*
|
||||
* The storage operation locks and unlocks the DNS cache.
|
||||
*/
|
||||
void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */
|
||||
int status,
|
||||
Curl_addrinfo *hostent)
|
||||
static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
||||
int status,
|
||||
void *addr)
|
||||
{
|
||||
struct connectdata *conn = (struct connectdata *)arg;
|
||||
struct Curl_dns_entry *dns = NULL;
|
||||
@@ -126,19 +126,19 @@ void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */
|
||||
*
|
||||
* IPv6: Curl_addrinfo_copy() returns the input pointer!
|
||||
*/
|
||||
Curl_addrinfo *he = Curl_addrinfo_copy(hostent);
|
||||
if(he) {
|
||||
Curl_addrinfo *ai = Curl_addrinfo_copy(addr, conn->async.port);
|
||||
if(ai) {
|
||||
struct SessionHandle *data = conn->data;
|
||||
|
||||
if(data->share)
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
dns = Curl_cache_addr(data, he,
|
||||
dns = Curl_cache_addr(data, ai,
|
||||
conn->async.hostname,
|
||||
conn->async.port);
|
||||
if(!dns)
|
||||
/* failed to store, cleanup and return error */
|
||||
Curl_freeaddrinfo(he);
|
||||
Curl_freeaddrinfo(ai);
|
||||
|
||||
if(data->share)
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||
@@ -151,4 +151,20 @@ void Curl_addrinfo_callback(void *arg, /* "struct connectdata *" */
|
||||
this function */
|
||||
}
|
||||
|
||||
void Curl_addrinfo4_callback(void *arg, /* "struct connectdata *" */
|
||||
int status,
|
||||
struct hostent *hostent)
|
||||
{
|
||||
addrinfo_callback(arg, status, hostent);
|
||||
}
|
||||
|
||||
#ifdef CURLRES_IPV6
|
||||
void Curl_addrinfo6_callback(void *arg, /* "struct connectdata *" */
|
||||
int status,
|
||||
struct addrinfo *ai)
|
||||
{
|
||||
addrinfo_callback(arg, status, ai);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CURLRES_ASYNC */
|
||||
|
190
lib/hostip.c
190
lib/hostip.c
@@ -174,14 +174,8 @@ void Curl_global_host_cache_dtor(void)
|
||||
int Curl_num_addresses(const Curl_addrinfo *addr)
|
||||
{
|
||||
int i;
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
for (i = 0; addr; addr = addr->ai_next, i++)
|
||||
#else
|
||||
for (i = 0; addr->h_addr_list[i]; i++)
|
||||
#endif
|
||||
;
|
||||
return (i);
|
||||
for (i = 0; addr; addr = addr->ai_next, i++);
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -191,42 +185,18 @@ int Curl_num_addresses(const Curl_addrinfo *addr)
|
||||
*
|
||||
* If the conversion fails, it returns NULL.
|
||||
*/
|
||||
const char *Curl_printable_address(const Curl_ipconnect *ip,
|
||||
const char *Curl_printable_address(const Curl_addrinfo *ip,
|
||||
char *buf, size_t bufsize)
|
||||
{
|
||||
#ifdef CURLRES_IPV6
|
||||
const void *ip4 = &((const struct sockaddr_in*)ip->ai_addr)->sin_addr;
|
||||
const void *ip6 = &((const struct sockaddr_in6*)ip->ai_addr)->sin6_addr;
|
||||
int af = ip->ai_family;
|
||||
|
||||
return Curl_inet_ntop(af, af == AF_INET6 ? ip6 : ip4, buf, bufsize);
|
||||
#ifdef CURLRES_IPV6
|
||||
const void *ip6 = &((const struct sockaddr_in6*)ip->ai_addr)->sin6_addr;
|
||||
#else
|
||||
return Curl_inet_ntop(AF_INET, ip, buf, bufsize);
|
||||
const void *ip6 = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Count the number of characters that an integer would use in a string
|
||||
* (base 10).
|
||||
*/
|
||||
static int _num_chars(int i)
|
||||
{
|
||||
int chars = 0;
|
||||
|
||||
/* While the number divided by 10 is greater than one,
|
||||
* re-divide the number by 10, and increment the number of
|
||||
* characters by 1.
|
||||
*
|
||||
* this relies on the fact that for every multiple of 10,
|
||||
* a new digit is added onto every number
|
||||
*/
|
||||
do {
|
||||
chars++;
|
||||
|
||||
i = (int) i / 10;
|
||||
} while (i >= 1);
|
||||
|
||||
return chars;
|
||||
return Curl_inet_ntop(af, af == AF_INET ? ip4 : ip6, buf, bufsize);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -234,24 +204,10 @@ static int _num_chars(int i)
|
||||
* the DNS caching.
|
||||
*/
|
||||
static char *
|
||||
create_hostcache_id(char *server, int port, size_t *entry_len)
|
||||
create_hostcache_id(char *server, int port)
|
||||
{
|
||||
char *id = NULL;
|
||||
|
||||
/* Get the length of the new entry id */
|
||||
*entry_len = strlen(server) + /* Hostname length */
|
||||
1 + /* ':' seperator */
|
||||
_num_chars(port); /* number of characters the port will take up */
|
||||
|
||||
/* Allocate the new entry id */
|
||||
id = malloc(*entry_len + 1); /* 1 extra for the zero terminator */
|
||||
if (!id)
|
||||
return NULL;
|
||||
|
||||
/* Create the new entry */
|
||||
sprintf(id, "%s:%d", server, port);
|
||||
|
||||
return id; /* return pointer to the string */
|
||||
/* create and return the new allocated entry */
|
||||
return aprintf("%s:%d", server, port);
|
||||
}
|
||||
|
||||
struct hostcache_prune_data {
|
||||
@@ -355,10 +311,11 @@ Curl_cache_addr(struct SessionHandle *data,
|
||||
time_t now;
|
||||
|
||||
/* Create an entry id, based upon the hostname and port */
|
||||
entry_id = create_hostcache_id(hostname, port, &entry_len);
|
||||
entry_id = create_hostcache_id(hostname, port);
|
||||
/* If we can't create the entry id, fail */
|
||||
if (!entry_id)
|
||||
return NULL;
|
||||
entry_len = strlen(entry_id);
|
||||
|
||||
/* Create a new cache entry */
|
||||
dns = (struct Curl_dns_entry *) malloc(sizeof(struct Curl_dns_entry));
|
||||
@@ -436,11 +393,13 @@ int Curl_resolv(struct connectdata *conn,
|
||||
#endif
|
||||
|
||||
/* Create an entry id, based upon the hostname and port */
|
||||
entry_id = create_hostcache_id(hostname, port, &entry_len);
|
||||
entry_id = create_hostcache_id(hostname, port);
|
||||
/* If we can't create the entry id, fail */
|
||||
if (!entry_id)
|
||||
return CURLRESOLV_ERROR;
|
||||
|
||||
entry_len = strlen(entry_id);
|
||||
|
||||
if(data->share)
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
@@ -547,35 +506,6 @@ curl_hash *Curl_mk_dnscache(void)
|
||||
return Curl_hash_alloc(7, freednsentry);
|
||||
}
|
||||
|
||||
#ifdef CURLRES_HOSTENT_RELOCATE
|
||||
/*
|
||||
* Curl_hostent_relocate() ajusts all pointers in the given hostent struct
|
||||
* according to the offset. This is typically used when a hostent has been
|
||||
* reallocated and needs to be setup properly on the new address.
|
||||
*/
|
||||
void Curl_hostent_relocate(struct hostent *h, long offset)
|
||||
{
|
||||
int i=0;
|
||||
|
||||
h->h_name=(char *)((long)h->h_name+offset);
|
||||
if(h->h_aliases) {
|
||||
/* only relocate aliases if there are any! */
|
||||
h->h_aliases=(char **)((long)h->h_aliases+offset);
|
||||
while(h->h_aliases[i]) {
|
||||
h->h_aliases[i]=(char *)((long)h->h_aliases[i]+offset);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
h->h_addr_list=(char **)((long)h->h_addr_list+offset);
|
||||
i=0;
|
||||
while(h->h_addr_list[i]) {
|
||||
h->h_addr_list[i]=(char *)((long)h->h_addr_list[i]+offset);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif /* CURLRES_HOSTENT_RELOCATE */
|
||||
|
||||
#ifdef CURLRES_ADDRINFO_COPY
|
||||
|
||||
/* align on even 64bit boundaries */
|
||||
@@ -586,94 +516,10 @@ void Curl_hostent_relocate(struct hostent *h, long offset)
|
||||
* returns a pointer to the malloc()ed copy. You need to call free() on the
|
||||
* returned buffer when you're done with it.
|
||||
*/
|
||||
Curl_addrinfo *Curl_addrinfo_copy(Curl_addrinfo *orig)
|
||||
Curl_addrinfo *Curl_addrinfo_copy(void *org, int port)
|
||||
{
|
||||
char *newbuf;
|
||||
Curl_addrinfo *copy;
|
||||
int i;
|
||||
char *str;
|
||||
size_t len;
|
||||
char *aptr = (char *)malloc(CURL_HOSTENT_SIZE);
|
||||
char *bufptr = aptr;
|
||||
struct hostent *orig = org;
|
||||
|
||||
if(!bufptr)
|
||||
return NULL; /* major bad */
|
||||
|
||||
copy = (Curl_addrinfo *)bufptr;
|
||||
|
||||
bufptr += sizeof(Curl_addrinfo);
|
||||
copy->h_name = bufptr;
|
||||
len = strlen(orig->h_name) + 1;
|
||||
strncpy(bufptr, orig->h_name, len);
|
||||
bufptr += len;
|
||||
|
||||
/* This must be aligned properly to work on many CPU architectures! */
|
||||
bufptr = MEMALIGN(bufptr);
|
||||
|
||||
copy->h_aliases = (char**)bufptr;
|
||||
|
||||
/* Figure out how many aliases there are */
|
||||
for (i = 0; orig->h_aliases && orig->h_aliases[i]; ++i);
|
||||
|
||||
/* Reserve room for the array */
|
||||
bufptr += (i + 1) * sizeof(char*);
|
||||
|
||||
/* Clone all known aliases */
|
||||
if(orig->h_aliases) {
|
||||
for(i = 0; (str = orig->h_aliases[i]); i++) {
|
||||
len = strlen(str) + 1;
|
||||
strncpy(bufptr, str, len);
|
||||
copy->h_aliases[i] = bufptr;
|
||||
bufptr += len;
|
||||
}
|
||||
}
|
||||
/* if(!orig->h_aliases) i was already set to 0 */
|
||||
|
||||
/* Terminate the alias list with a NULL */
|
||||
copy->h_aliases[i] = NULL;
|
||||
|
||||
copy->h_addrtype = orig->h_addrtype;
|
||||
copy->h_length = orig->h_length;
|
||||
|
||||
/* align it for (at least) 32bit accesses */
|
||||
bufptr = MEMALIGN(bufptr);
|
||||
|
||||
copy->h_addr_list = (char**)bufptr;
|
||||
|
||||
/* Figure out how many addresses there are */
|
||||
for (i = 0; orig->h_addr_list[i] != NULL; ++i);
|
||||
|
||||
/* Reserve room for the array */
|
||||
bufptr += (i + 1) * sizeof(char*);
|
||||
|
||||
i = 0;
|
||||
len = orig->h_length;
|
||||
str = orig->h_addr_list[i];
|
||||
while (str != NULL) {
|
||||
memcpy(bufptr, str, len);
|
||||
copy->h_addr_list[i] = bufptr;
|
||||
bufptr += len;
|
||||
str = orig->h_addr_list[++i];
|
||||
}
|
||||
copy->h_addr_list[i] = NULL;
|
||||
|
||||
/* now, shrink the allocated buffer to the size we actually need, which
|
||||
most often is only a fraction of the original alloc */
|
||||
newbuf=(char *)realloc(aptr, (long)(bufptr-aptr));
|
||||
|
||||
if(!newbuf) {
|
||||
/* serious error, but since this is shrinking only requested, we can
|
||||
still use the previous memory block */
|
||||
newbuf = aptr;
|
||||
}
|
||||
|
||||
/* if the alloc moved, we need to adjust the hostent struct */
|
||||
else if(newbuf != aptr)
|
||||
Curl_hostent_relocate((struct hostent*)newbuf, (long)(newbuf-aptr));
|
||||
|
||||
/* setup the return */
|
||||
copy = (Curl_addrinfo *)newbuf;
|
||||
|
||||
return copy;
|
||||
return Curl_he2ai(orig, port);
|
||||
}
|
||||
#endif /* CURLRES_ADDRINFO_COPY */
|
||||
|
172
lib/hostip.h
172
lib/hostip.h
@@ -26,6 +26,85 @@
|
||||
#include "setup.h"
|
||||
#include "hash.h"
|
||||
|
||||
/*
|
||||
* Setup comfortable CURLRES_* defines to use in the host*.c sources.
|
||||
*/
|
||||
|
||||
#ifdef USE_ARES
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_ARES
|
||||
#endif
|
||||
|
||||
#ifdef USE_THREADING_GETHOSTBYNAME
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_THREADED
|
||||
#endif
|
||||
|
||||
#ifdef USE_THREADING_GETADDRINFO
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_THREADED
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
#define CURLRES_IPV6
|
||||
#else
|
||||
#define CURLRES_IPV4
|
||||
#endif
|
||||
|
||||
#ifdef CURLRES_IPV4
|
||||
#if !defined(HAVE_GETHOSTBYNAME_R) || defined(CURLRES_ASYNCH)
|
||||
/* If built for ipv4 and missing gethostbyname_r(), or if using async name
|
||||
resolve, we need the Curl_addrinfo_copy() function (which itself needs the
|
||||
Curl_hostent_relocate() function)) */
|
||||
#define CURLRES_ADDRINFO_COPY
|
||||
#endif
|
||||
#endif /* IPv4-only */
|
||||
|
||||
#ifndef CURLRES_ASYNCH
|
||||
#define CURLRES_SYNCH
|
||||
#endif
|
||||
|
||||
#ifndef USE_LIBIDN
|
||||
#define CURLRES_IDN
|
||||
#endif
|
||||
|
||||
/* Allocate enough memory to hold the full name information structs and
|
||||
* everything. OSF1 is known to require at least 8872 bytes. The buffer
|
||||
* required for storing all possible aliases and IP numbers is according to
|
||||
* Stevens' Unix Network Programming 2nd edition, p. 304: 8192 bytes!
|
||||
*/
|
||||
#define CURL_HOSTENT_SIZE 9000
|
||||
|
||||
#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this
|
||||
many seconds for a name resolve */
|
||||
|
||||
#ifdef CURLRES_ARES
|
||||
#define CURL_ASYNC_SUCCESS ARES_SUCCESS
|
||||
#else
|
||||
#define CURL_ASYNC_SUCCESS CURLE_OK
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Curl_addrinfo MUST be used for all name resolved info.
|
||||
*/
|
||||
#ifdef CURLRES_IPV6
|
||||
typedef struct addrinfo Curl_addrinfo;
|
||||
#else
|
||||
/* OK, so some ipv4-only include tree probably have the addrinfo struct, but
|
||||
to work even on those that don't, we provide our own look-alike! */
|
||||
struct Curl_addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
char *ai_canonname;
|
||||
struct Curl_addrinfo *ai_next;
|
||||
};
|
||||
typedef struct Curl_addrinfo Curl_addrinfo;
|
||||
#endif
|
||||
|
||||
struct addrinfo;
|
||||
struct hostent;
|
||||
struct SessionHandle;
|
||||
@@ -119,28 +198,37 @@ int curl_dogetnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
#endif
|
||||
|
||||
/* This is the callback function that is used when we build with asynch
|
||||
resolve */
|
||||
void Curl_addrinfo_callback(void *arg,
|
||||
resolve, ipv4 */
|
||||
void Curl_addrinfo4_callback(void *arg,
|
||||
int status,
|
||||
Curl_addrinfo *hostent);
|
||||
struct hostent *hostent);
|
||||
/* This is the callback function that is used when we build with asynch
|
||||
resolve, ipv6 */
|
||||
void Curl_addrinfo6_callback(void *arg,
|
||||
int status,
|
||||
struct addrinfo *ai);
|
||||
|
||||
/* This is a utility-function for ipv4-builds to create a hostent struct
|
||||
from a numerical-only IP address */
|
||||
Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname);
|
||||
|
||||
/* [ipv4 only] Creates a Curl_addrinfo struct from a numerical-only IP
|
||||
address */
|
||||
Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port);
|
||||
|
||||
/* [ipv4 only] Curl_he2ai() converts a struct hostent to a Curl_addrinfo chain
|
||||
and returns it */
|
||||
Curl_addrinfo *Curl_he2ai(struct hostent *, int port);
|
||||
|
||||
/* relocate a hostent struct */
|
||||
void Curl_hostent_relocate(struct hostent *h, long offset);
|
||||
|
||||
/* copy a Curl_addrinfo struct, currently this only supports copying
|
||||
a hostent (ipv4-style) struct */
|
||||
Curl_addrinfo *Curl_addrinfo_copy(Curl_addrinfo *orig);
|
||||
/* Clone a Curl_addrinfo struct, works protocol independently */
|
||||
Curl_addrinfo *Curl_addrinfo_copy(void *orig, int port);
|
||||
|
||||
/*
|
||||
* Curl_printable_address() returns a printable version of the 1st address
|
||||
* given in the 'ip' argument. The result will be stored in the buf that is
|
||||
* bufsize bytes big.
|
||||
*/
|
||||
const char *Curl_printable_address(const Curl_ipconnect *ip,
|
||||
const char *Curl_printable_address(const Curl_addrinfo *ip,
|
||||
char *buf, size_t bufsize);
|
||||
|
||||
/*
|
||||
@@ -158,71 +246,7 @@ Curl_cache_addr(struct SessionHandle *data, Curl_addrinfo *addr,
|
||||
#define CURL_INADDR_NONE INADDR_NONE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Setup comfortable CURLRES_* defines to use in the host*.c sources.
|
||||
*/
|
||||
|
||||
#ifdef USE_ARES
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_ARES
|
||||
#endif
|
||||
|
||||
#ifdef USE_THREADING_GETHOSTBYNAME
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_THREADED
|
||||
#endif
|
||||
|
||||
#ifdef USE_THREADING_GETADDRINFO
|
||||
#define CURLRES_ASYNCH
|
||||
#define CURLRES_THREADED
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
#define CURLRES_IPV6
|
||||
#else
|
||||
#define CURLRES_IPV4
|
||||
#endif
|
||||
|
||||
#ifdef CURLRES_IPV4
|
||||
#if !defined(HAVE_GETHOSTBYNAME_R) || defined(CURLRES_ASYNCH)
|
||||
/* If built for ipv4 and missing gethostbyname_r(), or if using async name
|
||||
resolve, we need the Curl_addrinfo_copy() function (which itself needs the
|
||||
Curl_hostent_relocate() function)) */
|
||||
#define CURLRES_ADDRINFO_COPY
|
||||
#define CURLRES_HOSTENT_RELOCATE
|
||||
#endif
|
||||
#endif /* IPv4-only */
|
||||
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
||||
#define CURLRES_HOSTENT_RELOCATE
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_5
|
||||
#define CURLRES_HOSTENT_RELOCATE
|
||||
#endif
|
||||
|
||||
#ifndef CURLRES_ASYNCH
|
||||
#define CURLRES_SYNCH
|
||||
#endif
|
||||
|
||||
#ifndef USE_LIBIDN
|
||||
#define CURLRES_IDN
|
||||
#endif
|
||||
|
||||
/* Allocate enough memory to hold the full name information structs and
|
||||
* everything. OSF1 is known to require at least 8872 bytes. The buffer
|
||||
* required for storing all possible aliases and IP numbers is according to
|
||||
* Stevens' Unix Network Programming 2nd edition, p. 304: 8192 bytes!
|
||||
*/
|
||||
#define CURL_HOSTENT_SIZE 9000
|
||||
|
||||
#define CURL_TIMEOUT_RESOLVE 300 /* when using asynch methods, we allow this
|
||||
many seconds for a name resolve */
|
||||
|
||||
#ifdef CURLRES_ARES
|
||||
#define CURL_ASYNC_SUCCESS ARES_SUCCESS
|
||||
#else
|
||||
#define CURL_ASYNC_SUCCESS CURLE_OK
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
294
lib/hostip4.c
294
lib/hostip4.c
@@ -1,8 +1,8 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2004, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
@@ -10,7 +10,7 @@
|
||||
* 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.
|
||||
@@ -97,13 +97,19 @@
|
||||
#ifdef CURLRES_IPV4 /* plain ipv4 code coming up */
|
||||
|
||||
/*
|
||||
* This is a wrapper function for freeing name information in a protocol
|
||||
* independent way. This takes care of using the appropriate underlying
|
||||
* function.
|
||||
* This is a function for freeing name information in a protocol independent
|
||||
* way.
|
||||
*/
|
||||
void Curl_freeaddrinfo(Curl_addrinfo *p)
|
||||
void Curl_freeaddrinfo(Curl_addrinfo *ai)
|
||||
{
|
||||
free(p); /* works fine for the ARES case too */
|
||||
Curl_addrinfo *next;
|
||||
|
||||
/* walk over the list and free all entries */
|
||||
while(ai) {
|
||||
next = ai->ai_next;
|
||||
free(ai);
|
||||
ai = next;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -119,28 +125,29 @@ bool Curl_ipvalid(struct SessionHandle *data)
|
||||
return TRUE; /* OK, proceed */
|
||||
}
|
||||
|
||||
struct namebuf {
|
||||
struct hostent hostentry;
|
||||
char *h_addr_list[2];
|
||||
struct in_addr addrentry;
|
||||
char h_name[16]; /* 123.123.123.123 = 15 letters is maximum */
|
||||
};
|
||||
|
||||
/*
|
||||
* Curl_ip2addr() takes a 32bit ipv4 internet address as input parameter
|
||||
* together with a pointer to the string version of the address, and it
|
||||
* retruns a malloc()ed version of a hostent struct filled in correctly with
|
||||
* information for this address/host.
|
||||
* returns a Curl_addrinfo chain filled in correctly with information for this
|
||||
* address/host.
|
||||
*
|
||||
* The input parameters ARE NOT checked for validity but they are expected
|
||||
* to have been checked already when this is called.
|
||||
*/
|
||||
Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname)
|
||||
Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname, int port)
|
||||
{
|
||||
Curl_addrinfo *ai;
|
||||
struct hostent *h;
|
||||
struct in_addr *addrentry;
|
||||
struct namebuf {
|
||||
struct hostent hostentry;
|
||||
char *h_addr_list[2];
|
||||
struct in_addr addrentry;
|
||||
char h_name[16]; /* 123.123.123.123 = 15 letters is maximum */
|
||||
} *buf = (struct namebuf *)malloc(sizeof(struct namebuf));
|
||||
|
||||
if(!buf)
|
||||
return NULL; /* major failure */
|
||||
struct namebuf buffer;
|
||||
struct namebuf *buf = &buffer;
|
||||
|
||||
h = &buf->hostentry;
|
||||
h->h_addr_list = &buf->h_addr_list[0];
|
||||
@@ -156,7 +163,9 @@ Curl_addrinfo *Curl_ip2addr(in_addr_t num, char *hostname)
|
||||
/* Now store the dotted version of the address */
|
||||
snprintf(h->h_name, 16, "%s", hostname);
|
||||
|
||||
return h;
|
||||
ai = Curl_he2ai(h, port);
|
||||
|
||||
return ai;
|
||||
}
|
||||
|
||||
#ifdef CURLRES_SYNCH /* the functions below are for synchronous resolves */
|
||||
@@ -183,17 +192,21 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
int port,
|
||||
int *waitp)
|
||||
{
|
||||
Curl_addrinfo *ai = NULL;
|
||||
struct hostent *h = NULL;
|
||||
in_addr_t in;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct hostent *buf = NULL;
|
||||
|
||||
(void)port; /* unused in IPv4 code */
|
||||
|
||||
*waitp = 0; /* don't wait, we act synchronously */
|
||||
|
||||
in=inet_addr(hostname);
|
||||
if (in != CURL_INADDR_NONE)
|
||||
if (in != CURL_INADDR_NONE) {
|
||||
/* This is a dotted IP address 123.123.123.123-style */
|
||||
return Curl_ip2addr(in, hostname);
|
||||
return Curl_ip2addr(in, hostname, port);
|
||||
}
|
||||
|
||||
#if defined(HAVE_GETHOSTBYNAME_R)
|
||||
/*
|
||||
@@ -204,8 +217,8 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
else {
|
||||
int h_errnop;
|
||||
int res=ERANGE;
|
||||
int step_size=200;
|
||||
int *buf = (int *)calloc(CURL_HOSTENT_SIZE, 1);
|
||||
|
||||
buf = (struct hostent *)calloc(CURL_HOSTENT_SIZE, 1);
|
||||
if(!buf)
|
||||
return NULL; /* major failure */
|
||||
/*
|
||||
@@ -217,99 +230,64 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_5
|
||||
/* Solaris, IRIX and more */
|
||||
(void)res; /* prevent compiler warning */
|
||||
while(!h) {
|
||||
h = gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
step_size - sizeof(struct hostent),
|
||||
&h_errnop);
|
||||
h = gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
CURL_HOSTENT_SIZE - sizeof(struct hostent),
|
||||
&h_errnop);
|
||||
|
||||
/* If the buffer is too small, it returns NULL and sets errno to
|
||||
* ERANGE. The errno is thread safe if this is compiled with
|
||||
* -D_REENTRANT as then the 'errno' variable is a macro defined to get
|
||||
* used properly for threads.
|
||||
*/
|
||||
|
||||
if(h || (errno != ERANGE))
|
||||
break;
|
||||
|
||||
step_size+=200;
|
||||
}
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
|
||||
#endif
|
||||
/* If the buffer is too small, it returns NULL and sets errno to
|
||||
* ERANGE. The errno is thread safe if this is compiled with
|
||||
* -D_REENTRANT as then the 'errno' variable is a macro defined to get
|
||||
* used properly for threads.
|
||||
*/
|
||||
|
||||
if(h) {
|
||||
int offset;
|
||||
h=(struct hostent *)realloc(buf, step_size);
|
||||
offset=(long)h-(long)buf;
|
||||
Curl_hostent_relocate(h, offset);
|
||||
buf=(int *)h;
|
||||
;
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_GETHOSTBYNAME_R_5 */
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_6
|
||||
/* Linux */
|
||||
do {
|
||||
res=gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
step_size - sizeof(struct hostent),
|
||||
&h, /* DIFFERENCE */
|
||||
&h_errnop);
|
||||
/* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a
|
||||
* sudden this function returns EAGAIN if the given buffer size is too
|
||||
* small. Previous versions are known to return ERANGE for the same
|
||||
* problem.
|
||||
*
|
||||
* This wouldn't be such a big problem if older versions wouldn't
|
||||
* sometimes return EAGAIN on a common failure case. Alas, we can't
|
||||
* assume that EAGAIN *or* ERANGE means ERANGE for any given version of
|
||||
* glibc.
|
||||
*
|
||||
* For now, we do that and thus we may call the function repeatedly and
|
||||
* fail for older glibc versions that return EAGAIN, until we run out of
|
||||
* buffer size (step_size grows beyond CURL_HOSTENT_SIZE).
|
||||
*
|
||||
* If anyone has a better fix, please tell us!
|
||||
*
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* On October 23rd 2003, Dan C dug up more details on the mysteries of
|
||||
* gethostbyname_r() in glibc:
|
||||
*
|
||||
* In glibc 2.2.5 the interface is different (this has also been
|
||||
* discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't
|
||||
* explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32
|
||||
* (shipped/upgraded by Redhat 7.2) don't show this behavior!
|
||||
*
|
||||
* In this "buggy" version, the return code is -1 on error and 'errno'
|
||||
* is set to the ERANGE or EAGAIN code. Note that 'errno' is not a
|
||||
* thread-safe variable.
|
||||
*/
|
||||
|
||||
if(((ERANGE == res) || (EAGAIN == res)) ||
|
||||
((res<0) && ((ERANGE == errno) || (EAGAIN == errno))))
|
||||
step_size+=200;
|
||||
else
|
||||
break;
|
||||
} while(step_size <= CURL_HOSTENT_SIZE);
|
||||
res=gethostbyname_r(hostname,
|
||||
(struct hostent *)buf,
|
||||
(char *)buf + sizeof(struct hostent),
|
||||
CURL_HOSTENT_SIZE - sizeof(struct hostent),
|
||||
&h, /* DIFFERENCE */
|
||||
&h_errnop);
|
||||
/* Redhat 8, using glibc 2.2.93 changed the behavior. Now all of a
|
||||
* sudden this function returns EAGAIN if the given buffer size is too
|
||||
* small. Previous versions are known to return ERANGE for the same
|
||||
* problem.
|
||||
*
|
||||
* This wouldn't be such a big problem if older versions wouldn't
|
||||
* sometimes return EAGAIN on a common failure case. Alas, we can't
|
||||
* assume that EAGAIN *or* ERANGE means ERANGE for any given version of
|
||||
* glibc.
|
||||
*
|
||||
* For now, we do that and thus we may call the function repeatedly and
|
||||
* fail for older glibc versions that return EAGAIN, until we run out of
|
||||
* buffer size (step_size grows beyond CURL_HOSTENT_SIZE).
|
||||
*
|
||||
* If anyone has a better fix, please tell us!
|
||||
*
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* On October 23rd 2003, Dan C dug up more details on the mysteries of
|
||||
* gethostbyname_r() in glibc:
|
||||
*
|
||||
* In glibc 2.2.5 the interface is different (this has also been
|
||||
* discovered in glibc 2.1.1-6 as shipped by Redhat 6). What I can't
|
||||
* explain, is that tests performed on glibc 2.2.4-34 and 2.2.4-32
|
||||
* (shipped/upgraded by Redhat 7.2) don't show this behavior!
|
||||
*
|
||||
* In this "buggy" version, the return code is -1 on error and 'errno'
|
||||
* is set to the ERANGE or EAGAIN code. Note that 'errno' is not a
|
||||
* thread-safe variable.
|
||||
*/
|
||||
|
||||
if(!h) /* failure */
|
||||
res=1;
|
||||
|
||||
#ifdef CURLDEBUG
|
||||
infof(data, "gethostbyname_r() uses %d bytes\n", step_size);
|
||||
#endif
|
||||
if(!res) {
|
||||
int offset;
|
||||
h=(struct hostent *)realloc(buf, step_size);
|
||||
offset=(long)h-(long)buf;
|
||||
Curl_hostent_relocate(h, offset);
|
||||
buf=(int *)h;
|
||||
}
|
||||
else
|
||||
#endif/* HAVE_GETHOSTBYNAME_R_6 */
|
||||
#ifdef HAVE_GETHOSTBYNAME_R_3
|
||||
/* AIX, Digital Unix/Tru64, HPUX 10, more? */
|
||||
@@ -351,7 +329,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
|
||||
if(!res) { /* success */
|
||||
|
||||
h = (struct hostent*)buf; /* result expected in h */
|
||||
h = buf; /* result expected in h */
|
||||
|
||||
/* This is the worst kind of the different gethostbyname_r() interfaces.
|
||||
* Since we don't know how big buffer this particular lookup required,
|
||||
@@ -361,7 +339,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
* calling Curl_addrinfo_copy() that subsequent realloc()s down the new
|
||||
* memory area to the actually used amount.
|
||||
*/
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif /* HAVE_GETHOSTBYNAME_R_3 */
|
||||
{
|
||||
@@ -378,22 +356,94 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
h = gethostbyname(hostname);
|
||||
if (!h)
|
||||
infof(data, "gethostbyname(2) failed for %s\n", hostname);
|
||||
else {
|
||||
/*
|
||||
* Copy the hostent struct right here, as the static one we got a
|
||||
* pointer to might get removed when we don't want/expect that. Windows
|
||||
* (other platforms?) also doesn't allow passing of the returned data
|
||||
* between threads, which thus the copying here them allows the app to
|
||||
* do.
|
||||
*/
|
||||
h = Curl_addrinfo_copy(h);
|
||||
}
|
||||
#endif /*HAVE_GETHOSTBYNAME_R */
|
||||
}
|
||||
|
||||
return h;
|
||||
if(h) {
|
||||
ai = Curl_he2ai(h, port);
|
||||
|
||||
if (buf) /* used a *_r() function */
|
||||
free(buf);
|
||||
}
|
||||
|
||||
return ai;
|
||||
}
|
||||
|
||||
#endif /* CURLRES_SYNCH */
|
||||
|
||||
/*
|
||||
* Curl_he2ai() translates from a hostent struct to a Curl_addrinfo struct.
|
||||
* The Curl_addrinfo is meant to work like the addrinfo struct does for IPv6
|
||||
* stacks, but for all hosts and environments.
|
||||
|
||||
struct Curl_addrinfo {
|
||||
int ai_flags;
|
||||
int ai_family;
|
||||
int ai_socktype;
|
||||
int ai_protocol;
|
||||
size_t ai_addrlen;
|
||||
struct sockaddr *ai_addr;
|
||||
char *ai_canonname;
|
||||
struct addrinfo *ai_next;
|
||||
};
|
||||
|
||||
struct hostent {
|
||||
char *h_name; * official name of host *
|
||||
char **h_aliases; * alias list *
|
||||
int h_addrtype; * host address type *
|
||||
int h_length; * length of address *
|
||||
char **h_addr_list; * list of addresses *
|
||||
}
|
||||
#define h_addr h_addr_list[0] * for backward compatibility *
|
||||
|
||||
*/
|
||||
|
||||
Curl_addrinfo *Curl_he2ai(struct hostent *he, int port)
|
||||
{
|
||||
Curl_addrinfo *ai;
|
||||
Curl_addrinfo *prevai = NULL;
|
||||
Curl_addrinfo *firstai = NULL;
|
||||
struct sockaddr_in *addr;
|
||||
int i;
|
||||
struct in_addr *curr;
|
||||
|
||||
if(!he)
|
||||
/* no input == no output! */
|
||||
return NULL;
|
||||
|
||||
for(i=0; (curr = (struct in_addr *)he->h_addr_list[i]); i++) {
|
||||
|
||||
ai = calloc(1, sizeof(Curl_addrinfo) + sizeof(struct sockaddr_in));
|
||||
|
||||
if(!ai)
|
||||
break;
|
||||
|
||||
if(!firstai)
|
||||
/* store the pointer we want to return from this function */
|
||||
firstai = ai;
|
||||
|
||||
if(prevai)
|
||||
/* make the previous entry point to this */
|
||||
prevai->ai_next = ai;
|
||||
|
||||
ai->ai_family = AF_INET; /* we only support this */
|
||||
ai->ai_socktype = SOCK_STREAM; /* we only support this */
|
||||
ai->ai_addrlen = sizeof(struct sockaddr_in);
|
||||
/* make the ai_addr point to the address immediately following this struct
|
||||
and use that area to store the address */
|
||||
ai->ai_addr = (struct sockaddr *) ((char*)ai + sizeof(Curl_addrinfo));
|
||||
|
||||
/* leave the rest of the struct filled with zero */
|
||||
|
||||
addr = (struct sockaddr_in *)ai->ai_addr; /* storage area for this info */
|
||||
|
||||
memcpy((char *)&(addr->sin_addr), curr, sizeof(struct in_addr));
|
||||
addr->sin_family = he->h_addrtype;
|
||||
addr->sin_port = htons((unsigned short)port);
|
||||
|
||||
prevai = ai;
|
||||
}
|
||||
return firstai;
|
||||
}
|
||||
|
||||
#endif /* CURLRES_IPV4 */
|
||||
|
@@ -111,8 +111,9 @@ void Curl_freeaddrinfo(Curl_addrinfo *p)
|
||||
* address. But this is an ipv6 build and then we don't copy the address, we
|
||||
* just return the same pointer!
|
||||
*/
|
||||
Curl_addrinfo *Curl_addrinfo_copy(Curl_addrinfo *source)
|
||||
Curl_addrinfo *Curl_addrinfo_copy(void *source, int port)
|
||||
{
|
||||
(void) port;
|
||||
return source;
|
||||
}
|
||||
#endif
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user