Compare commits
151 Commits
curl-7_21_
...
curl-7_21_
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6d7d0eba6d | ||
![]() |
a865bd9fba | ||
![]() |
0fd439ebac | ||
![]() |
012f9b7f04 | ||
![]() |
573a2900cd | ||
![]() |
c28443c551 | ||
![]() |
0b5901bec6 | ||
![]() |
5965d4554d | ||
![]() |
34127c7adc | ||
![]() |
315e5277dc | ||
![]() |
5c7c9a768d | ||
![]() |
bf1c102b80 | ||
![]() |
2271b60b71 | ||
![]() |
c2bfe60086 | ||
![]() |
63598059cd | ||
![]() |
c1901f7ed0 | ||
![]() |
9c4ff4874e | ||
![]() |
46a0062dff | ||
![]() |
d97fa56fd4 | ||
![]() |
d534cd0027 | ||
![]() |
afd6e738f7 | ||
![]() |
de670efeab | ||
![]() |
421d918da3 | ||
![]() |
99a07a1fdf | ||
![]() |
81c16c2e30 | ||
![]() |
dd5d3518e4 | ||
![]() |
07f60235b0 | ||
![]() |
5580fb2b9c | ||
![]() |
7e3f0bffe5 | ||
![]() |
5d47bf3776 | ||
![]() |
11cddb68e0 | ||
![]() |
1b2b93e074 | ||
![]() |
c328214a2d | ||
![]() |
f6f5d7874f | ||
![]() |
5db0a412ff | ||
![]() |
cbe67a1b71 | ||
![]() |
23245ca83a | ||
![]() |
3590874999 | ||
![]() |
e39ab6f203 | ||
![]() |
c9081a8280 | ||
![]() |
5088e3709d | ||
![]() |
c2ba8ca81f | ||
![]() |
ef24ecde68 | ||
![]() |
e8bc33d0a3 | ||
![]() |
5087f89ac8 | ||
![]() |
b3d39275f5 | ||
![]() |
1d75d30816 | ||
![]() |
6fe18add71 | ||
![]() |
d212fe43af | ||
![]() |
13d537e404 | ||
![]() |
46041ee918 | ||
![]() |
1bb05ac16f | ||
![]() |
091c52fef7 | ||
![]() |
a83870ef9d | ||
![]() |
a768e39b2d | ||
![]() |
1c4fa240be | ||
![]() |
5046dd02b9 | ||
![]() |
4d6c0bdf74 | ||
![]() |
cbf4961bf3 | ||
![]() |
add5766dd4 | ||
![]() |
8d59d69449 | ||
![]() |
465865c3cb | ||
![]() |
c539b83138 | ||
![]() |
0a2edfc348 | ||
![]() |
64520e43d4 | ||
![]() |
c79f816c32 | ||
![]() |
c8a7df108f | ||
![]() |
8636742256 | ||
![]() |
a1f32ffee5 | ||
![]() |
fec5f03e22 | ||
![]() |
2b2ac9068e | ||
![]() |
890425ecd7 | ||
![]() |
1df1032444 | ||
![]() |
b1e4dce671 | ||
![]() |
0b20de0194 | ||
![]() |
d596a523b9 | ||
![]() |
592df29f9c | ||
![]() |
f1db21218b | ||
![]() |
892cacef43 | ||
![]() |
12b2412c52 | ||
![]() |
7d8343934b | ||
![]() |
7cebf22d57 | ||
![]() |
c6b97a8278 | ||
![]() |
f96a2641fc | ||
![]() |
fc6c4c10f9 | ||
![]() |
152578fb33 | ||
![]() |
0a41318f1d | ||
![]() |
4bde456f73 | ||
![]() |
689ee8345c | ||
![]() |
5d4355f19b | ||
![]() |
710ecb6946 | ||
![]() |
1b24b89cca | ||
![]() |
dc3e7df1c9 | ||
![]() |
1171bc5c8a | ||
![]() |
3adb68c605 | ||
![]() |
34498c13be | ||
![]() |
517d3eb0a4 | ||
![]() |
6a07e704ca | ||
![]() |
95719fbea6 | ||
![]() |
fbf51696ef | ||
![]() |
1786950759 | ||
![]() |
87374a47c9 | ||
![]() |
368f5a8547 | ||
![]() |
68a485b00a | ||
![]() |
7b823badbc | ||
![]() |
b0fd03f5b8 | ||
![]() |
4b2fbe1e97 | ||
![]() |
afecd1aa13 | ||
![]() |
68cde058f6 | ||
![]() |
809a748124 | ||
![]() |
542318b113 | ||
![]() |
909e711e74 | ||
![]() |
d95b67f409 | ||
![]() |
96945c98d5 | ||
![]() |
1db61aca3b | ||
![]() |
bbb6eb3aaa | ||
![]() |
a4765b0551 | ||
![]() |
29de7dd288 | ||
![]() |
52e3c60c86 | ||
![]() |
282b41c69b | ||
![]() |
13e9571dd0 | ||
![]() |
36420330de | ||
![]() |
cc87913294 | ||
![]() |
ca9f9cb875 | ||
![]() |
0c8e5f7e6a | ||
![]() |
59db31902c | ||
![]() |
c36b00a166 | ||
![]() |
59f07ddf28 | ||
![]() |
e214cd4a73 | ||
![]() |
5997f54a71 | ||
![]() |
e8c442952d | ||
![]() |
98d9dc7840 | ||
![]() |
6164d40fce | ||
![]() |
65ca4b547b | ||
![]() |
d09a905751 | ||
![]() |
0152dbbe23 | ||
![]() |
2261ddf9db | ||
![]() |
295496fa34 | ||
![]() |
09a2d93a0f | ||
![]() |
b0ccd24a72 | ||
![]() |
11e131c9f9 | ||
![]() |
4b0c411ce6 | ||
![]() |
0f2e35b305 | ||
![]() |
0cb3d7913c | ||
![]() |
7e46061cac | ||
![]() |
7b79c8bf96 | ||
![]() |
04ae23afff | ||
![]() |
987168d6b9 | ||
![]() |
ea07fde40b | ||
![]() |
e3df610ada | ||
![]() |
72d9c96ad5 |
@@ -55,22 +55,16 @@ borland-clean:
|
||||
make -f Makefile.b32 clean
|
||||
|
||||
watcom: .SYMBOLIC
|
||||
cd lib
|
||||
wmake -u -f Makefile.Watcom
|
||||
cd ..\src
|
||||
wmake -u -f Makefile.Watcom
|
||||
cd lib && $(MAKE) -u -f Makefile.Watcom
|
||||
cd src && $(MAKE) -u -f Makefile.Watcom
|
||||
|
||||
watcom-clean: .SYMBOLIC
|
||||
cd lib
|
||||
wmake -u -f Makefile.Watcom clean
|
||||
cd ..\src
|
||||
wmake -u -f Makefile.Watcom clean
|
||||
cd lib && $(MAKE) -u -f Makefile.Watcom clean
|
||||
cd src && $(MAKE) -u -f Makefile.Watcom clean
|
||||
|
||||
watcom-vclean: .SYMBOLIC
|
||||
cd lib
|
||||
wmake -u -f Makefile.Watcom vclean
|
||||
cd ..\src
|
||||
wmake -u -f Makefile.Watcom vclean
|
||||
cd lib && $(MAKE) -u -f Makefile.Watcom vclean
|
||||
cd src && $(MAKE) -u -f Makefile.Watcom vclean
|
||||
|
||||
mingw32:
|
||||
$(MAKE) -C lib -f Makefile.m32
|
||||
@@ -92,6 +86,10 @@ mingw32-ssh2-ssl-sspi-zlib:
|
||||
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||
|
||||
mingw32-rtmp-ssh2-ssl-sspi-zlib:
|
||||
$(MAKE) -C lib -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||
$(MAKE) -C src -f Makefile.m32 RTMP=1 SSH2=1 SSL=1 SSPI=1 ZLIB=1
|
||||
|
||||
mingw32-clean:
|
||||
$(MAKE) -C lib -f Makefile.m32 clean
|
||||
$(MAKE) -C src -f Makefile.m32 clean
|
||||
|
@@ -1,61 +1,51 @@
|
||||
Curl and libcurl 7.21.2
|
||||
Curl and libcurl 7.21.3
|
||||
|
||||
Public curl releases: 118
|
||||
Command line options: 138
|
||||
curl_easy_setopt() options: 180
|
||||
Public curl releases: 119
|
||||
Command line options: 143
|
||||
curl_easy_setopt() options: 185
|
||||
Public functions in libcurl: 58
|
||||
Known libcurl bindings: 39
|
||||
Contributors: 817
|
||||
Contributors: 827
|
||||
|
||||
This release includes the following changes:
|
||||
|
||||
o curl -T: ignore file size of special files
|
||||
o Added GOPHER protocol support
|
||||
o Added mk-ca-bundle.vbs script
|
||||
o c-ares build now requires c-ares >= 1.6.0
|
||||
o Added --noconfigure switch to testcurl.pl
|
||||
o Added --xattr option
|
||||
o Added CURLOPT_RESOLVE and --resolve
|
||||
o Added CURLAUTH_ONLY
|
||||
o Added version-check.pl to the examples dir
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o --remote-header-name security vulnerability fixed:
|
||||
http://curl.haxx.se/docs/adv_20101013.html
|
||||
|
||||
o multi: support the timeouts correctly, fixes known bug #62
|
||||
o multi: use timeouts properly for MAX_RECV/SEND_SPEED
|
||||
o negotiation: Wrong proxy authorization
|
||||
o multi: avoid sending multiple complete messages
|
||||
o cmdline: make -F type= accept ;charset=
|
||||
o RESUME_FROM: clarify what ftp uploads do
|
||||
o http: handle trailer headers in all chunked responses
|
||||
o Curl_is_connected: use correct errno
|
||||
o Added SSPI build to Watcom makefile
|
||||
o progress: callback for POSTs less than MAX_INITIAL_POST_SIZE
|
||||
o linking problem on Fedora 13
|
||||
o Link curl and the test apps with -lrt explicitly when necessary
|
||||
o chunky parser: only rewind stream internally if needed
|
||||
o remote-header-name: don't output filename when NULL
|
||||
o Curl_timeleft: avoid returning "no timeout" by mistake
|
||||
o timeout: use the correct start value as offset
|
||||
o FTP: fix wrong timeout trigger
|
||||
o buildconf got better output on failures
|
||||
o rtsp: avoid SIGSEGV on malformed header
|
||||
o LDAP: Support for tunnelling queries through HTTP proxy
|
||||
o configure's --enable-werror had a bashism
|
||||
o test565: Don't hardcode IP:PORT
|
||||
o configure: check for gcrypt if using GnuTLS
|
||||
o configure: don't enable RTMP if the lib detect fails
|
||||
o curl_easy_duphandle: clone the c-ares handle correctly
|
||||
o MacOSX-Framework: updates for Snowleopard
|
||||
o support URL containing colon without trailing port number
|
||||
o parsedate: allow time specified without seconds
|
||||
o curl_easy_escape: don't escape "unreserved" characters
|
||||
o SFTP: avoid downloading negative sizes
|
||||
o Lots of GSS/KRB FTP fixes
|
||||
o TFTP: Work around tftpd-hpa upload bug
|
||||
o libcurl.m4: several fixes
|
||||
o HTTP: remove special case for 416
|
||||
o examples: use example.com in example URLs
|
||||
o globbing: fix crash on unballanced open brace
|
||||
o cmake: build fixed
|
||||
o check for libcurl features for some command line options
|
||||
o Curl_setopt: disallow CURLOPT_USE_SSL without SSL support
|
||||
o http_chunks: remove debug output
|
||||
o URL-parsing: consider ? a divider
|
||||
o SSH: avoid using the libssh2_ prefix
|
||||
o SSH: use libssh2_session_handshake() to work on win64
|
||||
o ftp: prevent server from hanging on closed data connection when stopping
|
||||
a transfer before the end of the full transfer (ranges)
|
||||
o LDAP: detect non-binary attributes properly
|
||||
o ftp: treat server's response 421 as CURLE_OPERATION_TIMEDOUT
|
||||
o gnutls->handshake: improved timeout handling
|
||||
o security: Pass the right parameter to init
|
||||
o krb5: Use GSS_ERROR to check for error
|
||||
o TFTP: resend the correct data
|
||||
o configure: fix autoconf 2.68 warning: no AC_LANG_SOURCE call detected
|
||||
o GnuTLS: now detects socket errors on Windows
|
||||
o symbols-in-versions: updated en masse
|
||||
o added a couple examples that were missing from the tar ball
|
||||
o Curl_send/recv_plain: return errno on failure
|
||||
o Curl_wait_for_resolv (for c-ares): correct timeout
|
||||
o ossl_connect_common: detect connection re-use
|
||||
o configure: Prevent link errors with --librtmp
|
||||
o openldap: use remote port in URL passed to ldap_init_fd()
|
||||
o url: provide dead_connection flag in Curl_handler::disconnect
|
||||
o lots of compiler warning fixes
|
||||
o ssh: fix a download resume point calculation
|
||||
o fix getinfo CURLINFO_LOCAL* for reused connections
|
||||
o multi: the returned running handles conuter could turn negative
|
||||
o multi: only ever consider pipelining for connections doing HTTP(S)
|
||||
|
||||
This release includes the following known bugs:
|
||||
|
||||
@@ -64,10 +54,8 @@ This release includes the following known bugs:
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Kamil Dudka, Ben Greear, Cameron Kaiser, Dan Fandrich, Dirk Manske,
|
||||
Guenter Knauf, Julien Chaffraix, Quanah Gibson-Mount, Tor Arntsen,
|
||||
Peter Pentchev, James Bursa, Fabian Keil, Michal Gorny, Mauro Iorio,
|
||||
Hendrik Visage, Ning Dong, David McCreedy, Patrick Monnerat,
|
||||
Tim Newsome, Dan Locks, Vlad Ureche, Dimitre Dimitrov
|
||||
Dan Fandrich, Guenter Knauf, Pat Ray, Hongli Lai, Kamil Dudka,
|
||||
Stefan Tomanek, Alfred Gebert, Yang Tse, Julien Chaffraix, Adam Light,
|
||||
Rutger Hofman, Matthias Bolte, Heinrich Ko, Dmitri Shubin
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
11
TODO-RELEASE
11
TODO-RELEASE
@@ -1,17 +1,10 @@
|
||||
To be addressed in 7.21.2
|
||||
=========================
|
||||
|
||||
268 - 3076430 SFTP resume with 4GB file does not work
|
||||
|
||||
271 -
|
||||
|
||||
To be addressed in 7.21.3
|
||||
=========================
|
||||
|
||||
262 - Manual setting of TLS Server Name Indication - use Host:
|
||||
|
||||
263 - Support binding DNS to local interface/IP
|
||||
|
||||
265 - 1. FTP cmd channel and data channel validation
|
||||
|
||||
267 - 2. Cert chain for data channel
|
||||
|
||||
271 -
|
||||
|
41
acinclude.m4
41
acinclude.m4
@@ -3246,3 +3246,44 @@ AC_DEFUN([CURL_CHECK_PKGCONFIG], [
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
dnl CURL_GENERATE_CONFIGUREHELP_PM
|
||||
dnl -------------------------------------------------
|
||||
dnl Generate test harness configurehelp.pm module, defining and
|
||||
dnl initializing some perl variables with values which are known
|
||||
dnl when the configure script runs. For portability reasons, test
|
||||
dnl harness needs information on how to run the C preprocessor.
|
||||
|
||||
AC_DEFUN([CURL_GENERATE_CONFIGUREHELP_PM], [
|
||||
AC_REQUIRE([AC_PROG_CPP])dnl
|
||||
tmp_cpp=`eval echo "$ac_cpp" 2>/dev/null`
|
||||
if test -z "$tmp_cpp"; then
|
||||
tmp_cpp='cpp'
|
||||
fi
|
||||
cat >./tests/configurehelp.pm <<_EOF
|
||||
[@%:@] This is a generated file. Do not edit.
|
||||
|
||||
package configurehelp;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Exporter;
|
||||
|
||||
use vars qw(
|
||||
@ISA
|
||||
@EXPORT_OK
|
||||
\$Cpreprocessor
|
||||
);
|
||||
|
||||
@ISA = qw(Exporter);
|
||||
|
||||
@EXPORT_OK = qw(
|
||||
\$Cpreprocessor
|
||||
);
|
||||
|
||||
\$Cpreprocessor = '$tmp_cpp';
|
||||
|
||||
1;
|
||||
_EOF
|
||||
])
|
||||
|
@@ -293,6 +293,7 @@ for fname in .deps \
|
||||
config.status \
|
||||
config.sub \
|
||||
configure \
|
||||
configurehelp.pm \
|
||||
curl-config \
|
||||
curlbuild.h \
|
||||
depcomp \
|
||||
@@ -364,6 +365,12 @@ if test ! -f ./config.guess; then
|
||||
else
|
||||
buildhost=`./config.guess 2>/dev/null|head -n 1`
|
||||
case $buildhost in
|
||||
*-*-darwin*)
|
||||
need_lt_major=1
|
||||
need_lt_minor=5
|
||||
need_lt_patch=26
|
||||
need_lt_check="yes"
|
||||
;;
|
||||
*-*-hpux*)
|
||||
need_lt_major=1
|
||||
need_lt_minor=5
|
||||
|
49
configure.ac
49
configure.ac
@@ -955,16 +955,19 @@ dnl Check if the operating system allows programs to write to their own argv[]
|
||||
dnl **********************************************************************
|
||||
|
||||
AC_MSG_CHECKING([if argv can be written to])
|
||||
AC_CACHE_VAL(curl_cv_writable_argv, [
|
||||
AC_RUN_IFELSE([[
|
||||
AC_RUN_IFELSE([
|
||||
AC_LANG_SOURCE([[
|
||||
int main(int argc, char ** argv) {
|
||||
argv[0][0] = ' ';
|
||||
return (argv[0][0] == ' ')?0:1;
|
||||
argv[0][0] = ' ';
|
||||
return (argv[0][0] == ' ')?0:1;
|
||||
}
|
||||
]],
|
||||
curl_cv_writable_argv=yes,
|
||||
curl_cv_writable_argv=no,
|
||||
curl_cv_writable_argv=cross)
|
||||
]])
|
||||
],[
|
||||
curl_cv_writable_argv=yes
|
||||
],[
|
||||
curl_cv_writable_argv=no
|
||||
],[
|
||||
curl_cv_writable_argv=cross
|
||||
])
|
||||
case $curl_cv_writable_argv in
|
||||
yes)
|
||||
@@ -2019,8 +2022,9 @@ if test X"$OPT_LIBSSH2" != Xno; then
|
||||
dnl libssh2_version is a post 1.0 addition
|
||||
dnl libssh2_init and libssh2_exit were added in 1.2.5
|
||||
dnl libssh2_scp_send64 was added in 1.2.6
|
||||
dnl libssh2_session_handshake was added in 1.2.8
|
||||
AC_CHECK_FUNCS( libssh2_version libssh2_init libssh2_exit \
|
||||
libssh2_scp_send64 )
|
||||
libssh2_scp_send64 libssh2_session_handshake)
|
||||
|
||||
LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$DIR_SSH2"
|
||||
export LD_LIBRARY_PATH
|
||||
@@ -2062,6 +2066,10 @@ if test X"$OPT_LIBRTMP" != Xno; then
|
||||
CPP_RTMP=`$PKGCONFIG --cflags-only-I librtmp`
|
||||
version=`$PKGCONFIG --modversion librtmp`
|
||||
DIR_RTMP=`echo $LD_RTMP | $SED -e 's/-L//'`
|
||||
else
|
||||
dnl To avoid link errors, we do not allow --librtmp without
|
||||
dnl a pkgconfig file
|
||||
AC_MSG_ERROR([--librtmp was specified but could not find librtmp pkgconfig file.])
|
||||
fi
|
||||
|
||||
;;
|
||||
@@ -2277,11 +2285,17 @@ AC_CHECK_TYPE(long long,
|
||||
|
||||
if test "xyes" = "x$longlong"; then
|
||||
AC_MSG_CHECKING([if numberLL works])
|
||||
AC_COMPILE_IFELSE([long long val = 1000LL;],
|
||||
[AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])]
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
AC_COMPILE_IFELSE([
|
||||
AC_LANG_PROGRAM([[
|
||||
]],[[
|
||||
long long val = 1000LL;
|
||||
]])
|
||||
],[
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LL, 1, [if your compiler supports LL])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
fi
|
||||
|
||||
|
||||
@@ -2328,6 +2342,7 @@ CURL_CHECK_FUNC_FCNTL
|
||||
CURL_CHECK_FUNC_FDOPEN
|
||||
CURL_CHECK_FUNC_FREEADDRINFO
|
||||
CURL_CHECK_FUNC_FREEIFADDRS
|
||||
CURL_CHECK_FUNC_FSETXATTR
|
||||
CURL_CHECK_FUNC_FTRUNCATE
|
||||
CURL_CHECK_FUNC_GETADDRINFO
|
||||
CURL_CHECK_FUNC_GETHOSTBYADDR
|
||||
@@ -2368,10 +2383,6 @@ CURL_CHECK_FUNC_STRTOK_R
|
||||
CURL_CHECK_FUNC_STRTOLL
|
||||
CURL_CHECK_FUNC_WRITEV
|
||||
|
||||
dnl Checks for library functions.
|
||||
dnl AC_PROG_GCC_TRADITIONAL
|
||||
|
||||
dnl AC_FUNC_VPRINTF
|
||||
case $host in
|
||||
*msdosdjgpp)
|
||||
ac_cv_func_pipe=no
|
||||
@@ -2862,6 +2873,8 @@ AC_CONFIG_FILES([Makefile \
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
CURL_GENERATE_CONFIGUREHELP_PM
|
||||
|
||||
AC_MSG_NOTICE([Configured to build curl/libcurl:
|
||||
|
||||
curl version: ${VERSION}
|
||||
|
5
docs/FAQ
5
docs/FAQ
@@ -1284,7 +1284,10 @@ FAQ
|
||||
this section was much enhanced by Bjorn Reese.)
|
||||
|
||||
We are not lawyers and this is not legal advice. You should probably consult
|
||||
one if you want true and accurate legal insights without our prejudice.
|
||||
one if you want true and accurate legal insights without our prejudice. Note
|
||||
especially that this section concerns the libcurl license only; compiling in
|
||||
features of libcurl that depend on other libraries (e.g. OpenSSL) may affect
|
||||
the licensing obligations of your application.
|
||||
|
||||
6.1 I have a GPL program, can I use the libcurl library?
|
||||
|
||||
|
10
docs/THANKS
10
docs/THANKS
@@ -102,6 +102,7 @@ Brock Noland
|
||||
Bruce Mitchener
|
||||
Bryan Henderson
|
||||
Bryan Kemp
|
||||
Cameron Kaiser
|
||||
Camille Moncelier
|
||||
Caolan McNamara
|
||||
Carsten Lange
|
||||
@@ -147,6 +148,7 @@ Damien Adant
|
||||
Dan Becker
|
||||
Dan C
|
||||
Dan Fandrich
|
||||
Dan Locks
|
||||
Dan Nelson
|
||||
Dan Petitt
|
||||
Dan Torop
|
||||
@@ -192,6 +194,7 @@ Detlef Schmier
|
||||
Didier Brisebourg
|
||||
Diego Casorran
|
||||
Dima Barsky
|
||||
Dimitre Dimitrov
|
||||
Dimitris Sarris
|
||||
Dinar
|
||||
Dirk Eddelbuettel
|
||||
@@ -304,6 +307,7 @@ Hardeep Singh
|
||||
Harshal Pradhan
|
||||
Hauke Duden
|
||||
Heikki Korpela
|
||||
Hendrik Visage
|
||||
Henrik Storner
|
||||
Hidemoto Nakada
|
||||
Hoi-Ho Chan
|
||||
@@ -519,6 +523,7 @@ Matt Wixson
|
||||
Matthew Blain
|
||||
Matthew Clarke
|
||||
Maurice Barnum
|
||||
Mauro Iorio
|
||||
Max Katsev
|
||||
Maxim Ivanov
|
||||
Maxim Perenesenko
|
||||
@@ -536,6 +541,7 @@ Michael Smith
|
||||
Michael Stillwell
|
||||
Michael Wallner
|
||||
Michal Bonino
|
||||
Michal Gorny
|
||||
Michal Marek
|
||||
Michele Bini
|
||||
Mihai Ionescu
|
||||
@@ -572,6 +578,7 @@ Nikita Schmidt
|
||||
Nikitinskit Dmitriy
|
||||
Niklas Angebrand
|
||||
Nikolai Kondrashov
|
||||
Ning Dong
|
||||
Nir Soffer
|
||||
Nis Jorgensen
|
||||
Nodak Sodak
|
||||
@@ -632,6 +639,7 @@ Pooyan McSporran
|
||||
Pramod Sharma
|
||||
Puneet Pawaia
|
||||
Quagmire
|
||||
Quanah Gibson-Mount
|
||||
Rafa Muyo
|
||||
Rafael Sagula
|
||||
Rainer Canavan
|
||||
@@ -761,6 +769,7 @@ Tim Baker
|
||||
Tim Bartley
|
||||
Tim Chen
|
||||
Tim Costello
|
||||
Tim Newsome
|
||||
Tim Sneddon
|
||||
Tobias Rundstr<74>m
|
||||
Toby Peterson
|
||||
@@ -799,6 +808,7 @@ Vincent Le Normand
|
||||
Vincent Penquerc'h
|
||||
Vincent Sanders
|
||||
Vlad Grachov
|
||||
Vlad Ureche
|
||||
Vladimir Lazarenko
|
||||
Vojtech Janota
|
||||
Vojtech Minarik
|
||||
|
26
docs/curl.1
26
docs/curl.1
@@ -526,8 +526,8 @@ or
|
||||
|
||||
\fBcurl\fP -F "name=daniel;type=text/foo" url.com
|
||||
|
||||
You can also explicitly change the name field of an file upload part by
|
||||
setting filename=, like this:
|
||||
You can also explicitly change the name field of a file upload part by setting
|
||||
filename=, like this:
|
||||
|
||||
\fBcurl\fP -F "file=@localfile;filename=nameinpost" url.com
|
||||
|
||||
@@ -1142,6 +1142,18 @@ encodings and instead makes them passed on unaltered, raw. (Added in 7.16.2)
|
||||
When used, this will make libcurl attempt to figure out the timestamp of the
|
||||
remote file, and if that is available make the local file get that same
|
||||
timestamp.
|
||||
.IP "--resolve <host:port:address>"
|
||||
Provide a custom address for a specific host and port pair. Using this, you
|
||||
can make the curl requests(s) use a specified address and prevent the
|
||||
otherwise normally resolved address to be used. Consider it a sort of
|
||||
/etc/hosts alternative provided on the command line. The port number should be
|
||||
the number used for the specific protocol the host will be used for. It means
|
||||
you need several entries if you want to provide address for the same host but
|
||||
different ports.
|
||||
|
||||
This option can be used many times to add many host names to resolve.
|
||||
|
||||
(Added in 7.21.3)
|
||||
.IP "--retry <num>"
|
||||
If a transient error is returned when curl tries to perform a transfer, it
|
||||
will retry this number of times before giving up. Setting the number to 0
|
||||
@@ -1751,6 +1763,16 @@ Failed to shut down the SSL connection.
|
||||
Could not load CRL file, missing or wrong format (added in 7.19.0).
|
||||
.IP 83
|
||||
Issuer check failed (added in 7.19.0).
|
||||
.IP 84
|
||||
The FTP PRET command failed
|
||||
.IP 85
|
||||
RTSP: mismatch of CSeq numbers
|
||||
.IP 86
|
||||
RTSP: mismatch of Session Identifiers
|
||||
.IP 87
|
||||
unable to parse FTP file list
|
||||
.IP 88
|
||||
FTP chunk callback reported error
|
||||
.IP XX
|
||||
More error codes will appear here in future releases. The existing ones
|
||||
are meant to never change.
|
||||
|
@@ -3,10 +3,12 @@ check_PROGRAMS = 10-at-a-time anyauthput cookie_interface debug fileupload \
|
||||
fopen ftpget ftpgetresp ftpupload getinfo getinmemory http-post httpput \
|
||||
https multi-app multi-debugcallback multi-double multi-post multi-single \
|
||||
persistant post-callback postit2 sepheaders simple simplepost simplessl \
|
||||
sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard
|
||||
sendrecv httpcustomheader certinfo chkspeed ftpgetinfo ftp-wildcard \
|
||||
smtp-multi
|
||||
|
||||
# These examples require external dependencies that may not be commonly
|
||||
# available on POSIX systems, so don't bother attempting to compile them here.
|
||||
COMPLICATED_EXAMPLES = curlgtk.c curlx.c htmltitle.cc cacertinmem.c \
|
||||
ftpuploadresume.c ghiper.c hiperfifo.c htmltidy.c multithread.c \
|
||||
opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c
|
||||
opensslthreadlock.c sampleconv.c synctime.c threaded-ssl.c evhiperfifo.c \
|
||||
smooth-gtk-thread.c version-check.pl
|
||||
|
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
|
||||
} else if (strncasecmp(*argv, "-T", 2) == 0) {
|
||||
prttime = 1;
|
||||
} else if (strncasecmp(*argv, "-M=", 3) == 0) {
|
||||
int m = atoi(*argv + 3);
|
||||
long m = strtol(argv+3, NULL, 10);
|
||||
switch(m) {
|
||||
case 1: url = URL_1M;
|
||||
break;
|
||||
|
@@ -53,20 +53,24 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
enum fcurl_type_e { CFTYPE_NONE=0, CFTYPE_FILE=1, CFTYPE_CURL=2 };
|
||||
enum fcurl_type_e {
|
||||
CFTYPE_NONE=0,
|
||||
CFTYPE_FILE=1,
|
||||
CFTYPE_CURL=2
|
||||
};
|
||||
|
||||
struct fcurl_data
|
||||
{
|
||||
enum fcurl_type_e type; /* type of handle */
|
||||
union {
|
||||
CURL *curl;
|
||||
FILE *file;
|
||||
} handle; /* handle */
|
||||
enum fcurl_type_e type; /* type of handle */
|
||||
union {
|
||||
CURL *curl;
|
||||
FILE *file;
|
||||
} handle; /* handle */
|
||||
|
||||
char *buffer; /* buffer to store cached data*/
|
||||
int buffer_len; /* currently allocated buffers length */
|
||||
int buffer_pos; /* end of data in buffer*/
|
||||
int still_running; /* Is background url fetch still in progress */
|
||||
char *buffer; /* buffer to store cached data*/
|
||||
int buffer_len; /* currently allocated buffers length */
|
||||
int buffer_pos; /* end of data in buffer*/
|
||||
int still_running; /* Is background url fetch still in progress */
|
||||
};
|
||||
|
||||
typedef struct fcurl_data URL_FILE;
|
||||
@@ -83,491 +87,441 @@ void url_rewind(URL_FILE *file);
|
||||
CURLM *multi_handle;
|
||||
|
||||
/* curl calls this routine to get more data */
|
||||
static size_t
|
||||
write_callback(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
void *userp)
|
||||
static size_t write_callback(char *buffer,
|
||||
size_t size,
|
||||
size_t nitems,
|
||||
void *userp)
|
||||
{
|
||||
char *newbuff;
|
||||
int rembuff;
|
||||
char *newbuff;
|
||||
int rembuff;
|
||||
|
||||
URL_FILE *url = (URL_FILE *)userp;
|
||||
size *= nitems;
|
||||
URL_FILE *url = (URL_FILE *)userp;
|
||||
size *= nitems;
|
||||
|
||||
rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */
|
||||
rembuff=url->buffer_len - url->buffer_pos; /* remaining space in buffer */
|
||||
|
||||
if(size > rembuff)
|
||||
{
|
||||
/* not enough space in buffer */
|
||||
newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff));
|
||||
if(newbuff==NULL)
|
||||
{
|
||||
fprintf(stderr,"callback buffer grow failed\n");
|
||||
size=rembuff;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* realloc suceeded increase buffer size*/
|
||||
url->buffer_len+=size - rembuff;
|
||||
url->buffer=newbuff;
|
||||
|
||||
/*printf("Callback buffer grown to %d bytes\n",url->buffer_len);*/
|
||||
}
|
||||
if(size > rembuff) {
|
||||
/* not enough space in buffer */
|
||||
newbuff=realloc(url->buffer,url->buffer_len + (size - rembuff));
|
||||
if(newbuff==NULL) {
|
||||
fprintf(stderr,"callback buffer grow failed\n");
|
||||
size=rembuff;
|
||||
}
|
||||
else {
|
||||
/* realloc suceeded increase buffer size*/
|
||||
url->buffer_len+=size - rembuff;
|
||||
url->buffer=newbuff;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(&url->buffer[url->buffer_pos], buffer, size);
|
||||
url->buffer_pos += size;
|
||||
memcpy(&url->buffer[url->buffer_pos], buffer, size);
|
||||
url->buffer_pos += size;
|
||||
|
||||
/*fprintf(stderr, "callback %d size bytes\n", size);*/
|
||||
|
||||
return size;
|
||||
return size;
|
||||
}
|
||||
|
||||
/* use to attempt to fill the read buffer up to requested number of bytes */
|
||||
static int
|
||||
fill_buffer(URL_FILE *file,int want,int waittime)
|
||||
static int fill_buffer(URL_FILE *file,int want,int waittime)
|
||||
{
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
struct timeval timeout;
|
||||
int rc;
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
struct timeval timeout;
|
||||
int rc;
|
||||
|
||||
/* only attempt to fill buffer if transactions still running and buffer
|
||||
* doesnt exceed required size already
|
||||
*/
|
||||
if((!file->still_running) || (file->buffer_pos > want))
|
||||
return 0;
|
||||
/* only attempt to fill buffer if transactions still running and buffer
|
||||
* doesnt exceed required size already
|
||||
*/
|
||||
if((!file->still_running) || (file->buffer_pos > want))
|
||||
return 0;
|
||||
|
||||
/* attempt to fill buffer */
|
||||
do
|
||||
{
|
||||
int maxfd = -1;
|
||||
long curl_timeo = -1;
|
||||
/* attempt to fill buffer */
|
||||
do {
|
||||
int maxfd = -1;
|
||||
long curl_timeo = -1;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to fail on */
|
||||
timeout.tv_sec = 60; /* 1 minute */
|
||||
timeout.tv_usec = 0;
|
||||
/* set a suitable timeout to fail on */
|
||||
timeout.tv_sec = 60; /* 1 minute */
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(multi_handle, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
timeout.tv_sec = curl_timeo / 1000;
|
||||
if(timeout.tv_sec > 1)
|
||||
timeout.tv_sec = 1;
|
||||
else
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
curl_multi_timeout(multi_handle, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
timeout.tv_sec = curl_timeo / 1000;
|
||||
if(timeout.tv_sec > 1)
|
||||
timeout.tv_sec = 1;
|
||||
else
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially
|
||||
in case of (maxfd == -1), we call select(0, ...), which is basically
|
||||
equal to sleep. */
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially
|
||||
in case of (maxfd == -1), we call select(0, ...), which is basically
|
||||
equal to sleep. */
|
||||
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
default:
|
||||
/* timeout or readable/writable sockets */
|
||||
curl_multi_perform(multi_handle, &file->still_running);
|
||||
break;
|
||||
}
|
||||
} while(file->still_running && (file->buffer_pos < want));
|
||||
return 1;
|
||||
case 0:
|
||||
default:
|
||||
/* timeout or readable/writable sockets */
|
||||
curl_multi_perform(multi_handle, &file->still_running);
|
||||
break;
|
||||
}
|
||||
} while(file->still_running && (file->buffer_pos < want));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* use to remove want bytes from the front of a files buffer */
|
||||
static int
|
||||
use_buffer(URL_FILE *file,int want)
|
||||
static int use_buffer(URL_FILE *file,int want)
|
||||
{
|
||||
/* sort out buffer */
|
||||
if((file->buffer_pos - want) <=0)
|
||||
{
|
||||
/* ditch buffer - write will recreate */
|
||||
if(file->buffer)
|
||||
free(file->buffer);
|
||||
|
||||
file->buffer=NULL;
|
||||
file->buffer_pos=0;
|
||||
file->buffer_len=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* move rest down make it available for later */
|
||||
memmove(file->buffer,
|
||||
&file->buffer[want],
|
||||
(file->buffer_pos - want));
|
||||
|
||||
file->buffer_pos -= want;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
URL_FILE *
|
||||
url_fopen(const char *url,const char *operation)
|
||||
{
|
||||
/* this code could check for URLs or types in the 'url' and
|
||||
basicly use the real fopen() for standard files */
|
||||
|
||||
URL_FILE *file;
|
||||
(void)operation;
|
||||
|
||||
file = malloc(sizeof(URL_FILE));
|
||||
if(!file)
|
||||
return NULL;
|
||||
|
||||
memset(file, 0, sizeof(URL_FILE));
|
||||
|
||||
if((file->handle.file=fopen(url,operation)))
|
||||
{
|
||||
file->type = CFTYPE_FILE; /* marked as URL */
|
||||
}
|
||||
else
|
||||
{
|
||||
file->type = CFTYPE_CURL; /* marked as URL */
|
||||
file->handle.curl = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
|
||||
if(!multi_handle)
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
curl_multi_add_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* lets start the fetch */
|
||||
curl_multi_perform(multi_handle, &file->still_running);
|
||||
|
||||
if((file->buffer_pos == 0) && (!file->still_running))
|
||||
{
|
||||
/* if still_running is 0 now, we should return NULL */
|
||||
|
||||
/* make sure the easy handle is not in the multi handle anymore */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* cleanup */
|
||||
curl_easy_cleanup(file->handle.curl);
|
||||
|
||||
free(file);
|
||||
|
||||
file = NULL;
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
int
|
||||
url_fclose(URL_FILE *file)
|
||||
{
|
||||
int ret=0;/* default is good return */
|
||||
|
||||
switch(file->type)
|
||||
{
|
||||
case CFTYPE_FILE:
|
||||
ret=fclose(file->handle.file); /* passthrough */
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
/* make sure the easy handle is not in the multi handle anymore */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* cleanup */
|
||||
curl_easy_cleanup(file->handle.curl);
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ret=EOF;
|
||||
errno=EBADF;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
/* sort out buffer */
|
||||
if((file->buffer_pos - want) <=0) {
|
||||
/* ditch buffer - write will recreate */
|
||||
if(file->buffer)
|
||||
free(file->buffer);/* free any allocated buffer space */
|
||||
free(file->buffer);
|
||||
|
||||
free(file);
|
||||
file->buffer=NULL;
|
||||
file->buffer_pos=0;
|
||||
file->buffer_len=0;
|
||||
}
|
||||
else {
|
||||
/* move rest down make it available for later */
|
||||
memmove(file->buffer,
|
||||
&file->buffer[want],
|
||||
(file->buffer_pos - want));
|
||||
|
||||
return ret;
|
||||
file->buffer_pos -= want;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
url_feof(URL_FILE *file)
|
||||
URL_FILE *url_fopen(const char *url,const char *operation)
|
||||
{
|
||||
int ret=0;
|
||||
/* this code could check for URLs or types in the 'url' and
|
||||
basicly use the real fopen() for standard files */
|
||||
|
||||
switch(file->type)
|
||||
{
|
||||
case CFTYPE_FILE:
|
||||
ret=feof(file->handle.file);
|
||||
break;
|
||||
URL_FILE *file;
|
||||
(void)operation;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
if((file->buffer_pos == 0) && (!file->still_running))
|
||||
ret = 1;
|
||||
break;
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ret=-1;
|
||||
errno=EBADF;
|
||||
break;
|
||||
file = malloc(sizeof(URL_FILE));
|
||||
if(!file)
|
||||
return NULL;
|
||||
|
||||
memset(file, 0, sizeof(URL_FILE));
|
||||
|
||||
if((file->handle.file=fopen(url,operation)))
|
||||
file->type = CFTYPE_FILE; /* marked as URL */
|
||||
|
||||
else {
|
||||
file->type = CFTYPE_CURL; /* marked as URL */
|
||||
file->handle.curl = curl_easy_init();
|
||||
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 0L);
|
||||
curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);
|
||||
|
||||
if(!multi_handle)
|
||||
multi_handle = curl_multi_init();
|
||||
|
||||
curl_multi_add_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* lets start the fetch */
|
||||
curl_multi_perform(multi_handle, &file->still_running);
|
||||
|
||||
if((file->buffer_pos == 0) && (!file->still_running)) {
|
||||
/* if still_running is 0 now, we should return NULL */
|
||||
|
||||
/* make sure the easy handle is not in the multi handle anymore */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* cleanup */
|
||||
curl_easy_cleanup(file->handle.curl);
|
||||
|
||||
free(file);
|
||||
|
||||
file = NULL;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
size_t
|
||||
url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file)
|
||||
int url_fclose(URL_FILE *file)
|
||||
{
|
||||
size_t want;
|
||||
int ret=0;/* default is good return */
|
||||
|
||||
switch(file->type)
|
||||
{
|
||||
case CFTYPE_FILE:
|
||||
want=fread(ptr,size,nmemb,file->handle.file);
|
||||
break;
|
||||
switch(file->type) {
|
||||
case CFTYPE_FILE:
|
||||
ret=fclose(file->handle.file); /* passthrough */
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
want = nmemb * size;
|
||||
case CFTYPE_CURL:
|
||||
/* make sure the easy handle is not in the multi handle anymore */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
fill_buffer(file,want,1);
|
||||
/* cleanup */
|
||||
curl_easy_cleanup(file->handle.curl);
|
||||
break;
|
||||
|
||||
/* check if theres data in the buffer - if not fill_buffer()
|
||||
* either errored or EOF */
|
||||
if(!file->buffer_pos)
|
||||
return 0;
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ret=EOF;
|
||||
errno=EBADF;
|
||||
break;
|
||||
}
|
||||
|
||||
/* ensure only available data is considered */
|
||||
if(file->buffer_pos < want)
|
||||
want = file->buffer_pos;
|
||||
if(file->buffer)
|
||||
free(file->buffer);/* free any allocated buffer space */
|
||||
|
||||
/* xfer data to caller */
|
||||
memcpy(ptr, file->buffer, want);
|
||||
free(file);
|
||||
|
||||
use_buffer(file,want);
|
||||
|
||||
want = want / size; /* number of items - nb correct op - checked
|
||||
* with glibc code*/
|
||||
|
||||
/*printf("(fread) return %d bytes %d left\n", want,file->buffer_pos);*/
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
want=0;
|
||||
errno=EBADF;
|
||||
break;
|
||||
|
||||
}
|
||||
return want;
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *
|
||||
url_fgets(char *ptr, int size, URL_FILE *file)
|
||||
int url_feof(URL_FILE *file)
|
||||
{
|
||||
int want = size - 1;/* always need to leave room for zero termination */
|
||||
int loop;
|
||||
int ret=0;
|
||||
|
||||
switch(file->type)
|
||||
{
|
||||
case CFTYPE_FILE:
|
||||
ptr = fgets(ptr,size,file->handle.file);
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
fill_buffer(file,want,1);
|
||||
|
||||
/* check if theres data in the buffer - if not fill either errored or
|
||||
* EOF */
|
||||
if(!file->buffer_pos)
|
||||
return NULL;
|
||||
|
||||
/* ensure only available data is considered */
|
||||
if(file->buffer_pos < want)
|
||||
want = file->buffer_pos;
|
||||
|
||||
/*buffer contains data */
|
||||
/* look for newline or eof */
|
||||
for(loop=0;loop < want;loop++)
|
||||
{
|
||||
if(file->buffer[loop] == '\n')
|
||||
{
|
||||
want=loop+1;/* include newline */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* xfer data to caller */
|
||||
memcpy(ptr, file->buffer, want);
|
||||
ptr[want]=0;/* allways null terminate */
|
||||
|
||||
use_buffer(file,want);
|
||||
|
||||
/*printf("(fgets) return %d bytes %d left\n", want,file->buffer_pos);*/
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ptr=NULL;
|
||||
errno=EBADF;
|
||||
switch(file->type) {
|
||||
case CFTYPE_FILE:
|
||||
ret=feof(file->handle.file);
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
if((file->buffer_pos == 0) && (!file->still_running))
|
||||
ret = 1;
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ret=-1;
|
||||
errno=EBADF;
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
size_t url_fread(void *ptr, size_t size, size_t nmemb, URL_FILE *file)
|
||||
{
|
||||
size_t want;
|
||||
|
||||
switch(file->type) {
|
||||
case CFTYPE_FILE:
|
||||
want=fread(ptr,size,nmemb,file->handle.file);
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
want = nmemb * size;
|
||||
|
||||
fill_buffer(file,want,1);
|
||||
|
||||
/* check if theres data in the buffer - if not fill_buffer()
|
||||
* either errored or EOF */
|
||||
if(!file->buffer_pos)
|
||||
return 0;
|
||||
|
||||
/* ensure only available data is considered */
|
||||
if(file->buffer_pos < want)
|
||||
want = file->buffer_pos;
|
||||
|
||||
/* xfer data to caller */
|
||||
memcpy(ptr, file->buffer, want);
|
||||
|
||||
use_buffer(file,want);
|
||||
|
||||
want = want / size; /* number of items */
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
want=0;
|
||||
errno=EBADF;
|
||||
break;
|
||||
|
||||
}
|
||||
return want;
|
||||
}
|
||||
|
||||
char *url_fgets(char *ptr, int size, URL_FILE *file)
|
||||
{
|
||||
int want = size - 1;/* always need to leave room for zero termination */
|
||||
int loop;
|
||||
|
||||
switch(file->type) {
|
||||
case CFTYPE_FILE:
|
||||
ptr = fgets(ptr,size,file->handle.file);
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
fill_buffer(file,want,1);
|
||||
|
||||
/* check if theres data in the buffer - if not fill either errored or
|
||||
* EOF */
|
||||
if(!file->buffer_pos)
|
||||
return NULL;
|
||||
|
||||
/* ensure only available data is considered */
|
||||
if(file->buffer_pos < want)
|
||||
want = file->buffer_pos;
|
||||
|
||||
/*buffer contains data */
|
||||
/* look for newline or eof */
|
||||
for(loop=0;loop < want;loop++) {
|
||||
if(file->buffer[loop] == '\n') {
|
||||
want=loop+1;/* include newline */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ptr;/*success */
|
||||
/* xfer data to caller */
|
||||
memcpy(ptr, file->buffer, want);
|
||||
ptr[want]=0;/* allways null terminate */
|
||||
|
||||
use_buffer(file,want);
|
||||
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
ptr=NULL;
|
||||
errno=EBADF;
|
||||
break;
|
||||
}
|
||||
|
||||
return ptr;/*success */
|
||||
}
|
||||
|
||||
void
|
||||
url_rewind(URL_FILE *file)
|
||||
void url_rewind(URL_FILE *file)
|
||||
{
|
||||
switch(file->type)
|
||||
{
|
||||
case CFTYPE_FILE:
|
||||
rewind(file->handle.file); /* passthrough */
|
||||
break;
|
||||
switch(file->type) {
|
||||
case CFTYPE_FILE:
|
||||
rewind(file->handle.file); /* passthrough */
|
||||
break;
|
||||
|
||||
case CFTYPE_CURL:
|
||||
/* halt transaction */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
case CFTYPE_CURL:
|
||||
/* halt transaction */
|
||||
curl_multi_remove_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* restart */
|
||||
curl_multi_add_handle(multi_handle, file->handle.curl);
|
||||
/* restart */
|
||||
curl_multi_add_handle(multi_handle, file->handle.curl);
|
||||
|
||||
/* ditch buffer - write will recreate - resets stream pos*/
|
||||
if(file->buffer)
|
||||
free(file->buffer);
|
||||
/* ditch buffer - write will recreate - resets stream pos*/
|
||||
if(file->buffer)
|
||||
free(file->buffer);
|
||||
|
||||
file->buffer=NULL;
|
||||
file->buffer_pos=0;
|
||||
file->buffer_len=0;
|
||||
file->buffer=NULL;
|
||||
file->buffer_pos=0;
|
||||
file->buffer_len=0;
|
||||
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
break;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default: /* unknown or supported type - oh dear */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Small main program to retrive from a url using fgets and fread saving the
|
||||
* output to two test files (note the fgets method will corrupt binary files if
|
||||
* they contain 0 chars */
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
URL_FILE *handle;
|
||||
FILE *outf;
|
||||
URL_FILE *handle;
|
||||
FILE *outf;
|
||||
|
||||
int nread;
|
||||
char buffer[256];
|
||||
const char *url;
|
||||
int nread;
|
||||
char buffer[256];
|
||||
const char *url;
|
||||
|
||||
if(argc < 2)
|
||||
{
|
||||
url="http://192.168.7.3/testfile";/* default to testurl */
|
||||
}
|
||||
else
|
||||
{
|
||||
url=argv[1];/* use passed url */
|
||||
}
|
||||
if(argc < 2)
|
||||
url="http://192.168.7.3/testfile";/* default to testurl */
|
||||
else
|
||||
url=argv[1];/* use passed url */
|
||||
|
||||
/* copy from url line by line with fgets */
|
||||
outf=fopen("fgets.test","w+");
|
||||
if(!outf)
|
||||
{
|
||||
perror("couldn't open fgets output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen(url, "r");
|
||||
if(!handle)
|
||||
{
|
||||
printf("couldn't url_fopen() %s\n", url);
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
while(!url_feof(handle))
|
||||
{
|
||||
url_fgets(buffer,sizeof(buffer),handle);
|
||||
fwrite(buffer,1,strlen(buffer),outf);
|
||||
}
|
||||
|
||||
url_fclose(handle);
|
||||
/* copy from url line by line with fgets */
|
||||
outf=fopen("fgets.test","w+");
|
||||
if(!outf) {
|
||||
perror("couldn't open fgets output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen(url, "r");
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen() %s\n", url);
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
while(!url_feof(handle)) {
|
||||
url_fgets(buffer,sizeof(buffer),handle);
|
||||
fwrite(buffer,1,strlen(buffer),outf);
|
||||
}
|
||||
|
||||
url_fclose(handle);
|
||||
|
||||
fclose(outf);
|
||||
|
||||
|
||||
/* Copy from url with fread */
|
||||
outf=fopen("fread.test","w+");
|
||||
if(!outf)
|
||||
{
|
||||
perror("couldn't open fread output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen("testfile", "r");
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen() testfile\n");
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
do {
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
} while(nread);
|
||||
|
||||
url_fclose(handle);
|
||||
/* Copy from url with fread */
|
||||
outf=fopen("fread.test","w+");
|
||||
if(!outf) {
|
||||
perror("couldn't open fread output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen("testfile", "r");
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen() testfile\n");
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
do {
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
} while(nread);
|
||||
|
||||
url_fclose(handle);
|
||||
|
||||
fclose(outf);
|
||||
|
||||
|
||||
/* Test rewind */
|
||||
outf=fopen("rewind.test","w+");
|
||||
if(!outf)
|
||||
{
|
||||
perror("couldn't open fread output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen("testfile", "r");
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen() testfile\n");
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
url_rewind(handle);
|
||||
|
||||
buffer[0]='\n';
|
||||
fwrite(buffer,1,1,outf);
|
||||
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
|
||||
|
||||
url_fclose(handle);
|
||||
/* Test rewind */
|
||||
outf=fopen("rewind.test","w+");
|
||||
if(!outf) {
|
||||
perror("couldn't open fread output file\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
handle = url_fopen("testfile", "r");
|
||||
if(!handle) {
|
||||
printf("couldn't url_fopen() testfile\n");
|
||||
fclose(outf);
|
||||
return 2;
|
||||
}
|
||||
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
url_rewind(handle);
|
||||
|
||||
buffer[0]='\n';
|
||||
fwrite(buffer,1,1,outf);
|
||||
|
||||
nread = url_fread(buffer, 1,sizeof(buffer), handle);
|
||||
fwrite(buffer,1,nread,outf);
|
||||
|
||||
|
||||
return 0;/* all done */
|
||||
url_fclose(handle);
|
||||
|
||||
fclose(outf);
|
||||
|
||||
|
||||
return 0;/* all done */
|
||||
}
|
||||
|
@@ -101,12 +101,8 @@ int main(int argc, char **argv)
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0:
|
||||
/* timeout, do something else */
|
||||
break;
|
||||
default:
|
||||
/* one or more of curl's file descriptors say there's data to read
|
||||
or write */
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(multi_handle, &still_running);
|
||||
break;
|
||||
}
|
||||
|
@@ -112,7 +112,6 @@ int main(int argc, char *argv[])
|
||||
/* select error */
|
||||
break;
|
||||
case 0:
|
||||
printf("timeout!\n");
|
||||
default:
|
||||
/* timeout or readable/writable sockets */
|
||||
printf("perform!\n");
|
||||
|
192
docs/examples/smtp-multi.c
Normal file
192
docs/examples/smtp-multi.c
Normal file
@@ -0,0 +1,192 @@
|
||||
/*****************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
*
|
||||
* This is an example application source code sending SMTP mail using the
|
||||
* multi interface.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/*
|
||||
* This is the list of basic details you need to tweak to get things right.
|
||||
*/
|
||||
#define USERNAME "user@example.com"
|
||||
#define PASSWORD "123qwerty"
|
||||
#define SMTPSERVER "smtp.example.com"
|
||||
#define SMTPPORT ":587" /* it is a colon+port string, but you can set it
|
||||
to "" to use the default port */
|
||||
#define RECEPIENT "receipient@example.com"
|
||||
#define MAILFROM "<realuser@example.com>"
|
||||
|
||||
#define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
/* Note that you should include the actual meta data headers here as well if
|
||||
you want the mail to have a Subject, another From:, show a To: or whatever
|
||||
you think your mail should feature! */
|
||||
static const char *text[]={
|
||||
"one\n",
|
||||
"two\n",
|
||||
"three\n",
|
||||
" Hello, this is CURL email SMTP\n",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct WriteThis {
|
||||
int counter;
|
||||
};
|
||||
|
||||
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *userp)
|
||||
{
|
||||
struct WriteThis *pooh = (struct WriteThis *)userp;
|
||||
const char *data;
|
||||
|
||||
if(size*nmemb < 1)
|
||||
return 0;
|
||||
|
||||
data = text[pooh->counter];
|
||||
|
||||
if(data) {
|
||||
size_t len = strlen(data);
|
||||
memcpy(ptr, data, len);
|
||||
pooh->counter++; /* advance pointer */
|
||||
return len;
|
||||
}
|
||||
return 0; /* no more data left to deliver */
|
||||
}
|
||||
|
||||
static struct timeval tvnow(void)
|
||||
{
|
||||
/*
|
||||
** time() returns the value of time in seconds since the Epoch.
|
||||
*/
|
||||
struct timeval now;
|
||||
now.tv_sec = (long)time(NULL);
|
||||
now.tv_usec = 0;
|
||||
return now;
|
||||
}
|
||||
|
||||
static long tvdiff(struct timeval newer, struct timeval older)
|
||||
{
|
||||
return (newer.tv_sec-older.tv_sec)*1000+
|
||||
(newer.tv_usec-older.tv_usec)/1000;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
CURL *curl;
|
||||
CURLM *mcurl;
|
||||
int still_running = 1;
|
||||
struct timeval mp_start;
|
||||
char mp_timedout = 0;
|
||||
struct WriteThis pooh;
|
||||
struct curl_slist* rcpt_list = NULL;
|
||||
|
||||
pooh.counter = 0;
|
||||
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl)
|
||||
return 1;
|
||||
|
||||
mcurl = curl_multi_init();
|
||||
if(!mcurl)
|
||||
return 2;
|
||||
|
||||
rcpt_list = curl_slist_append(rcpt_list, RECEPIENT);
|
||||
/* more addresses can be added here
|
||||
rcpt_list = curl_slist_append(rcpt_list, "others@example.com");
|
||||
*/
|
||||
|
||||
curl_easy_setopt(curl, CURLOPT_URL, "smtp://" SMTPSERVER SMTPPORT);
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);
|
||||
curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, MAILFROM);
|
||||
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, rcpt_list);
|
||||
curl_easy_setopt(curl, CURLOPT_USE_SSL, CURLUSESSL_ALL);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_READDATA, &pooh);
|
||||
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
|
||||
curl_easy_setopt(curl, CURLOPT_SSLVERSION, 0);
|
||||
curl_easy_setopt(curl, CURLOPT_SSL_SESSIONID_CACHE, 0);
|
||||
curl_multi_add_handle(mcurl, curl);
|
||||
|
||||
mp_timedout = 0;
|
||||
mp_start = tvnow();
|
||||
|
||||
/* we start some action by calling perform right away */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
|
||||
while(still_running) {
|
||||
struct timeval timeout;
|
||||
int rc; /* select() return code */
|
||||
|
||||
fd_set fdread;
|
||||
fd_set fdwrite;
|
||||
fd_set fdexcep;
|
||||
int maxfd = -1;
|
||||
|
||||
long curl_timeo = -1;
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
/* set a suitable timeout to play around with */
|
||||
timeout.tv_sec = 1;
|
||||
timeout.tv_usec = 0;
|
||||
|
||||
curl_multi_timeout(mcurl, &curl_timeo);
|
||||
if(curl_timeo >= 0) {
|
||||
timeout.tv_sec = curl_timeo / 1000;
|
||||
if(timeout.tv_sec > 1)
|
||||
timeout.tv_sec = 1;
|
||||
else
|
||||
timeout.tv_usec = (curl_timeo % 1000) * 1000;
|
||||
}
|
||||
|
||||
/* get file descriptors from the transfers */
|
||||
curl_multi_fdset(mcurl, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
|
||||
/* In a real-world program you OF COURSE check the return code of the
|
||||
function calls. On success, the value of maxfd is guaranteed to be
|
||||
greater or equal than -1. We call select(maxfd + 1, ...), specially in
|
||||
case of (maxfd == -1), we call select(0, ...), which is basically equal
|
||||
to sleep. */
|
||||
|
||||
rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);
|
||||
|
||||
if (tvdiff(tvnow(), mp_start) > MULTI_PERFORM_HANG_TIMEOUT) {
|
||||
fprintf(stderr, "ABORTING TEST, since it seems "
|
||||
"that it would have run forever.\n");
|
||||
break;
|
||||
}
|
||||
|
||||
switch(rc) {
|
||||
case -1:
|
||||
/* select error */
|
||||
break;
|
||||
case 0: /* timeout */
|
||||
default: /* action */
|
||||
curl_multi_perform(mcurl, &still_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
curl_slist_free_all(rcpt_list);
|
||||
curl_multi_remove_handle(mcurl, curl);
|
||||
curl_multi_cleanup(mcurl);
|
||||
curl_easy_cleanup(curl);
|
||||
curl_global_cleanup();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
105
docs/examples/version-check.pl
Executable file
105
docs/examples/version-check.pl
Executable file
@@ -0,0 +1,105 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at http://curl.haxx.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# This script accepts a source file as input on the command line.
|
||||
#
|
||||
# It first loads the 'symbols-in-versions' document and stores a lookup
|
||||
# table for all known symbols for which version they were introduced.
|
||||
#
|
||||
# It then scans the given source file to dig up all symbols starting with CURL.
|
||||
# Finally, it sorts the internal list of found symbols (using the version
|
||||
# number as sort key) and then it outputs the most recent version number and
|
||||
# the symbols from that version that are used.
|
||||
#
|
||||
# Usage:
|
||||
#
|
||||
# version-check.pl [source file]
|
||||
#
|
||||
|
||||
open(S, "<../libcurl/symbols-in-versions") || die;
|
||||
|
||||
my %doc;
|
||||
my %rem;
|
||||
while(<S>) {
|
||||
if(/(^CURL[^ \n]*) *(.*)/) {
|
||||
my ($sym, $rest)=($1, $2);
|
||||
my @a=split(/ +/, $rest);
|
||||
|
||||
$doc{$sym}=$a[0]; # when it was introduced
|
||||
|
||||
if($a[2]) {
|
||||
# this symbol is documented to have been present the last time
|
||||
# in this release
|
||||
$rem{$sym}=$a[2];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
close(S);
|
||||
|
||||
sub age {
|
||||
my ($ver)=@_;
|
||||
|
||||
my @s=split(/\./, $ver);
|
||||
return $s[0]*10000+$s[1]*100+$s[2];
|
||||
}
|
||||
|
||||
my %used;
|
||||
open(C, "<$ARGV[0]") || die;
|
||||
|
||||
while(<C>) {
|
||||
if(/\W(CURL[_A-Z0-9v]+)\W/) {
|
||||
#print "$1\n";
|
||||
$used{$1}++;
|
||||
}
|
||||
}
|
||||
|
||||
close(C);
|
||||
|
||||
sub sortversions {
|
||||
my $r = age($doc{$a}) <=> age($doc{$b});
|
||||
if(!$r) {
|
||||
$r = $a cmp $b;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
my @recent = reverse sort sortversions keys %used;
|
||||
|
||||
# the most recent symbol
|
||||
my $newsym = $recent[0];
|
||||
# the most recent version
|
||||
my $newver = $doc{$newsym};
|
||||
|
||||
print "The scanned source uses these symbols introduced in $newver:\n";
|
||||
|
||||
for my $w (@recent) {
|
||||
if($doc{$w} eq $newver) {
|
||||
printf " $w\n";
|
||||
next;
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
||||
|
@@ -84,6 +84,13 @@ If this option is set and libcurl has been built with the standard name
|
||||
resolver, timeouts will not occur while the name resolve takes place.
|
||||
Consider building libcurl with c-ares support to enable asynchronous DNS
|
||||
lookups, which enables nice timeouts for name resolves without signals.
|
||||
|
||||
Setting \fICURLOPT_NOSIGNAL\fP to 1 makes libcurl NOT ask the system to ignore
|
||||
SIGPIPE signals, which otherwise are sent by the system when trying to send
|
||||
data to a socket which is closed in the other end. libcurl makes an effort to
|
||||
never cause such SIGPIPEs to trigger, but some operating systems have no way
|
||||
to avoid them and even on those that have there are some corner cases when
|
||||
they may still happen, contrary to our desire.
|
||||
.IP CURLOPT_WILDCARDMATCH
|
||||
Set this option to 1 if you want to transfer multiple files according to a
|
||||
file name pattern. The pattern can be specified as part of the
|
||||
@@ -858,6 +865,10 @@ secure.
|
||||
This is a convenience macro that sets all bits except Basic and thus makes
|
||||
libcurl pick any it finds suitable. libcurl will automatically select the one
|
||||
it finds most secure.
|
||||
.IP CURLAUTH_ONLY
|
||||
This is a meta symbol. Or this value together with a single specific auth
|
||||
value to force libcurl to probe for un-restricted auth and if not, only that
|
||||
single auth algorithm is acceptable. (Added in 7.21.3)
|
||||
.RE
|
||||
.IP CURLOPT_PROXYAUTH
|
||||
Pass a long as parameter, which is set to a bitmask, to tell libcurl which
|
||||
@@ -1337,22 +1348,6 @@ it already uses for the control connection. But it will use the port number
|
||||
from the 227-response. (Added in 7.14.2)
|
||||
|
||||
This option has no effect if PORT, EPRT or EPSV is used instead of PASV.
|
||||
.IP CURLOPT_USE_SSL
|
||||
Pass a long using one of the values from below, to make libcurl use your
|
||||
desired level of SSL for the FTP transfer. (Added in 7.11.0)
|
||||
|
||||
(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants
|
||||
were known as CURLFTPSSL_*)
|
||||
.RS
|
||||
.IP CURLUSESSL_NONE
|
||||
Don't attempt to use SSL.
|
||||
.IP CURLUSESSL_TRY
|
||||
Try using SSL, proceed as normal otherwise.
|
||||
.IP CURLUSESSL_CONTROL
|
||||
Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.IP CURLUSESSL_ALL
|
||||
Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.RE
|
||||
.IP CURLOPT_FTPSSLAUTH
|
||||
Pass a long using one of the values from below, to alter how libcurl issues
|
||||
\&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see
|
||||
@@ -1524,7 +1519,9 @@ to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT\fP has no effect when doing
|
||||
FTP via a proxy. Beware that not all proxies support this feature. (Added in
|
||||
7.18.0)
|
||||
.IP CURLOPT_CRLF
|
||||
Convert Unix newlines to CRLF newlines on transfers.
|
||||
Pass a long. If the value is set to 1 (one), libcurl converts Unix newlines to
|
||||
CRLF newlines on transfers. Disable this option again by setting the value to
|
||||
0 (zero).
|
||||
.IP CURLOPT_RANGE
|
||||
Pass a char * as parameter, which should contain the specified range you
|
||||
want. It should be in the format "X-Y", where X or Y may be left out. HTTP
|
||||
@@ -1763,6 +1760,47 @@ This option is useful with the \fICURLINFO_LASTSOCKET\fP option to
|
||||
\fIcurl_easy_getinfo(3)\fP. The library can set up the connection and then the
|
||||
application can obtain the most recently used socket for special data
|
||||
transfers. (Added in 7.15.2)
|
||||
.IP CURLOPT_USE_SSL
|
||||
Pass a long using one of the values from below, to make libcurl use your
|
||||
desired level of SSL for the transfer. (Added in 7.11.0)
|
||||
|
||||
This is for enabling SSL/TLS when you use FTP, SMTP, POP3, IMAP etc.
|
||||
|
||||
(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constants
|
||||
were known as CURLFTPSSL_*)
|
||||
.RS
|
||||
.IP CURLUSESSL_NONE
|
||||
Don't attempt to use SSL.
|
||||
.IP CURLUSESSL_TRY
|
||||
Try using SSL, proceed as normal otherwise.
|
||||
.IP CURLUSESSL_CONTROL
|
||||
Require SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.IP CURLUSESSL_ALL
|
||||
Require SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP.
|
||||
.RE
|
||||
.IP CURLOPT_RESOLVE
|
||||
Pass a pointer to a linked list of strings with host name resolve information
|
||||
to use for requests with this handle. The linked list should be a fully valid
|
||||
list of \fBstruct curl_slist\fP structs properly filled in. Use
|
||||
\fIcurl_slist_append(3)\fP to create the list and \fIcurl_slist_free_all(3)\fP
|
||||
to clean up an entire list.
|
||||
|
||||
Each single name resolve string should be written using the format
|
||||
HOST:PORT:ADDRESS where HOST is the name libcurl will try to resolve, PORT is
|
||||
the port number of the service where libcurl wants to connect to the HOST and
|
||||
ADDRESS is the numerical IP address. If libcurl is built to support IPv6,
|
||||
ADDRESS can of course be either IPv4 or IPv6 style addressing.
|
||||
|
||||
This option effectively pre-populates the DNS cache with entries for the
|
||||
host+port pair so redirects and everything that operations against the
|
||||
HOST+PORT will instead use your provided ADDRESS.
|
||||
|
||||
You can remove names from the DNS cache again, to stop providing these fake
|
||||
resolves, by including a string in the linked list that uses the format
|
||||
\&"-HOST:PORT". The host name must be prefixed with a dash, and the host name
|
||||
and port number must exactly match what was already added previously.
|
||||
|
||||
(Added in 7.12.3)
|
||||
.SH SSL and SECURITY OPTIONS
|
||||
.IP CURLOPT_SSLCERT
|
||||
Pass a pointer to a zero terminated string as parameter. The string should be
|
||||
|
@@ -18,18 +18,26 @@ CURLAUTH_BASIC 7.10.6
|
||||
CURLAUTH_DIGEST 7.10.6
|
||||
CURLAUTH_DIGEST_IE 7.19.3
|
||||
CURLAUTH_GSSNEGOTIATE 7.10.6
|
||||
CURLAUTH_NONE 7.10.6
|
||||
CURLAUTH_NTLM 7.10.6
|
||||
CURLAUTH_ONLY 7.21.3
|
||||
CURLCLOSEPOLICY_CALLBACK 7.7
|
||||
CURLCLOSEPOLICY_LEAST_RECENTLY_USED 7.7
|
||||
CURLCLOSEPOLICY_LEAST_TRAFFIC 7.7
|
||||
CURLCLOSEPOLICY_NONE 7.7
|
||||
CURLCLOSEPOLICY_OLDEST 7.7
|
||||
CURLCLOSEPOLICY_SLOWEST 7.7
|
||||
CURLE_ABORTED_BY_CALLBACK 7.1
|
||||
CURLE_AGAIN 7.18.2
|
||||
CURLE_ALREADY_COMPLETE 7.7.2
|
||||
CURLE_BAD_CALLING_ORDER 7.1 7.17.0
|
||||
CURLE_BAD_CONTENT_ENCODING 7.10
|
||||
CURLE_BAD_DOWNLOAD_RESUME 7.10
|
||||
CURLE_BAD_FUNCTION_ARGUMENT 7.1
|
||||
CURLE_BAD_PASSWORD_ENTERED - 7.17.0
|
||||
CURLE_CHUNK_FAILED 7.20.1
|
||||
CURLE_CONV_FAILED 7.15.4
|
||||
CURLE_CONV_REQD 7.15.4
|
||||
CURLE_COULDNT_CONNECT 7.1
|
||||
CURLE_COULDNT_RESOLVE_HOST 7.1
|
||||
CURLE_COULDNT_RESOLVE_PROXY 7.1
|
||||
@@ -37,7 +45,9 @@ CURLE_FAILED_INIT 7.1
|
||||
CURLE_FILESIZE_EXCEEDED 7.10.8
|
||||
CURLE_FILE_COULDNT_READ_FILE 7.1
|
||||
CURLE_FTP_ACCESS_DENIED 7.1
|
||||
CURLE_FTP_BAD_DOWNLOAD_RESUME 7.1
|
||||
CURLE_FTP_BAD_DOWNLOAD_RESUME 7.1 7.1
|
||||
CURLE_FTP_BAD_FILE_LIST 7.20.1
|
||||
CURLE_FTP_CANT_GET_HOST 7.1
|
||||
CURLE_FTP_CANT_RECONNECT 7.1 7.17.0
|
||||
CURLE_FTP_COULDNT_GET_SIZE 7.1 7.17.0
|
||||
@@ -65,11 +75,13 @@ CURLE_HTTP_NOT_FOUND 7.1
|
||||
CURLE_HTTP_PORT_FAILED - 7.12.0
|
||||
CURLE_HTTP_POST_ERROR 7.1
|
||||
CURLE_HTTP_RANGE_ERROR 7.1 7.17.0
|
||||
CURLE_HTTP_RETURNED_ERROR 7.10.3
|
||||
CURLE_INTERFACE_FAILED 7.12.0
|
||||
CURLE_LDAP_CANNOT_BIND 7.1
|
||||
CURLE_LDAP_INVALID_URL 7.10.8
|
||||
CURLE_LDAP_SEARCH_FAILED 7.1
|
||||
CURLE_LIBRARY_NOT_FOUND 7.1 7.17.0
|
||||
CURLE_LOGIN_DENIED 7.13.1
|
||||
CURLE_MALFORMAT_USER 7.1 7.17.0
|
||||
CURLE_OK 7.1
|
||||
CURLE_OPERATION_TIMEDOUT 7.17.0
|
||||
@@ -83,12 +95,16 @@ CURLE_READ_ERROR 7.1
|
||||
CURLE_RECV_ERROR 7.13.0
|
||||
CURLE_REMOTE_ACCESS_DENIED 7.17.0
|
||||
CURLE_REMOTE_DISK_FULL 7.17.0
|
||||
CURLE_REMOTE_FILE_EXISTS 7.17.0
|
||||
CURLE_REMOTE_FILE_NOT_FOUND 7.16.1
|
||||
CURLE_RTSP_CSEQ_ERROR 7.20.0
|
||||
CURLE_RTSP_SESSION_ERROR 7.20.0
|
||||
CURLE_SEND_ERROR 7.13.0
|
||||
CURLE_SEND_FAIL_REWIND 7.12.3
|
||||
CURLE_SHARE_IN_USE - 7.17.0
|
||||
CURLE_SSH 7.16.1
|
||||
CURLE_SSL_CACERT 7.10
|
||||
CURLE_SSL_CACERT_BADFILE 7.16.0
|
||||
CURLE_SSL_CERTPROBLEM 7.10
|
||||
CURLE_SSL_CIPHER 7.10
|
||||
CURLE_SSL_CONNECT_ERROR 7.1
|
||||
@@ -104,20 +120,59 @@ CURLE_TFTP_DISKFULL 7.15.0 7.17.0
|
||||
CURLE_TFTP_EXISTS 7.15.0 7.17.0
|
||||
CURLE_TFTP_ILLEGAL 7.15.0
|
||||
CURLE_TFTP_NOSUCHUSER 7.15.0
|
||||
CURLE_TFTP_NOTFOUND 7.15.0
|
||||
CURLE_TFTP_PERM 7.15.0
|
||||
CURLE_TFTP_UNKNOWNID 7.15.0
|
||||
CURLE_TOO_MANY_REDIRECTS 7.5
|
||||
CURLE_UNKNOWN_TELNET_OPTION 7.7
|
||||
CURLE_UNSUPPORTED_PROTOCOL 7.1
|
||||
CURLE_UPLOAD_FAILED 7.16.3
|
||||
CURLE_URL_MALFORMAT 7.1
|
||||
CURLE_URL_MALFORMAT_USER 7.1 7.17.0
|
||||
CURLE_USE_SSL_FAILED 7.17.0
|
||||
CURLE_WRITE_ERROR 7.1
|
||||
CURLFILETYPE_DEVICE_BLOCK 7.21.0
|
||||
CURLFILETYPE_DEVICE_CHAR 7.21.0
|
||||
CURLFILETYPE_DIRECTORY 7.21.0
|
||||
CURLFILETYPE_DOOR 7.21.0
|
||||
CURLFILETYPE_FILE 7.21.0
|
||||
CURLFILETYPE_NAMEDPIPE 7.21.0
|
||||
CURLFILETYPE_SOCKET 7.21.0
|
||||
CURLFILETYPE_SYMLINK 7.21.0
|
||||
CURLFILETYPE_UNKNOWN 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_FILENAME 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_FILETYPE 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_GID 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_HLINKCOUNT 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_PERM 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_SIZE 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_TIME 7.21.0
|
||||
CURLFINFOFLAG_KNOWN_UID 7.21.0
|
||||
CURLFORM_ARRAY 7.9.1
|
||||
CURLFORM_BUFFER 7.9.8
|
||||
CURLFORM_BUFFERLENGTH 7.9.8
|
||||
CURLFORM_BUFFERPTR 7.9.8
|
||||
CURLFORM_CONTENTHEADER 7.9.3
|
||||
CURLFORM_CONTENTSLENGTH 7.9.1
|
||||
CURLFORM_CONTENTTYPE 7.9.1
|
||||
CURLFORM_COPYCONTENTS 7.9.1
|
||||
CURLFORM_COPYNAME 7.9.1
|
||||
CURLFORM_END 7.9.1
|
||||
CURLFORM_FILE 7.9.1
|
||||
CURLFORM_FILECONTENT 7.9.1
|
||||
CURLFORM_FILENAME 7.9.6
|
||||
CURLFORM_NAMELENGTH 7.9.1
|
||||
CURLFORM_NOTHING 7.9.1
|
||||
CURLFORM_PTRCONTENTS 7.9.1
|
||||
CURLFORM_PTRNAME 7.9.1
|
||||
CURLFORM_STREAM 7.18.2
|
||||
CURLFTPAUTH_DEFAULT 7.12.2
|
||||
CURLFTPAUTH_DEFAULT 7.12.2
|
||||
CURLFTPAUTH_SSL 7.12.2
|
||||
CURLFTPAUTH_SSL 7.12.2
|
||||
CURLFTPAUTH_TLS 7.12.2
|
||||
CURLFTPAUTH_TLS 7.12.2
|
||||
CURLFTPMETHOD_DEFAULT 7.15.1
|
||||
CURLFTPMETHOD_MULTICWD 7.15.1
|
||||
CURLFTPMETHOD_NOCWD 7.15.1
|
||||
CURLFTPMETHOD_SINGLECWD 7.15.1
|
||||
@@ -141,7 +196,9 @@ CURLINFO_CONTENT_TYPE 7.9.4
|
||||
CURLINFO_COOKIELIST 7.14.1
|
||||
CURLINFO_DATA_IN 7.9.6
|
||||
CURLINFO_DATA_OUT 7.9.6
|
||||
CURLINFO_DOUBLE 7.4.1
|
||||
CURLINFO_EFFECTIVE_URL 7.3
|
||||
CURLINFO_END 7.4.1
|
||||
CURLINFO_FILETIME 7.5
|
||||
CURLINFO_FTP_ENTRY_PATH 7.15.4
|
||||
CURLINFO_HEADER_IN 7.9.6
|
||||
@@ -150,10 +207,14 @@ CURLINFO_HEADER_SIZE 7.4.1
|
||||
CURLINFO_HTTPAUTH_AVAIL 7.10.8
|
||||
CURLINFO_HTTP_CODE 7.4.1 7.10.8
|
||||
CURLINFO_HTTP_CONNECTCODE 7.10.7
|
||||
CURLINFO_LASTONE 7.4.1
|
||||
CURLINFO_LASTSOCKET 7.15.2
|
||||
CURLINFO_LOCAL_IP 7.21.0
|
||||
CURLINFO_LOCAL_PORT 7.21.0
|
||||
CURLINFO_LONG 7.4.1
|
||||
CURLINFO_MASK 7.4.1
|
||||
CURLINFO_NAMELOOKUP_TIME 7.4.1
|
||||
CURLINFO_NONE 7.4.1
|
||||
CURLINFO_NUM_CONNECTS 7.12.3
|
||||
CURLINFO_OS_ERRNO 7.12.2
|
||||
CURLINFO_PRETRANSFER_TIME 7.4.1
|
||||
@@ -167,23 +228,61 @@ CURLINFO_REDIRECT_TIME 7.9.7
|
||||
CURLINFO_REDIRECT_URL 7.18.2
|
||||
CURLINFO_REQUEST_SIZE 7.4.1
|
||||
CURLINFO_RESPONSE_CODE 7.10.8
|
||||
CURLINFO_RTSP_CLIENT_CSEQ 7.20.0
|
||||
CURLINFO_RTSP_CSEQ_RECV 7.20.0
|
||||
CURLINFO_RTSP_SERVER_CSEQ 7.20.0
|
||||
CURLINFO_RTSP_SESSION_ID 7.20.0
|
||||
CURLINFO_SIZE_DOWNLOAD 7.4.1
|
||||
CURLINFO_SIZE_UPLOAD 7.4.1
|
||||
CURLINFO_SLIST 7.12.3
|
||||
CURLINFO_SPEED_DOWNLOAD 7.4.1
|
||||
CURLINFO_SPEED_UPLOAD 7.4.1
|
||||
CURLINFO_SSL_DATA_IN 7.12.1
|
||||
CURLINFO_SSL_DATA_OUT 7.12.1
|
||||
CURLINFO_SSL_ENGINES 7.12.3
|
||||
CURLINFO_SSL_VERIFYRESULT 7.5
|
||||
CURLINFO_STARTTRANSFER_TIME 7.9.2
|
||||
CURLINFO_STRING 7.4.1
|
||||
CURLINFO_TEXT 7.9.6
|
||||
CURLINFO_TOTAL_TIME 7.4.1
|
||||
CURLINFO_TYPEMASK 7.4.1
|
||||
CURLIOCMD_NOP 7.12.3
|
||||
CURLIOCMD_RESTARTREAD 7.12.3
|
||||
CURLIOE_FAILRESTART 7.12.3
|
||||
CURLIOE_OK 7.12.3
|
||||
CURLIOE_UNKNOWNCMD 7.12.3
|
||||
CURLKHMATCH_MISMATCH 7.19.6
|
||||
CURLKHMATCH_MISSING 7.19.6
|
||||
CURLKHMATCH_OK 7.19.6
|
||||
CURLKHSTAT_DEFER 7.19.6
|
||||
CURLKHSTAT_FINE 7.19.6
|
||||
CURLKHSTAT_FINE_ADD_TO_FILE 7.19.6
|
||||
CURLKHSTAT_REJECT 7.19.6
|
||||
CURLKHTYPE_DSS 7.19.6
|
||||
CURLKHTYPE_RSA 7.19.6
|
||||
CURLKHTYPE_RSA1 7.19.6
|
||||
CURLKHTYPE_UNKNOWN 7.19.6
|
||||
CURLMOPT_MAXCONNECTS 7.16.3
|
||||
CURLMOPT_PIPELINING 7.16.0
|
||||
CURLMOPT_SOCKETDATA 7.15.4
|
||||
CURLMOPT_SOCKETFUNCTION 7.15.4
|
||||
CURLMOPT_TIMERDATA 7.16.0
|
||||
CURLMOPT_TIMERFUNCTION 7.16.0
|
||||
CURLMSG_DONE 7.9.6
|
||||
CURLMSG_NONE 7.9.6
|
||||
CURLM_BAD_EASY_HANDLE 7.9.6
|
||||
CURLM_BAD_HANDLE 7.9.6
|
||||
CURLM_BAD_SOCKET 7.15.4
|
||||
CURLM_CALL_MULTI_PERFORM 7.9.6
|
||||
CURLM_CALL_MULTI_SOCKET 7.15.5
|
||||
CURLM_INTERNAL_ERROR 7.9.6
|
||||
CURLM_OK 7.9.6
|
||||
CURLM_OUT_OF_MEMORY 7.9.6
|
||||
CURLM_UNKNOWN_OPTION 7.15.4
|
||||
CURLOPTTYPE_FUNCTIONPOINT 7.1
|
||||
CURLOPTTYPE_LONG 7.1
|
||||
CURLOPTTYPE_OBJECTPOINT 7.1
|
||||
CURLOPTTYPE_OFF_T 7.11.0
|
||||
CURLOPT_ADDRESS_SCOPE 7.19.0
|
||||
CURLOPT_APPEND 7.16.4
|
||||
CURLOPT_AUTOREFERER 7.1
|
||||
@@ -268,7 +367,7 @@ CURLOPT_IOCTLDATA 7.12.3
|
||||
CURLOPT_IOCTLFUNCTION 7.12.3
|
||||
CURLOPT_IPRESOLVE 7.10.8
|
||||
CURLOPT_ISSUERCERT 7.19.0
|
||||
CURLOPT_KEYPASSWD - 7.17.0
|
||||
CURLOPT_KEYPASSWD 7.17.0
|
||||
CURLOPT_KRB4LEVEL 7.3 7.17.0
|
||||
CURLOPT_KRBLEVEL 7.17.0
|
||||
CURLOPT_LOCALPORT 7.15.2
|
||||
@@ -328,8 +427,10 @@ CURLOPT_READDATA 7.9.7
|
||||
CURLOPT_READFUNCTION 7.1
|
||||
CURLOPT_REDIR_PROTOCOLS 7.19.4
|
||||
CURLOPT_REFERER 7.1
|
||||
CURLOPT_RESOLVE 7.21.3
|
||||
CURLOPT_RESUME_FROM 7.1
|
||||
CURLOPT_RESUME_FROM_LARGE 7.11.0
|
||||
CURLOPT_RTSPHEADER 7.20.0
|
||||
CURLOPT_RTSP_CLIENT_CSEQ 7.20.0
|
||||
CURLOPT_RTSP_REQUEST 7.20.0
|
||||
CURLOPT_RTSP_SERVER_CSEQ 7.20.0
|
||||
@@ -338,6 +439,7 @@ CURLOPT_RTSP_STREAM_URI 7.20.0
|
||||
CURLOPT_RTSP_TRANSPORT 7.20.0
|
||||
CURLOPT_SEEKDATA 7.18.1
|
||||
CURLOPT_SEEKFUNCTION 7.18.1
|
||||
CURLOPT_SERVER_RESPONSE_TIMEOUT 7.20.0
|
||||
CURLOPT_SHARE 7.10
|
||||
CURLOPT_SOCKOPTDATA 7.16.0
|
||||
CURLOPT_SOCKOPTFUNCTION 7.16.0
|
||||
@@ -353,6 +455,9 @@ CURLOPT_SOURCE_URL 7.13.0 - 7.15.4
|
||||
CURLOPT_SOURCE_USERPWD 7.12.1 - 7.15.4
|
||||
CURLOPT_SSH_AUTH_TYPES 7.16.1
|
||||
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 7.17.1
|
||||
CURLOPT_SSH_KEYDATA 7.19.6
|
||||
CURLOPT_SSH_KEYFUNCTION 7.19.6
|
||||
CURLOPT_SSH_KNOWNHOSTS 7.19.6
|
||||
CURLOPT_SSH_PRIVATE_KEYFILE 7.16.1
|
||||
CURLOPT_SSH_PUBLIC_KEYFILE 7.16.1
|
||||
CURLOPT_SSLCERT 7.1
|
||||
@@ -374,7 +479,7 @@ CURLOPT_SSL_VERIFYPEER 7.4.2
|
||||
CURLOPT_STDERR 7.1
|
||||
CURLOPT_TCP_NODELAY 7.11.2
|
||||
CURLOPT_TELNETOPTIONS 7.7
|
||||
CURLOPT_TFTPBLKSIZE 7.19.4
|
||||
CURLOPT_TFTP_BLKSIZE 7.19.4
|
||||
CURLOPT_TIMECONDITION 7.1
|
||||
CURLOPT_TIMEOUT 7.1
|
||||
CURLOPT_TIMEOUT_MS 7.16.2
|
||||
@@ -392,11 +497,19 @@ CURLOPT_WILDCARDMATCH 7.21.0
|
||||
CURLOPT_WRITEDATA 7.9.7
|
||||
CURLOPT_WRITEFUNCTION 7.1
|
||||
CURLOPT_WRITEHEADER 7.1
|
||||
CURLOPT_WRITEINFO 7.1
|
||||
CURLPAUSE_ALL 7.18.0
|
||||
CURLPAUSE_CONT 7.18.0
|
||||
CURLPAUSE_RECV 7.18.0
|
||||
CURLPAUSE_RECV_CONT 7.18.0
|
||||
CURLPAUSE_SEND 7.18.0
|
||||
CURLPAUSE_SEND_CONT 7.18.0
|
||||
CURLPROTO_ALL 7.19.4
|
||||
CURLPROTO_DICT 7.19.4
|
||||
CURLPROTO_FILE 7.19.4
|
||||
CURLPROTO_FTP 7.19.4
|
||||
CURLPROTO_FTPS 7.19.4
|
||||
CURLPROTO_GOPHER 7.21.2
|
||||
CURLPROTO_HTTP 7.19.4
|
||||
CURLPROTO_HTTPS 7.19.4
|
||||
CURLPROTO_IMAP 7.20.0
|
||||
@@ -424,6 +537,19 @@ CURLPROXY_SOCKS4 7.10
|
||||
CURLPROXY_SOCKS4A 7.18.0
|
||||
CURLPROXY_SOCKS5 7.10
|
||||
CURLPROXY_SOCKS5_HOSTNAME 7.18.0
|
||||
CURLSHE_BAD_OPTION 7.10.3
|
||||
CURLSHE_INVALID 7.10.3
|
||||
CURLSHE_IN_USE 7.10.3
|
||||
CURLSHE_NOMEM 7.10.3
|
||||
CURLSHE_OK 7.10.3
|
||||
CURLSHOPT_LOCKFUNC 7.10.3
|
||||
CURLSHOPT_NONE 7.10.3
|
||||
CURLSHOPT_SHARE 7.10.3
|
||||
CURLSHOPT_UNLOCKFUNC 7.10.3
|
||||
CURLSHOPT_UNSHARE 7.10.3
|
||||
CURLSHOPT_USERDATA 7.10.3
|
||||
CURLSOCKTYPE_IPCXN 7.15.6
|
||||
CURLSSH_AUTH_ANY 7.16.1
|
||||
CURLSSH_AUTH_DEFAULT 7.16.1
|
||||
CURLSSH_AUTH_HOST 7.16.1
|
||||
CURLSSH_AUTH_KEYBOARD 7.16.1
|
||||
@@ -439,6 +565,7 @@ CURLUSESSL_NONE 7.17.0
|
||||
CURLUSESSL_TRY 7.17.0
|
||||
CURLUSESSL_TRY 7.17.0
|
||||
CURLVERSION_FIRST 7.10
|
||||
CURLVERSION_FOURTH 7.16.1
|
||||
CURLVERSION_NOW 7.10
|
||||
CURLVERSION_SECOND 7.11.1
|
||||
CURLVERSION_THIRD 7.12.0
|
||||
@@ -447,21 +574,74 @@ CURL_CHUNK_BGN_FUNC_OK 7.21.0
|
||||
CURL_CHUNK_BGN_FUNC_SKIP 7.21.0
|
||||
CURL_CHUNK_END_FUNC_FAIL 7.21.0
|
||||
CURL_CHUNK_END_FUNC_OK 7.21.0
|
||||
CURL_CSELECT_ERR 7.16.3
|
||||
CURL_CSELECT_IN 7.16.3
|
||||
CURL_CSELECT_OUT 7.16.3
|
||||
CURL_ERROR_SIZE 7.1
|
||||
CURL_FNMATCHFUNC_FAIL 7.21.0
|
||||
CURL_FNMATCHFUNC_MATCH 7.21.0
|
||||
CURL_FNMATCHFUNC_NOMATCH 7.21.0
|
||||
CURL_FORMADD_DISABLED 7.12.1
|
||||
CURL_FORMADD_ILLEGAL_ARRAY 7.9.8
|
||||
CURL_FORMADD_INCOMPLETE 7.9.8
|
||||
CURL_FORMADD_MEMORY 7.9.8
|
||||
CURL_FORMADD_NULL 7.9.8
|
||||
CURL_FORMADD_OK 7.9.8
|
||||
CURL_FORMADD_OPTION_TWICE 7.9.8
|
||||
CURL_FORMADD_UNKNOWN_OPTION 7.9.8
|
||||
CURL_GLOBAL_ALL 7.8
|
||||
CURL_GLOBAL_DEFAULT 7.8
|
||||
CURL_GLOBAL_NOTHING 7.8
|
||||
CURL_GLOBAL_SSL 7.8
|
||||
CURL_GLOBAL_WIN32 7.8.1
|
||||
CURL_HTTP_VERSION_1_0 7.9.1
|
||||
CURL_HTTP_VERSION_1_1 7.9.1
|
||||
CURL_HTTP_VERSION_NONE 7.9.1
|
||||
CURL_IPRESOLVE_V4 7.10.8
|
||||
CURL_IPRESOLVE_V6 7.10.8
|
||||
CURL_IPRESOLVE_WHATEVER 7.10.8
|
||||
CURL_LOCK_ACCESS_NONE 7.10.3
|
||||
CURL_LOCK_ACCESS_SHARED 7.10.3
|
||||
CURL_LOCK_ACCESS_SINGLE 7.10.3
|
||||
CURL_LOCK_DATA_CONNECT 7.10.3
|
||||
CURL_LOCK_DATA_COOKIE 7.10.3
|
||||
CURL_LOCK_DATA_DNS 7.10.3
|
||||
CURL_LOCK_DATA_NONE 7.10.3
|
||||
CURL_LOCK_DATA_SHARE 7.10.4
|
||||
CURL_LOCK_DATA_SSL_SESSION 7.10.3
|
||||
CURL_MAX_HTTP_HEADER 7.19.7
|
||||
CURL_MAX_WRITE_SIZE 7.9.7
|
||||
CURL_NETRC_IGNORED 7.9.8
|
||||
CURL_NETRC_OPTIONAL 7.9.8
|
||||
CURL_NETRC_REQUIRED 7.9.8
|
||||
CURL_POLL_IN 7.14.0
|
||||
CURL_POLL_INOUT 7.14.0
|
||||
CURL_POLL_NONE 7.14.0
|
||||
CURL_POLL_OUT 7.14.0
|
||||
CURL_POLL_REMOVE 7.14.0
|
||||
CURL_READFUNC_ABORT 7.12.1
|
||||
CURL_READFUNC_PAUSE 7.18.0
|
||||
CURL_REDIR_GET_ALL 7.19.1
|
||||
CURL_REDIR_POST_301 7.19.1
|
||||
CURL_REDIR_POST_302 7.19.1
|
||||
CURL_REDIR_POST_ALL 7.19.1
|
||||
CURL_RTSPREQ_ANNOUNCE 7.20.0
|
||||
CURL_RTSPREQ_DESCRIBE 7.20.0
|
||||
CURL_RTSPREQ_GET_PARAMETER 7.20.0
|
||||
CURL_RTSPREQ_NONE 7.20.0
|
||||
CURL_RTSPREQ_OPTIONS 7.20.0
|
||||
CURL_RTSPREQ_PAUSE 7.20.0
|
||||
CURL_RTSPREQ_PLAY 7.20.0
|
||||
CURL_RTSPREQ_RECEIVE 7.20.0
|
||||
CURL_RTSPREQ_RECORD 7.20.0
|
||||
CURL_RTSPREQ_SETUP 7.20.0
|
||||
CURL_RTSPREQ_SET_PARAMETER 7.20.0
|
||||
CURL_RTSPREQ_TEARDOWN 7.20.0
|
||||
CURL_SEEKFUNC_CANTSEEK 7.19.5
|
||||
CURL_SEEKFUNC_FAIL 7.19.5
|
||||
CURL_SEEKFUNC_OK 7.19.5
|
||||
CURL_SOCKET_BAD 7.14.0
|
||||
CURL_SOCKET_TIMEOUT 7.14.0
|
||||
CURL_SSLVERSION_DEFAULT 7.9.2
|
||||
CURL_SSLVERSION_SSLv2 7.9.2
|
||||
CURL_SSLVERSION_SSLv3 7.9.2
|
||||
@@ -469,6 +649,7 @@ CURL_SSLVERSION_TLSv1 7.9.2
|
||||
CURL_TIMECOND_IFMODSINCE 7.9.7
|
||||
CURL_TIMECOND_IFUNMODSINCE 7.9.7
|
||||
CURL_TIMECOND_LASTMOD 7.9.7
|
||||
CURL_TIMECOND_NONE 7.9.7
|
||||
CURL_VERSION_ASYNCHDNS 7.10.7
|
||||
CURL_VERSION_CONV 7.15.4
|
||||
CURL_VERSION_CURLDEBUG 7.19.6
|
||||
@@ -483,3 +664,4 @@ CURL_VERSION_NTLM 7.10.6
|
||||
CURL_VERSION_SPNEGO 7.10.8
|
||||
CURL_VERSION_SSL 7.10
|
||||
CURL_VERSION_SSPI 7.13.2
|
||||
CURL_WRITEFUNC_PAUSE 7.18.0
|
||||
|
@@ -585,6 +585,9 @@ typedef enum {
|
||||
#define CURLAUTH_GSSNEGOTIATE (1<<2) /* GSS-Negotiate */
|
||||
#define CURLAUTH_NTLM (1<<3) /* NTLM */
|
||||
#define CURLAUTH_DIGEST_IE (1<<4) /* Digest with IE flavour */
|
||||
#define CURLAUTH_ONLY (1<<31) /* used together with a single other
|
||||
type to force no auth or just that
|
||||
single type */
|
||||
#define CURLAUTH_ANY (~CURLAUTH_DIGEST_IE) /* all fine types set */
|
||||
#define CURLAUTH_ANYSAFE (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE))
|
||||
|
||||
@@ -1436,6 +1439,9 @@ typedef enum {
|
||||
/* FNMATCH_FUNCTION user pointer */
|
||||
CINIT(FNMATCH_DATA, OBJECTPOINT, 202),
|
||||
|
||||
/* send linked-list of name:port:address sets */
|
||||
CINIT(RESOLVE, OBJECTPOINT, 203),
|
||||
|
||||
CURLOPT_LASTENTRY /* the last unused */
|
||||
} CURLoption;
|
||||
|
||||
|
@@ -30,13 +30,13 @@
|
||||
|
||||
/* This is the version number of the libcurl package from which this header
|
||||
file origins: */
|
||||
#define LIBCURL_VERSION "7.21.2-DEV"
|
||||
#define LIBCURL_VERSION "7.21.3-DEV"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBCURL_VERSION_MAJOR 7
|
||||
#define LIBCURL_VERSION_MINOR 21
|
||||
#define LIBCURL_VERSION_PATCH 2
|
||||
#define LIBCURL_VERSION_PATCH 3
|
||||
|
||||
/* This is the numeric version of the libcurl version number, meant for easier
|
||||
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will
|
||||
@@ -53,7 +53,7 @@
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBCURL_VERSION_NUM 0x071502
|
||||
#define LIBCURL_VERSION_NUM 0x071503
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@@ -9,3 +9,4 @@ Makefile.vc9.dist
|
||||
libcurl.plist.dist
|
||||
libcurl.vcproj
|
||||
vc6libcurl.dsp
|
||||
Makefile.vc10.dist
|
||||
|
@@ -5,9 +5,6 @@
|
||||
|
||||
!ifndef %watcom
|
||||
!error WATCOM environment variable not set!
|
||||
!else
|
||||
SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h
|
||||
SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386
|
||||
!endif
|
||||
|
||||
!ifdef %libname
|
||||
@@ -33,18 +30,30 @@ RC = wrc
|
||||
! endif
|
||||
!endif
|
||||
|
||||
!if $(__VERSION__) < 1250
|
||||
RM = del /q /f 2>NUL
|
||||
!else
|
||||
RM = rm -f
|
||||
!endif
|
||||
!ifdef __LINUX__
|
||||
DS = /
|
||||
CP = cp
|
||||
MD = mkdir -p
|
||||
RD = rmdir -p
|
||||
RM = rm -f
|
||||
!else
|
||||
DS = $(X)\$(X)
|
||||
CP = copy 2>NUL
|
||||
MD = mkdir
|
||||
RD = rmdir /q /s 2>NUL
|
||||
CP = copy
|
||||
!if $(__VERSION__) < 1250
|
||||
RM = del /q /f 2>NUL
|
||||
!else
|
||||
RM = rm -f
|
||||
!endif
|
||||
!endif
|
||||
|
||||
SYS_INCL = -I$(%watcom)$(DS)h$(DS)nt -I$(%watcom)$(DS)h
|
||||
SYS_LIBS = $(%watcom)$(DS)lib386$(DS)nt;$(%watcom)$(DS)lib386
|
||||
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -zc -s -fr=con -w2 -fpi -oilrtfm &
|
||||
-wcd=201 -bt=nt -d+ -dWIN32 -dCURL_WANTS_CA_BUNDLE_ENV &
|
||||
-dBUILDING_LIBCURL -dHAVE_SPNEGO=1 -I. -I..\include $(SYS_INCL)
|
||||
-dBUILDING_LIBCURL -dHAVE_SPNEGO=1 -I. -I..$(DS)include $(SYS_INCL)
|
||||
|
||||
!ifdef %debug
|
||||
DEBUG = -dDEBUG=1 -dDEBUGBUILD
|
||||
@@ -67,31 +76,31 @@ CFLAGS += -dUSE_WINDOWS_SSPI
|
||||
!ifdef %zlib_root
|
||||
ZLIB_ROOT = $(%zlib_root)
|
||||
!else
|
||||
ZLIB_ROOT = ..\..\zlib-1.2.5
|
||||
ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5
|
||||
!endif
|
||||
|
||||
!ifdef %libssh2_root
|
||||
LIBSSH2_ROOT = $(%libssh2_root)
|
||||
!else
|
||||
LIBSSH2_ROOT = ..\..\libssh2-1.2.7
|
||||
LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7
|
||||
!endif
|
||||
|
||||
!ifdef %librtmp_root
|
||||
LIBRTMP_ROOT = $(%librtmp_root)
|
||||
!else
|
||||
LIBRTMP_ROOT = ..\..\librtmp-2.3
|
||||
LIBRTMP_ROOT = ..$(DS)..$(DS)rtmpdump-2.3
|
||||
!endif
|
||||
|
||||
!ifdef %openssl_root
|
||||
OPENSSL_ROOT = $(%openssl_root)
|
||||
!else
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8o
|
||||
OPENSSL_ROOT = ..$(DS)..$(DS)openssl-0.9.8q
|
||||
!endif
|
||||
|
||||
!ifdef %ares_root
|
||||
ARES_ROOT = $(%ares_root)
|
||||
!else
|
||||
ARES_ROOT = ..\ares
|
||||
ARES_ROOT = ..$(DS)ares
|
||||
!endif
|
||||
|
||||
!ifdef %use_zlib
|
||||
@@ -103,11 +112,11 @@ CFLAGS += -dUSE_LIBRTMP -I$(LIBRTMP_ROOT)
|
||||
!endif
|
||||
|
||||
!ifdef %use_ssh2
|
||||
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I$(LIBSSH2_ROOT)\include -I$(LIBSSH2_ROOT)\win32
|
||||
CFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H -I$(LIBSSH2_ROOT)$(DS)include -I$(LIBSSH2_ROOT)$(DS)win32
|
||||
!endif
|
||||
|
||||
!ifdef %use_ssl
|
||||
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)\inc32
|
||||
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)$(DS)inc32
|
||||
!endif
|
||||
|
||||
!ifdef %use_ares
|
||||
@@ -115,12 +124,12 @@ CFLAGS += -dUSE_ARES -I$(ARES_ROOT)
|
||||
!endif
|
||||
|
||||
!ifdef %use_watt32
|
||||
CFLAGS += -dUSE_WATT32 -I$(%watt_root)\inc
|
||||
CFLAGS += -dUSE_WATT32 -I$(%watt_root)$(DS)inc
|
||||
!endif
|
||||
|
||||
OBJ_BASE = WC_Win32.obj
|
||||
LINK_ARG = $(OBJ_BASE)\dyn\wlink.arg
|
||||
LIB_ARG = $(OBJ_BASE)\stat\wlib.arg
|
||||
LINK_ARG = $(OBJ_BASE)$(DS)dyn$(DS)wlink.arg
|
||||
LIB_ARG = $(OBJ_BASE)$(DS)stat$(DS)wlib.arg
|
||||
|
||||
# In order to process Makefile.inc wmake must be called with -u switch!
|
||||
!ifndef %MAKEFLAGS
|
||||
@@ -130,19 +139,24 @@ LIB_ARG = $(OBJ_BASE)\stat\wlib.arg
|
||||
!endif
|
||||
|
||||
OBJS = $(CSOURCES:.c=.obj)
|
||||
!ifdef __LINUX__
|
||||
OBJS = $OBJ_DIR/$(OBJS: = $OBJ_DIR/)
|
||||
|
||||
!else
|
||||
OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
|
||||
!endif
|
||||
|
||||
#
|
||||
# Use $(OBJS) as a template to generate $(OBJS_STAT) and $(OBJS_DYN).
|
||||
#
|
||||
OBJ_DIR = $(OBJ_BASE)\stat
|
||||
OBJ_DIR = $(OBJ_BASE)$(DS)stat
|
||||
OBJS_STAT = $+ $(OBJS) $-
|
||||
|
||||
OBJ_DIR = $(OBJ_BASE)\dyn
|
||||
OBJ_DIR = $(OBJ_BASE)$(DS)dyn
|
||||
OBJS_DYN = $+ $(OBJS) $-
|
||||
|
||||
CURLBUILDH = ..\include\curl\curlbuild.h
|
||||
RESOURCE = $(OBJ_BASE)\dyn\libcurl.res
|
||||
CURLBUILDH = ..$(DS)include$(DS)curl$(DS)curlbuild.h
|
||||
RESOURCE = $(OBJ_BASE)$(DS)dyn$(DS)libcurl.res
|
||||
|
||||
all: $(CURLBUILDH) $(OBJ_BASE) $(TARGETS) .SYMBOLIC
|
||||
@echo Welcome to libcurl
|
||||
@@ -154,14 +168,14 @@ clean: .SYMBOLIC
|
||||
|
||||
vclean distclean: clean .SYMBOLIC
|
||||
-$(RM) $(TARGETS) $(LIBNAME).map $(LIBNAME).sym
|
||||
-$(RD) $(OBJ_BASE)\stat
|
||||
-$(RD) $(OBJ_BASE)\dyn
|
||||
-$(RD) $(OBJ_BASE)$(DS)stat
|
||||
-$(RD) $(OBJ_BASE)$(DS)dyn
|
||||
-$(RD) $(OBJ_BASE)
|
||||
|
||||
$(OBJ_BASE):
|
||||
-$(MD) $^@
|
||||
-$(MD) $^@\stat
|
||||
-$(MD) $^@\dyn
|
||||
-$(MD) $^@$(DS)stat
|
||||
-$(MD) $^@$(DS)dyn
|
||||
|
||||
$(CURLBUILDH): .EXISTSONLY
|
||||
$(CP) $^@.dist $^@
|
||||
@@ -174,14 +188,14 @@ $(LIBNAME).lib: $(OBJS_STAT) $(LIB_ARG)
|
||||
|
||||
.ERASE
|
||||
$(RESOURCE): libcurl.rc
|
||||
$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
|
||||
$(RC) $(DEBUG) -q -r -zm -bt=nt -I..$(DS)include $(SYS_INCL) $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\dyn}.obj:
|
||||
.c{$(OBJ_BASE)$(DS)dyn}.obj:
|
||||
$(CC) $(CFLAGS) -bd -br $[@ -fo=$^@
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_BASE)\stat}.obj:
|
||||
.c{$(OBJ_BASE)$(DS)stat}.obj:
|
||||
$(CC) $(CFLAGS) -DCURL_STATICLIB $[@ -fo=$^@
|
||||
|
||||
$(LINK_ARG): $(__MAKEFILES__)
|
||||
@@ -196,24 +210,24 @@ $(LINK_ARG): $(__MAKEFILES__)
|
||||
@%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS)
|
||||
@%append $^@ library wldap32.lib
|
||||
!ifdef %use_watt32
|
||||
@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
|
||||
@%append $^@ library $(%watt_root)$(DS)lib$(DS)wattcpw_imp.lib
|
||||
!else
|
||||
@%append $^@ library ws2_32.lib
|
||||
!endif
|
||||
!ifdef %use_zlib
|
||||
@%append $^@ library $(ZLIB_ROOT)\zlib.lib
|
||||
@%append $^@ library $(ZLIB_ROOT)$(DS)zlib.lib
|
||||
!endif
|
||||
!ifdef %use_rtmp
|
||||
@%append $^@ library $(LIBRTMP_ROOT)\librtmp\librtmp.lib
|
||||
@%append $^@ library $(LIBRTMP_ROOT)$(DS)librtmp$(DS)librtmp.lib
|
||||
!endif
|
||||
!ifdef %use_ssh2
|
||||
@%append $^@ library $(LIBSSH2_ROOT)\win32\libssh2.lib
|
||||
@%append $^@ library $(LIBSSH2_ROOT)$(DS)win32$(DS)libssh2.lib
|
||||
!endif
|
||||
!ifdef %use_ssl
|
||||
@%append $^@ library $(OPENSSL_ROOT)\out32\libeay32.lib, $(OPENSSL_ROOT)\out32\ssleay32.lib
|
||||
@%append $^@ library $(OPENSSL_ROOT)$(DS)out32$(DS)libeay32.lib, $(OPENSSL_ROOT)$(DS)out32$(DS)ssleay32.lib
|
||||
!endif
|
||||
!ifdef %use_ares
|
||||
@%append $^@ library $(ARES_ROOT)\cares.lib
|
||||
@%append $^@ library $(ARES_ROOT)$(DS)cares.lib
|
||||
!endif
|
||||
|
||||
$(LIB_ARG): $(__MAKEFILES__)
|
||||
|
@@ -30,15 +30,15 @@ DOCS = README.encoding README.memoryleak README.ares README.curlx \
|
||||
|
||||
CMAKE_DIST = CMakeLists.txt curl_config.h.cmake
|
||||
|
||||
EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 Makefile.riscos $(DSP) \
|
||||
EXTRA_DIST = Makefile.b32 Makefile.m32 Makefile.vc6 $(DSP) \
|
||||
vc6libcurl.dsw config-win32.h config-win32ce.h config-riscos.h \
|
||||
config-mac.h curl_config.h.in makefile.dj config.dos libcurl.plist \
|
||||
config-mac.h curl_config.h.in makefile.dj config-dos.h libcurl.plist \
|
||||
libcurl.rc config-amigaos.h amigaos.c amigaos.h makefile.amiga \
|
||||
Makefile.netware nwlib.c nwos.c libcurl.imp msvcproj.head msvcproj.foot \
|
||||
config-win32ce.h config-os400.h setup-os400.h config-symbian.h \
|
||||
Makefile.Watcom config-tpf.h $(DOCS) $(VCPROJ) mk-ca-bundle.pl \
|
||||
mk-ca-bundle.vbs firefox-db2pem.sh $(CMAKE_DIST) config-vxworks.h \
|
||||
Makefile.vxworks
|
||||
Makefile.vxworks config-vms.h
|
||||
|
||||
CLEANFILES = $(DSP) $(VCPROJ)
|
||||
|
||||
|
@@ -20,7 +20,7 @@ ZLIB_PATH = ../../zlib-1.2.5
|
||||
endif
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8o
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
endif
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
|
@@ -19,7 +19,7 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8o
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
@@ -424,6 +424,7 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@
|
||||
@echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@@ -459,6 +460,7 @@ else
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@
|
||||
@echo $(DL)#define _LARGEFILE 1$(DL) >> $@
|
||||
ifdef ENABLE_IPV6
|
||||
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
|
||||
|
@@ -1,232 +0,0 @@
|
||||
# Makefile for project libcurl
|
||||
|
||||
# Project objects:
|
||||
objs = o.base64 o.connect o.cookie o.dict \
|
||||
o.dllinit o.easy o.escape o.file \
|
||||
o.formdata o.ftp o.getenv o.gopher \
|
||||
o.getinfo o.getpass o.hostip \
|
||||
o.hostip4 o.hostsyn o.http \
|
||||
o.http_chunks o.inet_ntop o.inet_pton o.if2ip o.krb4 o.ldap \
|
||||
o.curl_fnmatch o.fileinfo o.ftplistparser o.wildcard \
|
||||
o.memdebug o.mprintf o.netrc o.parsedate o.progress \
|
||||
o.security o.select o.sendf o.speedcheck o.ssluse \
|
||||
o.strequal o.strtok o.telnet o.timeval \
|
||||
o.transfer o.url o.version o.strtoofft o.sslgen o.gtls \
|
||||
o.rawstr o.curl_addrinfo o.slist o.nonblock o.curl_rand \
|
||||
o.curl_memrchr o.imap o.pop3 o.smtp o.pingpong o.rtsp \
|
||||
o.curl_threads o.warnless o.hmac o.md5 o.curl_rtmp \
|
||||
o.openldap o.polarssl o.md4 o.curl_gethostname
|
||||
|
||||
|
||||
# Compile options:
|
||||
linkopts = -o libcurl
|
||||
compileropts = -mpoke-function-name -IUtilLib: -mthrowback
|
||||
|
||||
# Project target:
|
||||
libcurl: $(objs)
|
||||
makealf $(linkopts) $(objs)
|
||||
|
||||
# Static dependancies:
|
||||
o.base64: c.base64
|
||||
gcc $(compileropts) -c -o base64.o c.base64
|
||||
|
||||
o.connect: c.connect
|
||||
gcc $(compileropts) -c -o connect.o c.connect
|
||||
|
||||
o.cookie: c.cookie
|
||||
gcc $(compileropts) -c -o cookie.o c.cookie
|
||||
|
||||
o.curl_addrinfo: c.curl_addrinfo
|
||||
gcc $(compileropts) -c -o curl_addrinfo.o c.curl_addrinfo
|
||||
|
||||
o.curl_gethostname: c.curl_gethostname
|
||||
gcc $(compileropts) -c -o curl_gethostname.o c.curl_gethostname
|
||||
|
||||
o.curl_memrchr: c.curl_memrchr
|
||||
gcc $(compileropts) -c -o curl_memrchr.o c.curl_memrchr
|
||||
|
||||
o.curl_rand: c.curl_rand
|
||||
gcc $(compileropts) -c -o curl_rand.o c.curl_rand
|
||||
|
||||
o.curl_rtmp: c.curl_rtmp
|
||||
gcc $(compileropts) -c -o curl_rtmp.o c.curl_rtmp
|
||||
|
||||
o.curl_threads: c.curl_threads
|
||||
gcc $(compileropts) -c -o curl_threads.o c.curl_threads
|
||||
|
||||
o.dict: c.dict
|
||||
gcc $(compileropts) -c -o dict.o c.dict
|
||||
|
||||
o.dllinit: c.dllinit
|
||||
gcc $(compileropts) -c -o dllinit.o c.dllinit
|
||||
|
||||
o.easy: c.easy
|
||||
gcc $(compileropts) -c -o easy.o c.easy
|
||||
|
||||
o.escape: c.escape
|
||||
gcc $(compileropts) -c -o escape.o c.escape
|
||||
|
||||
o.file: c.file
|
||||
gcc $(compileropts) -c -o file.o c.file
|
||||
|
||||
o.formdata: c.formdata
|
||||
gcc $(compileropts) -c -o formdata.o c.formdata
|
||||
|
||||
o.ftp: c.ftp
|
||||
gcc $(compileropts) -c -o ftp.o c.ftp
|
||||
|
||||
o.getenv: c.getenv
|
||||
gcc $(compileropts) -c -o getenv.o c.getenv
|
||||
|
||||
o.getinfo: c.getinfo
|
||||
gcc $(compileropts) -c -o getinfo.o c.getinfo
|
||||
|
||||
o.getpass: c.getpass
|
||||
gcc $(compileropts) -c -o getpass.o c.getpass
|
||||
|
||||
o.gopher: c.gopher
|
||||
gcc $(compileropts) -c -o gopher.o c.gopher
|
||||
|
||||
o.hmac: c.hmac
|
||||
gcc $(compileropts) -c -o hmac.o c.hmac
|
||||
|
||||
o.hostip: c.hostip
|
||||
gcc $(compileropts) -c -o hostip.o c.hostip
|
||||
|
||||
o.hostip4: c.hostip4
|
||||
gcc $(compileropts) -c -o hostip4.o c.hostip4
|
||||
|
||||
o.hostsyn: c.hostsyn
|
||||
gcc $(compileropts) -c -o hostsyn.o c.hostsyn
|
||||
|
||||
o.http: c.http
|
||||
gcc $(compileropts) -c -o http.o c.http
|
||||
|
||||
o.http_chunks: c.http_chunks
|
||||
gcc $(compileropts) -c -o http_chunks.o c.http_chunks
|
||||
|
||||
o.if2ip: c.if2ip
|
||||
gcc $(compileropts) -c -o if2ip.o c.if2ip
|
||||
|
||||
o.imap: c.imap
|
||||
gcc $(compileropts) -c -o imap.o c.imap
|
||||
|
||||
o.inet_ntop: c.inet_ntop
|
||||
gcc $(compileropts) -c -o inet_ntop.o c.inet_ntop
|
||||
|
||||
o.inet_pton: c.inet_pton
|
||||
gcc $(compileropts) -c -o inet_pton.o c.inet_pton
|
||||
|
||||
o.krb4: c.krb4
|
||||
gcc $(compileropts) -c -o krb4.o c.krb4
|
||||
|
||||
o.ldap: c.ldap
|
||||
gcc $(compileropts) -IOpenLDAP: -c -o ldap.o c.ldap
|
||||
|
||||
o.md4: c.md4
|
||||
gcc $(compileropts) -c -o md4.o c.md4
|
||||
|
||||
o.md5: c.md5
|
||||
gcc $(compileropts) -c -o md5.o c.md5
|
||||
|
||||
o.memdebug: c.memdebug
|
||||
gcc $(compileropts) -c -o memdebug.o c.memdebug
|
||||
|
||||
o.mprintf: c.mprintf
|
||||
gcc $(compileropts) -c -o mprintf.o c.mprintf
|
||||
|
||||
o.netrc: c.netrc
|
||||
gcc $(compileropts) -c -o netrc.o c.netrc
|
||||
|
||||
o.openldap: c.openldap
|
||||
gcc $(compileropts) -c -o openldap.o c.openldap
|
||||
|
||||
o.parsedate: c.parsedate
|
||||
gcc $(compileropts) -c -o parsedate.o c.parsedate
|
||||
|
||||
o.pingpong: c.pingpong
|
||||
gcc $(compileropts) -c -o pingpong.o c.pingpong
|
||||
|
||||
o.polarssl: c.polarssl
|
||||
gcc $(compileropts) -c -o polarssl.o c.polarssl
|
||||
|
||||
o.pop3: c.pop3
|
||||
gcc $(compileropts) -c -o pop3.o c.pop3
|
||||
|
||||
o.progress: c.progress
|
||||
gcc $(compileropts) -c -o progress.o c.progress
|
||||
|
||||
o.rtsp: c.rtsp
|
||||
gcc $(compileropts) -c -o rtsp.o c.rtsp
|
||||
|
||||
o.security: c.security
|
||||
gcc $(compileropts) -c -o security.o c.security
|
||||
|
||||
o.select: c.select
|
||||
gcc $(compileropts) -c -o select.o c.select
|
||||
|
||||
o.sendf: c.sendf
|
||||
gcc $(compileropts) -c -o sendf.o c.sendf
|
||||
|
||||
o.slist: c.slist
|
||||
gcc $(compileropts) -c -o slist.o c.slist
|
||||
|
||||
o.smtp: c.smtp
|
||||
gcc $(compileropts) -c -o smtp.o c.smtp
|
||||
|
||||
o.speedcheck: c.speedcheck
|
||||
gcc $(compileropts) -c -o speedcheck.o c.speedcheck
|
||||
|
||||
o.gtls: c.gtls
|
||||
gcc $(compileropts) -c -o gtls.o c.gtls
|
||||
|
||||
o.sslgen: c.sslgen
|
||||
gcc $(compileropts) -c -o sslgen.o c.sslgen
|
||||
|
||||
o.ssluse: c.ssluse
|
||||
gcc $(compileropts) -c -o ssluse.o c.ssluse
|
||||
|
||||
o.nonblock: c.nonblock
|
||||
gcc $(compileropts) -c -o nonblock.o c.nonblock
|
||||
|
||||
o.rawstr: c.rawstr
|
||||
gcc $(compileropts) -c -o rawstr.o c.rawstr
|
||||
|
||||
o.strequal: c.strequal
|
||||
gcc $(compileropts) -c -o strequal.o c.strequal
|
||||
|
||||
o.strtok: c.strtok
|
||||
gcc $(compileropts) -c -o strtok.o c.strtok
|
||||
|
||||
o.strtoofft: c.strtoofft
|
||||
gcc $(compileropts) -c -o strtoofft.o c.strtoofft
|
||||
|
||||
o.telnet: c.telnet
|
||||
gcc $(compileropts) -c -o telnet.o c.telnet
|
||||
|
||||
o.timeval: c.timeval
|
||||
gcc $(compileropts) -c -o timeval.o c.timeval
|
||||
|
||||
o.transfer: c.transfer
|
||||
gcc $(compileropts) -c -o transfer.o c.transfer
|
||||
|
||||
o.url: c.url
|
||||
gcc $(compileropts) -c -o url.o c.url
|
||||
|
||||
o.version: c.version
|
||||
gcc $(compileropts) -c -o version.o c.version
|
||||
|
||||
o.warnless: c.warnless
|
||||
gcc $(compileropts) -c -o warnless.o c.warnless
|
||||
|
||||
o.curl_fnmatch: c.curl_fnmatch
|
||||
gcc $(compileropts) -c -o curl_fnmatch.o c.curl_fnmatch
|
||||
|
||||
o.fileinfo: c.fileinfo
|
||||
gcc $(compileropts) -c -o fileinfo.o c.fileinfo
|
||||
|
||||
o.ftplistparser: c.ftplistparser
|
||||
gcc $(compileropts) -c -o ftplistparser.o c.ftplistparser
|
||||
|
||||
o.wildcard: c.wildcard
|
||||
gcc $(compileropts) -c -o wildcard.o c.wildcard
|
@@ -86,6 +86,7 @@
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
#define USE_OPENSSL 1
|
||||
#define USE_SSLEAY 1
|
||||
|
@@ -3,7 +3,7 @@
|
||||
|
||||
|
||||
/* ================================================================ */
|
||||
/* lib/config.dos - Hand crafted config file for DOS */
|
||||
/* lib/config-dos.h - Hand crafted config file for DOS */
|
||||
/* ================================================================ */
|
||||
|
||||
#if defined(DJGPP)
|
||||
@@ -67,6 +67,7 @@
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_LONG_DOUBLE 16
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_SIZE_T 4
|
||||
#define STDC_HEADERS 1
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
|
@@ -61,6 +61,7 @@
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
#define HAVE_GETNAMEINFO 1
|
||||
#define GETNAMEINFO_QUAL_ARG1 const
|
||||
|
@@ -364,6 +364,9 @@
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 8
|
||||
|
||||
/* Whether long long constants must be suffixed by LL. */
|
||||
|
||||
#define HAVE_LL
|
||||
|
@@ -350,6 +350,9 @@
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
|
@@ -41,6 +41,9 @@
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#define SIZEOF_SIZE_T 4
|
||||
|
||||
/* Define if you have the alarm function. */
|
||||
#define HAVE_ALARM 1
|
||||
|
@@ -345,6 +345,13 @@
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#if defined(_WIN64)
|
||||
# define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
# define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
@@ -322,6 +322,13 @@
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#define SIZEOF_SHORT 2
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#if defined(_WIN64)
|
||||
# define SIZEOF_SIZE_T 8
|
||||
#else
|
||||
# define SIZEOF_SIZE_T 4
|
||||
#endif
|
||||
|
||||
/* ---------------------------------------------------------------- */
|
||||
/* STRUCT RELATED */
|
||||
/* ---------------------------------------------------------------- */
|
||||
|
176
lib/connect.c
176
lib/connect.c
@@ -310,20 +310,20 @@ static CURLcode bindlocal(struct connectdata *conn,
|
||||
* of the connection. The resolve functions should really be changed
|
||||
* to take a type parameter instead.
|
||||
*/
|
||||
long ipver = data->set.ip_version;
|
||||
long ipver = conn->ip_version;
|
||||
int rc;
|
||||
|
||||
if (af == AF_INET)
|
||||
data->set.ip_version = CURL_IPRESOLVE_V4;
|
||||
conn->ip_version = CURL_IPRESOLVE_V4;
|
||||
#ifdef ENABLE_IPV6
|
||||
else if (af == AF_INET6)
|
||||
data->set.ip_version = CURL_IPRESOLVE_V6;
|
||||
conn->ip_version = CURL_IPRESOLVE_V6;
|
||||
#endif
|
||||
|
||||
rc = Curl_resolv(conn, dev, 0, &h);
|
||||
if(rc == CURLRESOLV_PENDING)
|
||||
(void)Curl_wait_for_resolv(conn, &h);
|
||||
data->set.ip_version = ipver;
|
||||
conn->ip_version = ipver;
|
||||
|
||||
if(h) {
|
||||
/* convert the resolved address, sizeof myhost >= INET_ADDRSTRLEN */
|
||||
@@ -532,6 +532,16 @@ static CURLcode trynextip(struct connectdata *conn,
|
||||
return CURLE_COULDNT_CONNECT;
|
||||
}
|
||||
|
||||
/* Copies connection info into the session handle to make it available
|
||||
when the session handle is no longer associated with a connection. */
|
||||
void Curl_persistconninfo(struct connectdata *conn)
|
||||
{
|
||||
memcpy(conn->data->info.conn_primary_ip, conn->primary_ip, MAX_IPADR_LEN);
|
||||
memcpy(conn->data->info.conn_local_ip, conn->local_ip, MAX_IPADR_LEN);
|
||||
conn->data->info.conn_primary_port = conn->primary_port;
|
||||
conn->data->info.conn_local_port = conn->local_port;
|
||||
}
|
||||
|
||||
/* retrieves ip address and port from a sockaddr structure */
|
||||
static bool getaddressinfo(struct sockaddr* sa, char* addr,
|
||||
long* port)
|
||||
@@ -541,31 +551,46 @@ static bool getaddressinfo(struct sockaddr* sa, char* addr,
|
||||
#ifdef ENABLE_IPV6
|
||||
struct sockaddr_in6* si6 = NULL;
|
||||
#endif
|
||||
#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
|
||||
struct sockaddr_un* su = NULL;
|
||||
#endif
|
||||
|
||||
switch (sa->sa_family) {
|
||||
case AF_INET:
|
||||
si = (struct sockaddr_in*) sa;
|
||||
if(Curl_inet_ntop(sa->sa_family, &si->sin_addr,
|
||||
addr, MAX_IPADR_LEN) == NULL)
|
||||
return FALSE;
|
||||
us_port = ntohs(si->sin_port);
|
||||
*port = us_port;
|
||||
addr, MAX_IPADR_LEN)) {
|
||||
us_port = ntohs(si->sin_port);
|
||||
*port = us_port;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
#ifdef ENABLE_IPV6
|
||||
case AF_INET6:
|
||||
si6 = (struct sockaddr_in6*)sa;
|
||||
if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr,
|
||||
addr, MAX_IPADR_LEN) == NULL)
|
||||
return FALSE;
|
||||
us_port = ntohs(si6->sin6_port);
|
||||
*port = us_port;
|
||||
addr, MAX_IPADR_LEN)) {
|
||||
us_port = ntohs(si6->sin6_port);
|
||||
*port = us_port;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
addr[0] = '\0';
|
||||
#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
|
||||
case AF_UNIX:
|
||||
su = (struct sockaddr_un*)sa;
|
||||
snprintf(addr, MAX_IPADR_LEN, "%s", su->sun_path);
|
||||
*port = 0;
|
||||
return TRUE;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
addr[0] = '\0';
|
||||
*port = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* retrieves the start/end point information of a socket of an established
|
||||
@@ -577,43 +602,45 @@ void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd)
|
||||
struct Curl_sockaddr_storage ssrem;
|
||||
struct Curl_sockaddr_storage ssloc;
|
||||
struct SessionHandle *data = conn->data;
|
||||
struct PureInfo *info = &conn->data->info;
|
||||
|
||||
if(conn->bits.reuse)
|
||||
/* reusing same connection */
|
||||
return;
|
||||
if(!conn->bits.reuse) {
|
||||
|
||||
len = sizeof(struct Curl_sockaddr_storage);
|
||||
if(getpeername(sockfd, (struct sockaddr*) &ssrem, &len)) {
|
||||
error = SOCKERRNO;
|
||||
failf(data, "getpeername() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
len = sizeof(struct Curl_sockaddr_storage);
|
||||
if(getsockname(sockfd, (struct sockaddr*) &ssloc, &len)) {
|
||||
error = SOCKERRNO;
|
||||
failf(data, "getsockname() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!getaddressinfo((struct sockaddr*)&ssrem,
|
||||
conn->primary_ip, &conn->primary_port)) {
|
||||
error = ERRNO;
|
||||
failf(data, "ssrem inet_ntop() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!getaddressinfo((struct sockaddr*)&ssloc,
|
||||
conn->local_ip, &conn->local_port)) {
|
||||
error = ERRNO;
|
||||
failf(data, "ssloc inet_ntop() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
len = sizeof(struct Curl_sockaddr_storage);
|
||||
if(getpeername(sockfd, (struct sockaddr*) &ssrem, &len)) {
|
||||
error = SOCKERRNO;
|
||||
failf(data, "getpeername() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
len = sizeof(struct Curl_sockaddr_storage);
|
||||
if(getsockname(sockfd, (struct sockaddr*) &ssloc, &len)) {
|
||||
error = SOCKERRNO;
|
||||
failf(data, "getsockname() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!getaddressinfo((struct sockaddr*)&ssrem,
|
||||
info->ip, &info->port)) {
|
||||
error = ERRNO;
|
||||
failf(data, "ssrem inet_ntop() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
|
||||
if(!getaddressinfo((struct sockaddr*)&ssloc,
|
||||
info->localip, &info->localport)) {
|
||||
error = ERRNO;
|
||||
failf(data, "ssloc inet_ntop() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
return;
|
||||
}
|
||||
/* persist connection info in session handle */
|
||||
Curl_persistconninfo(conn);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -795,16 +822,13 @@ singleipconnect(struct connectdata *conn,
|
||||
bool *connected)
|
||||
{
|
||||
struct Curl_sockaddr_ex addr;
|
||||
char addr_buf[128];
|
||||
int rc;
|
||||
int error;
|
||||
bool isconnected;
|
||||
struct SessionHandle *data = conn->data;
|
||||
curl_socket_t sockfd;
|
||||
CURLcode res = CURLE_OK;
|
||||
const void *iptoprint;
|
||||
struct sockaddr_in * const sa4 = (void *)&addr.sa_addr;
|
||||
#ifdef ENABLE_IPV6
|
||||
#if defined(ENABLE_IPV6) && defined(HAVE_SOCKADDR_IN6_SIN6_SCOPE_ID)
|
||||
struct sockaddr_in6 * const sa6 = (void *)&addr.sa_addr;
|
||||
#endif
|
||||
|
||||
@@ -855,37 +879,25 @@ singleipconnect(struct connectdata *conn,
|
||||
sa6->sin6_scope_id = conn->scope;
|
||||
#endif
|
||||
|
||||
/* FIXME: do we have Curl_printable_address-like with struct sockaddr* as
|
||||
argument? */
|
||||
#if defined(HAVE_SYS_UN_H) && defined(AF_UNIX)
|
||||
if(addr.family == AF_UNIX) {
|
||||
infof(data, " Trying %s... ",
|
||||
((const struct sockaddr_un*)(&addr.sa_addr))->sun_path);
|
||||
snprintf(data->info.ip, MAX_IPADR_LEN, "%s",
|
||||
((const struct sockaddr_un*)(&addr.sa_addr))->sun_path);
|
||||
strcpy(conn->ip_addr_str, data->info.ip);
|
||||
/* store remote address and port used in this connection attempt */
|
||||
if(!getaddressinfo((struct sockaddr*)&addr.sa_addr,
|
||||
conn->primary_ip, &conn->primary_port)) {
|
||||
/* malformed address or bug in inet_ntop, try next address */
|
||||
error = ERRNO;
|
||||
failf(data, "sa_addr inet_ntop() failed with errno %d: %s",
|
||||
error, Curl_strerror(conn, error));
|
||||
sclose(sockfd);
|
||||
return CURLE_OK;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
#ifdef ENABLE_IPV6
|
||||
if(addr.family == AF_INET6) {
|
||||
iptoprint = &sa6->sin6_addr;
|
||||
conn->bits.ipv6 = TRUE;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
iptoprint = &sa4->sin_addr;
|
||||
}
|
||||
memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN);
|
||||
infof(data, " Trying %s... ", conn->ip_addr_str);
|
||||
|
||||
if(Curl_inet_ntop(addr.family, iptoprint, addr_buf,
|
||||
sizeof(addr_buf)) != NULL) {
|
||||
infof(data, " Trying %s... ", addr_buf);
|
||||
snprintf(data->info.ip, MAX_IPADR_LEN, "%s", addr_buf);
|
||||
strcpy(conn->ip_addr_str, data->info.ip);
|
||||
}
|
||||
}
|
||||
Curl_persistconninfo(conn);
|
||||
|
||||
#ifdef ENABLE_IPV6
|
||||
if(addr.family == AF_INET6)
|
||||
conn->bits.ipv6 = TRUE;
|
||||
#endif
|
||||
|
||||
if(data->set.tcp_nodelay)
|
||||
tcpnodelay(conn, sockfd);
|
||||
@@ -945,7 +957,7 @@ singleipconnect(struct connectdata *conn,
|
||||
default:
|
||||
/* unknown error, fallthrough and try another address! */
|
||||
failf(data, "Failed to connect to %s: %s",
|
||||
addr_buf, Curl_strerror(conn,error));
|
||||
conn->ip_addr_str, Curl_strerror(conn,error));
|
||||
data->state.os_errno = error;
|
||||
break;
|
||||
}
|
||||
|
@@ -69,4 +69,6 @@ void Curl_sndbufset(curl_socket_t sockfd);
|
||||
|
||||
void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd);
|
||||
|
||||
void Curl_persistconninfo(struct connectdata *conn);
|
||||
|
||||
#endif
|
||||
|
@@ -353,8 +353,8 @@ Curl_cookie_add(struct SessionHandle *data,
|
||||
break;
|
||||
}
|
||||
co->expires =
|
||||
atoi((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0]) +
|
||||
(long)now;
|
||||
strtol((*co->maxage=='\"')?&co->maxage[1]:&co->maxage[0],NULL,10)
|
||||
+ (long)now;
|
||||
}
|
||||
else if(Curl_raw_equal("expires", name)) {
|
||||
strstore(&co->expirestr, whatptr);
|
||||
|
@@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#include "curl_addrinfo.h"
|
||||
#include "inet_pton.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -117,12 +118,12 @@ Curl_getaddrinfo_ex(const char *nodename,
|
||||
const struct addrinfo *hints,
|
||||
Curl_addrinfo **result)
|
||||
{
|
||||
const struct addrinfo *ainext;
|
||||
const struct addrinfo *ai;
|
||||
struct addrinfo *aihead;
|
||||
Curl_addrinfo *cafirst = NULL;
|
||||
Curl_addrinfo *calast = NULL;
|
||||
Curl_addrinfo *ca;
|
||||
size_t ss_size;
|
||||
int error;
|
||||
|
||||
*result = NULL; /* assume failure */
|
||||
@@ -131,7 +132,28 @@ Curl_getaddrinfo_ex(const char *nodename,
|
||||
if(error)
|
||||
return error;
|
||||
|
||||
for(ai = aihead; ai != NULL; ai = ainext) {
|
||||
/* traverse the addrinfo list */
|
||||
|
||||
for(ai = aihead; ai != NULL; ai = ai->ai_next) {
|
||||
|
||||
/* ignore elements with unsupported address family, */
|
||||
/* settle family-specific sockaddr structure size. */
|
||||
if(ai->ai_family == AF_INET)
|
||||
ss_size = sizeof(struct sockaddr_in);
|
||||
#ifdef ENABLE_IPV6
|
||||
else if(ai->ai_family == AF_INET6)
|
||||
ss_size = sizeof(struct sockaddr_in6);
|
||||
#endif
|
||||
else
|
||||
continue;
|
||||
|
||||
/* ignore elements without required address info */
|
||||
if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0))
|
||||
continue;
|
||||
|
||||
/* ignore elements with bogus address size */
|
||||
if((size_t)ai->ai_addrlen < ss_size)
|
||||
continue;
|
||||
|
||||
if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) {
|
||||
error = EAI_MEMORY;
|
||||
@@ -139,35 +161,28 @@ Curl_getaddrinfo_ex(const char *nodename,
|
||||
}
|
||||
|
||||
/* copy each structure member individually, member ordering, */
|
||||
/* size, or padding might be different for each structure. */
|
||||
/* size, or padding might be different for each platform. */
|
||||
|
||||
ca->ai_flags = ai->ai_flags;
|
||||
ca->ai_family = ai->ai_family;
|
||||
ca->ai_socktype = ai->ai_socktype;
|
||||
ca->ai_protocol = ai->ai_protocol;
|
||||
ca->ai_addrlen = 0;
|
||||
ca->ai_addrlen = (curl_socklen_t)ss_size;
|
||||
ca->ai_addr = NULL;
|
||||
ca->ai_canonname = NULL;
|
||||
ca->ai_next = NULL;
|
||||
|
||||
if((ai->ai_addrlen > 0) && (ai->ai_addr != NULL)) {
|
||||
/* typecast below avoid warning on at least win64:
|
||||
conversion from 'size_t' to 'curl_socklen_t', possible loss of data
|
||||
*/
|
||||
ca->ai_addrlen = (curl_socklen_t)ai->ai_addrlen;
|
||||
if((ca->ai_addr = malloc(ca->ai_addrlen)) == NULL) {
|
||||
error = EAI_MEMORY;
|
||||
free(ca);
|
||||
break;
|
||||
}
|
||||
memcpy(ca->ai_addr, ai->ai_addr, ca->ai_addrlen);
|
||||
if((ca->ai_addr = malloc(ss_size)) == NULL) {
|
||||
error = EAI_MEMORY;
|
||||
free(ca);
|
||||
break;
|
||||
}
|
||||
memcpy(ca->ai_addr, ai->ai_addr, ss_size);
|
||||
|
||||
if(ai->ai_canonname != NULL) {
|
||||
if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) {
|
||||
error = EAI_MEMORY;
|
||||
if(ca->ai_addr)
|
||||
free(ca->ai_addr);
|
||||
free(ca->ai_addr);
|
||||
free(ca);
|
||||
break;
|
||||
}
|
||||
@@ -182,8 +197,6 @@ Curl_getaddrinfo_ex(const char *nodename,
|
||||
calast->ai_next = ca;
|
||||
calast = ca;
|
||||
|
||||
/* fetch next element fom the addrinfo list */
|
||||
ainext = ai->ai_next;
|
||||
}
|
||||
|
||||
/* destroy the addrinfo list */
|
||||
@@ -195,6 +208,18 @@ Curl_getaddrinfo_ex(const char *nodename,
|
||||
Curl_freeaddrinfo(cafirst);
|
||||
cafirst = NULL;
|
||||
}
|
||||
else if(!cafirst) {
|
||||
#ifdef EAI_NONAME
|
||||
/* rfc3493 conformant */
|
||||
error = EAI_NONAME;
|
||||
#else
|
||||
/* rfc3493 obsoleted */
|
||||
error = EAI_NODATA;
|
||||
#endif
|
||||
#ifdef USE_WINSOCK
|
||||
SET_SOCKERRNO(error);
|
||||
#endif
|
||||
}
|
||||
|
||||
*result = cafirst;
|
||||
|
||||
@@ -434,6 +459,26 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port)
|
||||
return ai;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given an IPv4 or IPv6 dotted string address, this converts it to a proper
|
||||
* allocated Curl_addrinfo struct and returns it.
|
||||
*/
|
||||
Curl_addrinfo *Curl_str2addr(char *address, int port)
|
||||
{
|
||||
struct in_addr in;
|
||||
if(Curl_inet_pton(AF_INET, address, &in) > 0)
|
||||
/* This is a dotted IP address 123.123.123.123-style */
|
||||
return Curl_ip2addr(AF_INET, &in, address, port);
|
||||
#ifdef ENABLE_IPV6
|
||||
else {
|
||||
struct in6_addr in6;
|
||||
if(Curl_inet_pton(AF_INET6, address, &in6) > 0)
|
||||
/* This is a dotted IPv6 address ::1-style */
|
||||
return Curl_ip2addr(AF_INET6, &in6, address, port);
|
||||
}
|
||||
#endif
|
||||
return NULL; /* bad input format */
|
||||
}
|
||||
|
||||
#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)
|
||||
/*
|
||||
|
@@ -80,6 +80,8 @@ Curl_he2ai(const struct hostent *he, int port);
|
||||
Curl_addrinfo *
|
||||
Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
|
||||
|
||||
Curl_addrinfo *Curl_str2addr(char *dotted, int port);
|
||||
|
||||
#if defined(CURLDEBUG) && defined(HAVE_FREEADDRINFO)
|
||||
void
|
||||
curl_dofreeaddrinfo(struct addrinfo *freethis,
|
||||
|
@@ -51,7 +51,7 @@ static CURLcode rtmp_setup(struct connectdata *conn);
|
||||
static CURLcode rtmp_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode rtmp_done(struct connectdata *conn, CURLcode, bool premature);
|
||||
static CURLcode rtmp_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode rtmp_disconnect(struct connectdata *conn);
|
||||
static CURLcode rtmp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
|
||||
static Curl_recv rtmp_recv;
|
||||
static Curl_send rtmp_send;
|
||||
@@ -236,9 +236,11 @@ static CURLcode rtmp_done(struct connectdata *conn, CURLcode status,
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static CURLcode rtmp_disconnect(struct connectdata *conn)
|
||||
static CURLcode rtmp_disconnect(struct connectdata *conn,
|
||||
bool dead_connection)
|
||||
{
|
||||
RTMP *r = conn->proto.generic;
|
||||
(void)dead_connection;
|
||||
if (r) {
|
||||
conn->proto.generic = NULL;
|
||||
RTMP_Close(r);
|
||||
|
172
lib/easy.c
172
lib/easy.c
@@ -626,125 +626,117 @@ CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...)
|
||||
*/
|
||||
CURL *curl_easy_duphandle(CURL *incurl)
|
||||
{
|
||||
bool fail = TRUE;
|
||||
struct SessionHandle *data=(struct SessionHandle *)incurl;
|
||||
|
||||
struct SessionHandle *outcurl = calloc(1, sizeof(struct SessionHandle));
|
||||
|
||||
if(NULL == outcurl)
|
||||
return NULL; /* failure */
|
||||
goto fail;
|
||||
|
||||
do {
|
||||
/*
|
||||
* We setup a few buffers we need. We should probably make them
|
||||
* get setup on-demand in the code, as that would probably decrease
|
||||
* the likeliness of us forgetting to init a buffer here in the future.
|
||||
*/
|
||||
outcurl->state.headerbuff = malloc(HEADERSIZE);
|
||||
if(!outcurl->state.headerbuff)
|
||||
goto fail;
|
||||
outcurl->state.headersize = HEADERSIZE;
|
||||
|
||||
/*
|
||||
* We setup a few buffers we need. We should probably make them
|
||||
* get setup on-demand in the code, as that would probably decrease
|
||||
* the likeliness of us forgetting to init a buffer here in the future.
|
||||
*/
|
||||
outcurl->state.headerbuff = malloc(HEADERSIZE);
|
||||
if(!outcurl->state.headerbuff) {
|
||||
break;
|
||||
}
|
||||
outcurl->state.headersize=HEADERSIZE;
|
||||
/* copy all userdefined values */
|
||||
if(Curl_dupset(outcurl, data) != CURLE_OK)
|
||||
goto fail;
|
||||
|
||||
/* copy all userdefined values */
|
||||
if(Curl_dupset(outcurl, data) != CURLE_OK)
|
||||
break;
|
||||
/* the connection cache is setup on demand */
|
||||
outcurl->state.connc = NULL;
|
||||
|
||||
/* the connection cache is setup on demand */
|
||||
outcurl->state.connc = NULL;
|
||||
outcurl->state.lastconnect = -1;
|
||||
|
||||
outcurl->state.lastconnect = -1;
|
||||
|
||||
outcurl->progress.flags = data->progress.flags;
|
||||
outcurl->progress.callback = data->progress.callback;
|
||||
outcurl->progress.flags = data->progress.flags;
|
||||
outcurl->progress.callback = data->progress.callback;
|
||||
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
if(data->cookies) {
|
||||
/* If cookies are enabled in the parent handle, we enable them
|
||||
in the clone as well! */
|
||||
outcurl->cookies = Curl_cookie_init(data,
|
||||
data->cookies->filename,
|
||||
outcurl->cookies,
|
||||
data->set.cookiesession);
|
||||
if(!outcurl->cookies) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(data->cookies) {
|
||||
/* If cookies are enabled in the parent handle, we enable them
|
||||
in the clone as well! */
|
||||
outcurl->cookies = Curl_cookie_init(data,
|
||||
data->cookies->filename,
|
||||
outcurl->cookies,
|
||||
data->set.cookiesession);
|
||||
if(!outcurl->cookies)
|
||||
goto fail;
|
||||
}
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
/* duplicate all values in 'change' */
|
||||
/* duplicate all values in 'change' */
|
||||
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
if(data->change.cookielist) {
|
||||
outcurl->change.cookielist =
|
||||
Curl_slist_duplicate(data->change.cookielist);
|
||||
|
||||
if (!outcurl->change.cookielist)
|
||||
break;
|
||||
}
|
||||
if(data->change.cookielist) {
|
||||
outcurl->change.cookielist =
|
||||
Curl_slist_duplicate(data->change.cookielist);
|
||||
if(!outcurl->change.cookielist)
|
||||
goto fail;
|
||||
}
|
||||
#endif /* CURL_DISABLE_HTTP */
|
||||
|
||||
if(data->change.url) {
|
||||
outcurl->change.url = strdup(data->change.url);
|
||||
if(!outcurl->change.url)
|
||||
break;
|
||||
outcurl->change.url_alloc = TRUE;
|
||||
}
|
||||
if(data->change.url) {
|
||||
outcurl->change.url = strdup(data->change.url);
|
||||
if(!outcurl->change.url)
|
||||
goto fail;
|
||||
outcurl->change.url_alloc = TRUE;
|
||||
}
|
||||
|
||||
if(data->change.referer) {
|
||||
outcurl->change.referer = strdup(data->change.referer);
|
||||
if(!outcurl->change.referer)
|
||||
break;
|
||||
outcurl->change.referer_alloc = TRUE;
|
||||
}
|
||||
if(data->change.referer) {
|
||||
outcurl->change.referer = strdup(data->change.referer);
|
||||
if(!outcurl->change.referer)
|
||||
goto fail;
|
||||
outcurl->change.referer_alloc = TRUE;
|
||||
}
|
||||
|
||||
#ifdef USE_ARES
|
||||
/* If we use ares, we clone the ares channel for the new handle */
|
||||
if(ARES_SUCCESS != ares_dup(&outcurl->state.areschannel,
|
||||
data->state.areschannel))
|
||||
break;
|
||||
/* If we use ares, we clone the ares channel for the new handle */
|
||||
if(ARES_SUCCESS != ares_dup(&outcurl->state.areschannel,
|
||||
data->state.areschannel))
|
||||
goto fail;
|
||||
#endif
|
||||
|
||||
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
|
||||
outcurl->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
|
||||
CURL_ICONV_CODESET_OF_NETWORK);
|
||||
outcurl->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
|
||||
CURL_ICONV_CODESET_OF_HOST);
|
||||
outcurl->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
|
||||
CURL_ICONV_CODESET_FOR_UTF8);
|
||||
outcurl->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
|
||||
CURL_ICONV_CODESET_OF_NETWORK);
|
||||
outcurl->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
|
||||
CURL_ICONV_CODESET_OF_HOST);
|
||||
outcurl->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
|
||||
CURL_ICONV_CODESET_FOR_UTF8);
|
||||
#endif
|
||||
|
||||
Curl_easy_initHandleData(outcurl);
|
||||
Curl_easy_initHandleData(outcurl);
|
||||
|
||||
outcurl->magic = CURLEASY_MAGIC_NUMBER;
|
||||
outcurl->magic = CURLEASY_MAGIC_NUMBER;
|
||||
|
||||
fail = FALSE; /* we reach this point and thus we are OK */
|
||||
|
||||
} while(0);
|
||||
|
||||
if(fail) {
|
||||
if(outcurl) {
|
||||
if(outcurl->state.connc &&
|
||||
(outcurl->state.connc->type == CONNCACHE_PRIVATE))
|
||||
Curl_rm_connc(outcurl->state.connc);
|
||||
if(outcurl->state.headerbuff)
|
||||
free(outcurl->state.headerbuff);
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
if(outcurl->change.cookielist)
|
||||
curl_slist_free_all(outcurl->change.cookielist);
|
||||
#endif
|
||||
if(outcurl->change.url)
|
||||
free(outcurl->change.url);
|
||||
if(outcurl->change.referer)
|
||||
free(outcurl->change.referer);
|
||||
Curl_freeset(outcurl);
|
||||
free(outcurl); /* free the memory again */
|
||||
outcurl = NULL;
|
||||
}
|
||||
}
|
||||
/* we reach this point and thus we are OK */
|
||||
|
||||
return outcurl;
|
||||
|
||||
fail:
|
||||
|
||||
if(outcurl) {
|
||||
if(outcurl->state.connc &&
|
||||
(outcurl->state.connc->type == CONNCACHE_PRIVATE))
|
||||
Curl_rm_connc(outcurl->state.connc);
|
||||
if(outcurl->state.headerbuff)
|
||||
free(outcurl->state.headerbuff);
|
||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_COOKIES)
|
||||
if(outcurl->change.cookielist)
|
||||
curl_slist_free_all(outcurl->change.cookielist);
|
||||
#endif
|
||||
if(outcurl->change.url)
|
||||
free(outcurl->change.url);
|
||||
if(outcurl->change.referer)
|
||||
free(outcurl->change.referer);
|
||||
Curl_freeset(outcurl);
|
||||
free(outcurl);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -146,7 +146,7 @@ static CURLcode file_range(struct connectdata *conn)
|
||||
|
||||
if(data->state.use_range && data->state.range) {
|
||||
from=curlx_strtoofft(data->state.range, &ptr, 0);
|
||||
while(*ptr && (isspace((int)*ptr) || (*ptr=='-')))
|
||||
while(*ptr && (ISSPACE(*ptr) || (*ptr=='-')))
|
||||
ptr++;
|
||||
to=curlx_strtoofft(ptr, &ptr2, 0);
|
||||
if(ptr == ptr2) {
|
||||
|
@@ -123,6 +123,7 @@ Content-Disposition: form-data; name="FILECONTENT"
|
||||
#include "curl_rand.h"
|
||||
#include "strequal.h"
|
||||
#include "curl_memory.h"
|
||||
#include "sendf.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -975,7 +976,7 @@ int curl_formget(struct curl_httppost *form, void *arg,
|
||||
curl_off_t size;
|
||||
struct FormData *data, *ptr;
|
||||
|
||||
rc = Curl_getFormData(&data, form, NULL, &size);
|
||||
rc = Curl_getformdata(NULL, &data, form, NULL, &size);
|
||||
if(rc != CURLE_OK)
|
||||
return (int)rc;
|
||||
|
||||
@@ -1105,15 +1106,20 @@ static char *strippath(const char *fullfile)
|
||||
}
|
||||
|
||||
/*
|
||||
* Curl_getFormData() converts a linked list of "meta data" into a complete
|
||||
* Curl_getformdata() converts a linked list of "meta data" into a complete
|
||||
* (possibly huge) multipart formdata. The input list is in 'post', while the
|
||||
* output resulting linked lists gets stored in '*finalform'. *sizep will get
|
||||
* the total size of the whole POST.
|
||||
* A multipart/form_data content-type is built, unless a custom content-type
|
||||
* is passed in 'custom_content_type'.
|
||||
*
|
||||
* This function will not do a failf() for the potential memory failures but
|
||||
* should for all other errors it spots. Just note that this function MAY get
|
||||
* a NULL pointer in the 'data' argument.
|
||||
*/
|
||||
|
||||
CURLcode Curl_getFormData(struct FormData **finalform,
|
||||
CURLcode Curl_getformdata(struct SessionHandle *data,
|
||||
struct FormData **finalform,
|
||||
struct curl_httppost *post,
|
||||
const char *custom_content_type,
|
||||
curl_off_t *sizep)
|
||||
@@ -1271,23 +1277,6 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* The header Content-Transfer-Encoding: seems to confuse some receivers
|
||||
* (like the built-in PHP engine). While I can't see any reason why it
|
||||
* should, I can just as well skip this to the benefit of the users who
|
||||
* are using such confused receivers.
|
||||
*/
|
||||
|
||||
if(file->contenttype &&
|
||||
!checkprefix("text/", file->contenttype)) {
|
||||
/* this is not a text content, mention our binary encoding */
|
||||
result = AddFormDataf(&form, &size,
|
||||
"\r\nContent-Transfer-Encoding: binary");
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
result = AddFormDataf(&form, &size, "\r\n\r\n");
|
||||
if(result)
|
||||
break;
|
||||
@@ -1327,50 +1316,31 @@ CURLcode Curl_getFormData(struct FormData **finalform,
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
#ifdef _FORM_DEBUG
|
||||
fprintf(stderr,
|
||||
"\n==> Curl_getFormData couldn't open/read \"%s\"\n",
|
||||
file->contents);
|
||||
#endif
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
if(data)
|
||||
failf(data, "couldn't open file \"%s\"\n", file->contents);
|
||||
*finalform = NULL;
|
||||
return CURLE_READ_ERROR;
|
||||
result = CURLE_READ_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
else if(post->flags & HTTPPOST_BUFFER) {
|
||||
else if(post->flags & HTTPPOST_BUFFER)
|
||||
/* include contents of buffer */
|
||||
result = AddFormData(&form, FORM_CONTENT, post->buffer,
|
||||
post->bufferlength, &size);
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
else if(post->flags & HTTPPOST_CALLBACK) {
|
||||
else if(post->flags & HTTPPOST_CALLBACK)
|
||||
/* the contents should be read with the callback and the size
|
||||
is set with the contentslength */
|
||||
result = AddFormData(&form, FORM_CALLBACK, post->userp,
|
||||
post->contentslength, &size);
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
else {
|
||||
else
|
||||
/* include the contents we got */
|
||||
result = AddFormData(&form, FORM_CONTENT, post->contents,
|
||||
post->contentslength, &size);
|
||||
if(result)
|
||||
break;
|
||||
}
|
||||
} while((file = file->more) != NULL); /* for each specified file for this field */
|
||||
|
||||
file = file->more;
|
||||
} while(file && !result); /* for each specified file for this field */
|
||||
|
||||
if(result) {
|
||||
Curl_formclean(&firstform);
|
||||
free(boundary);
|
||||
@@ -1666,25 +1636,25 @@ int main(int argc, argv_item_t argv[])
|
||||
CURLFORM_END))
|
||||
++errors;
|
||||
|
||||
rc = Curl_getFormData(&form, httppost, NULL, &size);
|
||||
rc = Curl_getformdata(NULL, &form, httppost, NULL, &size);
|
||||
if(rc != CURLE_OK) {
|
||||
if(rc != CURLE_READ_ERROR) {
|
||||
const char *errortext = curl_easy_strerror(rc);
|
||||
fprintf(stdout, "\n==> Curl_getFormData error: %s\n", errortext);
|
||||
fprintf(stdout, "\n==> Curl_getformdata error: %s\n", errortext);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Curl_FormInit(&formread, form);
|
||||
|
||||
do {
|
||||
for(;;) {
|
||||
nread = Curl_FormReader(buffer, 1, sizeof(buffer),
|
||||
(FILE *)&formread);
|
||||
|
||||
if(nread < 1)
|
||||
break;
|
||||
fwrite(buffer, nread, 1, stdout);
|
||||
} while(1);
|
||||
}
|
||||
|
||||
fprintf(stdout, "size: ");
|
||||
fprintf(stdout, "%" FORMAT_OFF_T, size);
|
||||
|
@@ -7,7 +7,7 @@
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
@@ -70,11 +70,11 @@ typedef struct FormInfo {
|
||||
|
||||
int Curl_FormInit(struct Form *form, struct FormData *formdata );
|
||||
|
||||
CURLcode
|
||||
Curl_getFormData(struct FormData **,
|
||||
struct curl_httppost *post,
|
||||
const char *custom_contenttype,
|
||||
curl_off_t *size);
|
||||
CURLcode Curl_getformdata(struct SessionHandle *data,
|
||||
struct FormData **,
|
||||
struct curl_httppost *post,
|
||||
const char *custom_contenttype,
|
||||
curl_off_t *size);
|
||||
|
||||
/* fread() emulation */
|
||||
size_t Curl_FormReader(char *buffer,
|
||||
|
87
lib/ftp.c
87
lib/ftp.c
@@ -136,7 +136,7 @@ static CURLcode ftp_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode ftp_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode ftp_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode ftp_disconnect(struct connectdata *conn);
|
||||
static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static CURLcode ftp_nextconnect(struct connectdata *conn);
|
||||
static CURLcode ftp_multi_statemach(struct connectdata *conn, bool *done);
|
||||
static int ftp_getsock(struct connectdata *conn,
|
||||
@@ -379,7 +379,7 @@ static int ftp_endofresp(struct pingpong *pp,
|
||||
size_t len = pp->nread_resp;
|
||||
|
||||
if((len > 3) && LASTLINE(line)) {
|
||||
*code = atoi(line);
|
||||
*code = curlx_sltosi(strtol(line, NULL, 10));
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@@ -405,13 +405,13 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
/* FIXME: some errorchecking perhaps... ***/
|
||||
switch(code) {
|
||||
case 631:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_safe);
|
||||
code = Curl_sec_read_msg(conn, buf, PROT_SAFE);
|
||||
break;
|
||||
case 632:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_private);
|
||||
code = Curl_sec_read_msg(conn, buf, PROT_PRIVATE);
|
||||
break;
|
||||
case 633:
|
||||
code = Curl_sec_read_msg(conn, buf, prot_confidential);
|
||||
code = Curl_sec_read_msg(conn, buf, PROT_CONFIDENTIAL);
|
||||
break;
|
||||
default:
|
||||
/* normal ftp stuff we pass through! */
|
||||
@@ -425,6 +425,12 @@ static CURLcode ftp_readresp(curl_socket_t sockfd,
|
||||
if(ftpcode)
|
||||
*ftpcode = code;
|
||||
|
||||
if(421 == code)
|
||||
/* 421 means "Service not available, closing control connection." and FTP
|
||||
* servers use it to signal that idle session timeout has been exceeded.
|
||||
* If we ignored the response, it could end up hanging in some cases. */
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1360,18 +1366,16 @@ static CURLcode ftp_state_ul_setup(struct connectdata *conn,
|
||||
else {
|
||||
curl_off_t passed=0;
|
||||
do {
|
||||
curl_off_t readthisamountnow = (data->state.resume_from - passed);
|
||||
curl_off_t actuallyread;
|
||||
size_t readthisamountnow =
|
||||
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
if(readthisamountnow > BUFSIZE)
|
||||
readthisamountnow = BUFSIZE;
|
||||
|
||||
actuallyread = (curl_off_t)
|
||||
conn->fread_func(data->state.buffer, 1, (size_t)readthisamountnow,
|
||||
size_t actuallyread =
|
||||
conn->fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
conn->fread_in);
|
||||
|
||||
passed += actuallyread;
|
||||
if((actuallyread <= 0) || (actuallyread > readthisamountnow)) {
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
/* this checks for greater-than only to make sure that the
|
||||
CURL_READFUNC_ABORT return code still aborts */
|
||||
failf(data, "Failed to read data");
|
||||
@@ -3083,6 +3087,10 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
|
||||
#endif
|
||||
|
||||
if(conn->sock[SECONDARYSOCKET] != CURL_SOCKET_BAD) {
|
||||
if(!result && ftpc->dont_check && data->req.maxdownload > 0)
|
||||
/* partial download completed */
|
||||
result = Curl_pp_sendf(pp, "ABOR");
|
||||
|
||||
if(conn->ssl[SECONDARYSOCKET].use) {
|
||||
/* The secondary socket is using SSL so we must close down that part
|
||||
first before we close the socket for real */
|
||||
@@ -3097,7 +3105,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
|
||||
}
|
||||
}
|
||||
|
||||
if((ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
|
||||
if(!result && (ftp->transfer == FTPTRANSFER_BODY) && ftpc->ctl_valid &&
|
||||
pp->pending_resp && !premature) {
|
||||
/*
|
||||
* Let's see what the server says about the transfer we just performed,
|
||||
@@ -3123,6 +3131,14 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
|
||||
if(result)
|
||||
return result;
|
||||
|
||||
if(ftpc->dont_check && data->req.maxdownload > 0) {
|
||||
/* we have just sent ABOR and there is no reliable way to check if it was
|
||||
* successful or not; we have to close the connection now */
|
||||
infof(data, "partial download completed, closing connection\n");
|
||||
conn->bits.close = TRUE; /* mark for closure */
|
||||
return result;
|
||||
}
|
||||
|
||||
if(!ftpc->dont_check) {
|
||||
/* 226 Transfer complete, 250 Requested file action okay, completed. */
|
||||
if((ftpcode != 226) && (ftpcode != 250)) {
|
||||
@@ -3562,14 +3578,12 @@ static CURLcode init_wc_data(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
/* This is called recursively */
|
||||
static CURLcode wc_statemach(struct connectdata *conn)
|
||||
{
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
struct WildcardData *wildcard = &(conn->data->wildcard);
|
||||
struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp;
|
||||
char *tmp_path;
|
||||
struct WildcardData * const wildcard = &(conn->data->wildcard);
|
||||
CURLcode ret = CURLE_OK;
|
||||
long userresponse = 0;
|
||||
|
||||
switch (wildcard->state) {
|
||||
case CURLWC_INIT:
|
||||
ret = init_wc_data(conn);
|
||||
@@ -3580,10 +3594,10 @@ static CURLcode wc_statemach(struct connectdata *conn)
|
||||
wildcard->state = ret ? CURLWC_ERROR : CURLWC_MATCHING;
|
||||
break;
|
||||
|
||||
case CURLWC_MATCHING:
|
||||
case CURLWC_MATCHING: {
|
||||
/* In this state is LIST response successfully parsed, so lets restore
|
||||
previous WRITEFUNCTION callback and WRITEDATA pointer */
|
||||
ftp_tmp = wildcard->tmp;
|
||||
struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp;
|
||||
conn->data->set.fwrite_func = ftp_tmp->backup.write_function;
|
||||
conn->data->set.out = ftp_tmp->backup.file_descriptor;
|
||||
wildcard->state = CURLWC_DOWNLOADING;
|
||||
@@ -3598,13 +3612,14 @@ static CURLcode wc_statemach(struct connectdata *conn)
|
||||
wildcard->state = CURLWC_CLEAN;
|
||||
return CURLE_REMOTE_FILE_NOT_FOUND;
|
||||
}
|
||||
ret = wc_statemach(conn);
|
||||
break;
|
||||
return wc_statemach(conn);
|
||||
}
|
||||
|
||||
case CURLWC_DOWNLOADING: {
|
||||
/* filelist has at least one file, lets get first one */
|
||||
struct ftp_conn *ftpc = &conn->proto.ftpc;
|
||||
struct curl_fileinfo *finfo = wildcard->filelist->head->ptr;
|
||||
tmp_path = malloc(strlen(conn->data->state.path) +
|
||||
char *tmp_path = malloc(strlen(conn->data->state.path) +
|
||||
strlen(finfo->filename) + 1);
|
||||
if(!tmp_path) {
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
@@ -3623,7 +3638,7 @@ static CURLcode wc_statemach(struct connectdata *conn)
|
||||
|
||||
infof(conn->data, "Wildcard - START of \"%s\"\n", finfo->filename);
|
||||
if(conn->data->set.chunk_bgn) {
|
||||
userresponse = conn->data->set.chunk_bgn(
|
||||
long userresponse = conn->data->set.chunk_bgn(
|
||||
finfo, wildcard->customptr, (int)wildcard->filelist->size);
|
||||
switch(userresponse) {
|
||||
case CURL_CHUNK_BGN_FUNC_SKIP:
|
||||
@@ -3666,16 +3681,17 @@ static CURLcode wc_statemach(struct connectdata *conn)
|
||||
Curl_llist_remove(wildcard->filelist, wildcard->filelist->head, NULL);
|
||||
wildcard->state = (wildcard->filelist->size == 0) ?
|
||||
CURLWC_CLEAN : CURLWC_DOWNLOADING;
|
||||
ret = wc_statemach(conn);
|
||||
} break;
|
||||
return wc_statemach(conn);
|
||||
}
|
||||
|
||||
case CURLWC_CLEAN:
|
||||
case CURLWC_CLEAN: {
|
||||
struct ftp_wc_tmpdata *ftp_tmp = wildcard->tmp;
|
||||
ret = CURLE_OK;
|
||||
if(ftp_tmp) {
|
||||
ret = Curl_ftp_parselist_geterror(ftp_tmp->parser);
|
||||
}
|
||||
wildcard->state = ret ? CURLWC_ERROR : CURLWC_DONE;
|
||||
break;
|
||||
} break;
|
||||
|
||||
case CURLWC_DONE:
|
||||
case CURLWC_ERROR:
|
||||
@@ -3766,11 +3782,12 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
|
||||
|
||||
for(;;) {
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
conn->data_prot = prot_cmd;
|
||||
conn->data_prot = PROT_CMD;
|
||||
#endif
|
||||
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
|
||||
&bytes_written);
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
|
||||
conn->data_prot = data_sec;
|
||||
#endif
|
||||
|
||||
@@ -3823,7 +3840,7 @@ static CURLcode ftp_quit(struct connectdata *conn)
|
||||
* Disconnect from an FTP server. Cleanup protocol-specific per-connection
|
||||
* resources. BLOCKING.
|
||||
*/
|
||||
static CURLcode ftp_disconnect(struct connectdata *conn)
|
||||
static CURLcode ftp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
struct ftp_conn *ftpc= &conn->proto.ftpc;
|
||||
struct pingpong *pp = &ftpc->pp;
|
||||
@@ -3835,6 +3852,8 @@ static CURLcode ftp_disconnect(struct connectdata *conn)
|
||||
ftp_quit() will check the state of ftp->ctl_valid. If it's ok it
|
||||
will try to send the QUIT command, otherwise it will just return.
|
||||
*/
|
||||
if(dead_connection)
|
||||
ftpc->ctl_valid = FALSE;
|
||||
|
||||
/* The FTP session may or may not have been allocated/setup at this point! */
|
||||
(void)ftp_quit(conn); /* ignore errors on the QUIT */
|
||||
@@ -3959,9 +3978,9 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
|
||||
else {
|
||||
/* parse the URL path into separate path components */
|
||||
while((slash_pos = strchr(cur_pos, '/')) != NULL) {
|
||||
/* 1 or 0 to indicate absolute directory */
|
||||
bool absolute_dir = (bool)((cur_pos - data->state.path > 0) &&
|
||||
(ftpc->dirdepth == 0));
|
||||
/* 1 or 0 pointer offset to indicate absolute directory */
|
||||
ssize_t absolute_dir = ((cur_pos - data->state.path > 0) &&
|
||||
(ftpc->dirdepth == 0))?1:0;
|
||||
|
||||
/* seek out the next path component */
|
||||
if(slash_pos-cur_pos) {
|
||||
|
@@ -67,10 +67,10 @@ CURLcode Curl_initinfo(struct SessionHandle *data)
|
||||
info->request_size = 0;
|
||||
info->numconnects = 0;
|
||||
|
||||
info->ip[0] = 0;
|
||||
info->port = 0;
|
||||
info->localip[0] = 0;
|
||||
info->localport = 0;
|
||||
info->conn_primary_ip[0] = '\0';
|
||||
info->conn_local_ip[0] = '\0';
|
||||
info->conn_primary_port = 0;
|
||||
info->conn_local_port = 0;
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
@@ -238,20 +238,20 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
|
||||
break;
|
||||
case CURLINFO_PRIMARY_IP:
|
||||
/* Return the ip address of the most recent (primary) connection */
|
||||
*param_charp = data->info.ip;
|
||||
*param_charp = data->info.conn_primary_ip;
|
||||
break;
|
||||
case CURLINFO_PRIMARY_PORT:
|
||||
/* Return the (remote) port of the most recent (primary) connection */
|
||||
*param_longp = data->info.port;
|
||||
*param_longp = data->info.conn_primary_port;
|
||||
break;
|
||||
case CURLINFO_LOCAL_IP:
|
||||
/* Return the source/local ip address of the most recent (primary)
|
||||
connection */
|
||||
*param_charp = data->info.localip;
|
||||
*param_charp = data->info.conn_local_ip;
|
||||
break;
|
||||
case CURLINFO_LOCAL_PORT:
|
||||
/* Return the local port of the most recent (primary) connection */
|
||||
*param_longp = data->info.localport;
|
||||
*param_longp = data->info.conn_local_port;
|
||||
break;
|
||||
case CURLINFO_CERTINFO:
|
||||
/* Return the a pointer to the certinfo struct. Not really an slist
|
||||
|
@@ -78,6 +78,7 @@
|
||||
#include "rawstr.h"
|
||||
#include "select.h"
|
||||
#include "url.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -156,7 +157,7 @@ static CURLcode gopher_do(struct connectdata *conn, bool *done)
|
||||
|
||||
/* We use Curl_write instead of Curl_sendf to make sure the entire buffer is
|
||||
sent, which could be sizeable with long selectors. */
|
||||
k = strlen(sel);
|
||||
k = curlx_uztosz(strlen(sel));
|
||||
|
||||
for(;;) {
|
||||
result = Curl_write(conn, sockfd, sel, k, &amount);
|
||||
|
65
lib/gtls.c
65
lib/gtls.c
@@ -78,6 +78,7 @@ static void tls_log_func(int level, const char *str)
|
||||
}
|
||||
#endif
|
||||
static bool gtls_inited = FALSE;
|
||||
|
||||
/*
|
||||
* Custom push and pull callback functions used by GNU TLS to read and write
|
||||
* to the socket. These functions are simple wrappers to send() and recv()
|
||||
@@ -85,15 +86,54 @@ static bool gtls_inited = FALSE;
|
||||
* We use custom functions rather than the GNU TLS defaults because it allows
|
||||
* us to get specific about the fourth "flags" argument, and to use arbitrary
|
||||
* private data with gnutls_transport_set_ptr if we wish.
|
||||
*
|
||||
* When these custom push and pull callbacks fail, GNU TLS checks its own
|
||||
* session-specific error variable, and when not set also its own global
|
||||
* errno variable, in order to take appropriate action. GNU TLS does not
|
||||
* require that the transport is actually a socket. This implies that for
|
||||
* Windows builds these callbacks should ideally set the session-specific
|
||||
* error variable using function gnutls_transport_set_errno or as a last
|
||||
* resort global errno variable using gnutls_transport_set_global_errno,
|
||||
* with a transport agnostic error value. This implies that some winsock
|
||||
* error translation must take place in these callbacks.
|
||||
*/
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
# define gtls_EINTR 4
|
||||
# define gtls_EIO 5
|
||||
# define gtls_EAGAIN 11
|
||||
static int gtls_mapped_sockerrno(void)
|
||||
{
|
||||
switch(SOCKERRNO) {
|
||||
case WSAEWOULDBLOCK:
|
||||
return gtls_EAGAIN;
|
||||
case WSAEINTR:
|
||||
return gtls_EINTR;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return gtls_EIO;
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t Curl_gtls_push(void *s, const void *buf, size_t len)
|
||||
{
|
||||
return swrite(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);
|
||||
ssize_t ret = swrite(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);
|
||||
#ifdef USE_WINSOCK
|
||||
if(ret < 0)
|
||||
gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t Curl_gtls_pull(void *s, void *buf, size_t len)
|
||||
{
|
||||
return sread(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);
|
||||
ssize_t ret = sread(GNUTLS_POINTER_TO_INT_CAST(s), buf, len);
|
||||
#ifdef USE_WINSOCK
|
||||
if(ret < 0)
|
||||
gnutls_transport_set_global_errno(gtls_mapped_sockerrno());
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Curl_gtls_init()
|
||||
@@ -196,7 +236,7 @@ static CURLcode handshake(struct connectdata *conn,
|
||||
int rc;
|
||||
int what;
|
||||
|
||||
while(1) {
|
||||
for(;;) {
|
||||
/* check allowed time left */
|
||||
timeout_ms = Curl_timeleft(conn, NULL, duringconnect);
|
||||
|
||||
@@ -216,19 +256,18 @@ static CURLcode handshake(struct connectdata *conn,
|
||||
connssl->connecting_state?sockfd:CURL_SOCKET_BAD;
|
||||
|
||||
what = Curl_socket_ready(readfd, writefd,
|
||||
nonblocking?0:(int)timeout_ms);
|
||||
nonblocking?0:(int)timeout_ms?1000:timeout_ms);
|
||||
if(what < 0) {
|
||||
/* fatal error */
|
||||
failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO);
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
else if(0 == what) {
|
||||
if(nonblocking) {
|
||||
if(nonblocking)
|
||||
return CURLE_OK;
|
||||
}
|
||||
else {
|
||||
else if(timeout_ms) {
|
||||
/* timeout */
|
||||
failf(data, "SSL connection timeout");
|
||||
failf(data, "SSL connection timeout at %ld", timeout_ms);
|
||||
return CURLE_OPERATION_TIMEDOUT;
|
||||
}
|
||||
}
|
||||
@@ -241,12 +280,14 @@ static CURLcode handshake(struct connectdata *conn,
|
||||
connssl->connecting_state =
|
||||
gnutls_record_get_direction(session)?
|
||||
ssl_connect_2_writing:ssl_connect_2_reading;
|
||||
if(nonblocking) {
|
||||
if(nonblocking)
|
||||
return CURLE_OK;
|
||||
}
|
||||
} else if (rc < 0) {
|
||||
}
|
||||
else if (rc < 0) {
|
||||
failf(data, "gnutls_handshake() failed: %s", gnutls_strerror(rc));
|
||||
} else {
|
||||
return CURLE_SSL_CONNECT_ERROR;
|
||||
}
|
||||
else {
|
||||
/* Reset our connect state machine */
|
||||
connssl->connecting_state = ssl_connect_1;
|
||||
return CURLE_OK;
|
||||
|
@@ -60,7 +60,7 @@ Curl_HMAC_init(const HMAC_params * hashparams,
|
||||
|
||||
/* Create HMAC context. */
|
||||
i = sizeof *ctxt + 2 * hashparams->hmac_ctxtsize + hashparams->hmac_resultlen;
|
||||
ctxt = (HMAC_context *) malloc(i);
|
||||
ctxt = malloc(i);
|
||||
|
||||
if(!ctxt)
|
||||
return ctxt;
|
||||
@@ -85,9 +85,9 @@ Curl_HMAC_init(const HMAC_params * hashparams,
|
||||
(*hashparams->hmac_hinit)(ctxt->hmac_hashctxt2);
|
||||
|
||||
for (i = 0; i < keylen; i++) {
|
||||
b = *key ^ hmac_ipad;
|
||||
b = (unsigned char)(*key ^ hmac_ipad);
|
||||
(*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt1, &b, 1);
|
||||
b = *key++ ^ hmac_opad;
|
||||
b = (unsigned char)(*key++ ^ hmac_opad);
|
||||
(*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, &b, 1);
|
||||
}
|
||||
|
||||
|
@@ -224,17 +224,12 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
long timeout;
|
||||
struct timeval now = Curl_tvnow();
|
||||
|
||||
/* now, see if there's a connect timeout or a regular timeout to
|
||||
use instead of the default one */
|
||||
if(conn->data->set.connecttimeout)
|
||||
timeout = conn->data->set.connecttimeout;
|
||||
else if(conn->data->set.timeout)
|
||||
timeout = conn->data->set.timeout;
|
||||
else
|
||||
timeout = Curl_timeleft(conn, &now, TRUE);
|
||||
if(!timeout)
|
||||
timeout = CURL_TIMEOUT_RESOLVE * 1000; /* default name resolve timeout */
|
||||
|
||||
/* Wait for the name resolve query to complete. */
|
||||
while(1) {
|
||||
for(;;) {
|
||||
struct timeval *tvp, tv, store;
|
||||
long timediff;
|
||||
int itimeout;
|
||||
@@ -265,8 +260,10 @@ CURLcode Curl_wait_for_resolv(struct connectdata *conn,
|
||||
timeout = -1; /* trigger the cancel below */
|
||||
}
|
||||
else {
|
||||
timediff = Curl_tvdiff(Curl_tvnow(), now); /* spent time */
|
||||
struct timeval now2 = Curl_tvnow();
|
||||
timediff = Curl_tvdiff(now2, now); /* spent time */
|
||||
timeout -= timediff?timediff:1; /* always deduct at least 1 */
|
||||
now = now2; /* for next loop */
|
||||
}
|
||||
if(timeout < 0) {
|
||||
/* our timeout, so we cancel the ares operation */
|
||||
@@ -378,7 +375,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
return Curl_ip2addr(AF_INET6, &in6, hostname, port);
|
||||
}
|
||||
|
||||
switch(data->set.ip_version) {
|
||||
switch(conn->ip_version) {
|
||||
default:
|
||||
#if ARES_VERSION >= 0x010601
|
||||
family = PF_UNSPEC; /* supported by c-ares since 1.6.1, so for older
|
||||
|
13
lib/hostip.c
13
lib/hostip.c
@@ -67,6 +67,7 @@
|
||||
#include "strerror.h"
|
||||
#include "url.h"
|
||||
#include "inet_ntop.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -366,7 +367,7 @@ Curl_cache_addr(struct SessionHandle *data,
|
||||
dns = dns2;
|
||||
dns->inuse++; /* mark entry as in-use */
|
||||
|
||||
/* free the allocated entry_id again */
|
||||
/* free the allocated entry_id */
|
||||
free(entry_id);
|
||||
|
||||
return dns;
|
||||
@@ -421,6 +422,9 @@ int Curl_resolv(struct connectdata *conn,
|
||||
/* See if its already in our dns cache */
|
||||
dns = Curl_hash_pick(data->dns.hostcache, entry_id, entry_len+1);
|
||||
|
||||
/* free the allocated entry_id again */
|
||||
free(entry_id);
|
||||
|
||||
/* See whether the returned entry is stale. Done before we release lock */
|
||||
if( remove_entry_if_stale(data, dns) )
|
||||
dns = NULL; /* the memory deallocation is being handled by the hash */
|
||||
@@ -433,9 +437,6 @@ int Curl_resolv(struct connectdata *conn,
|
||||
if(data->share)
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||
|
||||
/* free the allocated entry_id again */
|
||||
free(entry_id);
|
||||
|
||||
if(!dns) {
|
||||
/* The entry was not in the cache. Resolve it to IP address */
|
||||
|
||||
@@ -444,7 +445,7 @@ int Curl_resolv(struct connectdata *conn,
|
||||
|
||||
/* Check what IP specifics the app has requested and if we can provide it.
|
||||
* If not, bail out. */
|
||||
if(!Curl_ipvalid(data))
|
||||
if(!Curl_ipvalid(conn))
|
||||
return CURLRESOLV_ERROR;
|
||||
|
||||
/* If Curl_getaddrinfo() returns NULL, 'respwait' might be set to a
|
||||
@@ -597,7 +598,7 @@ int Curl_resolv_timeout(struct connectdata *conn,
|
||||
|
||||
/* alarm() makes a signal get sent when the timeout fires off, and that
|
||||
will abort system calls */
|
||||
prev_alarm = alarm((unsigned int) (timeout/1000L));
|
||||
prev_alarm = alarm(curlx_sltoui(timeout/1000L));
|
||||
|
||||
/* This allows us to time-out from the name resolver, as the timeout
|
||||
will generate a signal and we will siglongjmp() from that here.
|
||||
|
@@ -111,7 +111,7 @@ int Curl_resolv_timeout(struct connectdata *conn, const char *hostname,
|
||||
* Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've
|
||||
* been set and returns TRUE if they are OK.
|
||||
*/
|
||||
bool Curl_ipvalid(struct SessionHandle *data);
|
||||
bool Curl_ipvalid(struct connectdata *conn);
|
||||
|
||||
/*
|
||||
* Curl_getaddrinfo() is the generic low-level name resolve API within this
|
||||
|
@@ -77,9 +77,9 @@
|
||||
* Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've
|
||||
* been set and returns TRUE if they are OK.
|
||||
*/
|
||||
bool Curl_ipvalid(struct SessionHandle *data)
|
||||
bool Curl_ipvalid(struct connectdata *conn)
|
||||
{
|
||||
if(data->set.ip_version == CURL_IPRESOLVE_V6)
|
||||
if(conn->ip_version == CURL_IPRESOLVE_V6)
|
||||
/* an ipv6 address was requested and we can't get/use one */
|
||||
return FALSE;
|
||||
|
||||
|
@@ -112,9 +112,9 @@ int curl_dogetnameinfo(GETNAMEINFO_QUAL_ARG1 GETNAMEINFO_TYPE_ARG1 sa,
|
||||
* Curl_ipvalid() checks what CURL_IPRESOLVE_* requirements that might've
|
||||
* been set and returns TRUE if they are OK.
|
||||
*/
|
||||
bool Curl_ipvalid(struct SessionHandle *data)
|
||||
bool Curl_ipvalid(struct connectdata *conn)
|
||||
{
|
||||
if(data->set.ip_version == CURL_IPRESOLVE_V6) {
|
||||
if(conn->ip_version == CURL_IPRESOLVE_V6) {
|
||||
/* see if we have an IPv6 stack */
|
||||
curl_socket_t s = socket(PF_INET6, SOCK_DGRAM, 0);
|
||||
if(s == CURL_SOCKET_BAD)
|
||||
@@ -174,7 +174,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
/*
|
||||
* Check if a limited name resolve has been requested.
|
||||
*/
|
||||
switch(data->set.ip_version) {
|
||||
switch(conn->ip_version) {
|
||||
case CURL_IPRESOLVE_V4:
|
||||
pf = PF_INET;
|
||||
break;
|
||||
|
@@ -518,7 +518,7 @@ Curl_addrinfo *Curl_getaddrinfo(struct connectdata *conn,
|
||||
/*
|
||||
* Check if a limited name resolve has been requested.
|
||||
*/
|
||||
switch(data->set.ip_version) {
|
||||
switch(conn->ip_version) {
|
||||
case CURL_IPRESOLVE_V4:
|
||||
pf = PF_INET;
|
||||
break;
|
||||
|
41
lib/http.c
41
lib/http.c
@@ -98,6 +98,7 @@
|
||||
#include "rawstr.h"
|
||||
#include "content_encoding.h"
|
||||
#include "rtsp.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -2375,19 +2376,15 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
#endif /* CURL_DISABLE_PROXY */
|
||||
|
||||
if(HTTPREQ_POST_FORM == httpreq) {
|
||||
/* we must build the whole darned post sequence first, so that we have
|
||||
a size of the whole shebang before we start to send it */
|
||||
result = Curl_getFormData(&http->sendit, data->set.httppost,
|
||||
Curl_checkheaders(data, "Content-Type:"),
|
||||
&http->postsize);
|
||||
if(CURLE_OK != result) {
|
||||
/* Curl_getFormData() doesn't use failf() */
|
||||
failf(data, "failed creating formpost data");
|
||||
return result;
|
||||
}
|
||||
/* we must build the whole post sequence first, so that we have a size of
|
||||
the whole transfer before we start to send it */
|
||||
result = Curl_getformdata(data, &http->sendit, data->set.httppost,
|
||||
Curl_checkheaders(data, "Content-Type:"),
|
||||
&http->postsize);
|
||||
if(result)
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
http->p_accept = Curl_checkheaders(data, "Accept:")?NULL:"Accept: */*\r\n";
|
||||
|
||||
if(( (HTTPREQ_POST == httpreq) ||
|
||||
@@ -2428,27 +2425,25 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
||||
/* when seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
|
||||
else {
|
||||
curl_off_t passed=0;
|
||||
|
||||
do {
|
||||
size_t readthisamountnow = (size_t)(data->state.resume_from -
|
||||
passed);
|
||||
size_t actuallyread;
|
||||
size_t readthisamountnow =
|
||||
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
if(readthisamountnow > BUFSIZE)
|
||||
readthisamountnow = BUFSIZE;
|
||||
|
||||
actuallyread = data->set.fread_func(data->state.buffer, 1,
|
||||
(size_t)readthisamountnow,
|
||||
data->set.in);
|
||||
size_t actuallyread =
|
||||
data->set.fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
data->set.in);
|
||||
|
||||
passed += actuallyread;
|
||||
if(actuallyread != readthisamountnow) {
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
/* this checks for greater-than only to make sure that the
|
||||
CURL_READFUNC_ABORT return code still aborts */
|
||||
failf(data, "Could only read %" FORMAT_OFF_T
|
||||
" bytes from the input",
|
||||
passed);
|
||||
return CURLE_READ_ERROR;
|
||||
}
|
||||
} while(passed != data->state.resume_from); /* loop until done */
|
||||
} while(passed < data->state.resume_from);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -342,7 +342,6 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
|
||||
return CHUNKE_OUT_OF_MEMORY;
|
||||
conn->trailer = ptr;
|
||||
}
|
||||
fprintf(stderr, "MOO: %c\n", *datap);
|
||||
conn->trailer[conn->trlPos++]=*datap;
|
||||
}
|
||||
datap++;
|
||||
|
@@ -158,7 +158,7 @@ CURLdigest Curl_input_digest(struct connectdata *conn,
|
||||
/* clear off any former leftovers and init to defaults */
|
||||
Curl_digest_cleanup_one(d);
|
||||
|
||||
while(1) {
|
||||
for(;;) {
|
||||
char value[MAX_VALUE_LENGTH];
|
||||
char content[MAX_CONTENT_LENGTH];
|
||||
|
||||
|
@@ -100,7 +100,7 @@ static CURLcode imap_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode imap_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode imap_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode imap_disconnect(struct connectdata *conn);
|
||||
static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static CURLcode imap_multi_statemach(struct connectdata *conn, bool *done);
|
||||
static int imap_getsock(struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
@@ -877,13 +877,13 @@ static CURLcode imap_logout(struct connectdata *conn)
|
||||
* Disconnect from an IMAP server. Cleanup protocol-specific per-connection
|
||||
* resources. BLOCKING.
|
||||
*/
|
||||
static CURLcode imap_disconnect(struct connectdata *conn)
|
||||
static CURLcode imap_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
struct imap_conn *imapc= &conn->proto.imapc;
|
||||
|
||||
/* The IMAP session may or may not have been allocated/setup at this
|
||||
point! */
|
||||
if (imapc->pp.conn)
|
||||
if(!dead_connection && imapc->pp.conn)
|
||||
(void)imap_logout(conn); /* ignore errors on the LOGOUT */
|
||||
|
||||
Curl_pp_disconnect(&imapc->pp);
|
||||
|
@@ -218,14 +218,14 @@ inet_pton6(const char *src, unsigned char *dst)
|
||||
* Since some memmove()'s erroneously fail to handle
|
||||
* overlapping regions, we'll do the shift by hand.
|
||||
*/
|
||||
const size_t n = tp - colonp;
|
||||
size_t i;
|
||||
const ssize_t n = tp - colonp;
|
||||
ssize_t i;
|
||||
|
||||
if(tp == endp)
|
||||
return (0);
|
||||
for (i = 1; i <= n; i++) {
|
||||
endp[- i] = colonp[n - i];
|
||||
colonp[n - i] = 0;
|
||||
*(endp - i) = *(colonp + n - i);
|
||||
*(colonp + n - i) = 0;
|
||||
}
|
||||
tp = endp;
|
||||
}
|
||||
|
35
lib/krb4.c
35
lib/krb4.c
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska H<>gskolan
|
||||
* (Royal Institute of Technology, Stockholm, Sweden).
|
||||
* Copyright (c) 2004 - 2009 Daniel Stenberg
|
||||
* Copyright (c) 2004 - 2010 Daniel Stenberg
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -106,7 +106,7 @@ static int
|
||||
krb4_check_prot(void *app_data, int level)
|
||||
{
|
||||
app_data = NULL; /* prevent compiler warning */
|
||||
if(level == prot_confidential)
|
||||
if(level == PROT_CONFIDENTIAL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -119,7 +119,7 @@ krb4_decode(void *app_data, void *buf, int len, int level,
|
||||
int e;
|
||||
struct krb4_data *d = app_data;
|
||||
|
||||
if(level == prot_safe)
|
||||
if(level == PROT_SAFE)
|
||||
e = krb_rd_safe(buf, len, &d->key,
|
||||
(struct sockaddr_in *)REMOTE_ADDR,
|
||||
(struct sockaddr_in *)LOCAL_ADDR, &m);
|
||||
@@ -154,14 +154,14 @@ krb4_encode(void *app_data, const void *from, int length, int level, void **to,
|
||||
*to = malloc(length + 31);
|
||||
if(!*to)
|
||||
return -1;
|
||||
if(level == prot_safe)
|
||||
if(level == PROT_SAFE)
|
||||
/* NOTE that the void* cast is safe, krb_mk_safe/priv don't modify the
|
||||
* input buffer
|
||||
*/
|
||||
return krb_mk_safe((void*)from, *to, length, &d->key,
|
||||
(struct sockaddr_in *)LOCAL_ADDR,
|
||||
(struct sockaddr_in *)REMOTE_ADDR);
|
||||
else if(level == prot_private)
|
||||
else if(level == PROT_PRIVATE)
|
||||
return krb_mk_priv((void*)from, *to, length, d->schedule, &d->key,
|
||||
(struct sockaddr_in *)LOCAL_ADDR,
|
||||
(struct sockaddr_in *)REMOTE_ADDR);
|
||||
@@ -315,6 +315,15 @@ struct Curl_sec_client_mech Curl_krb4_client_mech = {
|
||||
krb4_decode
|
||||
};
|
||||
|
||||
static enum protection_level
|
||||
krb4_set_command_prot(struct connectdata *conn, enum protection_level level)
|
||||
{
|
||||
enum protection_level old = conn->command_prot;
|
||||
DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
|
||||
conn->command_prot = level;
|
||||
return old;
|
||||
}
|
||||
|
||||
CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
{
|
||||
des_cblock key;
|
||||
@@ -325,11 +334,11 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
char passwd[100];
|
||||
size_t tmp;
|
||||
ssize_t nread;
|
||||
int save;
|
||||
enum protection_level save;
|
||||
CURLcode result;
|
||||
unsigned char *ptr;
|
||||
|
||||
save = Curl_set_command_prot(conn, prot_private);
|
||||
save = krb4_set_command_prot(conn, PROT_PRIVATE);
|
||||
|
||||
result = Curl_ftpsendf(conn, "SITE KAUTH %s", conn->user);
|
||||
|
||||
@@ -341,14 +350,14 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
return result;
|
||||
|
||||
if(conn->data->state.buffer[0] != '3'){
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
|
||||
p = strstr(conn->data->state.buffer, "T=");
|
||||
if(!p) {
|
||||
Curl_failf(conn->data, "Bad reply from server");
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
|
||||
@@ -360,7 +369,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
}
|
||||
if(!tmp || !ptr) {
|
||||
Curl_failf(conn->data, "Failed to decode base64 in reply");
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
memcpy((char *)tkt.dat, ptr, tmp);
|
||||
@@ -371,7 +380,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
p = strstr(conn->data->state.buffer, "P=");
|
||||
if(!p) {
|
||||
Curl_failf(conn->data, "Bad reply from server");
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
return CURLE_FTP_WEIRD_SERVER_REPLY;
|
||||
}
|
||||
name = p + 2;
|
||||
@@ -400,7 +409,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
if(Curl_base64_encode(conn->data, (char *)tktcopy.dat, tktcopy.length, &p)
|
||||
< 1) {
|
||||
failf(conn->data, "Out of memory base64-encoding.");
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
memset (tktcopy.dat, 0, tktcopy.length);
|
||||
@@ -413,7 +422,7 @@ CURLcode Curl_krb_kauth(struct connectdata *conn)
|
||||
result = Curl_GetFTPResponse(&nread, conn, NULL);
|
||||
if(result)
|
||||
return result;
|
||||
Curl_set_command_prot(conn, save);
|
||||
krb4_set_command_prot(conn, save);
|
||||
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
17
lib/krb4.h
17
lib/krb4.h
@@ -47,24 +47,9 @@ extern struct Curl_sec_client_mech Curl_krb5_client_mech;
|
||||
#endif
|
||||
|
||||
CURLcode Curl_krb_kauth(struct connectdata *conn);
|
||||
int Curl_sec_fprintf (struct connectdata *, FILE *, const char *, ...);
|
||||
int Curl_sec_getc (struct connectdata *conn, FILE *);
|
||||
int Curl_sec_putc (struct connectdata *conn, int, FILE *);
|
||||
int Curl_sec_read_msg (struct connectdata *conn, char *, int);
|
||||
|
||||
int Curl_sec_vfprintf(struct connectdata *, FILE *, const char *, va_list);
|
||||
int Curl_sec_fprintf2(struct connectdata *conn, FILE *f, const char *fmt, ...);
|
||||
int Curl_sec_vfprintf2(struct connectdata *conn, FILE *, const char *, va_list);
|
||||
|
||||
int Curl_sec_read_msg (struct connectdata *conn, char *, enum protection_level);
|
||||
void Curl_sec_end (struct connectdata *);
|
||||
CURLcode Curl_sec_login (struct connectdata *);
|
||||
void Curl_sec_prot (int, char **);
|
||||
int Curl_sec_request_prot (struct connectdata *conn, const char *level);
|
||||
int Curl_sec_set_protection_level(struct connectdata *conn);
|
||||
void Curl_sec_status (void);
|
||||
|
||||
enum protection_level Curl_set_command_prot(struct connectdata *,
|
||||
enum protection_level);
|
||||
|
||||
|
||||
#endif
|
||||
|
12
lib/krb5.c
12
lib/krb5.c
@@ -88,7 +88,7 @@ static int
|
||||
krb5_check_prot(void *app_data, int level)
|
||||
{
|
||||
(void)app_data; /* unused */
|
||||
if(level == prot_confidential)
|
||||
if(level == PROT_CONFIDENTIAL)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
@@ -150,7 +150,7 @@ krb5_encode(void *app_data, const void *from, int length, int level, void **to,
|
||||
dec.value = (void*)from;
|
||||
dec.length = length;
|
||||
maj = gss_seal(&min, *context,
|
||||
level == prot_private,
|
||||
level == PROT_PRIVATE,
|
||||
GSS_C_QOP_DEFAULT,
|
||||
&dec, &state, &enc);
|
||||
|
||||
@@ -259,8 +259,8 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
gssresp = NULL;
|
||||
}
|
||||
|
||||
if(maj != GSS_S_COMPLETE && maj != GSS_S_CONTINUE_NEEDED) {
|
||||
Curl_infof(data, "Error creating security context");
|
||||
if(GSS_ERROR(maj)) {
|
||||
Curl_infof(data, "Error creating security context\n");
|
||||
ret = AUTH_ERROR;
|
||||
break;
|
||||
}
|
||||
@@ -268,7 +268,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
if(output_buffer.length != 0) {
|
||||
if(Curl_base64_encode(data, (char *)output_buffer.value,
|
||||
output_buffer.length, &p) < 1) {
|
||||
Curl_infof(data, "Out of memory base64-encoding");
|
||||
Curl_infof(data, "Out of memory base64-encoding\n");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ krb5_auth(void *app_data, struct connectdata *conn)
|
||||
_gssresp.length = Curl_base64_decode(p + 5, (unsigned char **)
|
||||
&_gssresp.value);
|
||||
if(_gssresp.length < 1) {
|
||||
Curl_failf(data, "Out of memory base64-encoding");
|
||||
Curl_failf(data, "Out of memory base64-encoding\n");
|
||||
ret = AUTH_CONTINUE;
|
||||
break;
|
||||
}
|
||||
|
@@ -473,7 +473,7 @@ static void _ldap_trace (const char *fmt, ...)
|
||||
|
||||
if(do_trace == -1) {
|
||||
const char *env = getenv("CURL_TRACE");
|
||||
do_trace = (env && atoi(env) > 0);
|
||||
do_trace = (env && strtol(env, NULL, 10) > 0);
|
||||
}
|
||||
if(!do_trace)
|
||||
return;
|
||||
|
@@ -21,7 +21,7 @@ all: $(OBJ_DIR) curl_config.h $(CURL_LIB)
|
||||
$(CURL_LIB): $(OBJECTS)
|
||||
ar rs $@ $?
|
||||
|
||||
curl_config.h: config.dos
|
||||
curl_config.h: config-dos.h
|
||||
$(COPY) $^ $@
|
||||
|
||||
# clean generated files
|
||||
|
65
lib/multi.c
65
lib/multi.c
@@ -41,6 +41,7 @@
|
||||
#include "sendf.h"
|
||||
#include "timeval.h"
|
||||
#include "http.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -67,24 +68,25 @@ struct Curl_message {
|
||||
well!
|
||||
*/
|
||||
typedef enum {
|
||||
CURLM_STATE_INIT, /* start in this state */
|
||||
CURLM_STATE_CONNECT, /* resolve/connect has been sent off */
|
||||
CURLM_STATE_WAITRESOLVE, /* awaiting the resolve to finalize */
|
||||
CURLM_STATE_WAITCONNECT, /* awaiting the connect to finalize */
|
||||
CURLM_STATE_WAITPROXYCONNECT, /* awaiting proxy CONNECT to finalize */
|
||||
CURLM_STATE_PROTOCONNECT, /* completing the protocol-specific connect phase */
|
||||
CURLM_STATE_WAITDO, /* wait for our turn to send the request */
|
||||
CURLM_STATE_DO, /* start send off the request (part 1) */
|
||||
CURLM_STATE_DOING, /* sending off the request (part 1) */
|
||||
CURLM_STATE_DO_MORE, /* send off the request (part 2) */
|
||||
CURLM_STATE_DO_DONE, /* done sending off request */
|
||||
CURLM_STATE_WAITPERFORM, /* wait for our turn to read the response */
|
||||
CURLM_STATE_PERFORM, /* transfer data */
|
||||
CURLM_STATE_TOOFAST, /* wait because limit-rate exceeded */
|
||||
CURLM_STATE_DONE, /* post data transfer operation */
|
||||
CURLM_STATE_COMPLETED, /* operation complete */
|
||||
CURLM_STATE_MSGSENT, /* the operation complete message is sent */
|
||||
CURLM_STATE_LAST /* not a true state, never use this */
|
||||
CURLM_STATE_INIT, /* 0 - start in this state */
|
||||
CURLM_STATE_CONNECT, /* 1 - resolve/connect has been sent off */
|
||||
CURLM_STATE_WAITRESOLVE, /* 2 - awaiting the resolve to finalize */
|
||||
CURLM_STATE_WAITCONNECT, /* 3 - awaiting the connect to finalize */
|
||||
CURLM_STATE_WAITPROXYCONNECT, /* 4 - awaiting proxy CONNECT to finalize */
|
||||
CURLM_STATE_PROTOCONNECT, /* 5 - completing the protocol-specific connect
|
||||
phase */
|
||||
CURLM_STATE_WAITDO, /* 6 - wait for our turn to send the request */
|
||||
CURLM_STATE_DO, /* 7 - start send off the request (part 1) */
|
||||
CURLM_STATE_DOING, /* 8 - sending off the request (part 1) */
|
||||
CURLM_STATE_DO_MORE, /* 9 - send off the request (part 2) */
|
||||
CURLM_STATE_DO_DONE, /* 10 - done sending off request */
|
||||
CURLM_STATE_WAITPERFORM, /* 11 - wait for our turn to read the response */
|
||||
CURLM_STATE_PERFORM, /* 12 - transfer data */
|
||||
CURLM_STATE_TOOFAST, /* 13 - wait because limit-rate exceeded */
|
||||
CURLM_STATE_DONE, /* 14 - post data transfer operation */
|
||||
CURLM_STATE_COMPLETED, /* 15 - operation complete */
|
||||
CURLM_STATE_MSGSENT, /* 16 - the operation complete message is sent */
|
||||
CURLM_STATE_LAST /* 17 - not a true state, never use this */
|
||||
} CURLMstate;
|
||||
|
||||
/* we support N sockets per easy handle. Set the corresponding bit to what
|
||||
@@ -976,12 +978,15 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
/* Make sure we set the connection's current owner */
|
||||
easy->easy_conn->data = data;
|
||||
|
||||
if(easy->easy_conn && (easy->state >= CURLM_STATE_CONNECT)) {
|
||||
/* we need to wait for the connect state as only then is the
|
||||
start time stored */
|
||||
if(easy->easy_conn &&
|
||||
(easy->state >= CURLM_STATE_CONNECT) &&
|
||||
(easy->state < CURLM_STATE_COMPLETED)) {
|
||||
/* we need to wait for the connect state as only then is the start time
|
||||
stored, but we must not check already completed handles */
|
||||
|
||||
timeout_ms = Curl_timeleft(easy->easy_conn, &now,
|
||||
easy->state <= CURLM_STATE_WAITDO);
|
||||
(easy->state <= CURLM_STATE_WAITDO)?
|
||||
TRUE:FALSE);
|
||||
|
||||
if(timeout_ms < 0) {
|
||||
/* Handle timed out */
|
||||
@@ -1632,7 +1637,8 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
||||
}
|
||||
|
||||
if(disconnect_conn) {
|
||||
Curl_disconnect(easy->easy_conn); /* disconnect properly */
|
||||
/* disconnect properly */
|
||||
Curl_disconnect(easy->easy_conn, /* dead_connection */ FALSE);
|
||||
|
||||
/* This is where we make sure that the easy_conn pointer is reset.
|
||||
We don't have to do this in every case block above where a
|
||||
@@ -1757,7 +1763,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle)
|
||||
for(i=0; i< multi->connc->num; i++) {
|
||||
if(multi->connc->connects[i] &&
|
||||
multi->connc->connects[i]->protocol & PROT_CLOSEACTION) {
|
||||
Curl_disconnect(multi->connc->connects[i]);
|
||||
Curl_disconnect(multi->connc->connects[i], /* dead_connection */ FALSE);
|
||||
multi->connc->connects[i] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -1836,7 +1842,7 @@ CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue)
|
||||
/* remove the extracted entry */
|
||||
Curl_llist_remove(multi->msglist, e, NULL);
|
||||
|
||||
*msgs_in_queue = (int)Curl_llist_count(multi->msglist);
|
||||
*msgs_in_queue = curlx_uztosi(Curl_llist_count(multi->msglist));
|
||||
|
||||
return &msg->extmsg;
|
||||
}
|
||||
@@ -2139,7 +2145,7 @@ static CURLMcode multi_socket(struct Curl_multi *multi,
|
||||
|
||||
now.tv_usec += 40000; /* compensate for bad precision timers that might've
|
||||
triggered too early */
|
||||
if(now.tv_usec > 1000000) {
|
||||
if(now.tv_usec >= 1000000) {
|
||||
now.tv_sec++;
|
||||
now.tv_usec -= 1000000;
|
||||
}
|
||||
@@ -2566,15 +2572,12 @@ void Curl_expire(struct SessionHandle *data, long milli)
|
||||
}
|
||||
else {
|
||||
struct timeval set;
|
||||
int rest;
|
||||
|
||||
set = Curl_tvnow();
|
||||
set.tv_sec += milli/1000;
|
||||
set.tv_usec += (milli%1000)*1000;
|
||||
|
||||
rest = (int)(set.tv_usec - 1000000);
|
||||
if(rest > 0) {
|
||||
/* bigger than a full microsec */
|
||||
if(set.tv_usec >= 1000000) {
|
||||
set.tv_sec++;
|
||||
set.tv_usec -= 1000000;
|
||||
}
|
||||
@@ -2666,7 +2669,7 @@ static void multi_connc_remove_handle(struct Curl_multi *multi,
|
||||
data->state.shared_conn = multi;
|
||||
else {
|
||||
/* out of memory - so much for graceful shutdown */
|
||||
Curl_disconnect(conn);
|
||||
Curl_disconnect(conn, /* dead_connection */ FALSE);
|
||||
multi->connc->connects[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ static CURLcode ldap_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode ldap_done(struct connectdata *conn, CURLcode, bool);
|
||||
static CURLcode ldap_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode ldap_connecting(struct connectdata *conn, bool *done);
|
||||
static CURLcode ldap_disconnect(struct connectdata *conn);
|
||||
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
|
||||
static Curl_recv ldap_recv;
|
||||
|
||||
@@ -188,7 +188,7 @@ static CURLcode ldap_connect(struct connectdata *conn, bool *done)
|
||||
if (conn->protocol & PROT_SSL)
|
||||
*ptr++ = 's';
|
||||
snprintf(ptr, sizeof(hosturl)-(ptr-hosturl), "://%s:%d",
|
||||
conn->host.name, conn->port);
|
||||
conn->host.name, conn->remote_port);
|
||||
|
||||
rc = ldap_init_fd(conn->sock[FIRSTSOCKET], li->proto, hosturl, &li->ld);
|
||||
if (rc) {
|
||||
@@ -344,9 +344,10 @@ retry:
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static CURLcode ldap_disconnect(struct connectdata *conn)
|
||||
static CURLcode ldap_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
ldapconninfo *li = conn->proto.generic;
|
||||
(void) dead_connection;
|
||||
|
||||
if (li) {
|
||||
if (li->ld) {
|
||||
@@ -499,6 +500,8 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
|
||||
|
||||
if (bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
|
||||
binary = 1;
|
||||
else
|
||||
binary = 0;
|
||||
|
||||
for (i=0; bvals[i].bv_val != NULL; i++) {
|
||||
int binval = 0;
|
||||
@@ -509,14 +512,14 @@ static ssize_t ldap_recv(struct connectdata *conn, int sockindex, char *buf,
|
||||
|
||||
if (!binary) {
|
||||
/* check for leading or trailing whitespace */
|
||||
if (isspace(bvals[i].bv_val[0]) ||
|
||||
isspace(bvals[i].bv_val[bvals[i].bv_len-1])) {
|
||||
if (ISSPACE(bvals[i].bv_val[0]) ||
|
||||
ISSPACE(bvals[i].bv_val[bvals[i].bv_len-1])) {
|
||||
binval = 1;
|
||||
} else {
|
||||
/* check for unprintable characters */
|
||||
unsigned int j;
|
||||
for (j=0; j<bvals[i].bv_len; j++)
|
||||
if (!isprint(bvals[i].bv_val[j])) {
|
||||
if (!ISPRINT(bvals[i].bv_val[j])) {
|
||||
binval = 1;
|
||||
break;
|
||||
}
|
||||
|
@@ -83,6 +83,7 @@
|
||||
|
||||
#include <curl/curl.h>
|
||||
#include "rawstr.h"
|
||||
#include "warnless.h"
|
||||
#include "parsedate.h"
|
||||
|
||||
const char * const Curl_wkday[] =
|
||||
@@ -378,7 +379,7 @@ int Curl_parsedate(const char *date, time_t *output)
|
||||
secnum = 0;
|
||||
}
|
||||
else {
|
||||
val = (int)strtol(date, &end, 10);
|
||||
val = curlx_sltosi(strtol(date, &end, 10));
|
||||
|
||||
if((tzoff == -1) &&
|
||||
((end - date) == 4) &&
|
||||
|
@@ -217,11 +217,12 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
|
||||
#endif /* CURL_DOES_CONVERSIONS */
|
||||
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
conn->data_prot = prot_cmd;
|
||||
conn->data_prot = PROT_CMD;
|
||||
#endif
|
||||
res = Curl_write(conn, conn->sock[FIRSTSOCKET], sptr, write_len,
|
||||
&bytes_written);
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
DEBUGASSERT(data_sec > PROT_NONE && data_sec < PROT_LAST);
|
||||
conn->data_prot = data_sec;
|
||||
#endif
|
||||
|
||||
@@ -331,13 +332,13 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
|
||||
int res;
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
enum protection_level prot = conn->data_prot;
|
||||
|
||||
conn->data_prot = 0;
|
||||
conn->data_prot = PROT_CLEAR;
|
||||
#endif
|
||||
DEBUGASSERT((ptr+BUFSIZE-pp->nread_resp) <= (buf+BUFSIZE+1));
|
||||
res = Curl_read(conn, sockfd, ptr, BUFSIZE-pp->nread_resp,
|
||||
&gotbytes);
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
DEBUGASSERT(prot > PROT_NONE && prot < PROT_LAST);
|
||||
conn->data_prot = prot;
|
||||
#endif
|
||||
if(res == CURLE_AGAIN)
|
||||
@@ -362,7 +363,7 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
|
||||
else if(gotbytes <= 0) {
|
||||
keepon = FALSE;
|
||||
result = CURLE_RECV_ERROR;
|
||||
failf(data, "FTP response reading failed");
|
||||
failf(data, "response reading failed");
|
||||
}
|
||||
else {
|
||||
/* we got a whole chunk of data, which can be anything from one
|
||||
|
@@ -221,7 +221,7 @@ Curl_polarssl_connect(struct connectdata *conn,
|
||||
ssl_set_dbg(&conn->ssl[sockindex].ssl, polarssl_debug, data);
|
||||
#endif
|
||||
|
||||
do {
|
||||
for(;;) {
|
||||
if (!(ret = ssl_handshake(&conn->ssl[sockindex].ssl))) {
|
||||
break;
|
||||
} else if(ret != POLARSSL_ERR_NET_TRY_AGAIN) {
|
||||
@@ -250,7 +250,7 @@ Curl_polarssl_connect(struct connectdata *conn,
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (1);
|
||||
}
|
||||
|
||||
infof(data, "PolarSSL: Handshake complete, cipher is %s\n",
|
||||
ssl_get_cipher(&conn->ssl[sockindex].ssl));
|
||||
|
@@ -101,7 +101,7 @@ static CURLcode pop3_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode pop3_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode pop3_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode pop3_disconnect(struct connectdata *conn);
|
||||
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static CURLcode pop3_multi_statemach(struct connectdata *conn, bool *done);
|
||||
static int pop3_getsock(struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
@@ -817,7 +817,7 @@ static CURLcode pop3_quit(struct connectdata *conn)
|
||||
* Disconnect from an POP3 server. Cleanup protocol-specific per-connection
|
||||
* resources. BLOCKING.
|
||||
*/
|
||||
static CURLcode pop3_disconnect(struct connectdata *conn)
|
||||
static CURLcode pop3_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
struct pop3_conn *pop3c= &conn->proto.pop3c;
|
||||
|
||||
@@ -828,7 +828,7 @@ static CURLcode pop3_disconnect(struct connectdata *conn)
|
||||
|
||||
/* The POP3 session may or may not have been allocated/setup at this
|
||||
point! */
|
||||
if(pop3c->pp.conn)
|
||||
if(!dead_connection && pop3c->pp.conn)
|
||||
(void)pop3_quit(conn); /* ignore errors on the LOGOUT */
|
||||
|
||||
|
||||
|
@@ -117,7 +117,9 @@ CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done)
|
||||
return httpStatus;
|
||||
}
|
||||
|
||||
CURLcode Curl_rtsp_disconnect(struct connectdata *conn) {
|
||||
CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
(void) dead_connection;
|
||||
Curl_safefree(conn->proto.rtspc.rtp_buf);
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ CURLcode Curl_rtsp_rtp_readwrite(struct SessionHandle *data,
|
||||
CURLcode Curl_rtsp(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_rtsp_done(struct connectdata *conn, CURLcode, bool premature);
|
||||
CURLcode Curl_rtsp_connect(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_rtsp_disconnect(struct connectdata *conn);
|
||||
CURLcode Curl_rtsp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
|
||||
CURLcode Curl_rtsp_parseheader(struct connectdata *conn, char *header);
|
||||
|
||||
|
@@ -72,10 +72,10 @@ static const struct {
|
||||
enum protection_level level;
|
||||
const char *name;
|
||||
} level_names[] = {
|
||||
{ prot_clear, "clear" },
|
||||
{ prot_safe, "safe" },
|
||||
{ prot_confidential, "confidential" },
|
||||
{ prot_private, "private" }
|
||||
{ PROT_CLEAR, "clear" },
|
||||
{ PROT_SAFE, "safe" },
|
||||
{ PROT_CONFIDENTIAL, "confidential" },
|
||||
{ PROT_PRIVATE, "private" }
|
||||
};
|
||||
|
||||
static enum protection_level
|
||||
@@ -85,22 +85,22 @@ name_to_level(const char *name)
|
||||
for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
|
||||
if(checkprefix(name, level_names[i].name))
|
||||
return level_names[i].level;
|
||||
return (enum protection_level)-1;
|
||||
return PROT_NONE;
|
||||
}
|
||||
|
||||
/* Convert a protocol |level| to its char representation.
|
||||
We take an int to catch programming mistakes. */
|
||||
static char level_to_char(int level) {
|
||||
switch(level) {
|
||||
case prot_clear:
|
||||
case PROT_CLEAR:
|
||||
return 'C';
|
||||
case prot_safe:
|
||||
case PROT_SAFE:
|
||||
return 'S';
|
||||
case prot_confidential:
|
||||
case PROT_CONFIDENTIAL:
|
||||
return 'E';
|
||||
case prot_private:
|
||||
case PROT_PRIVATE:
|
||||
return 'P';
|
||||
case prot_cmd:
|
||||
case PROT_CMD:
|
||||
/* Fall through */
|
||||
default:
|
||||
/* Those 2 cases should not be reached! */
|
||||
@@ -247,7 +247,7 @@ static ssize_t sec_recv(struct connectdata *conn, int sockindex,
|
||||
*err = CURLE_OK;
|
||||
|
||||
/* Handle clear text response. */
|
||||
if(conn->sec_complete == 0 || conn->data_prot == prot_clear)
|
||||
if(conn->sec_complete == 0 || conn->data_prot == PROT_CLEAR)
|
||||
return read(fd, buffer, len);
|
||||
|
||||
if(conn->in_buffer.eof_flag) {
|
||||
@@ -288,11 +288,13 @@ static void do_sec_send(struct connectdata *conn, curl_socket_t fd,
|
||||
char *buffer;
|
||||
char *cmd_buffer;
|
||||
enum protection_level prot_level = conn->data_prot;
|
||||
bool iscmd = prot_level == prot_cmd;
|
||||
bool iscmd = prot_level == PROT_CMD;
|
||||
|
||||
DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);
|
||||
|
||||
if(iscmd) {
|
||||
if(!strncmp(from, "PASS ", 5) || !strncmp(from, "ACCT ", 5))
|
||||
prot_level = prot_private;
|
||||
prot_level = PROT_PRIVATE;
|
||||
else
|
||||
prot_level = conn->command_prot;
|
||||
}
|
||||
@@ -303,14 +305,14 @@ static void do_sec_send(struct connectdata *conn, curl_socket_t fd,
|
||||
if(bytes > 0) {
|
||||
static const char *enc = "ENC ";
|
||||
static const char *mic = "MIC ";
|
||||
if(prot_level == prot_private)
|
||||
if(prot_level == PROT_PRIVATE)
|
||||
socket_write(conn, fd, enc, 4);
|
||||
else
|
||||
socket_write(conn, fd, mic, 4);
|
||||
|
||||
socket_write(conn, fd, cmd_buffer, bytes);
|
||||
socket_write(conn, fd, "\r\n", 2);
|
||||
infof(conn->data, "Send: %s%s\n", prot_level == prot_private?enc:mic,
|
||||
infof(conn->data, "Send: %s%s\n", prot_level == PROT_PRIVATE?enc:mic,
|
||||
cmd_buffer);
|
||||
free(cmd_buffer);
|
||||
}
|
||||
@@ -355,8 +357,8 @@ static ssize_t sec_send(struct connectdata *conn, int sockindex,
|
||||
return sec_write(conn, fd, buffer, len);
|
||||
}
|
||||
|
||||
/* FIXME: |level| should not be an int but a struct protection_level */
|
||||
int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level)
|
||||
int Curl_sec_read_msg(struct connectdata *conn, char *buffer,
|
||||
enum protection_level level)
|
||||
{
|
||||
/* decoded_len should be size_t or ssize_t but conn->mech->decode returns an
|
||||
int */
|
||||
@@ -364,6 +366,8 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level)
|
||||
char *buf;
|
||||
int ret_code;
|
||||
|
||||
DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
|
||||
|
||||
decoded_len = Curl_base64_decode(buffer + 4, (unsigned char **)&buf);
|
||||
if(decoded_len <= 0) {
|
||||
free(buf);
|
||||
@@ -399,22 +403,16 @@ int Curl_sec_read_msg(struct connectdata *conn, char *buffer, int level)
|
||||
return ret_code;
|
||||
}
|
||||
|
||||
enum protection_level
|
||||
Curl_set_command_prot(struct connectdata *conn, enum protection_level level)
|
||||
{
|
||||
enum protection_level old = conn->command_prot;
|
||||
conn->command_prot = level;
|
||||
return old;
|
||||
}
|
||||
|
||||
/* FIXME: The error code returned here is never checked. */
|
||||
int Curl_sec_set_protection_level(struct connectdata *conn)
|
||||
static int sec_set_protection_level(struct connectdata *conn)
|
||||
{
|
||||
int code;
|
||||
char* pbsz;
|
||||
static unsigned int buffer_size = 1 << 20; /* 1048576 */
|
||||
enum protection_level level = conn->request_data_prot;
|
||||
|
||||
DEBUGASSERT(level > PROT_NONE && level < PROT_LAST);
|
||||
|
||||
if(!conn->sec_complete) {
|
||||
infof(conn->data, "Trying to change the protection level after the"
|
||||
"completion of the data exchange.\n");
|
||||
@@ -457,7 +455,7 @@ int Curl_sec_set_protection_level(struct connectdata *conn)
|
||||
}
|
||||
|
||||
conn->data_prot = level;
|
||||
if(level == prot_private)
|
||||
if(level == PROT_PRIVATE)
|
||||
conn->command_prot = level;
|
||||
|
||||
return 0;
|
||||
@@ -466,10 +464,11 @@ int Curl_sec_set_protection_level(struct connectdata *conn)
|
||||
int
|
||||
Curl_sec_request_prot(struct connectdata *conn, const char *level)
|
||||
{
|
||||
int l = name_to_level(level);
|
||||
if(l == -1)
|
||||
enum protection_level l = name_to_level(level);
|
||||
if(l == PROT_NONE)
|
||||
return -1;
|
||||
conn->request_data_prot = (enum protection_level)l;
|
||||
DEBUGASSERT(l > PROT_NONE && l < PROT_LAST);
|
||||
conn->request_data_prot = l;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -498,7 +497,7 @@ static CURLcode choose_mech(struct connectdata *conn)
|
||||
conn->app_data = tmp_allocation;
|
||||
|
||||
if((*mech)->init) {
|
||||
ret = (*mech)->init(conn);
|
||||
ret = (*mech)->init(conn->app_data);
|
||||
if(ret != 0) {
|
||||
infof(data, "Failed initialization for %s. Skipping it.\n", mech_name);
|
||||
continue;
|
||||
@@ -548,10 +547,10 @@ static CURLcode choose_mech(struct connectdata *conn)
|
||||
conn->send[FIRSTSOCKET] = sec_send;
|
||||
conn->recv[SECONDARYSOCKET] = sec_recv;
|
||||
conn->send[SECONDARYSOCKET] = sec_send;
|
||||
conn->command_prot = prot_safe;
|
||||
conn->command_prot = PROT_SAFE;
|
||||
/* Set the requested protection level */
|
||||
/* BLOCKING */
|
||||
Curl_sec_set_protection_level(conn);
|
||||
(void)sec_set_protection_level(conn);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -583,7 +582,7 @@ Curl_sec_end(struct connectdata *conn)
|
||||
conn->in_buffer.eof_flag = 0;
|
||||
}
|
||||
conn->sec_complete = 0;
|
||||
conn->data_prot = (enum protection_level)0;
|
||||
conn->data_prot = PROT_CLEAR;
|
||||
conn->mech = NULL;
|
||||
}
|
||||
|
||||
|
@@ -301,6 +301,7 @@ ssize_t Curl_send_plain(struct connectdata *conn, int num,
|
||||
} else {
|
||||
failf(conn->data, "Send failure: %s",
|
||||
Curl_strerror(conn, err));
|
||||
conn->data->state.os_errno = err;
|
||||
*code = CURLE_SEND_ERROR;
|
||||
}
|
||||
}
|
||||
@@ -355,6 +356,7 @@ ssize_t Curl_recv_plain(struct connectdata *conn, int num, char *buf,
|
||||
} else {
|
||||
failf(conn->data, "Recv failure: %s",
|
||||
Curl_strerror(conn, err));
|
||||
conn->data->state.os_errno = err;
|
||||
*code = CURLE_RECV_ERROR;
|
||||
}
|
||||
}
|
||||
|
14
lib/smtp.c
14
lib/smtp.c
@@ -92,6 +92,7 @@
|
||||
#include "curl_md5.h"
|
||||
#include "curl_hmac.h"
|
||||
#include "curl_gethostname.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -106,7 +107,7 @@ static CURLcode smtp_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode smtp_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode smtp_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode smtp_disconnect(struct connectdata *conn);
|
||||
static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done);
|
||||
static int smtp_getsock(struct connectdata *conn,
|
||||
curl_socket_t *socks,
|
||||
@@ -225,8 +226,8 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
|
||||
if(len < 4 || !ISDIGIT(line[0]) || !ISDIGIT(line[1]) || !ISDIGIT(line[2]))
|
||||
return FALSE; /* Nothing for us. */
|
||||
|
||||
if((result = line[3] == ' '))
|
||||
*resp = atoi(line);
|
||||
if((result = (line[3] == ' ')) != 0)
|
||||
*resp = curlx_sltosi(strtol(line, NULL, 10));
|
||||
|
||||
line += 4;
|
||||
len -= 4;
|
||||
@@ -676,7 +677,8 @@ static CURLcode smtp_state_authcram_resp(struct connectdata *conn,
|
||||
if(++l) {
|
||||
chlg64[l] = '\0';
|
||||
|
||||
if(!(chlglen = Curl_base64_decode(chlg64, &chlg)))
|
||||
chlglen = Curl_base64_decode(chlg64, &chlg);
|
||||
if(!chlglen)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
@@ -1308,7 +1310,7 @@ static CURLcode smtp_quit(struct connectdata *conn)
|
||||
* Disconnect from an SMTP server. Cleanup protocol-specific per-connection
|
||||
* resources. BLOCKING.
|
||||
*/
|
||||
static CURLcode smtp_disconnect(struct connectdata *conn)
|
||||
static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
struct smtp_conn *smtpc= &conn->proto.smtpc;
|
||||
|
||||
@@ -1319,7 +1321,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn)
|
||||
|
||||
/* The SMTP session may or may not have been allocated/setup at this
|
||||
point! */
|
||||
if(smtpc->pp.conn)
|
||||
if(!dead_connection && smtpc->pp.conn)
|
||||
(void)smtp_quit(conn); /* ignore errors on the LOGOUT */
|
||||
|
||||
Curl_pp_disconnect(&smtpc->pp);
|
||||
|
65
lib/ssh.c
65
lib/ssh.c
@@ -101,6 +101,7 @@
|
||||
#include "strtoofft.h"
|
||||
#include "multiif.h"
|
||||
#include "select.h"
|
||||
#include "warnless.h"
|
||||
|
||||
#define _MPRINTF_REPLACE /* use our functions only */
|
||||
#include <curl/mprintf.h>
|
||||
@@ -116,9 +117,9 @@
|
||||
|
||||
/* Local functions: */
|
||||
static const char *sftp_libssh2_strerror(unsigned long err);
|
||||
static LIBSSH2_ALLOC_FUNC(libssh2_malloc);
|
||||
static LIBSSH2_REALLOC_FUNC(libssh2_realloc);
|
||||
static LIBSSH2_FREE_FUNC(libssh2_free);
|
||||
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc);
|
||||
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc);
|
||||
static LIBSSH2_FREE_FUNC(my_libssh2_free);
|
||||
|
||||
static CURLcode get_pathname(const char **cpp, char **path);
|
||||
|
||||
@@ -134,13 +135,13 @@ static CURLcode scp_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode scp_doing(struct connectdata *conn,
|
||||
bool *dophase_done);
|
||||
static CURLcode scp_disconnect(struct connectdata *conn);
|
||||
static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
|
||||
static CURLcode sftp_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
static CURLcode sftp_doing(struct connectdata *conn,
|
||||
bool *dophase_done);
|
||||
static CURLcode sftp_disconnect(struct connectdata *conn);
|
||||
static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static
|
||||
CURLcode sftp_perform(struct connectdata *conn,
|
||||
bool *connected,
|
||||
@@ -301,19 +302,19 @@ static CURLcode libssh2_session_error_to_CURLE(int err)
|
||||
return CURLE_SSH;
|
||||
}
|
||||
|
||||
static LIBSSH2_ALLOC_FUNC(libssh2_malloc)
|
||||
static LIBSSH2_ALLOC_FUNC(my_libssh2_malloc)
|
||||
{
|
||||
(void)abstract; /* arg not used */
|
||||
return malloc(count);
|
||||
}
|
||||
|
||||
static LIBSSH2_REALLOC_FUNC(libssh2_realloc)
|
||||
static LIBSSH2_REALLOC_FUNC(my_libssh2_realloc)
|
||||
{
|
||||
(void)abstract; /* arg not used */
|
||||
return realloc(ptr, count);
|
||||
}
|
||||
|
||||
static LIBSSH2_FREE_FUNC(libssh2_free)
|
||||
static LIBSSH2_FREE_FUNC(my_libssh2_free)
|
||||
{
|
||||
(void)abstract; /* arg not used */
|
||||
free(ptr);
|
||||
@@ -496,6 +497,13 @@ static int sshkeycallback(CURL *easy,
|
||||
(libssh2_uint64_t)d, 0, 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* libssh2 1.2.8 fixed the problem with 32bit ints used for sockets on win64.
|
||||
*/
|
||||
#ifdef HAVE_LIBSSH2_SESSION_HANDSHAKE
|
||||
#define libssh2_session_startup(x,y) libssh2_session_handshake(x,y)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ssh_statemach_act() runs the SSH state machine as far as it can without
|
||||
* blocking and without reaching the end. The data the pointer 'block' points
|
||||
@@ -1431,7 +1439,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
|
||||
if(data->state.resume_from != 0) {
|
||||
LIBSSH2_SFTP_ATTRIBUTES attrs;
|
||||
if(data->state.resume_from< 0) {
|
||||
if(data->state.resume_from < 0) {
|
||||
rc = libssh2_sftp_stat_ex(sshc->sftp_session, sftp_scp->path,
|
||||
(unsigned int)strlen(sftp_scp->path),
|
||||
LIBSSH2_SFTP_STAT, &attrs);
|
||||
@@ -1534,21 +1542,17 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
/* seekerr == CURL_SEEKFUNC_CANTSEEK (can't seek to offset) */
|
||||
else {
|
||||
curl_off_t passed=0;
|
||||
curl_off_t readthisamountnow;
|
||||
curl_off_t actuallyread;
|
||||
do {
|
||||
readthisamountnow = (data->state.resume_from - passed);
|
||||
size_t readthisamountnow =
|
||||
(data->state.resume_from - passed > CURL_OFF_T_C(BUFSIZE)) ?
|
||||
BUFSIZE : curlx_sotouz(data->state.resume_from - passed);
|
||||
|
||||
if(readthisamountnow > BUFSIZE)
|
||||
readthisamountnow = BUFSIZE;
|
||||
|
||||
actuallyread =
|
||||
(curl_off_t) conn->fread_func(data->state.buffer, 1,
|
||||
(size_t)readthisamountnow,
|
||||
conn->fread_in);
|
||||
size_t actuallyread =
|
||||
conn->fread_func(data->state.buffer, 1, readthisamountnow,
|
||||
conn->fread_in);
|
||||
|
||||
passed += actuallyread;
|
||||
if((actuallyread <= 0) || (actuallyread > readthisamountnow)) {
|
||||
if((actuallyread == 0) || (actuallyread > readthisamountnow)) {
|
||||
/* this checks for greater-than only to make sure that the
|
||||
CURL_READFUNC_ABORT return code still aborts */
|
||||
failf(data, "Failed to read data");
|
||||
@@ -1559,7 +1563,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
}
|
||||
|
||||
/* now, decrease the size of the read */
|
||||
if(data->set.infilesize>0) {
|
||||
if(data->set.infilesize > 0) {
|
||||
data->set.infilesize -= data->state.resume_from;
|
||||
data->req.size = data->set.infilesize;
|
||||
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
||||
@@ -1567,7 +1571,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
|
||||
SFTP_SEEK(sshc->sftp_handle, data->state.resume_from);
|
||||
}
|
||||
if(data->set.infilesize>0) {
|
||||
if(data->set.infilesize > 0) {
|
||||
data->req.size = data->set.infilesize;
|
||||
Curl_pgrsSetUploadSize(data, data->set.infilesize);
|
||||
}
|
||||
@@ -1928,7 +1932,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
char *ptr2;
|
||||
|
||||
from=curlx_strtoofft(conn->data->state.range, &ptr, 0);
|
||||
while(*ptr && (isspace((int)*ptr) || (*ptr=='-')))
|
||||
while(*ptr && (ISSPACE(*ptr) || (*ptr=='-')))
|
||||
ptr++;
|
||||
to=curlx_strtoofft(ptr, &ptr2, 0);
|
||||
if((ptr == ptr2) /* no "to" value given */
|
||||
@@ -1962,7 +1966,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
|
||||
/* We can resume if we can seek to the resume position */
|
||||
if(data->state.resume_from) {
|
||||
if(data->state.resume_from< 0) {
|
||||
if(data->state.resume_from < 0) {
|
||||
/* We're supposed to download the last abs(from) bytes */
|
||||
if((curl_off_t)attrs.filesize < -data->state.resume_from) {
|
||||
failf(data, "Offset (%"
|
||||
@@ -1971,7 +1975,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
|
||||
return CURLE_BAD_DOWNLOAD_RESUME;
|
||||
}
|
||||
/* download from where? */
|
||||
data->state.resume_from = attrs.filesize - data->state.resume_from;
|
||||
data->state.resume_from += attrs.filesize;
|
||||
}
|
||||
else {
|
||||
if((curl_off_t)attrs.filesize < data->state.resume_from) {
|
||||
@@ -2543,8 +2547,9 @@ static CURLcode ssh_connect(struct connectdata *conn, bool *done)
|
||||
sock = conn->sock[FIRSTSOCKET];
|
||||
#endif /* CURL_LIBSSH2_DEBUG */
|
||||
|
||||
ssh->ssh_session = libssh2_session_init_ex(libssh2_malloc, libssh2_free,
|
||||
libssh2_realloc, conn);
|
||||
ssh->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
|
||||
my_libssh2_free,
|
||||
my_libssh2_realloc, conn);
|
||||
if(ssh->ssh_session == NULL) {
|
||||
failf(data, "Failure initialising ssh session");
|
||||
return CURLE_FAILED_INIT;
|
||||
@@ -2684,10 +2689,11 @@ static CURLcode ssh_do(struct connectdata *conn, bool *done)
|
||||
/* BLOCKING, but the function is using the state machine so the only reason
|
||||
this is still blocking is that the multi interface code has no support for
|
||||
disconnecting operations that takes a while */
|
||||
static CURLcode scp_disconnect(struct connectdata *conn)
|
||||
static CURLcode scp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct ssh_conn *ssh = &conn->proto.sshc;
|
||||
(void) dead_connection;
|
||||
|
||||
Curl_safefree(conn->data->state.proto.ssh);
|
||||
conn->data->state.proto.ssh = NULL;
|
||||
@@ -2848,9 +2854,10 @@ static CURLcode sftp_doing(struct connectdata *conn,
|
||||
/* BLOCKING, but the function is using the state machine so the only reason
|
||||
this is still blocking is that the multi interface code has no support for
|
||||
disconnecting operations that takes a while */
|
||||
static CURLcode sftp_disconnect(struct connectdata *conn)
|
||||
static CURLcode sftp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
(void) dead_connection;
|
||||
|
||||
DEBUGF(infof(conn->data, "SSH DISCONNECT starts now\n"));
|
||||
|
||||
|
@@ -1049,7 +1049,7 @@ static int asn1_output(const ASN1_UTCTIME *tm,
|
||||
|
||||
static int hostmatch(const char *hostname, const char *pattern)
|
||||
{
|
||||
while(1) {
|
||||
for(;;) {
|
||||
char c = *pattern++;
|
||||
|
||||
if(c == '\0')
|
||||
@@ -2371,6 +2371,12 @@ ossl_connect_common(struct connectdata *conn,
|
||||
long timeout_ms;
|
||||
int what;
|
||||
|
||||
/* check if the connection has already been established */
|
||||
if(ssl_connection_complete == connssl->state) {
|
||||
*done = TRUE;
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
if(ssl_connect_1==connssl->connecting_state) {
|
||||
/* Find out how much more time we're allowed */
|
||||
timeout_ms = Curl_timeleft(conn, NULL, TRUE);
|
||||
|
@@ -166,7 +166,7 @@ typedef struct tftp_state_data {
|
||||
static CURLcode tftp_rx(tftp_state_data_t *state, tftp_event_t event) ;
|
||||
static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event) ;
|
||||
static CURLcode tftp_connect(struct connectdata *conn, bool *done);
|
||||
static CURLcode tftp_disconnect(struct connectdata *conn);
|
||||
static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection);
|
||||
static CURLcode tftp_do(struct connectdata *conn, bool *done);
|
||||
static CURLcode tftp_done(struct connectdata *conn,
|
||||
CURLcode, bool premature);
|
||||
@@ -738,7 +738,7 @@ static CURLcode tftp_tx(tftp_state_data_t *state, tftp_event_t event)
|
||||
}
|
||||
else {
|
||||
/* Re-send the data packet */
|
||||
sbytes = sendto(state->sockfd, (void *)&state->spacket,
|
||||
sbytes = sendto(state->sockfd, (void *)&state->spacket.data,
|
||||
4+state->sbytes, SEND_4TH_ARG,
|
||||
(struct sockaddr *)&state->remote_addr,
|
||||
state->remote_addrlen);
|
||||
@@ -925,9 +925,10 @@ static CURLcode tftp_state_machine(tftp_state_data_t *state,
|
||||
* The disconnect callback
|
||||
*
|
||||
**********************************************************/
|
||||
static CURLcode tftp_disconnect(struct connectdata *conn)
|
||||
static CURLcode tftp_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
tftp_state_data_t *state = conn->proto.tftpc;
|
||||
(void) dead_connection;
|
||||
|
||||
/* done, free dynamically allocated pkt buffers */
|
||||
if(state) {
|
||||
|
@@ -1382,6 +1382,46 @@ Transfer(struct connectdata *conn)
|
||||
return CURLE_OK;
|
||||
}
|
||||
|
||||
static void loadhostpairs(struct SessionHandle *data)
|
||||
{
|
||||
struct curl_slist *hostp;
|
||||
char hostname[256];
|
||||
char address[256];
|
||||
int port;
|
||||
|
||||
for(hostp = data->change.resolve; hostp; hostp = hostp->next ) {
|
||||
if(!hostp->data)
|
||||
continue;
|
||||
if(hostp->data[0] == '-') {
|
||||
/* mark an entry for removal */
|
||||
}
|
||||
else if(3 == sscanf(hostp->data, "%255[^:]:%d:%255s", hostname, &port,
|
||||
address)) {
|
||||
struct Curl_dns_entry *dns;
|
||||
Curl_addrinfo *addr;
|
||||
|
||||
addr = Curl_str2addr(address, port);
|
||||
if(!addr) {
|
||||
infof(data, "Resolve %s found illegal!\n", hostp->data);
|
||||
continue;
|
||||
}
|
||||
infof(data, "Added %s:%d:%s to DNS cache\n",
|
||||
hostname, port, address);
|
||||
|
||||
if(data->share)
|
||||
Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
|
||||
|
||||
/* put this host in the cache */
|
||||
dns = Curl_cache_addr(data, addr, hostname, port);
|
||||
|
||||
if(data->share)
|
||||
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||
}
|
||||
}
|
||||
data->change.resolve = NULL; /* dealt with now */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Curl_pretransfer() is called immediately before a transfer starts.
|
||||
*/
|
||||
@@ -1415,9 +1455,12 @@ CURLcode Curl_pretransfer(struct SessionHandle *data)
|
||||
data->info.wouldredirect = NULL;
|
||||
|
||||
/* If there is a list of cookie files to read, do it now! */
|
||||
if(data->change.cookielist) {
|
||||
if(data->change.cookielist)
|
||||
Curl_cookie_loadfiles(data);
|
||||
}
|
||||
|
||||
/* If there is a list of host pairs to deal with */
|
||||
if(data->change.resolve)
|
||||
loadhostpairs(data);
|
||||
|
||||
/* Allow data->set.use_port to set which port to use. This needs to be
|
||||
* disabled for example when we follow Location: headers to URLs using
|
||||
@@ -1916,7 +1959,7 @@ connect_host(struct SessionHandle *data,
|
||||
res = Curl_async_resolved(*conn, &protocol_done);
|
||||
else
|
||||
/* if we can't resolve, we kill this "connection" now */
|
||||
(void)Curl_disconnect(*conn);
|
||||
(void)Curl_disconnect(*conn, /* dead_connection */ FALSE);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
237
lib/url.c
237
lib/url.c
@@ -651,7 +651,7 @@ CURLcode Curl_ch_connc(struct SessionHandle *data,
|
||||
close handles not in use.
|
||||
*/
|
||||
for(i=newamount; i< c->num; i++)
|
||||
Curl_disconnect(c->connects[i]);
|
||||
Curl_disconnect(c->connects[i], /* dead_connection */ FALSE);
|
||||
|
||||
/* If the most recent connection is no longer valid, mark it
|
||||
invalid. */
|
||||
@@ -1006,7 +1006,21 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
* An FTP option that modifies an upload to create missing directories on
|
||||
* the server.
|
||||
*/
|
||||
data->set.ftp_create_missing_dirs = (int)va_arg(param, long);
|
||||
switch(va_arg(param, long)) {
|
||||
case 0:
|
||||
data->set.ftp_create_missing_dirs = 0;
|
||||
break;
|
||||
case 1:
|
||||
data->set.ftp_create_missing_dirs = 1;
|
||||
break;
|
||||
case 2:
|
||||
data->set.ftp_create_missing_dirs = 2;
|
||||
break;
|
||||
default:
|
||||
/* reserve other values for future use */
|
||||
result = CURLE_FAILED_INIT;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CURLOPT_SERVER_RESPONSE_TIMEOUT:
|
||||
/*
|
||||
@@ -1750,6 +1764,20 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
*/
|
||||
data->set.quote = va_arg(param, struct curl_slist *);
|
||||
break;
|
||||
case CURLOPT_RESOLVE:
|
||||
/*
|
||||
* List of NAME:[address] names to populate the DNS cache with
|
||||
* Prefix the NAME with dash (-) to _remove_ the name from the cache.
|
||||
*
|
||||
* Names added with this API will remain in the cache until explicitly
|
||||
* removed or the handle is cleaned up.
|
||||
*
|
||||
* This API can remove any name from the DNS cache, but only entries
|
||||
* that aren't actually in use right now will be pruned immediately.
|
||||
*/
|
||||
data->set.resolve = va_arg(param, struct curl_slist *);
|
||||
data->change.resolve = data->set.resolve;
|
||||
break;
|
||||
case CURLOPT_PROGRESSFUNCTION:
|
||||
/*
|
||||
* Progress callback function
|
||||
@@ -1987,13 +2015,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
/*
|
||||
* Set what local port to bind the socket to when performing an operation.
|
||||
*/
|
||||
data->set.localport = (unsigned short) va_arg(param, long);
|
||||
data->set.localport = curlx_sltous(va_arg(param, long));
|
||||
break;
|
||||
case CURLOPT_LOCALPORTRANGE:
|
||||
/*
|
||||
* Set number of local ports to try, starting with CURLOPT_LOCALPORT.
|
||||
*/
|
||||
data->set.localportrange = (int) va_arg(param, long);
|
||||
data->set.localportrange = curlx_sltosi(va_arg(param, long));
|
||||
break;
|
||||
case CURLOPT_KRBLEVEL:
|
||||
/*
|
||||
@@ -2166,13 +2194,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
data->set.max_filesize = va_arg(param, long);
|
||||
break;
|
||||
|
||||
#ifdef USE_SSL
|
||||
case CURLOPT_USE_SSL:
|
||||
/*
|
||||
* Make transfers attempt to use SSL/TLS.
|
||||
*/
|
||||
data->set.ftp_ssl = (curl_usessl)va_arg(param, long);
|
||||
break;
|
||||
|
||||
#endif
|
||||
case CURLOPT_FTPSSLAUTH:
|
||||
/*
|
||||
* Set a specific auth for FTP-SSL transfers.
|
||||
@@ -2181,7 +2210,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
break;
|
||||
|
||||
case CURLOPT_IPRESOLVE:
|
||||
data->set.ip_version = va_arg(param, long);
|
||||
data->set.ipver = va_arg(param, long);
|
||||
break;
|
||||
|
||||
case CURLOPT_MAXFILESIZE_LARGE:
|
||||
@@ -2341,7 +2370,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
|
||||
* know that an unsigned int will always hold the value so we blindly
|
||||
* typecast to this type
|
||||
*/
|
||||
data->set.scope = (unsigned int) va_arg(param, long);
|
||||
data->set.scope = curlx_sltoui(va_arg(param, long));
|
||||
break;
|
||||
|
||||
case CURLOPT_PROTOCOLS:
|
||||
@@ -2558,7 +2587,7 @@ static void conn_free(struct connectdata *conn)
|
||||
free(conn); /* free all the connection oriented data */
|
||||
}
|
||||
|
||||
CURLcode Curl_disconnect(struct connectdata *conn)
|
||||
CURLcode Curl_disconnect(struct connectdata *conn, bool dead_connection)
|
||||
{
|
||||
struct SessionHandle *data;
|
||||
if(!conn)
|
||||
@@ -2618,7 +2647,7 @@ CURLcode Curl_disconnect(struct connectdata *conn)
|
||||
|
||||
if(conn->handler->disconnect)
|
||||
/* This is set if protocol-specific cleanups should be made */
|
||||
conn->handler->disconnect(conn);
|
||||
conn->handler->disconnect(conn, dead_connection);
|
||||
|
||||
if(-1 != conn->connectindex) {
|
||||
/* unlink ourselves! */
|
||||
@@ -2709,12 +2738,14 @@ static bool RTSPConnIsDead(struct connectdata *check)
|
||||
}
|
||||
#endif /* CURL_DISABLE_RTSP */
|
||||
|
||||
static bool IsPipeliningPossible(const struct SessionHandle *handle)
|
||||
static bool IsPipeliningPossible(const struct SessionHandle *handle,
|
||||
const struct connectdata *conn)
|
||||
{
|
||||
if(handle->multi && Curl_multi_canPipeline(handle->multi) &&
|
||||
(handle->set.httpreq == HTTPREQ_GET ||
|
||||
handle->set.httpreq == HTTPREQ_HEAD) &&
|
||||
handle->set.httpversion != CURL_HTTP_VERSION_1_0)
|
||||
if((conn->handler->protocol & PROT_HTTP) &&
|
||||
handle->multi && Curl_multi_canPipeline(handle->multi) &&
|
||||
(handle->set.httpreq == HTTPREQ_GET ||
|
||||
handle->set.httpreq == HTTPREQ_HEAD) &&
|
||||
handle->set.httpversion != CURL_HTTP_VERSION_1_0)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
@@ -2731,13 +2762,6 @@ bool Curl_isPipeliningEnabled(const struct SessionHandle *handle)
|
||||
CURLcode Curl_addHandleToPipeline(struct SessionHandle *data,
|
||||
struct curl_llist *pipeline)
|
||||
{
|
||||
#ifdef DEBUGBUILD
|
||||
if(!IsPipeliningPossible(data)) {
|
||||
/* when not pipelined, there MUST be no handle in the list already */
|
||||
if(pipeline->head)
|
||||
infof(data, "PIPE when no PIPE supposed!\n");
|
||||
}
|
||||
#endif
|
||||
if(!Curl_llist_insert_next(pipeline, pipeline->tail, data))
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
return CURLE_OK;
|
||||
@@ -2847,7 +2871,7 @@ ConnectionExists(struct SessionHandle *data,
|
||||
{
|
||||
long i;
|
||||
struct connectdata *check;
|
||||
bool canPipeline = IsPipeliningPossible(data);
|
||||
bool canPipeline = IsPipeliningPossible(data, needle);
|
||||
|
||||
for(i=0; i< data->state.connc->num; i++) {
|
||||
bool match = FALSE;
|
||||
@@ -2886,7 +2910,8 @@ ConnectionExists(struct SessionHandle *data,
|
||||
check->data = data;
|
||||
infof(data, "Connection #%ld seems to be dead!\n", i);
|
||||
|
||||
Curl_disconnect(check); /* disconnect resources */
|
||||
/* disconnect resources */
|
||||
Curl_disconnect(check, /* dead_connection */ TRUE);
|
||||
data->state.connc->connects[i]=NULL; /* nothing here */
|
||||
|
||||
continue;
|
||||
@@ -2898,11 +2923,11 @@ ConnectionExists(struct SessionHandle *data,
|
||||
struct SessionHandle* sh = gethandleathead(check->send_pipe);
|
||||
struct SessionHandle* rh = gethandleathead(check->recv_pipe);
|
||||
if(sh) {
|
||||
if(!IsPipeliningPossible(sh))
|
||||
if(!IsPipeliningPossible(sh, check))
|
||||
continue;
|
||||
}
|
||||
else if(rh) {
|
||||
if(!IsPipeliningPossible(rh))
|
||||
if(!IsPipeliningPossible(rh, check))
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -3073,7 +3098,7 @@ ConnectionKillOne(struct SessionHandle *data)
|
||||
conn->data = data;
|
||||
|
||||
/* the winner gets the honour of being disconnected */
|
||||
(void)Curl_disconnect(conn);
|
||||
(void)Curl_disconnect(conn, /* dead_connection */ FALSE);
|
||||
|
||||
/* clean the array entry */
|
||||
data->state.connc->connects[connindex] = NULL;
|
||||
@@ -3440,14 +3465,19 @@ static void fix_hostname(struct SessionHandle *data,
|
||||
#endif
|
||||
}
|
||||
|
||||
static void llist_dtor(void *user, void *element)
|
||||
{
|
||||
(void)user;
|
||||
(void)element;
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate and initialize a new connectdata object.
|
||||
*/
|
||||
static struct connectdata *allocate_conn(void)
|
||||
static struct connectdata *allocate_conn(struct SessionHandle *data)
|
||||
{
|
||||
struct connectdata *conn;
|
||||
|
||||
conn = calloc(1, sizeof(struct connectdata));
|
||||
struct connectdata *conn = calloc(1, sizeof(struct connectdata));
|
||||
if(!conn)
|
||||
return NULL;
|
||||
|
||||
@@ -3470,7 +3500,70 @@ static struct connectdata *allocate_conn(void)
|
||||
/* Store creation time to help future close decision making */
|
||||
conn->created = Curl_tvnow();
|
||||
|
||||
conn->data = data; /* Setup the association between this connection
|
||||
and the SessionHandle */
|
||||
|
||||
conn->proxytype = data->set.proxytype; /* type */
|
||||
|
||||
#ifdef CURL_DISABLE_PROXY
|
||||
|
||||
conn->bits.proxy = FALSE;
|
||||
conn->bits.httpproxy = FALSE;
|
||||
conn->bits.proxy_user_passwd = FALSE;
|
||||
conn->bits.tunnel_proxy = FALSE;
|
||||
|
||||
#else /* CURL_DISABLE_PROXY */
|
||||
|
||||
conn->bits.proxy = (bool)(data->set.str[STRING_PROXY] &&
|
||||
*data->set.str[STRING_PROXY]);
|
||||
conn->bits.httpproxy = (bool)(conn->bits.proxy &&
|
||||
(conn->proxytype == CURLPROXY_HTTP ||
|
||||
conn->proxytype == CURLPROXY_HTTP_1_0));
|
||||
conn->bits.proxy_user_passwd =
|
||||
(bool)(NULL != data->set.str[STRING_PROXYUSERNAME]);
|
||||
conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
|
||||
|
||||
#endif /* CURL_DISABLE_PROXY */
|
||||
|
||||
conn->bits.user_passwd = (bool)(NULL != data->set.str[STRING_USERNAME]);
|
||||
conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;
|
||||
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
|
||||
|
||||
conn->verifypeer = data->set.ssl.verifypeer;
|
||||
conn->verifyhost = data->set.ssl.verifyhost;
|
||||
|
||||
conn->ip_version = data->set.ipver;
|
||||
|
||||
if(data->multi && Curl_multi_canPipeline(data->multi) &&
|
||||
!conn->master_buffer) {
|
||||
/* Allocate master_buffer to be used for pipelining */
|
||||
conn->master_buffer = calloc(BUFSIZE, sizeof (char));
|
||||
if(!conn->master_buffer)
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Initialize the pipeline lists */
|
||||
conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->pend_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->done_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
if(!conn->send_pipe || !conn->recv_pipe || !conn->pend_pipe ||
|
||||
!conn->done_pipe)
|
||||
goto error;
|
||||
|
||||
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
|
||||
conn->data_prot = PROT_CLEAR;
|
||||
#endif
|
||||
|
||||
return conn;
|
||||
error:
|
||||
Curl_llist_destroy(conn->send_pipe, NULL);
|
||||
Curl_llist_destroy(conn->recv_pipe, NULL);
|
||||
Curl_llist_destroy(conn->pend_pipe, NULL);
|
||||
Curl_llist_destroy(conn->done_pipe, NULL);
|
||||
Curl_safefree(conn->master_buffer);
|
||||
Curl_safefree(conn);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static CURLcode findprotocol(struct SessionHandle *data,
|
||||
@@ -3596,7 +3689,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
|
||||
path[0]=0;
|
||||
|
||||
if(2 > sscanf(data->change.url,
|
||||
"%15[^\n:]://%[^\n/]%[^\n]",
|
||||
"%15[^\n:]://%[^\n/?]%[^\n]",
|
||||
protobuf,
|
||||
conn->host.name, path)) {
|
||||
|
||||
@@ -3604,7 +3697,7 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
|
||||
* The URL was badly formatted, let's try the browser-style _without_
|
||||
* protocol specified like 'http://'.
|
||||
*/
|
||||
rc = sscanf(data->change.url, "%[^\n/]%[^\n]", conn->host.name, path);
|
||||
rc = sscanf(data->change.url, "%[^\n/?]%[^\n]", conn->host.name, path);
|
||||
if(1 > rc) {
|
||||
/*
|
||||
* We couldn't even get this format.
|
||||
@@ -3736,13 +3829,6 @@ static CURLcode parseurlandfillconn(struct SessionHandle *data,
|
||||
return findprotocol(data, conn, protop);
|
||||
}
|
||||
|
||||
static void llist_dtor(void *user, void *element)
|
||||
{
|
||||
(void)user;
|
||||
(void)element;
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
/*
|
||||
* If we're doing a resumed transfer, we need to setup our stuff
|
||||
* properly.
|
||||
@@ -4079,7 +4165,7 @@ static CURLcode parse_proxy(struct SessionHandle *data,
|
||||
*prox_portno = 0x0; /* cut off number from host name */
|
||||
prox_portno ++;
|
||||
/* now set the local port number */
|
||||
conn->port = atoi(prox_portno);
|
||||
conn->port = strtol(prox_portno, NULL, 10);
|
||||
}
|
||||
else {
|
||||
/* without a port number after the host name, some people seem to use
|
||||
@@ -4523,6 +4609,9 @@ static void reuse_conn(struct connectdata *old_conn,
|
||||
else
|
||||
free(old_conn->host.rawalloc); /* free the newly allocated name buffer */
|
||||
|
||||
/* persist connection info in session handle */
|
||||
Curl_persistconninfo(conn);
|
||||
|
||||
/* re-use init */
|
||||
conn->bits.reuse = TRUE; /* yes, we're re-using here */
|
||||
|
||||
@@ -4580,66 +4669,16 @@ static CURLcode create_conn(struct SessionHandle *data,
|
||||
parts for checking against the already present connections. In order
|
||||
to not have to modify everything at once, we allocate a temporary
|
||||
connection data struct and fill in for comparison purposes. */
|
||||
conn = allocate_conn(data);
|
||||
|
||||
conn = allocate_conn();
|
||||
if(!conn)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* We must set the return variable as soon as possible, so that our
|
||||
parent can cleanup any possible allocs we may have done before
|
||||
any failure */
|
||||
*in_connect = conn;
|
||||
|
||||
if(!conn)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
conn->data = data; /* Setup the association between this connection
|
||||
and the SessionHandle */
|
||||
|
||||
conn->proxytype = data->set.proxytype; /* type */
|
||||
|
||||
#ifdef CURL_DISABLE_PROXY
|
||||
|
||||
conn->bits.proxy = FALSE;
|
||||
conn->bits.httpproxy = FALSE;
|
||||
conn->bits.proxy_user_passwd = FALSE;
|
||||
conn->bits.tunnel_proxy = FALSE;
|
||||
|
||||
#else /* CURL_DISABLE_PROXY */
|
||||
|
||||
conn->bits.proxy = (bool)(data->set.str[STRING_PROXY] &&
|
||||
*data->set.str[STRING_PROXY]);
|
||||
conn->bits.httpproxy = (bool)(conn->bits.proxy &&
|
||||
(conn->proxytype == CURLPROXY_HTTP ||
|
||||
conn->proxytype == CURLPROXY_HTTP_1_0));
|
||||
conn->bits.proxy_user_passwd =
|
||||
(bool)(NULL != data->set.str[STRING_PROXYUSERNAME]);
|
||||
conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
|
||||
|
||||
#endif /* CURL_DISABLE_PROXY */
|
||||
|
||||
conn->bits.user_passwd = (bool)(NULL != data->set.str[STRING_USERNAME]);
|
||||
conn->bits.ftp_use_epsv = data->set.ftp_use_epsv;
|
||||
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
|
||||
|
||||
conn->verifypeer = data->set.ssl.verifypeer;
|
||||
conn->verifyhost = data->set.ssl.verifyhost;
|
||||
|
||||
if(data->multi && Curl_multi_canPipeline(data->multi) &&
|
||||
!conn->master_buffer) {
|
||||
/* Allocate master_buffer to be used for pipelining */
|
||||
conn->master_buffer = calloc(BUFSIZE, sizeof (char));
|
||||
if(!conn->master_buffer)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/* Initialize the pipeline lists */
|
||||
conn->send_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->recv_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->pend_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
conn->done_pipe = Curl_llist_alloc((curl_llist_dtor) llist_dtor);
|
||||
if(!conn->send_pipe || !conn->recv_pipe || !conn->pend_pipe ||
|
||||
!conn->done_pipe)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
/* This initing continues below, see the comment "Continue connectdata
|
||||
* initialization here" */
|
||||
|
||||
@@ -4899,12 +4938,6 @@ static CURLcode create_conn(struct SessionHandle *data,
|
||||
infof(data, "Re-using existing connection! (#%ld) with host %s\n",
|
||||
conn->connectindex,
|
||||
conn->proxy.name?conn->proxy.dispname:conn->host.dispname);
|
||||
/* copy this IP address to the common buffer for the easy handle so that
|
||||
the address can actually survice the removal of this connection. strcpy
|
||||
is safe since the target buffer is big enough to hold the largest
|
||||
possible IP address */
|
||||
strcpy(data->info.ip, conn->ip_addr_str);
|
||||
|
||||
}
|
||||
else {
|
||||
/*
|
||||
@@ -5079,7 +5112,7 @@ CURLcode Curl_connect(struct SessionHandle *data,
|
||||
if(code && *in_connect) {
|
||||
/* We're not allowed to return failure with memory left allocated
|
||||
in the connectdata struct, free those here */
|
||||
Curl_disconnect(*in_connect); /* close the connection */
|
||||
Curl_disconnect(*in_connect, FALSE); /* close the connection */
|
||||
*in_connect = NULL; /* return a NULL */
|
||||
}
|
||||
|
||||
@@ -5107,7 +5140,7 @@ CURLcode Curl_async_resolved(struct connectdata *conn,
|
||||
if(code)
|
||||
/* We're not allowed to return failure with memory left allocated
|
||||
in the connectdata struct, free those here */
|
||||
Curl_disconnect(conn); /* close the connection */
|
||||
Curl_disconnect(conn, FALSE); /* close the connection */
|
||||
|
||||
return code;
|
||||
#else
|
||||
@@ -5199,7 +5232,7 @@ CURLcode Curl_done(struct connectdata **connp,
|
||||
*/
|
||||
if(data->set.reuse_forbid || conn->bits.close || premature ||
|
||||
(-1 == conn->connectindex)) {
|
||||
CURLcode res2 = Curl_disconnect(conn); /* close the connection */
|
||||
CURLcode res2 = Curl_disconnect(conn, FALSE); /* close the connection */
|
||||
|
||||
/* If we had an error already, make sure we return that one. But
|
||||
if we got a new error, return that. */
|
||||
|
@@ -42,7 +42,7 @@ CURLcode Curl_async_resolved(struct connectdata *conn,
|
||||
CURLcode Curl_do(struct connectdata **, bool *done);
|
||||
CURLcode Curl_do_more(struct connectdata *);
|
||||
CURLcode Curl_done(struct connectdata **, CURLcode, bool premature);
|
||||
CURLcode Curl_disconnect(struct connectdata *);
|
||||
CURLcode Curl_disconnect(struct connectdata *, bool dead_connection);
|
||||
CURLcode Curl_protocol_connect(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_protocol_connecting(struct connectdata *conn, bool *done);
|
||||
CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done);
|
||||
|
@@ -199,12 +199,15 @@ struct krb4buffer {
|
||||
size_t index;
|
||||
int eof_flag;
|
||||
};
|
||||
|
||||
enum protection_level {
|
||||
prot_clear,
|
||||
prot_safe,
|
||||
prot_confidential,
|
||||
prot_private,
|
||||
prot_cmd
|
||||
PROT_NONE, /* first in list */
|
||||
PROT_CLEAR,
|
||||
PROT_SAFE,
|
||||
PROT_CONFIDENTIAL,
|
||||
PROT_PRIVATE,
|
||||
PROT_CMD,
|
||||
PROT_LAST /* last in list */
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -643,9 +646,11 @@ struct Curl_handler {
|
||||
int numsocks);
|
||||
|
||||
/* This function *MAY* be set to a protocol-dependent function that is run
|
||||
* by the curl_disconnect(), as a step in the disconnection.
|
||||
* by the curl_disconnect(), as a step in the disconnection. If the handler
|
||||
* is called because the connection has been considered dead, dead_connection
|
||||
* is set to TRUE.
|
||||
*/
|
||||
CURLcode (*disconnect)(struct connectdata *);
|
||||
CURLcode (*disconnect)(struct connectdata *, bool dead_connection);
|
||||
|
||||
long defport; /* Default port. */
|
||||
long protocol; /* PROT_* flags concerning the protocol set */
|
||||
@@ -754,6 +759,23 @@ struct connectdata {
|
||||
unsigned short remote_port; /* what remote port to connect to,
|
||||
not the proxy port! */
|
||||
|
||||
/* 'primary_ip' and 'primary_port' get filled with peer's numerical
|
||||
ip address and port number whenever an outgoing connection is
|
||||
*attemted* from the primary socket to a remote address. When more
|
||||
than one address is tried for a connection these will hold data
|
||||
for the last attempt. When the connection is actualy established
|
||||
these are updated with data which comes directly from the socket. */
|
||||
|
||||
char primary_ip[MAX_IPADR_LEN];
|
||||
long primary_port;
|
||||
|
||||
/* 'local_ip' and 'local_port' get filled with local's numerical
|
||||
ip address and port number whenever an outgoing connection is
|
||||
**established** from the primary socket to a remote address. */
|
||||
|
||||
char local_ip[MAX_IPADR_LEN];
|
||||
long local_port;
|
||||
|
||||
char *user; /* user name string, allocated */
|
||||
char *passwd; /* password string, allocated */
|
||||
|
||||
@@ -779,6 +801,8 @@ struct connectdata {
|
||||
|
||||
const struct Curl_handler * handler; /* Connection's protocol handler. */
|
||||
|
||||
long ip_version; /* copied from the SessionHandle at creation time */
|
||||
|
||||
/**** curl_get() phase fields */
|
||||
|
||||
curl_socket_t sockfd; /* socket to read from or CURL_SOCKET_BAD */
|
||||
@@ -909,15 +933,21 @@ struct PureInfo {
|
||||
long numconnects; /* how many new connection did libcurl created */
|
||||
char *contenttype; /* the content type of the object */
|
||||
char *wouldredirect; /* URL this would've been redirected to if asked to */
|
||||
char ip[MAX_IPADR_LEN]; /* this buffer gets the numerical ip version stored
|
||||
at the connect *attempt* so it will get the last
|
||||
tried connect IP even on failures */
|
||||
long port; /* the remote port the last connection was established to */
|
||||
char localip[MAX_IPADR_LEN]; /* this buffer gets the numerical (local) ip
|
||||
stored from where the last connection was
|
||||
established */
|
||||
long localport; /* the local (src) port the last connection
|
||||
originated from */
|
||||
|
||||
/* PureInfo members 'conn_primary_ip', 'conn_primary_port', 'conn_local_ip'
|
||||
and, 'conn_local_port' are copied over from the connectdata struct in
|
||||
order to allow curl_easy_getinfo() to return this information even when
|
||||
the session handle is no longer associated with a connection, and also
|
||||
allow curl_easy_reset() to clear this information from the session handle
|
||||
without disturbing information which is still alive, and that might be
|
||||
reused, in the connection cache. */
|
||||
|
||||
char conn_primary_ip[MAX_IPADR_LEN];
|
||||
long conn_primary_port;
|
||||
|
||||
char conn_local_ip[MAX_IPADR_LEN];
|
||||
long conn_local_port;
|
||||
|
||||
struct curl_certinfo certs; /* info about the certs, only populated in
|
||||
OpenSSL builds. Asked for with
|
||||
CURLOPT_CERTINFO / CURLINFO_CERTINFO */
|
||||
@@ -1186,6 +1216,8 @@ struct DynamicStatic {
|
||||
bool referer_alloc; /* referer sting is malloc()ed */
|
||||
struct curl_slist *cookielist; /* list of cookie files set by
|
||||
curl_easy_setopt(COOKIEFILE) calls */
|
||||
struct curl_slist *resolve; /* set to point to the set.resolve list when
|
||||
this should be dealt with in pretransfer */
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -1332,6 +1364,8 @@ struct UserDefined {
|
||||
struct curl_slist *source_postquote; /* in 3rd party transfer mode - after
|
||||
the transfer on source host */
|
||||
struct curl_slist *telnet_options; /* linked list of telnet options */
|
||||
struct curl_slist *resolve; /* list of names to add/remove from
|
||||
DNS cache */
|
||||
curl_TimeCond timecondition; /* kind of time/date comparison */
|
||||
time_t timevalue; /* what time to compare with */
|
||||
Curl_HttpReq httpreq; /* what kind of HTTP request (if any) is this */
|
||||
@@ -1351,8 +1385,8 @@ struct UserDefined {
|
||||
|
||||
struct curl_slist *http200aliases; /* linked list of aliases for http200 */
|
||||
|
||||
long ip_version; /* the CURL_IPRESOLVE_* defines in the public header file
|
||||
0 - whatever, 1 - v2, 2 - v6 */
|
||||
long ipver; /* the CURL_IPRESOLVE_* defines in the public header file
|
||||
0 - whatever, 1 - v2, 2 - v6 */
|
||||
|
||||
curl_off_t max_filesize; /* Maximum file size to download */
|
||||
|
||||
|
134
lib/warnless.c
134
lib/warnless.c
@@ -37,7 +37,7 @@
|
||||
# define CURL_MASK_SSHORT 0x7FFFFFFFFFFFFFFF
|
||||
# define CURL_MASK_USHORT 0xFFFFFFFFFFFFFFFF
|
||||
#else
|
||||
# error "SIZEOF_SHORT not defined"
|
||||
# error "SIZEOF_SHORT not defined"
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_INT == 2)
|
||||
@@ -53,7 +53,7 @@
|
||||
# define CURL_MASK_SINT 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
# define CURL_MASK_UINT 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
#else
|
||||
# error "SIZEOF_INT not defined"
|
||||
# error "SIZEOF_INT not defined"
|
||||
#endif
|
||||
|
||||
#if (CURL_SIZEOF_LONG == 2)
|
||||
@@ -69,7 +69,39 @@
|
||||
# define CURL_MASK_SLONG 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFL
|
||||
# define CURL_MASK_ULONG 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFUL
|
||||
#else
|
||||
# error "SIZEOF_LONG not defined"
|
||||
# error "CURL_SIZEOF_LONG not defined"
|
||||
#endif
|
||||
|
||||
#if (CURL_SIZEOF_CURL_OFF_T == 2)
|
||||
# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFF)
|
||||
# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFF)
|
||||
#elif (CURL_SIZEOF_CURL_OFF_T == 4)
|
||||
# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFF)
|
||||
# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFF)
|
||||
#elif (CURL_SIZEOF_CURL_OFF_T == 8)
|
||||
# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFF)
|
||||
# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFF)
|
||||
#elif (CURL_SIZEOF_CURL_OFF_T == 16)
|
||||
# define CURL_MASK_SCOFFT CURL_OFF_T_C(0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
|
||||
# define CURL_MASK_UCOFFT CURL_OFF_TU_C(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
|
||||
#else
|
||||
# error "CURL_SIZEOF_CURL_OFF_T not defined"
|
||||
#endif
|
||||
|
||||
#if (SIZEOF_SIZE_T == SIZEOF_SHORT)
|
||||
# define CURL_MASK_SSIZE_T CURL_MASK_SSHORT
|
||||
# define CURL_MASK_USIZE_T CURL_MASK_USHORT
|
||||
#elif (SIZEOF_SIZE_T == SIZEOF_INT)
|
||||
# define CURL_MASK_SSIZE_T CURL_MASK_SINT
|
||||
# define CURL_MASK_USIZE_T CURL_MASK_UINT
|
||||
#elif (SIZEOF_SIZE_T == CURL_SIZEOF_LONG)
|
||||
# define CURL_MASK_SSIZE_T CURL_MASK_SLONG
|
||||
# define CURL_MASK_USIZE_T CURL_MASK_ULONG
|
||||
#elif (SIZEOF_SIZE_T == CURL_SIZEOF_CURL_OFF_T)
|
||||
# define CURL_MASK_SSIZE_T CURL_MASK_SCOFFT
|
||||
# define CURL_MASK_USIZE_T CURL_MASK_UCOFFT
|
||||
#else
|
||||
# error "SIZEOF_SIZE_T not defined"
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -109,7 +141,7 @@ unsigned char curlx_ultouc(unsigned long ulnum)
|
||||
}
|
||||
|
||||
/*
|
||||
** size_t to signed int
|
||||
** unsigned size_t to signed int
|
||||
*/
|
||||
|
||||
int curlx_uztosi(size_t uznum)
|
||||
@@ -125,3 +157,97 @@ int curlx_uztosi(size_t uznum)
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** signed long to signed int
|
||||
*/
|
||||
|
||||
int curlx_sltosi(long slnum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(slnum >= 0);
|
||||
return (int)(slnum & (long) CURL_MASK_SINT);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** signed long to unsigned int
|
||||
*/
|
||||
|
||||
unsigned int curlx_sltoui(long slnum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(slnum >= 0);
|
||||
return (unsigned int)(slnum & (long) CURL_MASK_UINT);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** signed long to unsigned short
|
||||
*/
|
||||
|
||||
unsigned short curlx_sltous(long slnum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(slnum >= 0);
|
||||
return (unsigned short)(slnum & (long) CURL_MASK_USHORT);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** unsigned size_t to signed ssize_t
|
||||
*/
|
||||
|
||||
ssize_t curlx_uztosz(size_t uznum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
return (ssize_t)(uznum & (size_t) CURL_MASK_SSIZE_T);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
** signed curl_off_t to unsigned size_t
|
||||
*/
|
||||
|
||||
size_t curlx_sotouz(curl_off_t sonum)
|
||||
{
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:810) /* conversion may lose significant bits */
|
||||
#endif
|
||||
|
||||
DEBUGASSERT(sonum >= 0);
|
||||
return (size_t)(sonum & (curl_off_t) CURL_MASK_USIZE_T);
|
||||
|
||||
#ifdef __INTEL_COMPILER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
@@ -28,4 +28,14 @@ unsigned char curlx_ultouc(unsigned long ulnum);
|
||||
|
||||
int curlx_uztosi(size_t uznum);
|
||||
|
||||
int curlx_sltosi(long slnum);
|
||||
|
||||
unsigned int curlx_sltoui(long slnum);
|
||||
|
||||
unsigned short curlx_sltous(long slnum);
|
||||
|
||||
ssize_t curlx_uztosz(size_t uznum);
|
||||
|
||||
size_t curlx_sotouz(curl_off_t sonum);
|
||||
|
||||
#endif /* HEADER_CURL_WARNLESS_H */
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#***************************************************************************
|
||||
|
||||
# File version for 'aclocal' use. Keep it a single number.
|
||||
# serial 55
|
||||
# serial 56
|
||||
|
||||
|
||||
dnl CURL_CHECK_COMPILER
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#***************************************************************************
|
||||
|
||||
# File version for 'aclocal' use. Keep it a single number.
|
||||
# serial 13
|
||||
# serial 14
|
||||
|
||||
dnl CURL_CHECK_OPTION_THREADED_RESOLVER
|
||||
dnl -------------------------------------------------
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ UID 0x00000000 0xF0206442
|
||||
SOURCEPATH ../../../src
|
||||
SOURCE \
|
||||
main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
||||
getpass.c homedir.c curlutil.c
|
||||
getpass.c homedir.c curlutil.c os-specific.c xattr.c
|
||||
|
||||
SOURCEPATH ../../../lib
|
||||
SOURCE \
|
||||
|
@@ -1,5 +1,4 @@
|
||||
EXTRA_DIST = build_vms.com \
|
||||
config-vms.h \
|
||||
curlmsg.h \
|
||||
curlmsg.msg \
|
||||
curlmsg.sdl \
|
||||
|
@@ -426,7 +426,7 @@ $ define curl 'top_dev_dir'.include.curl]
|
||||
$!
|
||||
$! Copy the VMS-specific config file into the product directory.
|
||||
$!
|
||||
$ call MoveIfDiff 'proc_dev_dir'config-vms.h 'objdir'curl_config.h
|
||||
$ call MoveIfDiff 'top_dev_dir'.lib]config-vms.h 'objdir'curl_config.h
|
||||
$!
|
||||
$ on control_y then goto Common_Exit
|
||||
$!
|
||||
|
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@@ -6,3 +6,4 @@ stamp-h2
|
||||
Makefile.vc8.dist
|
||||
Makefile.vc9.dist
|
||||
version.h.dist
|
||||
Makefile.vc10.dist
|
||||
|
@@ -5,9 +5,6 @@
|
||||
|
||||
!ifndef %watcom
|
||||
!error WATCOM environment variable not set!
|
||||
!else
|
||||
SYS_INCL = -I$(%watcom)\h\nt -I$(%watcom)\h
|
||||
SYS_LIBS = $(%watcom)\lib386\nt;$(%watcom)\lib386
|
||||
!endif
|
||||
|
||||
!ifdef %libname
|
||||
@@ -33,18 +30,30 @@ RC = wrc
|
||||
! endif
|
||||
!endif
|
||||
|
||||
!ifdef __LINUX__
|
||||
DS = /
|
||||
CP = cp
|
||||
MD = mkdir -p
|
||||
RD = rmdir -p
|
||||
RM = rm -f
|
||||
!else
|
||||
DS = $(X)\$(X)
|
||||
CP = copy 2>NUL
|
||||
MD = mkdir
|
||||
RD = rmdir /q /s 2>NUL
|
||||
!if $(__VERSION__) < 1250
|
||||
RM = del /q /f 2>NUL
|
||||
!else
|
||||
RM = rm -f
|
||||
!endif
|
||||
MD = mkdir
|
||||
RD = rmdir /q /s 2>NUL
|
||||
CP = copy
|
||||
!endif
|
||||
|
||||
SYS_INCL = -I$(%watcom)$(DS)h$(DS)nt -I$(%watcom)$(DS)h
|
||||
SYS_LIBS = $(%watcom)$(DS)lib386$(DS)nt;$(%watcom)$(DS)lib386
|
||||
|
||||
CFLAGS = -3r -mf -hc -zff -zgf -zq -zm -s -fr=con -w2 -fpi -oilrtfm &
|
||||
-wcd=201 -bt=nt -bc -d+ -dWIN32 -dHAVE_STRTOLL &
|
||||
-I..\include -I..\lib $(SYS_INCL)
|
||||
-I..$(DS)include -I..$(DS)lib $(SYS_INCL)
|
||||
|
||||
!ifdef %debug
|
||||
DEBUG = -dDEBUG=1 -dDEBUGBUILD
|
||||
@@ -63,39 +72,39 @@ CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
|
||||
!ifdef %zlib_root
|
||||
ZLIB_ROOT = $(%zlib_root)
|
||||
!else
|
||||
ZLIB_ROOT = ..\..\zlib-1.2.5
|
||||
ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5
|
||||
!endif
|
||||
|
||||
!ifdef %libssh2_root
|
||||
LIBSSH2_ROOT = $(%libssh2_root)
|
||||
!else
|
||||
LIBSSH2_ROOT = ..\..\libssh2-1.2.7
|
||||
LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7
|
||||
!endif
|
||||
|
||||
!ifdef %librtmp_root
|
||||
LIBRTMP_ROOT = $(%librtmp_root)
|
||||
!else
|
||||
LIBRTMP_ROOT = ..\..\librtmp-2.3
|
||||
LIBRTMP_ROOT = ..$(DS)..$(DS)rtmpdump-2.3
|
||||
!endif
|
||||
|
||||
!ifdef %openssl_root
|
||||
OPENSSL_ROOT = $(%openssl_root)
|
||||
!else
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8o
|
||||
OPENSSL_ROOT = ..$(DS)..$(DS)openssl-0.9.8q
|
||||
!endif
|
||||
|
||||
!ifdef %ares_root
|
||||
ARES_ROOT = $(%ares_root)
|
||||
!else
|
||||
ARES_ROOT = ..\ares
|
||||
ARES_ROOT = ..$(DS)ares
|
||||
!endif
|
||||
|
||||
!ifdef %use_ssl
|
||||
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)\inc32
|
||||
CFLAGS += -wcd=138 -dUSE_OPENSSL -dUSE_SSLEAY -I$(OPENSSL_ROOT)$(DS)inc32
|
||||
!endif
|
||||
|
||||
OBJ_DIR = WC_Win32.obj
|
||||
LINK_ARG = $(OBJ_DIR)\wlink.arg
|
||||
LINK_ARG = $(OBJ_DIR)$(DS)wlink.arg
|
||||
|
||||
# In order to process Makefile.inc wmake must be called with -u switch!
|
||||
!ifndef %MAKEFLAGS
|
||||
@@ -114,9 +123,14 @@ CFLAGS += -DCURL_STATICLIB
|
||||
CFLAGS += -br
|
||||
OBJS += $(CURLX_SOURCES:.c=.obj)
|
||||
!endif
|
||||
OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
|
||||
!ifdef __LINUX__
|
||||
OBJS = $OBJ_DIR/$(OBJS: = $OBJ_DIR/)
|
||||
|
||||
RESOURCE = $(OBJ_DIR)\curl.res
|
||||
!else
|
||||
OBJS = $OBJ_DIR\$(OBJS: = $OBJ_DIR\)
|
||||
!endif
|
||||
|
||||
RESOURCE = $(OBJ_DIR)$(DS)curl.res
|
||||
|
||||
all: hugehelp.c $(OBJ_DIR) curl.exe .SYMBOLIC
|
||||
@echo Welcome to cURL
|
||||
@@ -142,10 +156,10 @@ curl.exe: $(OBJS) $(RESOURCE) $(LINK_ARG)
|
||||
$(LD) name $^@ @$]@
|
||||
|
||||
$(RESOURCE): curl.rc
|
||||
$(RC) $(DEBUG) -q -r -zm -I..\include $(SYS_INCL) $[@ -fo=$^@
|
||||
$(RC) $(DEBUG) -q -r -zm -bt=nt -I..$(DS)include $(SYS_INCL) $[@ -fo=$^@
|
||||
|
||||
# suffix search path - vpath-like hack
|
||||
.c: ..\lib
|
||||
.c: ..$(DS)lib
|
||||
|
||||
.ERASE
|
||||
.c{$(OBJ_DIR)}.obj:
|
||||
@@ -163,27 +177,27 @@ $(LINK_ARG): $(__MAKEFILES__)
|
||||
@%append $^@ res=$(RESOURCE) libpath $(SYS_LIBS)
|
||||
!ifdef %curl_static
|
||||
@%append $^@ library wldap32.lib
|
||||
@%append $^@ library ..\lib\$(LIBNAME).lib
|
||||
@%append $^@ library ..$(DS)lib$(DS)$(LIBNAME).lib
|
||||
!ifdef %use_zlib
|
||||
@%append $^@ library $(ZLIB_ROOT)\zlib.lib
|
||||
@%append $^@ library $(ZLIB_ROOT)$(DS)zlib.lib
|
||||
!endif
|
||||
!ifdef %use_rtmp
|
||||
@%append $^@ library $(LIBRTMP_ROOT)\librtmp\librtmp.lib, winmm.lib
|
||||
@%append $^@ library $(LIBRTMP_ROOT)$(DS)librtmp$(DS)librtmp.lib, winmm.lib
|
||||
!endif
|
||||
!ifdef %use_ssh2
|
||||
@%append $^@ library $(LIBSSH2_ROOT)\win32\libssh2.lib
|
||||
@%append $^@ library $(LIBSSH2_ROOT)$(DS)win32$(DS)libssh2.lib
|
||||
!endif
|
||||
!ifdef %use_ssl
|
||||
@%append $^@ library $(OPENSSL_ROOT)\out32\libeay32.lib, $(OPENSSL_ROOT)\out32\ssleay32.lib
|
||||
@%append $^@ library $(OPENSSL_ROOT)$(DS)out32$(DS)libeay32.lib, $(OPENSSL_ROOT)$(DS)out32$(DS)ssleay32.lib
|
||||
!endif
|
||||
!ifdef %use_ares
|
||||
@%append $^@ library $(ARES_ROOT)\cares.lib
|
||||
@%append $^@ library $(ARES_ROOT)$(DS)cares.lib
|
||||
!endif
|
||||
!else
|
||||
@%append $^@ library ..\lib\$(LIBNAME)_imp.lib
|
||||
@%append $^@ library ..$(DS)lib$(DS)$(LIBNAME)_imp.lib
|
||||
!endif
|
||||
!ifeq USE_WATT32 1
|
||||
@%append $^@ library $(%watt_root)\lib\wattcpw_imp.lib
|
||||
@%append $^@ library $(%watt_root)$(DS)lib$(DS)wattcpw_imp.lib
|
||||
!else
|
||||
@%append $^@ library ws2_32.lib
|
||||
!endif
|
||||
|
@@ -58,7 +58,7 @@ CLEANFILES = hugehelp.c
|
||||
NROFF=env LC_ALL=C @NROFF@ @MANOPT@ # figured out by the configure script
|
||||
|
||||
EXTRA_DIST = mkhelp.pl makefile.dj Makefile.vc6 Makefile.b32 Makefile.m32 \
|
||||
Makefile.riscos curl_config.h.in macos/curl.mcp.xml.sit.hqx \
|
||||
curl_config.h.in macos/curl.mcp.xml.sit.hqx \
|
||||
macos/MACINSTALL.TXT macos/src/curl_GUSIConfig.cpp vc6curlsrc.dsp \
|
||||
macos/src/macos_main.cpp config-amigaos.h makefile.amiga curl.rc \
|
||||
Makefile.netware Makefile.inc Makefile.Watcom vc6curlsrc.dsw \
|
||||
|
@@ -15,11 +15,12 @@ CURLX_ONES = $(top_srcdir)/lib/strtoofft.c \
|
||||
$(top_srcdir)/lib/nonblock.c
|
||||
|
||||
CURL_CFILES = main.c hugehelp.c urlglob.c writeout.c writeenv.c \
|
||||
getpass.c homedir.c curlutil.c os-specific.c
|
||||
getpass.c homedir.c curlutil.c os-specific.c xattr.c
|
||||
|
||||
CURL_HFILES = hugehelp.h setup.h config-win32.h config-mac.h \
|
||||
config-riscos.h urlglob.h version.h os-specific.h \
|
||||
writeout.h writeenv.h getpass.h homedir.h curlutil.h
|
||||
writeout.h writeenv.h getpass.h homedir.h curlutil.h \
|
||||
xattr.h
|
||||
|
||||
curl_SOURCES = $(CURL_CFILES) $(CURLX_ONES) $(CURL_HFILES)
|
||||
|
||||
|
@@ -20,7 +20,7 @@ ZLIB_PATH = ../../zlib-1.2.5
|
||||
endif
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8o
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
endif
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
ifndef LIBSSH2_PATH
|
||||
|
@@ -19,7 +19,7 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8o
|
||||
OPENSSL_PATH = ../../openssl-0.9.8q
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your LibSSH2 package.
|
||||
@@ -418,6 +418,7 @@ ifeq ($(LIBARCH),CLIB)
|
||||
@echo $(DL)#define SEND_TYPE_ARG3 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV int$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 4$(DL) >> $@
|
||||
@echo $(DL)#define pressanykey PressAnyKeyToContinue$(DL) >> $@
|
||||
else
|
||||
@echo $(DL)#define OS "i586-pc-libc-NetWare"$(DL) >> $@
|
||||
@@ -453,6 +454,7 @@ else
|
||||
@echo $(DL)#define SEND_TYPE_ARG4 int$(DL) >> $@
|
||||
@echo $(DL)#define SEND_TYPE_RETV ssize_t$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_OFF_T 8$(DL) >> $@
|
||||
@echo $(DL)#define SIZEOF_SIZE_T 8$(DL) >> $@
|
||||
@echo $(DL)#define _LARGEFILE 1$(DL) >> $@
|
||||
ifdef ENABLE_IPV6
|
||||
@echo $(DL)#define ENABLE_IPV6 1$(DL) >> $@
|
||||
|
@@ -1,64 +0,0 @@
|
||||
# Makefile for project cURL
|
||||
# Generated on Sun,13 Jan 2002.17:11:10 by EasyGCC (0.1.3 [beta 2] (3 Jan 2002))
|
||||
# Manually updated
|
||||
# Contact: easygcc@melotech.co.uk
|
||||
|
||||
# Project objects:
|
||||
objs = o.hugehelp o.main o.urlglob o.writeout o.writeenv o.rawstr o.nonblock
|
||||
|
||||
|
||||
# Compile options:
|
||||
linkopts = ../lib/libcurl openldap:libraries/libldap/libldap -o curl
|
||||
compileropts = -mpoke-function-name -IUtilLib: -mthrowback
|
||||
|
||||
# Project target:
|
||||
curl: $(objs)
|
||||
gcc $(linkopts) $(objs)
|
||||
|
||||
# Static dependancies:
|
||||
o.hugehelp: c.hugehelp
|
||||
gcc $(compileropts) -c -o hugehelp.o c.hugehelp
|
||||
|
||||
o.main: c.main
|
||||
gcc $(compileropts) -c -o main.o c.main
|
||||
|
||||
o.os-specific: c.os-specific
|
||||
gcc $(compileropts) -c -o os-specific.o c.os-specific
|
||||
|
||||
o.urlglob: c.urlglob
|
||||
gcc $(compileropts) -c -o urlglob.o c.urlglob
|
||||
|
||||
o.writeout: c.writeout
|
||||
gcc $(compileropts) -c -o writeout.o c.writeout
|
||||
|
||||
o.writeenv: c.writeenv
|
||||
gcc $(compileropts) -c -o writeenv.o c.writeenv
|
||||
|
||||
o.rawstr: ../lib/c.rawstr
|
||||
gcc $(compileropts) -c -o rawstr.o ../lib/c.rawstr
|
||||
|
||||
o.nonblock: ../lib/c.nonblock
|
||||
gcc $(compileropts) -c -o nonblock.o ../lib/c.nonblock
|
||||
|
||||
# Dynamic dependancies:
|
||||
o.hugehelp: c.hugehelp
|
||||
|
||||
o.main: c.main
|
||||
o.main: h.setup
|
||||
o.main: h.os-specific
|
||||
o.main: h.urlglob
|
||||
o.main: h.writeout
|
||||
o.main: h.version
|
||||
|
||||
o.os-specific: c.os-specific
|
||||
o.os-specific: h.setup
|
||||
o.os-specific: h.os-specific
|
||||
|
||||
o.urlglob: c.urlglob
|
||||
o.urlglob: h.setup
|
||||
o.urlglob: h.os-specific
|
||||
o.urlglob: h.urlglob
|
||||
|
||||
o.writeout: c.writeout
|
||||
o.writeout: h.writeout
|
||||
|
@@ -91,31 +91,33 @@ CFLAGS = $(CFLAGS) /DUSE_WINDOWS_SSPI /I$(WINDOWS_SDK_PATH)\include
|
||||
!ENDIF
|
||||
|
||||
RELEASE_OBJS= \
|
||||
hugehelpr.obj \
|
||||
writeoutr.obj \
|
||||
urlglobr.obj \
|
||||
curlutilr.obj \
|
||||
getpassr.obj \
|
||||
homedirr.obj \
|
||||
curlutilr.obj \
|
||||
os-specificr.obj \
|
||||
hugehelpr.obj \
|
||||
mainr.obj \
|
||||
nonblockr.obj \
|
||||
os-specificr.obj \
|
||||
rawstrr.obj \
|
||||
strtoofftr.obj \
|
||||
mainr.obj \
|
||||
urlglobr.obj \
|
||||
writeoutr.obj \
|
||||
xattrr.obj \
|
||||
curlr.res
|
||||
|
||||
DEBUG_OBJS= \
|
||||
hugehelpd.obj \
|
||||
writeoutd.obj \
|
||||
urlglobd.obj \
|
||||
curlutild.obj \
|
||||
getpassd.obj \
|
||||
homedird.obj \
|
||||
curlutild.obj \
|
||||
os-specificd.obj \
|
||||
hugehelpd.obj \
|
||||
maind.obj \
|
||||
nonblockd.obj \
|
||||
os-specificd.obj \
|
||||
rawstrd.obj \
|
||||
strtoofftd.obj \
|
||||
maind.obj \
|
||||
urlglobd.obj \
|
||||
writeoutd.obj \
|
||||
xattrd.obj \
|
||||
curld.res
|
||||
|
||||
#################################################
|
||||
@@ -258,6 +260,8 @@ rawstrr.obj: ../lib/rawstr.c
|
||||
$(CCR) $(CFLAGS) /Fo"$@" ../lib/rawstr.c
|
||||
strtoofftr.obj: ../lib/strtoofft.c
|
||||
$(CCR) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
|
||||
xattrr.obj: xattr.c
|
||||
$(CCR) $(CFLAGS) /Fo"$@" xattr.c
|
||||
mainr.obj: main.c
|
||||
$(CCR) $(CFLAGS) /Fo"$@" main.c
|
||||
curlr.res : curl.rc
|
||||
@@ -284,6 +288,8 @@ rawstrd.obj: ../lib/rawstr.c
|
||||
$(CCD) $(CFLAGS) /Fo"$@" ../lib/rawstr.c
|
||||
strtoofftd.obj: ../lib/strtoofft.c
|
||||
$(CCD) $(CFLAGS) /Fo"$@" ../lib/strtoofft.c
|
||||
xattrd.obj: xattr.c
|
||||
$(CCD) $(CFLAGS) /Fo"$@" xattr.c
|
||||
maind.obj: main.c
|
||||
$(CCD) $(CFLAGS) /Fo"$@" main.c
|
||||
curld.res : curl.rc
|
||||
|
103
src/main.c
103
src/main.c
@@ -51,6 +51,8 @@
|
||||
#endif
|
||||
#include "rawstr.h"
|
||||
|
||||
#include "xattr.h"
|
||||
|
||||
#define CURLseparator "--_curl_--"
|
||||
|
||||
#ifdef NETWARE
|
||||
@@ -579,6 +581,7 @@ struct Configurable {
|
||||
struct curl_httppost *httppost;
|
||||
struct curl_httppost *last_post;
|
||||
struct curl_slist *telnet_options;
|
||||
struct curl_slist *resolve;
|
||||
HttpReq httpreq;
|
||||
|
||||
/* for bandwidth limiting features: */
|
||||
@@ -621,6 +624,7 @@ struct Configurable {
|
||||
int default_node_flags; /* default flags to seach for each 'node', which is
|
||||
basically each given URL to transfer */
|
||||
struct OutStruct *outs;
|
||||
bool xattr; /* store metadata in extended attributes */
|
||||
};
|
||||
|
||||
#define WARN_PREFIX "Warning: "
|
||||
@@ -866,6 +870,7 @@ static void help(void)
|
||||
" --remote-name-all Use the remote file name for all URLs",
|
||||
" -R/--remote-time Set the remote file's time on the local output",
|
||||
" -X/--request <command> Specify request command to use",
|
||||
" --resolve <host:port:address> Force resolve of HOST:PORT to ADDRESS",
|
||||
" --retry <num> Retry request <num> times if transient problems occur",
|
||||
" --retry-delay <seconds> When retrying, wait this many seconds between each",
|
||||
" --retry-max-time <seconds> Retry only within this period",
|
||||
@@ -906,6 +911,7 @@ static void help(void)
|
||||
" --wdebug Turn on Watt-32 debugging",
|
||||
#endif
|
||||
" -w/--write-out <format> What to output after completion",
|
||||
" --xattr Store metadata in extended file attributes",
|
||||
" -q If used as the first parameter disables .curlrc",
|
||||
NULL
|
||||
};
|
||||
@@ -1138,7 +1144,7 @@ static int formparse(struct Configurable *config,
|
||||
char *sep2;
|
||||
|
||||
if((1 == sscanf(input, "%255[^=]=", name)) &&
|
||||
(contp = strchr(input, '='))) {
|
||||
((contp = strchr(input, '=')) != NULL)) {
|
||||
/* the input was using the correct format */
|
||||
|
||||
/* Allocate the contents */
|
||||
@@ -1503,12 +1509,15 @@ static void cleanarg(char *str)
|
||||
|
||||
static int str2num(long *val, const char *str)
|
||||
{
|
||||
int retcode = 0;
|
||||
if(str && ISDIGIT(*str))
|
||||
*val = atoi(str);
|
||||
else
|
||||
retcode = 1; /* badness */
|
||||
return retcode;
|
||||
if(str && ISDIGIT(*str)) {
|
||||
char *endptr;
|
||||
long num = strtol(str, &endptr, 10);
|
||||
if((endptr != str) && (endptr == str + strlen(str))) {
|
||||
*val = num;
|
||||
return 0; /* Ok */
|
||||
}
|
||||
}
|
||||
return 1; /* badness */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1877,6 +1886,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
{"$C", "ftp-pret", FALSE},
|
||||
{"$D", "proto", TRUE},
|
||||
{"$E", "proto-redir", TRUE},
|
||||
{"$F", "resolve", TRUE},
|
||||
{"0", "http1.0", FALSE},
|
||||
{"1", "tlsv1", FALSE},
|
||||
{"2", "sslv2", FALSE},
|
||||
@@ -1953,6 +1963,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
{"y", "speed-time", TRUE},
|
||||
{"z", "time-cond", TRUE},
|
||||
{"#", "progress-bar",FALSE},
|
||||
{"~", "xattr",FALSE},
|
||||
};
|
||||
|
||||
if(('-' != flag[0]) ||
|
||||
@@ -2116,6 +2127,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
break;
|
||||
|
||||
case 'j': /* --compressed */
|
||||
if(toggle && !(curlinfo->features & CURL_VERSION_LIBZ))
|
||||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
config->encoding = toggle;
|
||||
break;
|
||||
|
||||
@@ -2233,7 +2246,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
default: /* the URL! */
|
||||
{
|
||||
struct getout *url;
|
||||
if(config->url_get || (config->url_get=config->url_list)) {
|
||||
if(config->url_get || ((config->url_get = config->url_list) != NULL)) {
|
||||
/* there's a node here, if it already is filled-in continue to find
|
||||
an "empty" node */
|
||||
while(config->url_get && (config->url_get->flags&GETOUT_URL))
|
||||
@@ -2260,6 +2273,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
case '$': /* more options without a short option */
|
||||
switch(subletter) {
|
||||
case 'a': /* --ftp-ssl */
|
||||
if(toggle && !(curlinfo->features & CURL_VERSION_SSL))
|
||||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
config->ftp_ssl = toggle;
|
||||
break;
|
||||
case 'b': /* --ftp-pasv */
|
||||
@@ -2351,12 +2366,16 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
GetStr(&config->ftp_alternative_to_user, nextarg);
|
||||
break;
|
||||
case 'v': /* --ftp-ssl-reqd */
|
||||
if(toggle && !(curlinfo->features & CURL_VERSION_SSL))
|
||||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
config->ftp_ssl_reqd = toggle;
|
||||
break;
|
||||
case 'w': /* --no-sessionid */
|
||||
config->disable_sessionid = (bool)(!toggle);
|
||||
break;
|
||||
case 'x': /* --ftp-ssl-control */
|
||||
if(toggle && !(curlinfo->features & CURL_VERSION_SSL))
|
||||
return PARAM_LIBCURL_DOESNT_SUPPORT;
|
||||
config->ftp_ssl_control = toggle;
|
||||
break;
|
||||
case 'y': /* --ftp-ssl-ccc */
|
||||
@@ -2429,6 +2448,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
if(proto2num(config, &config->proto_redir, nextarg))
|
||||
return PARAM_BAD_USE;
|
||||
break;
|
||||
case 'F': /* --resolve */
|
||||
err = add2list(&config->resolve, nextarg);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '#': /* --progress-bar */
|
||||
@@ -2437,6 +2459,9 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
else
|
||||
config->progressmode = CURL_PROGRESS_STATS;
|
||||
break;
|
||||
case '~': /* --xattr */
|
||||
config->xattr = toggle;
|
||||
break;
|
||||
case '0':
|
||||
/* HTTP version 1.0 */
|
||||
config->httpversion = CURL_HTTP_VERSION_1_0;
|
||||
@@ -2879,7 +2904,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
/* output file */
|
||||
{
|
||||
struct getout *url;
|
||||
if(config->url_out || (config->url_out=config->url_list)) {
|
||||
if(config->url_out || ((config->url_out = config->url_list) != NULL)) {
|
||||
/* there's a node here, if it already is filled-in continue to find
|
||||
an "empty" node */
|
||||
while(config->url_out && (config->url_out->flags&GETOUT_OUTFILE))
|
||||
@@ -3007,7 +3032,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
|
||||
/* we are uploading */
|
||||
{
|
||||
struct getout *url;
|
||||
if(config->url_out || (config->url_out=config->url_list)) {
|
||||
if(config->url_out || ((config->url_out = config->url_list) != NULL)) {
|
||||
/* there's a node here, if it already is filled-in continue to find
|
||||
an "empty" node */
|
||||
while(config->url_out && (config->url_out->flags&GETOUT_UPLOAD))
|
||||
@@ -3689,7 +3714,12 @@ void progressbarinit(struct ProgressData *bar,
|
||||
* we're using our own way to determine screen width */
|
||||
colp = curlx_getenv("COLUMNS");
|
||||
if(colp != NULL) {
|
||||
bar->width = atoi(colp);
|
||||
char *endptr;
|
||||
long num = strtol(colp, &endptr, 10);
|
||||
if((endptr != colp) && (endptr == colp + strlen(colp)) && (num > 0))
|
||||
bar->width = (int)num;
|
||||
else
|
||||
bar->width = 79;
|
||||
curl_free(colp);
|
||||
}
|
||||
else
|
||||
@@ -4027,6 +4057,7 @@ static void free_config_fields(struct Configurable *config)
|
||||
curl_slist_free_all(config->headers);
|
||||
curl_slist_free_all(config->telnet_options);
|
||||
curl_slist_free_all(config->mail_rcpt);
|
||||
curl_slist_free_all(config->resolve);
|
||||
|
||||
if(config->easy)
|
||||
curl_easy_cleanup(config->easy);
|
||||
@@ -4172,15 +4203,9 @@ static CURLcode _my_setopt(CURL *curl, bool str, struct Configurable *config,
|
||||
|
||||
static const char * const srchead[]={
|
||||
"/********* Sample code generated by the curl command line tool **********",
|
||||
" * Add error code checking where appropriate!",
|
||||
" * Compile this with a suitable header include path. Then link with ",
|
||||
" * libcurl.",
|
||||
" * If you use any *_LARGE options, make sure your compiler figure",
|
||||
" * out the correct size for the curl_off_t variable.",
|
||||
" * Read the details for all curl_easy_setopt() options online on:",
|
||||
" * http://curlm.haxx.se/libcurl/c/curl_easy_setopt.html",
|
||||
" * All curl_easy_setopt() options are documented at:",
|
||||
" * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html",
|
||||
" ************************************************************************/",
|
||||
"[m]",
|
||||
"#include <curl/curl.h>",
|
||||
"",
|
||||
"int main(int argc, char *argv[])",
|
||||
@@ -4209,17 +4234,8 @@ static void dumpeasycode(struct Configurable *config)
|
||||
int i;
|
||||
const char *c;
|
||||
|
||||
for(i=0; (c = srchead[i]); i++) {
|
||||
if(!memcmp((char *)c, "[m]", 3)) {
|
||||
#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS > 32)
|
||||
fprintf(out, "#define _FILE_OFFSET_BITS %d "
|
||||
"/* for pre libcurl 7.19.0 curl_off_t magic */\n",
|
||||
_FILE_OFFSET_BITS);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
fprintf(out, "%s\n", c);
|
||||
}
|
||||
for(i=0; ((c = srchead[i]) != '\0'); i++)
|
||||
fprintf(out, "%s\n", c);
|
||||
|
||||
ptr = easycode;
|
||||
while(ptr) {
|
||||
@@ -4505,7 +4521,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
}
|
||||
env = curlx_getenv("CURL_MEMLIMIT");
|
||||
if(env) {
|
||||
curl_memlimit(atoi(env));
|
||||
char *endptr;
|
||||
long num = strtol(env, &endptr, 10);
|
||||
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
|
||||
curl_memlimit(num);
|
||||
curl_free(env);
|
||||
}
|
||||
#endif
|
||||
@@ -4777,9 +4796,9 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
single globbed string. If no upload, we enter the loop once anyway. */
|
||||
for(up = 0;
|
||||
(!up && !infiles) ||
|
||||
(uploadfile = inglob?
|
||||
((uploadfile = inglob?
|
||||
glob_next_url(inglob):
|
||||
(!up?strdup(infiles):NULL));
|
||||
(!up?strdup(infiles):NULL)) != NULL);
|
||||
up++) {
|
||||
int separator = 0;
|
||||
long retry_numretries;
|
||||
@@ -4802,7 +4821,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
|
||||
/* Here's looping around each globbed URL */
|
||||
for(i = 0;
|
||||
(url = urls?glob_next_url(urls):(i?NULL:strdup(url)));
|
||||
((url = urls?glob_next_url(urls):(i?NULL:strdup(url))) != NULL);
|
||||
i++) {
|
||||
/* NOTE: In the condition expression in the for() statement above, the
|
||||
'url' variable is only ever strdup()ed if(i == 0) and thus never
|
||||
@@ -5437,6 +5456,10 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
my_setopt(curl, CURLOPT_HEADERDATA, &outs);
|
||||
}
|
||||
|
||||
if(config->resolve)
|
||||
/* new in 7.21.3 */
|
||||
my_setopt(curl, CURLOPT_RESOLVE, config->resolve);
|
||||
|
||||
retry_numretries = config->req_retry;
|
||||
|
||||
retrystart = cutil_tvnow();
|
||||
@@ -5621,9 +5644,17 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(outfile && !curlx_strequal(outfile, "-") && outs.stream) {
|
||||
int rc = fclose(outs.stream);
|
||||
int rc;
|
||||
|
||||
if(config->xattr) {
|
||||
rc = fwrite_xattr(curl, fileno(outs.stream) );
|
||||
if(rc)
|
||||
warnf(config, "Error setting extended attributes: %s\n",
|
||||
strerror(errno) );
|
||||
}
|
||||
|
||||
rc = fclose(outs.stream);
|
||||
if(!res && rc) {
|
||||
/* something went wrong in the writing process */
|
||||
res = CURLE_WRITE_ERROR;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user