Compare commits

...

38 Commits

Author SHA1 Message Date
Daniel Stenberg
2a05025510 RELEASE-NOTES: two more contributors 2011-04-22 19:17:26 +02:00
Dan Fandrich
d8373cb992 Fixed test 1023 when using daily snapshots 2011-04-21 14:47:35 -07:00
Dan Fandrich
17df5d8caa Include unistd.h to declare close() 2011-04-21 14:47:07 -07:00
Fabian Keil
210278d9a1 In lib/, change 'wanna' to 'want to'.
Found with codespell.
2011-04-21 07:55:53 -07:00
Fabian Keil
5942362847 Fix spelling errors in buildconf
Found with codespell.
2011-04-21 07:55:53 -07:00
Fabian Keil
7d86e467fa Fix spelling errors in src/
Found with codespell.
2011-04-21 07:55:53 -07:00
Fabian Keil
7609b32e7c Fix spelling errors in include/ 2011-04-21 07:55:53 -07:00
Fabian Keil
1702a2c08d Fix a couple of spelling errors in lib/
Found with codespell.
2011-04-21 07:55:53 -07:00
Julien Chaffraix
9230be0797 transfer.c: Fixed indentation in readwrite_data. 2011-04-21 07:55:53 -07:00
Dan Fandrich
7872c8d5a2 Fixed closing test tag 2011-04-20 16:51:44 -07:00
Daniel Stenberg
37b9fe104a RELEASE-NOTES: synced with 3242abd87a 2011-04-20 23:59:36 +02:00
Daniel Stenberg
3242abd87a SFTP: close file before postquote
Make sure that files are closed before the post quote commands run as if
they operate on the just transferred file they could otherwise easily
fail.

Patch by: Rajesh Naganathan (edited)
2011-04-20 23:37:29 +02:00
Dan Fandrich
1b6df743f6 Fixed test 1022 when using daily snapshots 2011-04-20 14:11:12 -07:00
Daniel Stenberg
c2c8948190 Curl_http_connect: detect HTTPS properly after CONNECT
libcurl failed to check the correct struct for HTTPS after CONNECT was
issued to the proxy, so it didn't do the TLS handshake and subsequently
failed the connection. A regression released in 7.21.5 (introduced
around commit 8831000bc0).

Bug: http://curl.haxx.se/mail/lib-2011-04/0134.html
Reported by: Josue Andrade Gomes
2011-04-20 22:50:04 +02:00
Daniel Stenberg
c6a0abdd97 curl_easy_setopt.3: CURLOPT_PROXYTYPE clarification
When set to a HTTP 1.0 proxy, that only affects the CONNECT request and
not the regular HTTP request.
2011-04-20 15:42:23 +02:00
Gisle Vanem
9039d19f01 CURL_DOES_CONVERSIONS: fixes
Made it compile and work again after the code move.
2011-04-20 15:23:57 +02:00
Daniel Stenberg
c828646f60 CURL_DOES_CONVERSIONS: cleanup
Massively reduce #ifdefs all over (23 #ifdef lines less so far)
Moved conversion-specific code to non-ascii.c
2011-04-20 00:50:07 +02:00
Guenter Knauf
eb65a49bef Improve MinGW static makefile builds.
It is now possible to use any combination of features without
having to 1st add makefile targets to the main makefile. The
main makefile now passes the 'mingw32-feat1-feat2' as var CFG,
and the ./[lib|src]/Makefile.m32 parses the CFG var to determine
the features to be enabled.
2011-04-19 20:59:24 +02:00
Guenter Knauf
b2140a09f8 Enabled MinGW native Windows IDN build. 2011-04-19 17:28:28 +02:00
Guenter Knauf
519bec7c91 Windows native IDN fixes.
changed windows.h include to system header;
changed obsolete 2nd check for str_w to str_utf8 in order to catch
malloc() failure and avoid a free(NULL);
changed calls to GetLastError() to void to kill unsused var compiler
warnings;
moved one call to GetLastError() into else case so that its only
called when WideCharToMultiByte() really fails.
2011-04-19 17:13:09 +02:00
Guenter Knauf
24e5a40156 Windows native IDN fixes.
Provide prototype for curl_win32_idn_to_ascii();
remove wrong 3rd parameter from curl_win32_idn_to_ascii() call.
2011-04-19 16:48:32 +02:00
Daniel Stenberg
2d1b6242f2 curl-config: fix version output
do the s/VERSION/CURLVERSION replacement for the human redable output
for --checkfor

Reported by: Ryan Schmidt
2011-04-19 16:41:34 +02:00
Daniel Stenberg
a5db4a46ac RELEASE-NOTES: synced with 5aae3c13e2 2011-04-19 16:40:24 +02:00
Guenter Knauf
65aadf2118 Updated default (recommended) dependency versions. 2011-04-19 14:32:08 +02:00
Guenter Knauf
24667466f0 Updated default (recommended) dependency versions. 2011-04-19 14:26:51 +02:00
Daniel Stenberg
5aae3c13e2 transfer-encoding: document the options
The new libcurl and command line options are now described.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
8e4fb01e64 transfer-encoding: added new option and cmdline
Added CURLOPT_TRANSFER_ENCODING as the option to set to request Transfer
Encoding in HTTP requests (if built zlib enabled). I also renamed
CURLOPT_ENCODING to CURLOPT_ACCEPT_ENCODING (while keeping the old name
around) to reduce the confusion when we have to encoding options for
HTTP.

--tr-encoding is now the new command line option for curl to request
this, and thus I updated the test cases accordingly.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
ebb37eac8b CURLE_BAD_CONTENT_ENCODING: now used for transfer encoding too 2011-04-18 19:46:21 +02:00
Daniel Stenberg
9d191a6a40 TE: do the Connection: header
When TE: is inserted in the request, we must add a "Connection: TE" as
well to be HTTP 1.1 compliant. If a custom Connection: header is passed
in, we must use that and only append TE to it. Test case 1125 verifies
TE: + custom Connection:.
2011-04-18 19:46:21 +02:00
Daniel Stenberg
be973b6f91 test1124: verify gzip AND chunked transfer-encoding 2011-04-18 19:46:21 +02:00
Daniel Stenberg
2db6f7e703 TE: rename struct field content_encoding
Since this struct member is used in the code to determine what and how
to decode automatically and since it is now also used for compressed
Transfer-Encodings, I renamed it to the more suitable 'auto_decoding'
2011-04-18 19:46:21 +02:00
Daniel Stenberg
0790b27910 HTTP: add support for gzip and deflate Transfer-Encoding
Transfer-Encoding differs from Content-Encoding in a few subtle ways,
but primarily it concerns the transfer only and not the content so when
discovered to be compressed we know we have to uncompress it. There will
only arrive compressed transfers in a response after we have requested
them with the appropriate TE: header.

Test case 1122 and 1123 verify.
2011-04-18 19:46:21 +02:00
Patrick Monnerat
e80b957789 OS400 pragma comment: replace (date) by (user, __DATE__) to include year. 2011-04-18 16:52:27 +02:00
Patrick Monnerat
213939c8ba Augment RPG binding with "OLDIES" definitions.
Fix OS400 LDAP wrappers: strings were non null-terminated.
2011-04-18 15:54:45 +02:00
Daniel Stenberg
82ecc85d9e curl-config: fix --version
curl-config --version didn't output the correct version string (bug
introduced in commit 0355e33b5f), and unfortunately the test
case 1022 that was supposed to check for this was broken.

This change fixes the test to detect this problem and it fixes the
output.

Bug: http://curl.haxx.se/bug/view.cgi?id=3288727
2011-04-18 09:03:12 +02:00
Daniel Stenberg
84f809e7a8 RELEASE-NOTES: updated contributor amount 2011-04-17 23:48:50 +02:00
Daniel Stenberg
cae351e9f5 THANKS: 11 new contributors from 7.21.5 2011-04-17 23:46:21 +02:00
Daniel Stenberg
909acfbbba 7.21.6: next planned release number 2011-04-17 23:44:24 +02:00
86 changed files with 1484 additions and 691 deletions

View File

@@ -70,30 +70,18 @@ mingw32:
$(MAKE) -C lib -f Makefile.m32 $(MAKE) -C lib -f Makefile.m32
$(MAKE) -C src -f Makefile.m32 $(MAKE) -C src -f Makefile.m32
mingw32-zlib:
$(MAKE) -C lib -f Makefile.m32 ZLIB=1
$(MAKE) -C src -f Makefile.m32 ZLIB=1
mingw32-ssl-zlib:
$(MAKE) -C lib -f Makefile.m32 SSL=1 ZLIB=1
$(MAKE) -C src -f Makefile.m32 SSL=1 ZLIB=1
mingw32-ssh2-ssl-zlib:
$(MAKE) -C lib -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1
$(MAKE) -C src -f Makefile.m32 SSH2=1 SSL=1 ZLIB=1
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: mingw32-clean:
$(MAKE) -C lib -f Makefile.m32 clean $(MAKE) -C lib -f Makefile.m32 clean
$(MAKE) -C src -f Makefile.m32 clean $(MAKE) -C src -f Makefile.m32 clean
mingw32-vclean mingw32-distclean:
$(MAKE) -C lib -f Makefile.m32 vclean
$(MAKE) -C src -f Makefile.m32 vclean
mingw32%:
$(MAKE) -C lib -f Makefile.m32 CFG=$@
$(MAKE) -C src -f Makefile.m32 CFG=$@
vc-clean: $(VC) vc-clean: $(VC)
cd lib cd lib
nmake -f Makefile.$(VC) clean nmake -f Makefile.$(VC) clean

View File

@@ -1,69 +1,22 @@
Curl and libcurl 7.21.5 Curl and libcurl 7.21.6
Public curl releases: 121 Public curl releases: 122
Command line options: 143 Command line options: 144
curl_easy_setopt() options: 185 curl_easy_setopt() options: 186
Public functions in libcurl: 58 Public functions in libcurl: 58
Known libcurl bindings: 39 Known libcurl bindings: 39
Contributors: 854 Contributors: 865
This release includes the following changes: This release includes the following changes:
o SOCKOPTFUNCTION: callback can say already-connected o Added --tr-encoding and CURLOPT_TRANSFER_ENCODING
o Added --netrc-file
o Added (new) support for cyassl
o TSL-SRP: enabled with OpenSSL
o Added CURLE_NOT_BUILT_IN and CURLE_UNKNOWN_OPTION
This release includes the following bugfixes: This release includes the following bugfixes:
o nss: avoid memory leak on SSL connection failure o curl-config: fix --version
o nss: do not ignore failure of SSL handshake o curl_easy_setopt.3: CURLOPT_PROXYTYPE clarification
o multi: better failed connect handling when using FTP, SMTP, POP3 and IMAP o use HTTPS properly after CONNECT
o runtests.pl: fix pid number concatenation that prevented it from killing o SFTP: close file before post quote operations
the correct process at times
o PolarSSL: Return 0 on receiving TLS CLOSE_NOTIFY alert
o curl_easy_setopt.3: Removed wrong reference to CURLOPT_USERPASSWORD
o multi: close connection on timeout
o IMAP in multi mode does SSL connections non-blocking
o honours the --disable-ldaps configure option
o Force setopt constants written by --libcurl to be long
o ssh_connect: treat libssh2 return code better
o SFTP upload could stall the state machine when the multi_socket API was
used
o SFTP and SCP could leak memory when used with the multi interface and
the connection was closed
o Added missing file to repair the MSVC makefiles
o Fixed detection of recvfrom arguments on Android/bionic
o GSS: handle reuse fix
o transfer: avoid insane conversion of time_t
o nss: do not ignore value of CURLOPT_SSL_VERIFYPEER in certain cases
o SMTP-multi: non-blocking connect
o SFTP-multi: set cselect for sftp and scp to fix "stall" risk
o configure: removed wrongly claimed default paths
o pop3: fixed torture tests to succeed
o symbols-in-versions: many corrections
o if a HTTP request gets retried because the connection was dead, rewind if
any data was sent as part of it
o only probe for working ipv6 once and then re-use that info for further
requests
o requests that are asked to bound to a local interface/port will no longer
wrongly re-use connections that aren't
o libcurl.m4: Add missing quotes in AC_LINK_IFELSE
o progress output: don't print the last update on a separate line
o POP3: the command to send is STLS, not STARTTLS
o POP3: PASS command was not sent after upgrade to TLS
o configure: fix libtool warning
o nss: allow to use multiple client certificates for a single host
o HTTP pipelining: Fix handling of zero-length responses
o Don't list NTLM in curl-config when HTTP is disabled
o curl_easy_setopt.3: CURLOPT_RESOLVE typo version
o OpenSSL: build fine with no-sslv2 versions
o checkconnection: don't call with NULL pointer with RTSP and multi interface
o Borland makefile updates
o configure: libssh2 link fix without pkg-config
o certinfo crash
o CCC crash
This release includes the following known bugs: This release includes the following known bugs:
@@ -72,10 +25,8 @@ This release includes the following known bugs:
This release would not have looked like this without help, code, reports and This release would not have looked like this without help, code, reports and
advice from friends like these: advice from friends like these:
Mike Crowe, Kamil Dudka, Julien Chaffraix, Hoi-Ho Chan, Ben Noordhuis, Patrick Monnerat, Dan Fandrich, Gisle Vanem, Guenter Knauf,
Dan Fandrich, Henry Ludemann, Karl M, Manuel Massing, Marcus Sundberg, Rajesh Naganathan, Josue Andrade Gomes, Ryan Schmidt, Fabian Keil,
Stefan Krause, Todd A Ouska, Saqib Ali, Andre Guibert de Bruet, Julien Chaffraix
Tor Arntsen, Vincent Torri, Dave Reisner, Chris Smowton, Tinus van den Berg,
Hongli Lai, Gisle Vanem, Andrei Benea, Mehmet Bozkurt
Thanks! (and sorry if I forgot to mention someone) Thanks! (and sorry if I forgot to mention someone)

View File

@@ -411,7 +411,7 @@ else
fi fi
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
# Finished succesfully. # Finished successfully.
# #
echo "buildconf: OK" echo "buildconf: OK"

View File

@@ -6,7 +6,7 @@
# | (__| |_| | _ <| |___ # | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____| # \___|\___/|_| \_\_____|
# #
# Copyright (C) 2001 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. # Copyright (C) 2001 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
# #
# This software is licensed as described in the file COPYING, which # This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms # you should have received as part of this distribution. The terms
@@ -94,7 +94,7 @@ while test $# -gt 0; do
;; ;;
--version) --version)
echo libcurl @VERSION@ echo libcurl @CURLVERSION@
exit 0 exit 0
;; ;;
@@ -113,7 +113,7 @@ while test $# -gt 0; do
# silent success # silent success
exit 0 exit 0
else else
echo "requested version $checkfor is newer than existing @VERSION@" echo "requested version $checkfor is newer than existing @CURLVERSION@"
exit 1 exit 1
fi fi
;; ;;

View File

@@ -213,7 +213,7 @@ Win32
set ZLIB_PATH=c:\zlib-1.2.5 set ZLIB_PATH=c:\zlib-1.2.5
set OPENSSL_PATH=c:\openssl-0.9.8r set OPENSSL_PATH=c:\openssl-0.9.8r
set LIBSSH2_PATH=c:\libssh2-1.2.7 set LIBSSH2_PATH=c:\libssh2-1.2.8
ATTENTION: if you want to build with libssh2 support you have to use latest ATTENTION: if you want to build with libssh2 support you have to use latest
version 0.17 - previous versions will NOT work with 7.17.0 and later! version 0.17 - previous versions will NOT work with 7.17.0 and later!

View File

@@ -78,6 +78,7 @@ Bas Mevissen
Ben Darnell Ben Darnell
Ben Greear Ben Greear
Ben Madsen Ben Madsen
Ben Noordhuis
Ben Van Hof Ben Van Hof
Benbuck Nason Benbuck Nason
Benjamin Gerard Benjamin Gerard
@@ -123,6 +124,7 @@ Chris Flerackers
Chris Gaukroger Chris Gaukroger
Chris Maltby Chris Maltby
Chris Mumford Chris Mumford
Chris Smowton
Christian Krause Christian Krause
Christian Kurz Christian Kurz
Christian Robottom Reis Christian Robottom Reis
@@ -320,6 +322,7 @@ Heikki Korpela
Heinrich Ko Heinrich Ko
Hendrik Visage Hendrik Visage
Henrik Storner Henrik Storner
Henry Ludemann
Hidemoto Nakada Hidemoto Nakada
Hoi-Ho Chan Hoi-Ho Chan
Hongli Lai Hongli Lai
@@ -438,6 +441,7 @@ Kai-Uwe Rommel
Kalle Vahlman Kalle Vahlman
Kamil Dudka Kamil Dudka
Kang-Jin Lee Kang-Jin Lee
Karl M
Karl Moerder Karl Moerder
Karol Pietrzak Karol Pietrzak
Kaspar Brand Kaspar Brand
@@ -499,6 +503,7 @@ Luong Dinh Dung
Maciej Karpiuk Maciej Karpiuk
Maciej W. Rozycki Maciej W. Rozycki
Manfred Schwarb Manfred Schwarb
Manuel Massing
Marc Boucher Marc Boucher
Marc Kleine-Budde Marc Kleine-Budde
Marcel Roelofs Marcel Roelofs
@@ -506,6 +511,7 @@ Marcelo Juchem
Marcin Konicki Marcin Konicki
Marco G. Salvagno Marco G. Salvagno
Marco Maggi Marco Maggi
Marcus Sundberg
Marcus Webster Marcus Webster
Mario Schroeder Mario Schroeder
Mark Butler Mark Butler
@@ -545,6 +551,7 @@ Mauro Iorio
Max Katsev Max Katsev
Maxim Ivanov Maxim Ivanov
Maxim Perenesenko Maxim Perenesenko
Mehmet Bozkurt
Mekonikum Mekonikum
Mettgut Jamalla Mettgut Jamalla
Michael Benedict Michael Benedict
@@ -730,6 +737,7 @@ Samuel Listopad
Samuel Thibault Samuel Thibault
Sander Gates Sander Gates
Sandor Feldi Sandor Feldi
Saqib Ali
Saul good Saul good
Scott Barrett Scott Barrett
Scott Cantor Scott Cantor
@@ -796,8 +804,10 @@ Tim Chen
Tim Costello Tim Costello
Tim Newsome Tim Newsome
Tim Sneddon Tim Sneddon
Tinus van den Berg
Tobias Rundstr<74>m Tobias Rundstr<74>m
Toby Peterson Toby Peterson
Todd A Ouska
Todd Kulesza Todd Kulesza
Todd Vierling Todd Vierling
Tom Benoist Tom Benoist
@@ -833,6 +843,7 @@ Vincent Bronner
Vincent Le Normand Vincent Le Normand
Vincent Penquerc'h Vincent Penquerc'h
Vincent Sanders Vincent Sanders
Vincent Torri
Vlad Grachov Vlad Grachov
Vlad Ureche Vlad Ureche
Vladimir Lazarenko Vladimir Lazarenko

View File

@@ -20,7 +20,7 @@
.\" * .\" *
.\" ************************************************************************** .\" **************************************************************************
.\" .\"
.TH curl 1 "28 November 2009" "Curl 7.21.4" "Curl Manual" .TH curl 1 "14 April 2009" "Curl 7.21.6" "Curl Manual"
.SH NAME .SH NAME
curl \- transfer a URL curl \- transfer a URL
.SH SYNOPSIS .SH SYNOPSIS
@@ -175,8 +175,8 @@ NSS ciphers is in the NSSCipherSuite entry at this URL:
If this option is used several times, the last one will override the others. If this option is used several times, the last one will override the others.
.IP "--compressed" .IP "--compressed"
(HTTP) Request a compressed response using one of the algorithms libcurl (HTTP) Request a compressed response using one of the algorithms libcurl
supports, and return the uncompressed document. If this option is used and supports, and save the uncompressed document. If this option is used and the
the server sends an unsupported encoding, curl will report an error. server sends an unsupported encoding, curl will report an error.
.IP "--connect-timeout <seconds>" .IP "--connect-timeout <seconds>"
Maximum time in seconds that you allow the connection to the server to take. Maximum time in seconds that you allow the connection to the server to take.
This only limits the connection phase, once curl has connected this option is This only limits the connection phase, once curl has connected this option is
@@ -1345,6 +1345,11 @@ If this option is used several times, the last one will be used.
.IP "--trace-time" .IP "--trace-time"
Prepends a time stamp to each trace or verbose line that curl displays. Prepends a time stamp to each trace or verbose line that curl displays.
(Added in 7.14.0) (Added in 7.14.0)
.IP "--tr-encoding"
(HTTP) Request a compressed Transfer-Encoding response using one of the
algorithms libcurl supports, and uncompress the data while receiving it.
(Added in 7.21.6)
.IP "-u/--user <user:password>" .IP "-u/--user <user:password>"
Specify the user name and password to use for server authentication. Overrides Specify the user name and password to use for server authentication. Overrides
\fI-n/--netrc\fP and \fI--netrc-optional\fP. \fI-n/--netrc\fP and \fI--netrc-optional\fP.

View File

@@ -641,6 +641,11 @@ this are \fICURLPROXY_HTTP\fP, \fICURLPROXY_HTTP_1_0\fP (added in 7.19.4),
\fICURLPROXY_SOCKS4\fP (added in 7.15.2), \fICURLPROXY_SOCKS5\fP, \fICURLPROXY_SOCKS4\fP (added in 7.15.2), \fICURLPROXY_SOCKS5\fP,
\fICURLPROXY_SOCKS4A\fP (added in 7.18.0) and \fICURLPROXY_SOCKS5_HOSTNAME\fP \fICURLPROXY_SOCKS4A\fP (added in 7.18.0) and \fICURLPROXY_SOCKS5_HOSTNAME\fP
(added in 7.18.0). The HTTP type is default. (Added in 7.10) (added in 7.18.0). The HTTP type is default. (Added in 7.10)
If you set \fBCURLOPT_PROXYTYPE\fP to \fICURLPROXY_HTTP_1_0\fP, it will only
affect how libcurl speaks to a proxy when CONNECT is used. The HTTP version
used for "regular" HTTP requests is instead controled with
\fICURLOPT_HTTP_VERSION\fP.
.IP CURLOPT_NOPROXY .IP CURLOPT_NOPROXY
Pass a pointer to a zero terminated string. The should be a comma- separated Pass a pointer to a zero terminated string. The should be a comma- separated
list of hosts which do not use a proxy, if one is specified. The only list of hosts which do not use a proxy, if one is specified. The only
@@ -916,7 +921,7 @@ work. (Added in 7.10.7)
Pass a parameter set to 1 to enable this. When enabled, libcurl will Pass a parameter set to 1 to enable this. When enabled, libcurl will
automatically set the Referer: field in requests where it follows a Location: automatically set the Referer: field in requests where it follows a Location:
redirect. redirect.
.IP CURLOPT_ENCODING .IP CURLOPT_ACCEPT_ENCODING
Sets the contents of the Accept-Encoding: header sent in an HTTP request, and Sets the contents of the Accept-Encoding: header sent in an HTTP request, and
enables decoding of a response when a Content-Encoding: header is received. enables decoding of a response when a Content-Encoding: header is received.
Three encodings are supported: \fIidentity\fP, which does nothing, Three encodings are supported: \fIidentity\fP, which does nothing,
@@ -928,6 +933,21 @@ supported encodings is sent.
This is a request, not an order; the server may or may not do it. This option This is a request, not an order; the server may or may not do it. This option
must be set (to any non-NULL value) or else any unsolicited encoding done by must be set (to any non-NULL value) or else any unsolicited encoding done by
the server is ignored. See the special file lib/README.encoding for details. the server is ignored. See the special file lib/README.encoding for details.
(This option was called CURLOPT_ENCODING before 7.21.6)
.IP CURLOPT_TRANSFER_ENCODING
Adds a request for compressed Transfer Encoding in the outgoing HTTP
request. If the server supports this and so desires, it can respond with the
HTTP resonse sent using a compressed Transfer-Encoding that will be
automatically uncompressed by libcurl on receival.
Transfer-Encoding differs slightly from the Content-Encoding you ask for with
\fBCURLOPT_ACCEPT_ENCODING\fP in that a Transfer-Encoding is strictly meant to
be for the transfer and thus MUST be decoded before the data arrives in the
client. Traditionally, Transfer-Encoding has been much less used and supported
by both HTTP clients and HTTP servers.
(Added in 7.21.6)
.IP CURLOPT_FOLLOWLOCATION .IP CURLOPT_FOLLOWLOCATION
A parameter set to 1 tells the library to follow any Location: header that the A parameter set to 1 tells the library to follow any Location: header that the
server sends as part of an HTTP header. server sends as part of an HTTP header.

View File

@@ -282,6 +282,7 @@ CURLOPTTYPE_FUNCTIONPOINT 7.1
CURLOPTTYPE_LONG 7.1 CURLOPTTYPE_LONG 7.1
CURLOPTTYPE_OBJECTPOINT 7.1 CURLOPTTYPE_OBJECTPOINT 7.1
CURLOPTTYPE_OFF_T 7.11.0 CURLOPTTYPE_OFF_T 7.11.0
CURLOPT_ACCEPT_ENCODING 7.21.6
CURLOPT_ADDRESS_SCOPE 7.19.0 CURLOPT_ADDRESS_SCOPE 7.19.0
CURLOPT_APPEND 7.17.0 CURLOPT_APPEND 7.17.0
CURLOPT_AUTOREFERER 7.1 CURLOPT_AUTOREFERER 7.1
@@ -485,6 +486,7 @@ CURLOPT_TLSAUTH_PASSWORD 7.21.4
CURLOPT_TLSAUTH_TYPE 7.21.4 CURLOPT_TLSAUTH_TYPE 7.21.4
CURLOPT_TLSAUTH_USERNAME 7.21.4 CURLOPT_TLSAUTH_USERNAME 7.21.4
CURLOPT_TRANSFERTEXT 7.1.1 CURLOPT_TRANSFERTEXT 7.1.1
CURLOPT_TRANSFER_ENCODING 7.21.6
CURLOPT_UNRESTRICTED_AUTH 7.10.4 CURLOPT_UNRESTRICTED_AUTH 7.10.4
CURLOPT_UPLOAD 7.1 CURLOPT_UPLOAD 7.1
CURLOPT_URL 7.1 CURLOPT_URL 7.1

View File

@@ -36,7 +36,7 @@ The following notes apply to libcurl version 7.19.0 and later.
* If you intend to distribute an already compiled libcurl library you _MUST_ * If you intend to distribute an already compiled libcurl library you _MUST_
also distribute along with it the generated curl/curlbuild.h which has been also distribute along with it the generated curl/curlbuild.h which has been
used to compile it. Otherwise the library will be of no use for the users of used to compile it. Otherwise the library will be of no use for the users of
the library that you have built. It is _your_ responsability to provide this the library that you have built. It is _your_ responsibility to provide this
file. No one at the cURL project can know how you have built the library. file. No one at the cURL project can know how you have built the library.
* File curl/curlbuild.h includes platform and configuration dependent info, * File curl/curlbuild.h includes platform and configuration dependent info,

View File

@@ -467,7 +467,7 @@ typedef enum {
CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */ CURLE_SSL_CERTPROBLEM, /* 58 - problem with the local certificate */
CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */ CURLE_SSL_CIPHER, /* 59 - couldn't use specified cipher */
CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */ CURLE_SSL_CACERT, /* 60 - problem with the CA cert (path?) */
CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized transfer encoding */ CURLE_BAD_CONTENT_ENCODING, /* 61 - Unrecognized/bad encoding */
CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */ CURLE_LDAP_INVALID_URL, /* 62 - Invalid LDAP URL */
CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */ CURLE_FILESIZE_EXCEEDED, /* 63 - Maximum file size exceeded */
CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */ CURLE_USE_SSL_FAILED, /* 64 - Requested FTP SSL level failed */
@@ -517,7 +517,8 @@ typedef enum {
#ifndef CURL_NO_OLDIES /* define this to test if your app builds with all #ifndef CURL_NO_OLDIES /* define this to test if your app builds with all
the obsolete stuff removed! */ the obsolete stuff removed! */
/* Backwards compatibility with older names */ /* compatibility with older names */
#define CURLOPT_ENCODING CURLOPT_ACCEPT_ENCODING
/* The following were added in 7.21.5, April 2011 */ /* The following were added in 7.21.5, April 2011 */
#define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION #define CURLE_UNKNOWN_TELNET_OPTION CURLE_UNKNOWN_OPTION
@@ -528,7 +529,7 @@ typedef enum {
/* The following were added in 7.17.0 */ /* The following were added in 7.17.0 */
/* These are scheduled to disappear by 2009 */ /* These are scheduled to disappear by 2009 */
#define CURLE_OBSOLETE CURLE_OBSOLETE50 /* noone should be using this! */ #define CURLE_OBSOLETE CURLE_OBSOLETE50 /* no one should be using this! */
#define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46 #define CURLE_BAD_PASSWORD_ENTERED CURLE_OBSOLETE46
#define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44 #define CURLE_BAD_CALLING_ORDER CURLE_OBSOLETE44
#define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10 #define CURLE_FTP_USER_PASSWORD_INCORRECT CURLE_OBSOLETE10
@@ -1103,8 +1104,9 @@ typedef enum {
CINIT(PROXYTYPE, LONG, 101), CINIT(PROXYTYPE, LONG, 101),
/* Set the Accept-Encoding string. Use this to tell a server you would like /* Set the Accept-Encoding string. Use this to tell a server you would like
the response to be compressed. */ the response to be compressed. Before 7.21.6, this was known as
CINIT(ENCODING, OBJECTPOINT, 102), CURLOPT_ENCODING */
CINIT(ACCEPT_ENCODING, OBJECTPOINT, 102),
/* Set pointer to private data */ /* Set pointer to private data */
CINIT(PRIVATE, OBJECTPOINT, 103), CINIT(PRIVATE, OBJECTPOINT, 103),
@@ -1462,6 +1464,18 @@ typedef enum {
/* Set authentication type for authenticated TLS */ /* Set authentication type for authenticated TLS */
CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206), CINIT(TLSAUTH_TYPE, OBJECTPOINT, 206),
/* Set to 1 to enable the "TE:" header in HTTP requests to ask for
compressed transfer-encoded responses. Set to 0 to disable the use of TE:
in outgoing requests. The current default is 0, but it might change in a
future libcurl release.
libcurl will ask for the compressed methods it knows of, and if that
isn't any, it will not ask for transfer-encoding at all even if this
option is set to 1.
*/
CINIT(TRANSFER_ENCODING, LONG, 207),
CURLOPT_LASTENTRY /* the last unused */ CURLOPT_LASTENTRY /* the last unused */
} CURLoption; } CURLoption;

View File

@@ -30,13 +30,13 @@
/* This is the version number of the libcurl package from which this header /* This is the version number of the libcurl package from which this header
file origins: */ file origins: */
#define LIBCURL_VERSION "7.21.5-DEV" #define LIBCURL_VERSION "7.21.6-DEV"
/* The numeric version number is also available "in parts" by using these /* The numeric version number is also available "in parts" by using these
defines: */ defines: */
#define LIBCURL_VERSION_MAJOR 7 #define LIBCURL_VERSION_MAJOR 7
#define LIBCURL_VERSION_MINOR 21 #define LIBCURL_VERSION_MINOR 21
#define LIBCURL_VERSION_PATCH 5 #define LIBCURL_VERSION_PATCH 6
/* This is the numeric version of the libcurl version number, meant for easier /* This is the numeric version of the libcurl version number, meant for easier
parsing and comparions by programs. The LIBCURL_VERSION_NUM define will 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 and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work. comparisons with greater than and less than work.
*/ */
#define LIBCURL_VERSION_NUM 0x071505 #define LIBCURL_VERSION_NUM 0x071506
/* /*
* This is the date and time when the full source package was created. The * This is the date and time when the full source package was created. The

View File

@@ -53,8 +53,8 @@ CURL_EXTERN CURLcode curl_easy_getinfo(CURL *curl, CURLINFO info, ...);
* *
* Creates a new curl session handle with the same options set for the handle * Creates a new curl session handle with the same options set for the handle
* passed in. Duplicating a handle could only be a matter of cloning data and * passed in. Duplicating a handle could only be a matter of cloning data and
* options, internal state info and things like persistant connections cannot * options, internal state info and things like persistent connections cannot
* be transfered. It is useful in multithreaded applications when you can run * be transferred. It is useful in multithreaded applications when you can run
* curl_easy_duphandle() for each new thread to avoid a series of identical * curl_easy_duphandle() for each new thread to avoid a series of identical
* curl_easy_setopt() invokes in every thread. * curl_easy_setopt() invokes in every thread.
*/ */

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -224,7 +224,7 @@ _CURL_WARNING(_curl_easy_getinfo_err_curl_slist,
(option) == CURLOPT_PROXYUSERNAME || \ (option) == CURLOPT_PROXYUSERNAME || \
(option) == CURLOPT_PROXYPASSWORD || \ (option) == CURLOPT_PROXYPASSWORD || \
(option) == CURLOPT_NOPROXY || \ (option) == CURLOPT_NOPROXY || \
(option) == CURLOPT_ENCODING || \ (option) == CURLOPT_ACCEPT_ENCODING || \
(option) == CURLOPT_REFERER || \ (option) == CURLOPT_REFERER || \
(option) == CURLOPT_USERAGENT || \ (option) == CURLOPT_USERAGENT || \
(option) == CURLOPT_COOKIE || \ (option) == CURLOPT_COOKIE || \

View File

@@ -82,7 +82,7 @@ ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5
!ifdef %libssh2_root !ifdef %libssh2_root
LIBSSH2_ROOT = $(%libssh2_root) LIBSSH2_ROOT = $(%libssh2_root)
!else !else
LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7 LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.8
!endif !endif
!ifdef %librtmp_root !ifdef %librtmp_root

View File

@@ -21,7 +21,8 @@ CSOURCES = file.c timeval.c base64.c hostip.c progress.c formdata.c \
socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \ socks_gssapi.c socks_sspi.c curl_sspi.c slist.c nonblock.c \
curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \ curl_memrchr.c imap.c pop3.c smtp.c pingpong.c rtsp.c curl_threads.c \
warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\ warnless.c hmac.c polarssl.c curl_rtmp.c openldap.c curl_gethostname.c\
gopher.c axtls.c idn_win32.c http_negotiate_sspi.c cyassl.c http_proxy.c gopher.c axtls.c idn_win32.c http_negotiate_sspi.c cyassl.c http_proxy.c \
non-ascii.c
HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \ progress.h formdata.h cookie.h http.h sendf.h ftp.h url.h dict.h \
@@ -36,5 +37,5 @@ HHEADERS = arpa_telnet.h netrc.h file.h timeval.h qssl.h hostip.h \
curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \ curl_base64.h rawstr.h curl_addrinfo.h curl_sspi.h slist.h nonblock.h \
curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \ curl_memrchr.h imap.h pop3.h smtp.h pingpong.h rtsp.h curl_threads.h \
warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \ warnless.h curl_hmac.h polarssl.h curl_rtmp.h curl_gethostname.h \
gopher.h axtls.h cyassl.h http_proxy.h gopher.h axtls.h cyassl.h http_proxy.h non-ascii.h

View File

@@ -1,10 +1,10 @@
######################################################################### #########################################################################
# #
## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later) ## Makefile for building libcurl.a with MingW32 (GCC-3.2 or later)
## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5) ## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5), librtmp (2.3)
## ##
## Usage: ## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1] ## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-sspi-winidn
## ##
## Hint: you can also set environment vars to control the build, f.e.: ## Hint: you can also set environment vars to control the build, f.e.:
## set ZLIB_PATH=c:/zlib-1.2.5 ## set ZLIB_PATH=c:/zlib-1.2.5
@@ -24,15 +24,21 @@ OPENSSL_PATH = ../../openssl-0.9.8r
endif endif
# Edit the path below to point to the base of your LibSSH2 package. # Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.2.7 LIBSSH2_PATH = ../../libssh2-1.2.8
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.3
endif endif
# Edit the path below to point to the base of your libidn package. # Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.18 LIBIDN_PATH = ../../libidn-1.18
endif endif
# Edit the path below to point to the base of your librtmp package. # Edit the path below to point to the base of your MS idndlpackage.
ifndef LIBRTMP_PATH # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
LIBRTMP_PATH = ../../librtmp-2.3 # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
ifndef WINIDN_PATH
WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
endif endif
# Edit the path below to point to the base of your Novell LDAP NDK. # Edit the path below to point to the base of your Novell LDAP NDK.
ifndef LDAP_SDK ifndef LDAP_SDK
@@ -45,9 +51,10 @@ LIBCARES_PATH = ../ares
endif endif
CC = gcc CC = gcc
AR = ar CFLAGS = -g -O2 -Wall
# comment LDFLAGS below to keep debug info # comment LDFLAGS below to keep debug info
LDFLAGS = -s LDFLAGS = -s
AR = ar
RANLIB = ranlib RANLIB = ranlib
RC = windres RC = windres
RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i RCFLAGS = --include-dir=../include -DDEBUGBUILD=0 -O COFF -i
@@ -57,8 +64,46 @@ STRIP = strip -g
######################################################## ########################################################
## Nothing more to do below this line! ## Nothing more to do below this line!
ifeq ($(findstring -dyn,$(CFG)),-dyn)
DYN = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
ARES = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
RTMP = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
SSH2 = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssl,$(CFG)),-ssl)
SSL = 1
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
IDN = 1
endif
ifeq ($(findstring -winidn,$(CFG)),-winidn)
WINIDN = 1
endif
ifeq ($(findstring -sspi,$(CFG)),-sspi)
SSPI = 1
endif
ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
LDAPS = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
IPV6 = 1
endif
INCLUDES = -I. -I../include INCLUDES = -I. -I../include
CFLAGS = -g -O2 -DBUILDING_LIBCURL CFLAGS += -DBUILDING_LIBCURL
ifdef ARES ifdef ARES
INCLUDES += -I$(LIBCARES_PATH) INCLUDES += -I$(LIBCARES_PATH)
CFLAGS += -DUSE_ARES CFLAGS += -DUSE_ARES
@@ -91,6 +136,13 @@ ifdef IDN
INCLUDES += -I"$(LIBIDN_PATH)/include" INCLUDES += -I"$(LIBIDN_PATH)/include"
CFLAGS += -DUSE_LIBIDN CFLAGS += -DUSE_LIBIDN
DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn DLL_LIBS += -L$(LIBIDN_PATH)/lib -lidn
else
ifdef WINIDN
INCLUDES += -I"$(WINIDN_PATH)/include"
CFLAGS += -DHAVE_NORMALIZATION_H
CFLAGS += -DUSE_WIN32_IDN
DLL_LIBS += -L"$(WINIDN_PATH)" -lnormaliz
endif
endif endif
ifdef SSPI ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI CFLAGS += -DUSE_WINDOWS_SSPI

View File

@@ -24,7 +24,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package. # Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.2.7 LIBSSH2_PATH = ../../libssh2-1.2.8
endif endif
# Edit the path below to point to the base of your axTLS package. # Edit the path below to point to the base of your axTLS package.

View File

@@ -5,7 +5,7 @@
#Description: makefile to be used in order to compile libcurl for VxWoorks 6.3. #Description: makefile to be used in order to compile libcurl for VxWoorks 6.3.
# #
#How to use: #How to use:
# 1. Adjust environment variables at the file begining # 1. Adjust environment variables at the file beginning
# 2. Open the Command Prompt window and change directory ('cd') # 2. Open the Command Prompt window and change directory ('cd')
# into the 'lib' folder # into the 'lib' folder
# 3. Add <CYGWIN>/bin folder to the PATH environment variable # 3. Add <CYGWIN>/bin folder to the PATH environment variable

View File

@@ -33,21 +33,21 @@ Gallagher, and support for the 'gzip' encoding was added by Dan Fandrich.
To cause libcurl to request a content encoding use: To cause libcurl to request a content encoding use:
curl_easy_setopt(curl, CURLOPT_ENCODING, <string>) curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, <string>)
where <string> is the intended value of the Accept-Encoding header. where <string> is the intended value of the Accept-Encoding header.
Currently, libcurl only understands how to process responses that use the Currently, libcurl only understands how to process responses that use the
"deflate" or "gzip" Content-Encoding, so the only values for CURLOPT_ENCODING "deflate" or "gzip" Content-Encoding, so the only values for
that will work (besides "identity," which does nothing) are "deflate" and CURLOPT_ACCEPT_ENCODING that will work (besides "identity," which does
"gzip" If a response is encoded using the "compress" or methods, libcurl will nothing) are "deflate" and "gzip" If a response is encoded using the
return an error indicating that the response could not be decoded. If "compress" or methods, libcurl will return an error indicating that the
<string> is NULL no Accept-Encoding header is generated. If <string> is a response could not be decoded. If <string> is NULL no Accept-Encoding header
zero-length string, then an Accept-Encoding header containing all supported is generated. If <string> is a zero-length string, then an Accept-Encoding
encodings will be generated. header containing all supported encodings will be generated.
The CURLOPT_ENCODING must be set to any non-NULL value for content to be The CURLOPT_ACCEPT_ENCODING must be set to any non-NULL value for content to
automatically decoded. If it is not set and the server still sends encoded be automatically decoded. If it is not set and the server still sends encoded
content (despite not having been asked), the data is returned in its raw form content (despite not having been asked), the data is returned in its raw form
and the Content-Encoding type is not checked. and the Content-Encoding type is not checked.

View File

@@ -26,7 +26,7 @@
* Telnet option defines. Add more here if in need. * Telnet option defines. Add more here if in need.
*/ */
#define CURL_TELOPT_BINARY 0 /* binary 8bit data */ #define CURL_TELOPT_BINARY 0 /* binary 8bit data */
#define CURL_TELOPT_SGA 3 /* Supress Go Ahead */ #define CURL_TELOPT_SGA 3 /* Suppress Go Ahead */
#define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */ #define CURL_TELOPT_EXOPL 255 /* EXtended OPtions List */
#define CURL_TELOPT_TTYPE 24 /* Terminal TYPE */ #define CURL_TELOPT_TTYPE 24 /* Terminal TYPE */
#define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */ #define CURL_TELOPT_XDISPLOC 35 /* X DISPlay LOCation */

View File

@@ -296,7 +296,7 @@ Curl_axtls_connect(struct connectdata *conn,
else else
infof(data, "\t server certificate verification SKIPPED\n"); infof(data, "\t server certificate verification SKIPPED\n");
/* Here, gtls.c does issuer verfication. axTLS has no straightforward /* Here, gtls.c does issuer verification. axTLS has no straightforward
* equivalent, so omitting for now.*/ * equivalent, so omitting for now.*/
/* See if common name was set in server certificate */ /* See if common name was set in server certificate */

View File

@@ -31,10 +31,10 @@
#include <curl/mprintf.h> #include <curl/mprintf.h>
#include "urldata.h" /* for the SessionHandle definition */ #include "urldata.h" /* for the SessionHandle definition */
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "warnless.h" #include "warnless.h"
#include "curl_base64.h" #include "curl_base64.h"
#include "curl_memory.h" #include "curl_memory.h"
#include "non-ascii.h"
/* include memdebug.h last */ /* include memdebug.h last */
#include "memdebug.h" #include "memdebug.h"
@@ -146,9 +146,7 @@ size_t Curl_base64_encode(struct SessionHandle *data,
int inputparts; int inputparts;
char *output; char *output;
char *base64data; char *base64data;
#ifdef CURL_DOES_CONVERSIONS
char *convbuf = NULL; char *convbuf = NULL;
#endif
const char *indata = inputbuff; const char *indata = inputbuff;
@@ -161,29 +159,16 @@ size_t Curl_base64_encode(struct SessionHandle *data,
if(NULL == output) if(NULL == output)
return 0; return 0;
#ifdef CURL_DOES_CONVERSIONS
/* /*
* The base64 data needs to be created using the network encoding * The base64 data needs to be created using the network encoding
* not the host encoding. And we can't change the actual input * not the host encoding. And we can't change the actual input
* so we copy it to a buffer, translate it, and use that instead. * so we copy it to a buffer, translate it, and use that instead.
*/ */
if(data) { if(Curl_convert_clone(data, indata, insize, &convbuf))
convbuf = malloc(insize); return 0;
if(!convbuf) {
free(output); if(convbuf)
return 0; indata = (char *)convbuf;
}
memcpy(convbuf, indata, insize);
if(CURLE_OK != Curl_convert_to_network(data, convbuf, insize)) {
free(convbuf);
free(output);
return 0;
}
indata = convbuf; /* switch to the converted buffer */
}
#else
(void)data;
#endif
while(insize > 0) { while(insize > 0) {
for (i = inputparts = 0; i < 3; i++) { for (i = inputparts = 0; i < 3; i++) {
@@ -229,10 +214,9 @@ size_t Curl_base64_encode(struct SessionHandle *data,
*output=0; *output=0;
*outptr = base64data; /* make it return the actual data memory */ *outptr = base64data; /* make it return the actual data memory */
#ifdef CURL_DOES_CONVERSIONS if(convbuf)
if(data)
free(convbuf); free(convbuf);
#endif
return strlen(base64data); /* return the length of the new data */ return strlen(base64data); /* return the length of the new data */
} }
/* ---- End of Base64 Encoding ---- */ /* ---- End of Base64 Encoding ---- */

View File

@@ -174,7 +174,7 @@ long Curl_timeleft(struct SessionHandle *data,
nowp = &now; nowp = &now;
} }
/* substract elapsed time */ /* subtract elapsed time */
timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle); timeout_ms -= Curl_tvdiff(*nowp, data->progress.t_startsingle);
if(!timeout_ms) if(!timeout_ms)
/* avoid returning 0 as that means no timeout! */ /* avoid returning 0 as that means no timeout! */

View File

@@ -266,7 +266,7 @@ Curl_cookie_add(struct SessionHandle *data,
} }
} }
else if(Curl_raw_equal("domain", name)) { else if(Curl_raw_equal("domain", name)) {
/* note that this name may or may not have a preceeding dot, but /* note that this name may or may not have a preceding dot, but
we don't care about that, we treat the names the same anyway */ we don't care about that, we treat the names the same anyway */
const char *domptr=whatptr; const char *domptr=whatptr;
@@ -307,7 +307,7 @@ Curl_cookie_add(struct SessionHandle *data,
or the given domain is not valid and thus cannot be set. */ or the given domain is not valid and thus cannot be set. */
if('.' == whatptr[0]) if('.' == whatptr[0])
whatptr++; /* ignore preceeding dot */ whatptr++; /* ignore preceding dot */
if(!domain || tailmatch(whatptr, domain)) { if(!domain || tailmatch(whatptr, domain)) {
const char *tailptr=whatptr; const char *tailptr=whatptr;
@@ -479,7 +479,7 @@ Curl_cookie_add(struct SessionHandle *data,
marked with httpOnly after the domain name are not accessible marked with httpOnly after the domain name are not accessible
from javascripts, but since curl does not operate at javascript from javascripts, but since curl does not operate at javascript
level, we include them anyway. In Firefox's cookie files, these level, we include them anyway. In Firefox's cookie files, these
lines are preceeded with #HttpOnly_ and then everything is lines are preceded with #HttpOnly_ and then everything is
as usual, so we skip 10 characters of the line.. as usual, so we skip 10 characters of the line..
*/ */
if (strncmp(lineptr, "#HttpOnly_", 10) == 0) { if (strncmp(lineptr, "#HttpOnly_", 10) == 0) {
@@ -514,7 +514,7 @@ Curl_cookie_add(struct SessionHandle *data,
ptr=strtok_r(NULL, "\t", &tok_buf), fields++) { ptr=strtok_r(NULL, "\t", &tok_buf), fields++) {
switch(fields) { switch(fields) {
case 0: case 0:
if(ptr[0]=='.') /* skip preceeding dots */ if(ptr[0]=='.') /* skip preceding dots */
ptr++; ptr++;
co->domain = strdup(ptr); co->domain = strdup(ptr);
if(!co->domain) if(!co->domain)

View File

@@ -486,7 +486,7 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
* *
* This is strictly for memory tracing and are using the same style as the * This is strictly for memory tracing and are using the same style as the
* family otherwise present in memdebug.c. I put these ones here since they * family otherwise present in memdebug.c. I put these ones here since they
* require a bunch of structs I didn't wanna include in memdebug.c * require a bunch of structs I didn't want to include in memdebug.c
*/ */
void void
@@ -506,7 +506,7 @@ curl_dofreeaddrinfo(struct addrinfo *freethis,
* *
* This is strictly for memory tracing and are using the same style as the * This is strictly for memory tracing and are using the same style as the
* family otherwise present in memdebug.c. I put these ones here since they * family otherwise present in memdebug.c. I put these ones here since they
* require a bunch of structs I didn't wanna include in memdebug.c * require a bunch of structs I didn't want to include in memdebug.c
*/ */
int int

View File

@@ -29,7 +29,7 @@
#include <curl/curl.h> #include <curl/curl.h>
/* /*
* When including the folowing three headers, it is mandatory to define either * When including the following three headers, it is mandatory to define either
* SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code. * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code.
*/ */

View File

@@ -85,22 +85,11 @@
#include "connect.h" /* for Curl_getconnectinfo */ #include "connect.h" /* for Curl_getconnectinfo */
#include "slist.h" #include "slist.h"
#include "curl_rand.h" #include "curl_rand.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
#include <iconv.h>
/* set default codesets for iconv */
#ifndef CURL_ICONV_CODESET_OF_NETWORK
#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
#endif
#ifndef CURL_ICONV_CODESET_FOR_UTF8
#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
#endif
#define ICONV_ERROR (size_t)-1
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
@@ -694,14 +683,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
goto fail; goto fail;
#endif #endif
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) Curl_convert_setup(outcurl);
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);
@@ -863,196 +845,6 @@ CURLcode curl_easy_pause(CURL *curl, int action)
return result; return result;
} }
#ifdef CURL_DOES_CONVERSIONS
/*
* Curl_convert_to_network() is an internal function
* for performing ASCII conversions on non-ASCII platforms.
*/
CURLcode Curl_convert_to_network(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convtonetwork) {
/* use translation callback */
rc = data->set.convtonetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return(rc);
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->outbound_cd == (iconv_t)-1) {
data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST);
if(data->outbound_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->outbound_cd, (const char**)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_to_network iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
failf(data, "CURLOPT_CONV_TO_NETWORK_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
/*
* Curl_convert_from_network() is an internal function
* for performing ASCII conversions on non-ASCII platforms.
*/
CURLcode Curl_convert_from_network(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convfromnetwork) {
/* use translation callback */
rc = data->set.convfromnetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return(rc);
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->inbound_cd == (iconv_t)-1) {
data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK);
if(data->inbound_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_from_network iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
failf(data, "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
/*
* Curl_convert_from_utf8() is an internal function
* for performing UTF-8 conversions on non-ASCII platforms.
*/
CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convfromutf8) {
/* use translation callback */
rc = data->set.convfromutf8(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return(rc);
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
const char *input_ptr;
char *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->utf8_cd == (iconv_t)-1) {
data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8);
if(data->utf8_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->utf8_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
if(output_ptr < input_ptr) {
/* null terminate the now shorter output string */
*output_ptr = 0x00;
}
#else
failf(data, "CURLOPT_CONV_FROM_UTF8_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
#endif /* CURL_DOES_CONVERSIONS */
static CURLcode easy_connection(struct SessionHandle *data, static CURLcode easy_connection(struct SessionHandle *data,
curl_socket_t *sfd, curl_socket_t *sfd,

View File

@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -29,11 +29,4 @@ void Curl_easy_addmulti(struct SessionHandle *data, void *multi);
void Curl_easy_initHandleData(struct SessionHandle *data); void Curl_easy_initHandleData(struct SessionHandle *data);
CURLcode Curl_convert_to_network(struct SessionHandle *data,
char *buffer, size_t length);
CURLcode Curl_convert_from_network(struct SessionHandle *data,
char *buffer, size_t length);
CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
char *buffer, size_t length);
#endif /* __EASYIF_H */ #endif /* __EASYIF_H */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -31,10 +31,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "curl_memory.h" #include "curl_memory.h"
/* urldata.h and easyif.h are included for Curl_convert_... prototypes */
#include "urldata.h" #include "urldata.h"
#include "easyif.h"
#include "warnless.h" #include "warnless.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -91,10 +90,6 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
int strindex=0; int strindex=0;
size_t length; size_t length;
#ifndef CURL_DOES_CONVERSIONS
/* avoid compiler warnings */
(void)handle;
#endif
ns = malloc(alloc); ns = malloc(alloc);
if(!ns) if(!ns)
return NULL; return NULL;
@@ -122,15 +117,11 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength)
} }
} }
#ifdef CURL_DOES_CONVERSIONS if(Curl_convert_to_network(handle, &in, 1)) {
/* escape sequences are always in ASCII so convert them on non-ASCII hosts */
if(!handle ||
(Curl_convert_to_network(handle, &in, 1) != CURLE_OK)) {
/* Curl_convert_to_network calls failf if unsuccessful */ /* Curl_convert_to_network calls failf if unsuccessful */
free(ns); free(ns);
return NULL; return NULL;
} }
#endif /* CURL_DOES_CONVERSIONS */
snprintf(&ns[strindex], 4, "%%%02X", in); snprintf(&ns[strindex], 4, "%%%02X", in);
@@ -157,11 +148,7 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
int strindex=0; int strindex=0;
unsigned long hex; unsigned long hex;
#ifndef CURL_DOES_CONVERSIONS if(!ns)
/* avoid compiler warnings */
(void)handle;
#endif
if( !ns )
return NULL; return NULL;
while(--alloc > 0) { while(--alloc > 0) {
@@ -178,15 +165,11 @@ char *curl_easy_unescape(CURL *handle, const char *string, int length,
in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */ in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */
#ifdef CURL_DOES_CONVERSIONS if(Curl_convert_from_network(handle, &in, 1)) {
/* escape sequences are always in ASCII so convert them on non-ASCII hosts */
if(!handle ||
(Curl_convert_from_network(handle, &in, 1) != CURLE_OK)) {
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
free(ns); free(ns);
return NULL; return NULL;
} }
#endif /* CURL_DOES_CONVERSIONS */
string+=2; string+=2;
alloc-=2; alloc-=2;

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -118,7 +118,6 @@ Content-Disposition: form-data; name="FILECONTENT"
#include <libgen.h> #include <libgen.h>
#endif #endif
#include "urldata.h" /* for struct SessionHandle */ #include "urldata.h" /* for struct SessionHandle */
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "formdata.h" #include "formdata.h"
#include "curl_rand.h" #include "curl_rand.h"
#include "strequal.h" #include "strequal.h"
@@ -461,8 +460,10 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
*/ */
case CURLFORM_PTRNAME: case CURLFORM_PTRNAME:
#ifdef CURL_DOES_CONVERSIONS #ifdef CURL_DOES_CONVERSIONS
/* treat CURLFORM_PTR like CURLFORM_COPYNAME so we'll /* Treat CURLFORM_PTR like CURLFORM_COPYNAME so that libcurl will copy
have safe memory for the eventual conversion */ * the data in all cases so that we'll have safe memory for the eventual
* conversion.
*/
#else #else
current_form->flags |= HTTPPOST_PTRNAME; /* fall through */ current_form->flags |= HTTPPOST_PTRNAME; /* fall through */
#endif #endif
@@ -934,36 +935,6 @@ void Curl_formclean(struct FormData **form_ptr)
*form_ptr = NULL; *form_ptr = NULL;
} }
#ifdef CURL_DOES_CONVERSIONS
/*
* Curl_formcovert() is used from http.c, this converts any
form items that need to be sent in the network encoding.
Returns CURLE_OK on success.
*/
CURLcode Curl_formconvert(struct SessionHandle *data, struct FormData *form)
{
struct FormData *next;
CURLcode rc;
if(!form)
return CURLE_OK;
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
do {
next=form->next; /* the following form line */
if(form->type == FORM_DATA) {
rc = Curl_convert_to_network(data, form->line, form->length);
/* Curl_convert_to_network calls failf if unsuccessful */
if(rc != CURLE_OK)
return rc;
}
} while((form = next) != NULL); /* continue */
return CURLE_OK;
}
#endif /* CURL_DOES_CONVERSIONS */
/* /*
* curl_formget() * curl_formget()
* Serialize a curl_httppost struct. * Serialize a curl_httppost struct.

View File

@@ -61,8 +61,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "if2ip.h" #include "if2ip.h"
#include "hostip.h" #include "hostip.h"
#include "progress.h" #include "progress.h"
@@ -94,6 +92,7 @@
#include "speedcheck.h" #include "speedcheck.h"
#include "warnless.h" #include "warnless.h"
#include "http_proxy.h" #include "http_proxy.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -2163,7 +2162,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
/* /*
A; A;
150 Opening BINARY mode data connection for /etc/passwd (2241 150 Opening BINARY mode data connection for /etc/passwd (2241
bytes). (ok, the file is being transfered) bytes). (ok, the file is being transferred)
B: B:
150 Opening ASCII mode data connection for /bin/ls 150 Opening ASCII mode data connection for /bin/ls
@@ -2195,7 +2194,7 @@ static CURLcode ftp_state_get_resp(struct connectdata *conn,
/* /*
* It seems directory listings either don't show the size or very * It seems directory listings either don't show the size or very
* often uses size 0 anyway. ASCII transfers may very well turn out * often uses size 0 anyway. ASCII transfers may very well turn out
* that the transfered amount of data is not the same as this line * that the transferred amount of data is not the same as this line
* tells, why using this number in those cases only confuses us. * tells, why using this number in those cases only confuses us.
* *
* Example D above makes this parsing a little tricky */ * Example D above makes this parsing a little tricky */
@@ -2693,7 +2692,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
case FTP_RETR_PREQUOTE: case FTP_RETR_PREQUOTE:
case FTP_STOR_PREQUOTE: case FTP_STOR_PREQUOTE:
if((ftpcode >= 400) && !ftpc->count2) { if((ftpcode >= 400) && !ftpc->count2) {
/* failure reponse code, and not allowed to fail */ /* failure response code, and not allowed to fail */
failf(conn->data, "QUOT command failed with %03d", ftpcode); failf(conn->data, "QUOT command failed with %03d", ftpcode);
return CURLE_QUOTE_ERROR; return CURLE_QUOTE_ERROR;
} }
@@ -2914,7 +2913,7 @@ static CURLcode ftp_connect(struct connectdata *conn,
if(CURLE_OK != result) if(CURLE_OK != result)
return result; return result;
/* We always support persistant connections on ftp */ /* We always support persistent connections on ftp */
conn->bits.close = FALSE; conn->bits.close = FALSE;
pp->response_time = RESP_TIMEOUT; /* set default response time-out */ pp->response_time = RESP_TIMEOUT; /* set default response time-out */
@@ -3110,7 +3109,7 @@ static CURLcode ftp_done(struct connectdata *conn, CURLcode status,
/* /*
* Let's see what the server says about the transfer we just performed, * Let's see what the server says about the transfer we just performed,
* but lower the timeout as sometimes this connection has died while the * but lower the timeout as sometimes this connection has died while the
* data has been transfered. This happens when doing through NATs etc that * data has been transferred. This happens when doing through NATs etc that
* abandon old silent connections. * abandon old silent connections.
*/ */
long old_time = pp->response_time; long old_time = pp->response_time;
@@ -3772,13 +3771,10 @@ CURLcode Curl_ftpsendf(struct connectdata *conn,
bytes_written=0; bytes_written=0;
write_len = strlen(s); write_len = strlen(s);
#ifdef CURL_DOES_CONVERSIONS
res = Curl_convert_to_network(conn->data, s, write_len); res = Curl_convert_to_network(conn->data, s, write_len);
/* Curl_convert_to_network calls failf if unsuccessful */ /* Curl_convert_to_network calls failf if unsuccessful */
if(res != CURLE_OK) { if(res)
return(res); return(res);
}
#endif /* CURL_DOES_CONVERSIONS */
for(;;) { for(;;) {
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) #if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
@@ -3985,7 +3981,7 @@ CURLcode ftp_parse_url_path(struct connectdata *conn)
/* seek out the next path component */ /* seek out the next path component */
if(slash_pos-cur_pos) { if(slash_pos-cur_pos) {
/* we skip empty path components, like "x//y" since the FTP command /* we skip empty path components, like "x//y" since the FTP command
CWD requires a parameter and a non-existant parameter a) doesn't CWD requires a parameter and a non-existent parameter a) doesn't
work on many servers and b) has no effect on the others. */ work on many servers and b) has no effect on the others. */
int len = (int)(slash_pos - cur_pos + absolute_dir); int len = (int)(slash_pos - cur_pos + absolute_dir);
ftpc->dirs[ftpc->dirdepth] = ftpc->dirs[ftpc->dirdepth] =

View File

@@ -260,7 +260,7 @@ CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
*param_slistp = ptr.to_slist; *param_slistp = ptr.to_slist;
break; break;
case CURLINFO_CONDITION_UNMET: case CURLINFO_CONDITION_UNMET:
/* return if the condition prevented the document to get transfered */ /* return if the condition prevented the document to get transferred */
*param_longp = data->info.timecond; *param_longp = data->info.timecond;
break; break;
case CURLINFO_RTSP_SESSION_ID: case CURLINFO_RTSP_SESSION_ID:

View File

@@ -186,7 +186,7 @@ Curl_addrinfo *Curl_ipv4_resolve_r(const char * hostname, int port);
* Curl_addrinfo_callback() is used when we build with any asynch specialty. * Curl_addrinfo_callback() is used when we build with any asynch specialty.
* Handles end of async request processing. Inserts ai into hostcache when * Handles end of async request processing. Inserts ai into hostcache when
* status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async * status is CURL_ASYNC_SUCCESS. Twiddles fields in conn to indicate async
* request completed wether successfull or failed. * request completed wether successful or failed.
*/ */
CURLcode Curl_addrinfo_callback(struct connectdata *conn, CURLcode Curl_addrinfo_callback(struct connectdata *conn,
int status, int status,

View File

@@ -78,7 +78,7 @@
#if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO) #if defined(CURLDEBUG) && defined(HAVE_GETNAMEINFO)
/* These are strictly for memory tracing and are using the same style as the /* These are strictly for memory tracing and are using the same style as the
* family otherwise present in memdebug.c. I put these ones here since they * family otherwise present in memdebug.c. I put these ones here since they
* require a bunch of structs I didn't wanna include in memdebug.c * require a bunch of structs I didn't want to include in memdebug.c
*/ */
/* /*

View File

@@ -76,7 +76,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "transfer.h" #include "transfer.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "formdata.h" #include "formdata.h"
#include "progress.h" #include "progress.h"
#include "curl_base64.h" #include "curl_base64.h"
@@ -100,6 +99,7 @@
#include "rtsp.h" #include "rtsp.h"
#include "http_proxy.h" #include "http_proxy.h"
#include "warnless.h" #include "warnless.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -1014,17 +1014,15 @@ CURLcode Curl_add_buffer_send(Curl_send_buffer *in,
DEBUGASSERT(size > included_body_bytes); DEBUGASSERT(size > included_body_bytes);
#ifdef CURL_DOES_CONVERSIONS
res = Curl_convert_to_network(conn->data, ptr, headersize); res = Curl_convert_to_network(conn->data, ptr, headersize);
/* Curl_convert_to_network calls failf if unsuccessful */ /* Curl_convert_to_network calls failf if unsuccessful */
if(res != CURLE_OK) { if(res) {
/* conversion failed, free memory and return to the caller */ /* conversion failed, free memory and return to the caller */
if(in->buffer) if(in->buffer)
free(in->buffer); free(in->buffer);
free(in); free(in);
return res; return res;
} }
#endif /* CURL_DOES_CONVERSIONS */
if(conn->handler->protocol & CURLPROTO_HTTPS) { if(conn->handler->protocol & CURLPROTO_HTTPS) {
/* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk /* We never send more than CURL_MAX_WRITE_SIZE bytes in one single chunk
@@ -1305,7 +1303,7 @@ CURLcode Curl_http_connect(struct connectdata *conn, bool *done)
} }
#endif /* CURL_DISABLE_PROXY */ #endif /* CURL_DISABLE_PROXY */
if(conn->handler->protocol & CURLPROTO_HTTPS) { if(conn->given->protocol & CURLPROTO_HTTPS) {
/* perform SSL initialization */ /* perform SSL initialization */
if(data->state.used_interface == Curl_if_multi) { if(data->state.used_interface == Curl_if_multi) {
result = https_connecting(conn, done); result = https_connecting(conn, done);
@@ -1533,6 +1531,11 @@ CURLcode Curl_add_custom_headers(struct connectdata *conn,
we will force length zero then */ we will force length zero then */
checkprefix("Content-Length", headers->data)) checkprefix("Content-Length", headers->data))
; ;
else if(conn->allocptr.te &&
/* when asking for Transfer-Encoding, don't pass on a custom
Connection: */
checkprefix("Connection", headers->data))
;
else { else {
CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n", CURLcode result = Curl_add_bufferf(req_buffer, "%s\r\n",
headers->data); headers->data);
@@ -1728,6 +1731,29 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
} }
#ifdef HAVE_LIBZ
/* we only consider transfer-encoding magic if libz support is built-in */
if(!Curl_checkheaders(data, "TE:") && data->set.http_transfer_encoding) {
/* When we are to insert a TE: header in the request, we must also insert
TE in a Connection: header, so we need to merge the custom provided
Connection: header and prevent the original to get sent. Note that if
the user has inserted his/hers own TE: header we don't do this magic
but then assume that the user will handle it all! */
char *cptr = Curl_checkheaders(data, "Connection:");
#define TE_HEADER "TE: gzip\r\n"
Curl_safefree(conn->allocptr.te);
/* Create the (updated) Connection: header */
conn->allocptr.te = cptr? aprintf("%s, TE\r\n" TE_HEADER, cptr):
strdup("Connection: TE\r\n" TE_HEADER);
if(!conn->allocptr.te)
return CURLE_OUT_OF_MEMORY;
}
#endif
ptr = Curl_checkheaders(data, "Transfer-Encoding:"); ptr = Curl_checkheaders(data, "Transfer-Encoding:");
if(ptr) { if(ptr) {
/* Some kind of TE is requested, check if 'chunked' is chosen */ /* Some kind of TE is requested, check if 'chunked' is chosen */
@@ -2058,6 +2084,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
"%s" /* user agent */ "%s" /* user agent */
"%s" /* host */ "%s" /* host */
"%s" /* accept */ "%s" /* accept */
"%s" /* TE: */
"%s" /* accept-encoding */ "%s" /* accept-encoding */
"%s" /* referer */ "%s" /* referer */
"%s" /* Proxy-Connection */ "%s" /* Proxy-Connection */
@@ -2075,6 +2102,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
conn->allocptr.uagent:"", conn->allocptr.uagent:"",
(conn->allocptr.host?conn->allocptr.host:""), /* Host: host */ (conn->allocptr.host?conn->allocptr.host:""), /* Host: host */
http->p_accept?http->p_accept:"", http->p_accept?http->p_accept:"",
conn->allocptr.te?conn->allocptr.te:"",
(data->set.str[STRING_ENCODING] && (data->set.str[STRING_ENCODING] &&
*data->set.str[STRING_ENCODING] && *data->set.str[STRING_ENCODING] &&
conn->allocptr.accept_encoding)? conn->allocptr.accept_encoding)?
@@ -2262,14 +2290,14 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
Curl_formclean(&http->sendit); /* free that whole lot */ Curl_formclean(&http->sendit); /* free that whole lot */
return result; return result;
} }
#ifdef CURL_DOES_CONVERSIONS
/* time to convert the form data... */ /* convert the form data */
result = Curl_formconvert(data, http->sendit); result = Curl_convert_form(data, http->sendit);
if(result) { if(result) {
Curl_formclean(&http->sendit); /* free that whole lot */ Curl_formclean(&http->sendit); /* free that whole lot */
return result; return result;
} }
#endif /* CURL_DOES_CONVERSIONS */
break; break;
case HTTPREQ_PUT: /* Let's PUT the data to the server! */ case HTTPREQ_PUT: /* Let's PUT the data to the server! */
@@ -2508,13 +2536,13 @@ checkhttpprefix(struct SessionHandle *data,
/* convert from the network encoding using a scratch area */ /* convert from the network encoding using a scratch area */
char *scratch = strdup(s); char *scratch = strdup(s);
if(NULL == scratch) { if(NULL == scratch) {
failf (data, "Failed to allocate memory for conversion!"); failf (data, "Failed to allocate memory for conversion!");
return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */ return FALSE; /* can't return CURLE_OUT_OF_MEMORY so return FALSE */
} }
if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) { if(CURLE_OK != Curl_convert_from_network(data, scratch, strlen(s)+1)) {
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
free(scratch); free(scratch);
return FALSE; /* can't return CURLE_foobar so return FALSE */ return FALSE; /* can't return CURLE_foobar so return FALSE */
} }
s = scratch; s = scratch;
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
@@ -2527,9 +2555,8 @@ checkhttpprefix(struct SessionHandle *data,
head = head->next; head = head->next;
} }
if((rc != TRUE) && (checkprefix("HTTP/", s))) { if((rc != TRUE) && (checkprefix("HTTP/", s)))
rc = TRUE; rc = TRUE;
}
#ifdef CURL_DOES_CONVERSIONS #ifdef CURL_DOES_CONVERSIONS
free(scratch); free(scratch);
@@ -2901,10 +2928,9 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
res = Curl_convert_from_network(data, res = Curl_convert_from_network(data,
&scratch[0], &scratch[0],
SCRATCHSIZE); SCRATCHSIZE);
if(CURLE_OK != res) { if(res)
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
return res; return res;
}
#else #else
#define HEADER1 k->p /* no conversion needed, just use k->p */ #define HEADER1 k->p /* no conversion needed, just use k->p */
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
@@ -3035,14 +3061,10 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
} }
} }
#ifdef CURL_DOES_CONVERSIONS
/* convert from the network encoding */
result = Curl_convert_from_network(data, k->p, strlen(k->p)); result = Curl_convert_from_network(data, k->p, strlen(k->p));
if(CURLE_OK != result) {
return(result);
}
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
#endif /* CURL_DOES_CONVERSIONS */ if(result)
return result;
/* Check for Content-Length: header lines to get size */ /* Check for Content-Length: header lines to get size */
if(!k->ignorecl && !data->set.ignorecl && if(!k->ignorecl && !data->set.ignorecl &&
@@ -3127,8 +3149,9 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
*/ */
conn->bits.close = TRUE; /* close when done */ conn->bits.close = TRUE; /* close when done */
} }
else if(Curl_compareheader(k->p, "Transfer-Encoding:", "chunked") && else if(checkprefix("Transfer-Encoding:", k->p)) {
!(conn->handler->protocol & CURLPROTO_RTSP)) { /* One or more encodings. We check for chunked and/or a compression
algorithm. */
/* /*
* [RFC 2616, section 3.6.1] A 'chunked' transfer encoding * [RFC 2616, section 3.6.1] A 'chunked' transfer encoding
* means that the server will send a series of "chunks". Each * means that the server will send a series of "chunks". Each
@@ -3137,10 +3160,60 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
* with the previously mentioned size. There can be any amount * with the previously mentioned size. There can be any amount
* of chunks, and a chunk-data set to zero signals the * of chunks, and a chunk-data set to zero signals the
* end-of-chunks. */ * end-of-chunks. */
k->chunk = TRUE; /* chunks coming our way */
/* init our chunky engine */ char *start;
Curl_httpchunk_init(conn);
/* Find the first non-space letter */
start = k->p + 18;
do {
/* skip whitespaces and commas */
while(*start && (ISSPACE(*start) || (*start == ',')))
start++;
if(checkprefix("chunked", start)) {
k->chunk = TRUE; /* chunks coming our way */
/* init our chunky engine */
Curl_httpchunk_init(conn);
start += 7;
}
if(k->auto_decoding)
/* TODO: we only support the first mentioned compression for now */
break;
if(checkprefix("identity", start)) {
k->auto_decoding = IDENTITY;
start += 8;
}
else if(checkprefix("deflate", start)) {
k->auto_decoding = DEFLATE;
start += 7;
}
else if(checkprefix("gzip", start)) {
k->auto_decoding = GZIP;
start += 4;
}
else if(checkprefix("x-gzip", start)) {
k->auto_decoding = GZIP;
start += 6;
}
else if(checkprefix("compress", start)) {
k->auto_decoding = COMPRESS;
start += 8;
}
else if(checkprefix("x-compress", start)) {
k->auto_decoding = COMPRESS;
start += 10;
}
else
/* unknown! */
break;
} while(1);
} }
else if(checkprefix("Content-Encoding:", k->p) && else if(checkprefix("Content-Encoding:", k->p) &&
data->set.str[STRING_ENCODING]) { data->set.str[STRING_ENCODING]) {
@@ -3160,15 +3233,15 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
/* Record the content-encoding for later use */ /* Record the content-encoding for later use */
if(checkprefix("identity", start)) if(checkprefix("identity", start))
k->content_encoding = IDENTITY; k->auto_decoding = IDENTITY;
else if(checkprefix("deflate", start)) else if(checkprefix("deflate", start))
k->content_encoding = DEFLATE; k->auto_decoding = DEFLATE;
else if(checkprefix("gzip", start) else if(checkprefix("gzip", start)
|| checkprefix("x-gzip", start)) || checkprefix("x-gzip", start))
k->content_encoding = GZIP; k->auto_decoding = GZIP;
else if(checkprefix("compress", start) else if(checkprefix("compress", start)
|| checkprefix("x-compress", start)) || checkprefix("x-compress", start))
k->content_encoding = COMPRESS; k->auto_decoding = COMPRESS;
} }
else if(checkprefix("Content-Range:", k->p)) { else if(checkprefix("Content-Range:", k->p)) {
/* Content-Range: bytes [num]- /* Content-Range: bytes [num]-

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -35,7 +35,7 @@
#include "content_encoding.h" #include "content_encoding.h"
#include "http.h" #include "http.h"
#include "curl_memory.h" #include "curl_memory.h"
#include "easyif.h" /* for Curl_convert_to_network prototype */ #include "non-ascii.h" /* for Curl_convert_to_network prototype */
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -153,17 +153,16 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
} }
/* length and datap are unmodified */ /* length and datap are unmodified */
ch->hexbuffer[ch->hexindex]=0; ch->hexbuffer[ch->hexindex]=0;
#ifdef CURL_DOES_CONVERSIONS
/* convert to host encoding before calling strtoul */ /* convert to host encoding before calling strtoul */
result = Curl_convert_from_network(conn->data, result = Curl_convert_from_network(conn->data, ch->hexbuffer,
ch->hexbuffer,
ch->hexindex); ch->hexindex);
if(result != CURLE_OK) { if(result) {
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
/* Treat it as a bad hex character */ /* Treat it as a bad hex character */
return(CHUNKE_ILLEGAL_HEX); return(CHUNKE_ILLEGAL_HEX);
} }
#endif /* CURL_DOES_CONVERSIONS */
ch->datasize=strtoul(ch->hexbuffer, NULL, 16); ch->datasize=strtoul(ch->hexbuffer, NULL, 16);
ch->state = CHUNK_POSTHEX; ch->state = CHUNK_POSTHEX;
} }
@@ -209,7 +208,7 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
/* Write the data portion available */ /* Write the data portion available */
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
switch (conn->data->set.http_ce_skip? switch (conn->data->set.http_ce_skip?
IDENTITY : data->req.content_encoding) { IDENTITY : data->req.auto_decoding) {
case IDENTITY: case IDENTITY:
#endif #endif
if(!k->ignorebody) { if(!k->ignorebody) {
@@ -297,17 +296,14 @@ CHUNKcode Curl_httpchunk_read(struct connectdata *conn,
conn->trailer[conn->trlPos++]=0x0a; conn->trailer[conn->trlPos++]=0x0a;
conn->trailer[conn->trlPos]=0; conn->trailer[conn->trlPos]=0;
#ifdef CURL_DOES_CONVERSIONS
/* Convert to host encoding before calling Curl_client_write */ /* Convert to host encoding before calling Curl_client_write */
result = Curl_convert_from_network(conn->data, result = Curl_convert_from_network(conn->data, conn->trailer,
conn->trailer,
conn->trlPos); conn->trlPos);
if(result != CURLE_OK) if(result)
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
/* Treat it as a bad chunk */ /* Treat it as a bad chunk */
return CHUNKE_BAD_CHUNK; return CHUNKE_BAD_CHUNK;
#endif /* CURL_DOES_CONVERSIONS */
if(!data->set.http_te_skip) { if(!data->set.http_te_skip) {
result = Curl_client_write(conn, CLIENTWRITE_HEADER, result = Curl_client_write(conn, CLIENTWRITE_HEADER,
conn->trailer, conn->trlPos); conn->trailer, conn->trlPos);

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -38,7 +38,7 @@
#include "strtok.h" #include "strtok.h"
#include "url.h" /* for Curl_safefree() */ #include "url.h" /* for Curl_safefree() */
#include "curl_memory.h" #include "curl_memory.h"
#include "easyif.h" /* included for Curl_convert_... prototypes */ #include "non-ascii.h" /* included for Curl_convert_... prototypes */
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -294,7 +294,6 @@ CURLcode Curl_output_digest(struct connectdata *conn,
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
struct digestdata *d; struct digestdata *d;
#ifdef CURL_DOES_CONVERSIONS
CURLcode rc; CURLcode rc;
/* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines. /* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines.
It converts digest text to ASCII so the MD5 will be correct for It converts digest text to ASCII so the MD5 will be correct for
@@ -306,9 +305,6 @@ CURLcode Curl_output_digest(struct connectdata *conn,
free(b); \ free(b); \
return rc; \ return rc; \
} }
#else
#define CURL_OUTPUT_DIGEST_CONV(a, b)
#endif /* CURL_DOES_CONVERSIONS */
if(proxy) { if(proxy) {
d = &data->state.proxydigest; d = &data->state.proxydigest;

View File

@@ -167,7 +167,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
} }
if(neg_ctx->context && neg_ctx->status == GSS_S_COMPLETE) { if(neg_ctx->context && neg_ctx->status == GSS_S_COMPLETE) {
/* We finished succesfully our part of authentication, but server /* We finished successfully our part of authentication, but server
* rejected it (since we're again here). Exit with an error since we * rejected it (since we're again here). Exit with an error since we
* can't invent anything better */ * can't invent anything better */
Curl_cleanup_negotiate(conn->data); Curl_cleanup_negotiate(conn->data);

View File

@@ -122,7 +122,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
} }
if(neg_ctx->context && neg_ctx->status == SEC_E_OK) { if(neg_ctx->context && neg_ctx->status == SEC_E_OK) {
/* We finished succesfully our part of authentication, but server /* We finished successfully our part of authentication, but server
* rejected it (since we're again here). Exit with an error since we * rejected it (since we're again here). Exit with an error since we
* can't invent anything better */ * can't invent anything better */
Curl_cleanup_negotiate(conn->data); Curl_cleanup_negotiate(conn->data);
@@ -165,7 +165,7 @@ int Curl_input_negotiate(struct connectdata *conn, bool proxy,
} }
if ( !input_token ) { if ( !input_token ) {
/* first call in a new negotation, we have to require credentials, /* first call in a new negotiation, we have to require credentials,
and allocate memory for the context */ and allocate memory for the context */
neg_ctx->credentials = (CredHandle *)malloc(sizeof(CredHandle)); neg_ctx->credentials = (CredHandle *)malloc(sizeof(CredHandle));

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -52,7 +52,7 @@
#endif #endif
#include "urldata.h" #include "urldata.h"
#include "easyif.h" /* for Curl_convert_... prototypes */ #include "non-ascii.h" /* for Curl_convert_... prototypes */
#include "sendf.h" #include "sendf.h"
#include "rawstr.h" #include "rawstr.h"
#include "curl_base64.h" #include "curl_base64.h"
@@ -525,16 +525,12 @@ static void mk_lm_hash(struct SessionHandle *data,
Curl_strntoupper((char *)pw, password, len); Curl_strntoupper((char *)pw, password, len);
memset(&pw[len], 0, 14-len); memset(&pw[len], 0, 14-len);
#ifdef CURL_DOES_CONVERSIONS
/* /*
* The LanManager hashed password needs to be created using the * The LanManager hashed password needs to be created using the
* password in the network encoding not the host encoding. * password in the network encoding not the host encoding.
*/ */
if(data) if(Curl_convert_to_network(data, (char *)pw, 14))
Curl_convert_to_network(data, (char *)pw, 14); return;
#else
(void)data;
#endif
{ {
/* Create LanManager hashed password. */ /* Create LanManager hashed password. */
@@ -590,21 +586,19 @@ static CURLcode mk_nt_hash(struct SessionHandle *data,
{ {
size_t len = strlen(password); size_t len = strlen(password);
unsigned char *pw = malloc(len*2); unsigned char *pw = malloc(len*2);
CURLcode result;
if(!pw) if(!pw)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
ascii_to_unicode_le(pw, password, len); ascii_to_unicode_le(pw, password, len);
#ifdef CURL_DOES_CONVERSIONS
/* /*
* The NT hashed password needs to be created using the * The NT hashed password needs to be created using the password in the
* password in the network encoding not the host encoding. * network encoding not the host encoding.
*/ */
if(data) result = Curl_convert_to_network(data, (char *)pw, len*2);
Curl_convert_to_network(data, (char *)pw, len*2); if(result)
#else return result;
(void)data;
#endif
{ {
/* Create NT hashed password. */ /* Create NT hashed password. */
@@ -1244,14 +1238,10 @@ CURLcode Curl_output_ntlm(struct connectdata *conn,
memcpy(&ntlmbuf[size], host, hostlen); memcpy(&ntlmbuf[size], host, hostlen);
size += hostlen; size += hostlen;
#ifdef CURL_DOES_CONVERSIONS
/* convert domain, user, and host to ASCII but leave the rest as-is */ /* convert domain, user, and host to ASCII but leave the rest as-is */
if(CURLE_OK != Curl_convert_to_network(conn->data, if(Curl_convert_to_network(conn->data, (char *)&ntlmbuf[domoff],
(char *)&ntlmbuf[domoff], size-domoff))
size-domoff)) {
return CURLE_CONV_FAILED; return CURLE_CONV_FAILED;
}
#endif /* CURL_DOES_CONVERSIONS */
#endif #endif

View File

@@ -24,6 +24,9 @@
#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) #if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP)
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "urldata.h" #include "urldata.h"
#include <curl/curl.h> #include <curl/curl.h>
#include "http_proxy.h" #include "http_proxy.h"
@@ -33,6 +36,7 @@
#include "select.h" #include "select.h"
#include "rawstr.h" #include "rawstr.h"
#include "progress.h" #include "progress.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -315,14 +319,12 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn,
char letter; char letter;
int writetype; int writetype;
#ifdef CURL_DOES_CONVERSIONS
/* convert from the network encoding */ /* convert from the network encoding */
result = Curl_convert_from_network(data, line_start, result = Curl_convert_from_network(data, line_start,
perline); perline);
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
if(result) if(result)
return result; return result;
#endif /* CURL_DOES_CONVERSIONS */
/* output debug if that is requested */ /* output debug if that is requested */
if(data->set.verbose) if(data->set.verbose)

View File

@@ -24,7 +24,13 @@
* Pierre Joye <pierre@php.net> * Pierre Joye <pierre@php.net>
***************************************************************************/ ***************************************************************************/
#if defined(WIN32) && defined(USE_WIN32_IDN) #if defined(WIN32) && defined(USE_WIN32_IDN)
#include "windows.h" #include <windows.h>
#ifdef HAVE_NORMALIZATION_H
#define __in
#define __in_ecount(x)
#define __out_ecount(x)
#include <normalization.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <tchar.h> #include <tchar.h>
#define IDN_MAX_LENGTH 255 #define IDN_MAX_LENGTH 255
@@ -58,18 +64,20 @@ static const char *_curl_win32_wchar_to_UTF8(const wchar_t *str_w)
if (str_w) { if (str_w) {
size_t str_utf8_len = WideCharToMultiByte(CP_UTF8, 0, str_w, -1, NULL, size_t str_utf8_len = WideCharToMultiByte(CP_UTF8, 0, str_w, -1, NULL,
0, NULL, NULL); 0, NULL, NULL);
DWORD err = GetLastError();
if (str_utf8_len) { if (str_utf8_len) {
str_utf8 = (char *) malloc(str_utf8_len * sizeof(wchar_t)); str_utf8 = (char *) malloc(str_utf8_len * sizeof(wchar_t));
if (str_w) { if (str_utf8) {
if (WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, str_utf8_len, if (WideCharToMultiByte(CP_UTF8, 0, str_w, -1, str_utf8, str_utf8_len,
NULL, FALSE) == 0) { NULL, FALSE) == 0) {
DWORD err = GetLastError(); (void) GetLastError();
free((void *)str_utf8); free((void *)str_utf8);
str_utf8 = NULL; str_utf8 = NULL;
} }
} }
} }
else {
(void) GetLastError();
}
} }
return str_utf8; return str_utf8;

View File

@@ -64,8 +64,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "if2ip.h" #include "if2ip.h"
#include "hostip.h" #include "hostip.h"
#include "progress.h" #include "progress.h"
@@ -472,7 +470,7 @@ static CURLcode imap_state_fetch_resp(struct connectdata *conn,
infof(data, "Filesize left: %" FORMAT_OFF_T "\n", filesize); infof(data, "Filesize left: %" FORMAT_OFF_T "\n", filesize);
if(!filesize) if(!filesize)
/* the entire data is already transfered! */ /* the entire data is already transferred! */
Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL); Curl_setup_transfer(conn, -1, -1, FALSE, NULL, -1, NULL);
else else
/* IMAP download */ /* IMAP download */
@@ -711,7 +709,7 @@ static CURLcode imap_connect(struct connectdata *conn,
if(CURLE_OK != result) if(CURLE_OK != result)
return result; return result;
/* We always support persistant connections on imap */ /* We always support persistent connections on imap */
conn->bits.close = FALSE; conn->bits.close = FALSE;
pp->response_time = RESP_TIMEOUT; /* set default response time-out */ pp->response_time = RESP_TIMEOUT; /* set default response time-out */

View File

@@ -195,9 +195,9 @@ static char *inet_ntop6 (const unsigned char *src, char *dst, size_t size)
* error, EAFNOSUPPORT or ENOSPC. * error, EAFNOSUPPORT or ENOSPC.
* *
* On Windows we store the error in the thread errno, not * On Windows we store the error in the thread errno, not
* in the winsock error code. This is to avoid loosing the * in the winsock error code. This is to avoid losing the
* actual last winsock error. So use macro ERRNO to fetch the * actual last winsock error. So use macro ERRNO to fetch the
* errno this funtion sets when returning NULL, not SOCKERRNO. * errno this function sets when returning NULL, not SOCKERRNO.
*/ */
char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size) char *Curl_inet_ntop(int af, const void *src, char *buf, size_t size)
{ {

View File

@@ -61,9 +61,9 @@ static int inet_pton6(const char *src, unsigned char *dst);
* -1 if some other error occurred (`dst' is untouched in this case, too) * -1 if some other error occurred (`dst' is untouched in this case, too)
* notice: * notice:
* On Windows we store the error in the thread errno, not * On Windows we store the error in the thread errno, not
* in the winsock error code. This is to avoid loosing the * in the winsock error code. This is to avoid losing the
* actual last winsock error. So use macro ERRNO to fetch the * actual last winsock error. So use macro ERRNO to fetch the
* errno this funtion sets when returning (-1), not SOCKERRNO. * errno this function sets when returning (-1), not SOCKERRNO.
* author: * author:
* Paul Vixie, 1996. * Paul Vixie, 1996.
*/ */

View File

@@ -218,7 +218,7 @@ static CURLcode Curl_ldap(struct connectdata *conn, bool *done)
if(ldap_ssl) { if(ldap_ssl) {
#ifdef HAVE_LDAP_SSL #ifdef HAVE_LDAP_SSL
#ifdef CURL_LDAP_WIN #ifdef CURL_LDAP_WIN
/* Win32 LDAP SDK doesnt support insecure mode without CA! */ /* Win32 LDAP SDK doesn't support insecure mode without CA! */
server = ldap_sslinit(conn->host.name, (int)conn->port, 1); server = ldap_sslinit(conn->host.name, (int)conn->port, 1);
ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON); ldap_set_option(server, LDAP_OPT_SSL, LDAP_OPT_ON);
#else #else

View File

@@ -124,7 +124,7 @@ typedef enum {
FORMAT_WIDTH /* For internal use */ FORMAT_WIDTH /* For internal use */
} FormatType; } FormatType;
/* convertion and display flags */ /* conversion and display flags */
enum { enum {
FLAGS_NEW = 0, FLAGS_NEW = 0,
FLAGS_SPACE = 1<<0, FLAGS_SPACE = 1<<0,
@@ -692,7 +692,7 @@ static int dprintf_formatf(
continue; continue;
} }
/* If this is a positional parameter, the position must follow imediately /* If this is a positional parameter, the position must follow immediately
after the %, thus create a %<num>$ sequence */ after the %, thus create a %<num>$ sequence */
param=dprintf_DollarString(f, &f); param=dprintf_DollarString(f, &f);

View File

@@ -645,7 +645,7 @@ CURLMcode curl_multi_remove_handle(CURLM *multi_handle,
easy->state > CURLM_STATE_WAITDO && easy->state > CURLM_STATE_WAITDO &&
easy->state < CURLM_STATE_COMPLETED) { easy->state < CURLM_STATE_COMPLETED) {
/* If the handle is in a pipeline and has started sending off its /* If the handle is in a pipeline and has started sending off its
request but not received its reponse yet, we need to close request but not received its response yet, we need to close
connection. */ connection. */
easy->easy_conn->bits.close = TRUE; easy->easy_conn->bits.close = TRUE;
/* Set connection owner so that Curl_done() closes it. /* Set connection owner so that Curl_done() closes it.
@@ -1495,7 +1495,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
/* call this even if the readwrite function returned error */ /* call this even if the readwrite function returned error */
Curl_posttransfer(data); Curl_posttransfer(data);
/* we're no longer receving */ /* we're no longer receiving */
moveHandleFromRecvToDonePipeline(data, moveHandleFromRecvToDonePipeline(data,
easy->easy_conn); easy->easy_conn);

339
lib/non-ascii.c Normal file
View File

@@ -0,0 +1,339 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, 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.
*
***************************************************************************/
#include "setup.h"
#ifdef CURL_DOES_CONVERSIONS
#include "non-ascii.h"
#include "formdata.h"
#include "sendf.h"
#include "urldata.h"
#include <curl/curl.h>
#ifdef HAVE_ICONV
#include <iconv.h>
/* set default codesets for iconv */
#ifndef CURL_ICONV_CODESET_OF_NETWORK
#define CURL_ICONV_CODESET_OF_NETWORK "ISO8859-1"
#endif
#ifndef CURL_ICONV_CODESET_FOR_UTF8
#define CURL_ICONV_CODESET_FOR_UTF8 "UTF-8"
#endif
#define ICONV_ERROR (size_t)-1
#endif /* HAVE_ICONV */
/*
* Curl_convert_clone() returns a malloced copy of the source string (if
* returning CURLE_OK), with the data converted to network format.
*/
CURLcode Curl_convert_clone(struct SessionHandle *data,
const char *indata,
size_t insize,
char **outbuf)
{
char *convbuf;
CURLcode result;
convbuf = malloc(insize);
if(!convbuf)
return CURLE_OUT_OF_MEMORY;
memcpy(convbuf, indata, insize);
result = Curl_convert_to_network(data, convbuf, insize);
if(result) {
free(convbuf);
return result;
}
*outbuf = convbuf; /* return the converted buffer */
return CURLE_OK;
}
/*
* Curl_convert_to_network() is an internal function for performing ASCII
* conversions on non-ASCII platforms. It convers the buffer _in place_.
*/
CURLcode Curl_convert_to_network(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convtonetwork) {
/* use translation callback */
rc = data->set.convtonetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_TO_NETWORK_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return rc;
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->outbound_cd == (iconv_t)-1) {
data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST);
if(data->outbound_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->outbound_cd, (const char**)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_to_network iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
failf(data, "CURLOPT_CONV_TO_NETWORK_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
/*
* Curl_convert_from_network() is an internal function for performing ASCII
* conversions on non-ASCII platforms. It convers the buffer _in place_.
*/
CURLcode Curl_convert_from_network(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convfromnetwork) {
/* use translation callback */
rc = data->set.convfromnetwork(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_FROM_NETWORK_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return rc;
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
char *input_ptr, *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->inbound_cd == (iconv_t)-1) {
data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK);
if(data->inbound_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->inbound_cd, (const char **)&input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_from_network iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
#else
failf(data, "CURLOPT_CONV_FROM_NETWORK_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
/*
* Curl_convert_from_utf8() is an internal function for performing UTF-8
* conversions on non-ASCII platforms.
*/
CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
char *buffer, size_t length)
{
CURLcode rc;
if(data->set.convfromutf8) {
/* use translation callback */
rc = data->set.convfromutf8(buffer, length);
if(rc != CURLE_OK) {
failf(data,
"CURLOPT_CONV_FROM_UTF8_FUNCTION callback returned %d: %s",
(int)rc, curl_easy_strerror(rc));
}
return rc;
}
else {
#ifdef HAVE_ICONV
/* do the translation ourselves */
const char *input_ptr;
char *output_ptr;
size_t in_bytes, out_bytes, rc;
int error;
/* open an iconv conversion descriptor if necessary */
if(data->utf8_cd == (iconv_t)-1) {
data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8);
if(data->utf8_cd == (iconv_t)-1) {
error = ERRNO;
failf(data,
"The iconv_open(\"%s\", \"%s\") call failed with errno %i: %s",
CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8,
error, strerror(error));
return CURLE_CONV_FAILED;
}
}
/* call iconv */
input_ptr = output_ptr = buffer;
in_bytes = out_bytes = length;
rc = iconv(data->utf8_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
if((rc == ICONV_ERROR) || (in_bytes != 0)) {
error = ERRNO;
failf(data,
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
error, strerror(error));
return CURLE_CONV_FAILED;
}
if(output_ptr < input_ptr) {
/* null terminate the now shorter output string */
*output_ptr = 0x00;
}
#else
failf(data, "CURLOPT_CONV_FROM_UTF8_FUNCTION callback required");
return CURLE_CONV_REQD;
#endif /* HAVE_ICONV */
}
return CURLE_OK;
}
/*
* Init conversion stuff for a SessionHandle
*/
void Curl_convert_init(struct SessionHandle *data)
{
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV)
/* conversion descriptors for iconv calls */
data->outbound_cd = (iconv_t)-1;
data->inbound_cd = (iconv_t)-1;
data->utf8_cd = (iconv_t)-1;
#else
(void)data;
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
}
/*
* Setup conversion stuff for a SessionHandle
*/
void Curl_convert_setup(struct SessionHandle *data)
{
data->inbound_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_OF_NETWORK);
data->outbound_cd = iconv_open(CURL_ICONV_CODESET_OF_NETWORK,
CURL_ICONV_CODESET_OF_HOST);
data->utf8_cd = iconv_open(CURL_ICONV_CODESET_OF_HOST,
CURL_ICONV_CODESET_FOR_UTF8);
}
/*
* Close conversion stuff for a SessionHandle
*/
void Curl_convert_close(struct SessionHandle *data)
{
#ifdef HAVE_ICONV
/* close iconv conversion descriptors */
if(data->inbound_cd != (iconv_t)-1) {
iconv_close(data->inbound_cd);
}
if(data->outbound_cd != (iconv_t)-1) {
iconv_close(data->outbound_cd);
}
if(data->utf8_cd != (iconv_t)-1) {
iconv_close(data->utf8_cd);
}
#else
(void)data;
#endif /* HAVE_ICONV */
}
/*
* Curl_convert_form() is used from http.c, this converts any form items that
need to be sent in the network encoding. Returns CURLE_OK on success.
*/
CURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form)
{
struct FormData *next;
CURLcode rc;
if(!form)
return CURLE_OK;
if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
do {
next=form->next; /* the following form line */
if(form->type == FORM_DATA) {
rc = Curl_convert_to_network(data, form->line, form->length);
/* Curl_convert_to_network calls failf if unsuccessful */
if(rc != CURLE_OK)
return rc;
}
} while((form = next) != NULL); /* continue */
return CURLE_OK;
}
#endif /* CURL_DOES_CONVERSIONS */

60
lib/non-ascii.h Normal file
View File

@@ -0,0 +1,60 @@
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2011, 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.
*
***************************************************************************/
#include "setup.h"
#ifdef CURL_DOES_CONVERSIONS
#include "urldata.h"
/*
* Curl_convert_clone() returns a malloced copy of the source string (if
* returning CURLE_OK), with the data converted to network format.
*
* If no conversion was needed *outbuf may be NULL.
*/
CURLcode Curl_convert_clone(struct SessionHandle *data,
const char *indata,
size_t insize,
char **outbuf);
void Curl_convert_init(struct SessionHandle *data);
void Curl_convert_setup(struct SessionHandle *data);
void Curl_convert_close(struct SessionHandle *data);
CURLcode Curl_convert_to_network(struct SessionHandle *data,
char *buffer, size_t length);
CURLcode Curl_convert_from_network(struct SessionHandle *data,
char *buffer, size_t length);
CURLcode Curl_convert_from_utf8(struct SessionHandle *data,
char *buffer, size_t length);
CURLcode Curl_convert_form(struct SessionHandle *data, struct FormData *form);
#else
#define Curl_convert_clone(a,b,c,d) \
((void)a, (void)b, (void)c, *(d)=NULL, CURLE_OK)
#define Curl_convert_init(x)
#define Curl_convert_setup(x)
#define Curl_convert_close(x)
#define Curl_convert_to_network(a,b,c) ((void)a, CURLE_OK)
#define Curl_convert_from_network(a,b,c) ((void)a, CURLE_OK)
#define Curl_convert_from_utf8(a,b,c) ((void)a, CURLE_OK)
#define Curl_convert_form(a,b) CURLE_OK
#endif

View File

@@ -68,7 +68,6 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "rawstr.h" #include "rawstr.h"
#include "easyif.h" /* for Curl_convert_from_utf8 prototype */
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"

View File

@@ -387,7 +387,7 @@ int Curl_parsedate(const char *date, time_t *output)
(indate< date) && (indate< date) &&
((date[-1] == '+' || date[-1] == '-'))) { ((date[-1] == '+' || date[-1] == '-'))) {
/* four digits and a value less than or equal to 1400 (to take into /* four digits and a value less than or equal to 1400 (to take into
account all sorts of funny time zone diffs) and it is preceeded account all sorts of funny time zone diffs) and it is preceded
with a plus or minus. This is a time zone indication. 1400 is with a plus or minus. This is a time zone indication. 1400 is
picked since +1300 is frequently used and +1400 is mentioned as picked since +1300 is frequently used and +1400 is mentioned as
an edge number in the document "ISO C 200X Proposal: Timezone an edge number in the document "ISO C 200X Proposal: Timezone

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -32,6 +32,7 @@
#include "speedcheck.h" #include "speedcheck.h"
#include "pingpong.h" #include "pingpong.h"
#include "multiif.h" #include "multiif.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -208,13 +209,10 @@ CURLcode Curl_pp_vsendf(struct pingpong *pp,
Curl_pp_init(pp); Curl_pp_init(pp);
#ifdef CURL_DOES_CONVERSIONS
res = Curl_convert_to_network(data, s, write_len); res = Curl_convert_to_network(data, s, write_len);
/* Curl_convert_to_network calls failf if unsuccessful */ /* Curl_convert_to_network calls failf if unsuccessful */
if(res != CURLE_OK) { if(res)
return res; return res;
}
#endif /* CURL_DOES_CONVERSIONS */
#if defined(HAVE_KRB4) || defined(HAVE_GSSAPI) #if defined(HAVE_KRB4) || defined(HAVE_GSSAPI)
conn->data_prot = PROT_CMD; conn->data_prot = PROT_CMD;
@@ -344,13 +342,10 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
if(res == CURLE_AGAIN) if(res == CURLE_AGAIN)
return CURLE_OK; /* return */ return CURLE_OK; /* return */
#ifdef CURL_DOES_CONVERSIONS if((res == CURLE_OK) && (gotbytes > 0))
if((res == CURLE_OK) && (gotbytes > 0)) {
/* convert from the network encoding */ /* convert from the network encoding */
res = Curl_convert_from_network(data, ptr, gotbytes); res = Curl_convert_from_network(data, ptr, gotbytes);
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
}
#endif /* CURL_DOES_CONVERSIONS */
if(CURLE_OK != res) { if(CURLE_OK != res) {
result = (CURLcode)res; /* Set outer result variable to this error. */ result = (CURLcode)res; /* Set outer result variable to this error. */

View File

@@ -65,8 +65,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "if2ip.h" #include "if2ip.h"
#include "hostip.h" #include "hostip.h"
#include "progress.h" #include "progress.h"
@@ -643,7 +641,7 @@ static CURLcode pop3_connect(struct connectdata *conn,
if(CURLE_OK != result) if(CURLE_OK != result)
return result; return result;
/* We always support persistant connections on pop3 */ /* We always support persistent connections on pop3 */
conn->bits.close = FALSE; conn->bits.close = FALSE;
pp->response_time = RESP_TIMEOUT; /* set default response time-out */ pp->response_time = RESP_TIMEOUT; /* set default response time-out */

View File

@@ -409,17 +409,17 @@ int Curl_pgrsUpdate(struct connectdata *conn)
time2str(time_total, total_estimate); time2str(time_total, total_estimate);
time2str(time_spent, timespent); time2str(time_spent, timespent);
/* Get the total amount of data expected to get transfered */ /* Get the total amount of data expected to get transferred */
total_expected_transfer = total_expected_transfer =
(data->progress.flags & PGRS_UL_SIZE_KNOWN? (data->progress.flags & PGRS_UL_SIZE_KNOWN?
data->progress.size_ul:data->progress.uploaded)+ data->progress.size_ul:data->progress.uploaded)+
(data->progress.flags & PGRS_DL_SIZE_KNOWN? (data->progress.flags & PGRS_DL_SIZE_KNOWN?
data->progress.size_dl:data->progress.downloaded); data->progress.size_dl:data->progress.downloaded);
/* We have transfered this much so far */ /* We have transferred this much so far */
total_transfer = data->progress.downloaded + data->progress.uploaded; total_transfer = data->progress.downloaded + data->progress.uploaded;
/* Get the percentage of data transfered so far */ /* Get the percentage of data transferred so far */
if(total_expected_transfer > CURL_OFF_T_C(10000)) if(total_expected_transfer > CURL_OFF_T_C(10000))
total_percen = total_transfer / total_percen = total_transfer /
(total_expected_transfer/CURL_OFF_T_C(100)); (total_expected_transfer/CURL_OFF_T_C(100));

View File

@@ -395,7 +395,7 @@ static ssize_t qsossl_send(struct connectdata * conn, int sockindex,
case SSL_ERROR_BAD_STATE: case SSL_ERROR_BAD_STATE:
/* The operation did not complete; the same SSL I/O function /* The operation did not complete; the same SSL I/O function
should be called again later. This is basicly an EWOULDBLOCK should be called again later. This is basically an EWOULDBLOCK
equivalent. */ equivalent. */
*curlcode = CURLE_AGAIN; *curlcode = CURLE_AGAIN;
return -1; return -1;

View File

@@ -28,7 +28,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "transfer.h" #include "transfer.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "multiif.h" #include "multiif.h"
#include "http.h" #include "http.h"
#include "url.h" #include "url.h"

View File

@@ -147,7 +147,7 @@ static int ftp_send_command(struct connectdata *conn, const char *message, ...)
} }
/* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode /* Read |len| from the socket |fd| and store it in |to|. Return a CURLcode
saying whether an error occured or CURLE_OK if |len| was read. */ saying whether an error occurred or CURLE_OK if |len| was read. */
static CURLcode static CURLcode
socket_read(curl_socket_t fd, void *to, size_t len) socket_read(curl_socket_t fd, void *to, size_t len)
{ {
@@ -173,7 +173,7 @@ socket_read(curl_socket_t fd, void *to, size_t len)
/* Write |len| bytes from the buffer |to| to the socket |fd|. Return a /* Write |len| bytes from the buffer |to| to the socket |fd|. Return a
CURLcode saying whether an error occured or CURLE_OK if |len| was CURLcode saying whether an error occurred or CURLE_OK if |len| was
written. */ written. */
static CURLcode static CURLcode
socket_write(struct connectdata *conn, curl_socket_t fd, const void *to, socket_write(struct connectdata *conn, curl_socket_t fd, const void *to,

View File

@@ -43,6 +43,7 @@
#include "ssh.h" #include "ssh.h"
#include "multiif.h" #include "multiif.h"
#include "rtsp.h" #include "rtsp.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use the internal *printf() functions */ #define _MPRINTF_REPLACE /* use the internal *printf() functions */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -58,7 +59,7 @@
#include <string.h> #include <string.h>
#include "curl_memory.h" #include "curl_memory.h"
#include "strerror.h" #include "strerror.h"
#include "easyif.h" /* for the Curl_convert_from_network prototype */
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
@@ -443,14 +444,11 @@ CURLcode Curl_client_write(struct connectdata *conn,
if(type & CLIENTWRITE_BODY) { if(type & CLIENTWRITE_BODY) {
if((conn->handler->protocol&CURLPROTO_FTP) && if((conn->handler->protocol&CURLPROTO_FTP) &&
conn->proto.ftpc.transfertype == 'A') { conn->proto.ftpc.transfertype == 'A') {
#ifdef CURL_DOES_CONVERSIONS
/* convert from the network encoding */ /* convert from the network encoding */
size_t rc; size_t rc = Curl_convert_from_network(data, ptr, len);
rc = Curl_convert_from_network(data, ptr, len);
/* Curl_convert_from_network calls failf if unsuccessful */ /* Curl_convert_from_network calls failf if unsuccessful */
if(rc != CURLE_OK) if(rc)
return rc; return rc;
#endif /* CURL_DOES_CONVERSIONS */
#ifdef CURL_DO_LINEEND_CONV #ifdef CURL_DO_LINEEND_CONV
/* convert end-of-line markers */ /* convert end-of-line markers */
@@ -623,7 +621,7 @@ static int showit(struct SessionHandle *data, curl_infotype type,
size_t i; size_t i;
for(i = 0; i < size-4; i++) { for(i = 0; i < size-4; i++) {
if(memcmp(&buf[i], "\x0d\x0a\x0d\x0a", 4) == 0) { if(memcmp(&buf[i], "\x0d\x0a\x0d\x0a", 4) == 0) {
/* convert everthing through this CRLFCRLF but no further */ /* convert everything through this CRLFCRLF but no further */
conv_size = i + 4; conv_size = i + 4;
break; break;
} }

View File

@@ -67,8 +67,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "if2ip.h" #include "if2ip.h"
#include "hostip.h" #include "hostip.h"
#include "progress.h" #include "progress.h"
@@ -1110,7 +1108,7 @@ static CURLcode smtp_connect(struct connectdata *conn,
if(CURLE_OK != result) if(CURLE_OK != result)
return result; return result;
/* We always support persistant connections on smtp */ /* We always support persistent connections on smtp */
conn->bits.close = FALSE; conn->bits.close = FALSE;
pp->response_time = RESP_TIMEOUT; /* set default response time-out */ pp->response_time = RESP_TIMEOUT; /* set default response time-out */

View File

@@ -422,7 +422,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
} }
if(result & CURL_CSELECT_ERR) { if(result & CURL_CSELECT_ERR) {
failf(conn->data, "SOCKS5: error occured during connection"); failf(conn->data, "SOCKS5: error occurred during connection");
return CURLE_COULDNT_CONNECT; return CURLE_COULDNT_CONNECT;
} }
@@ -461,7 +461,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
} }
if(result & CURL_CSELECT_ERR) { if(result & CURL_CSELECT_ERR) {
failf(conn->data, "SOCKS5 read error occured"); failf(conn->data, "SOCKS5 read error occurred");
return CURLE_RECV_ERROR; return CURLE_RECV_ERROR;
} }

View File

@@ -53,7 +53,7 @@ CURLcode Curl_speedcheck(struct SessionHandle *data,
/* we have been this slow for long enough, now die */ /* we have been this slow for long enough, now die */
failf(data, failf(data,
"Operation too slow. " "Operation too slow. "
"Less than %ld bytes/sec transfered the last %ld seconds", "Less than %ld bytes/sec transferred the last %ld seconds",
data->set.low_speed_limit, data->set.low_speed_limit,
data->set.low_speed_time); data->set.low_speed_time);
return CURLE_OPERATION_TIMEDOUT; return CURLE_OPERATION_TIMEDOUT;

View File

@@ -79,8 +79,6 @@
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#include "easyif.h" /* for Curl_convert_... prototypes */
#include "hostip.h" #include "hostip.h"
#include "progress.h" #include "progress.h"
#include "transfer.h" #include "transfer.h"
@@ -1053,6 +1051,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(!tmp) { if(!tmp) {
result = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
break; break;
} }
if(data->set.verbose) { if(data->set.verbose) {
@@ -1076,6 +1075,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
if(cp == NULL) { if(cp == NULL) {
failf(data, "Syntax error in SFTP command. Supply parameter(s)!"); failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1091,6 +1091,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
else else
failf(data, "Syntax error: Bad first parameter"); failf(data, "Syntax error: Bad first parameter");
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = result; sshc->actualcode = result;
break; break;
} }
@@ -1118,6 +1119,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = result; sshc->actualcode = result;
break; break;
} }
@@ -1140,6 +1142,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = result; sshc->actualcode = result;
break; break;
} }
@@ -1164,6 +1167,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_safefree(sshc->quote_path1); Curl_safefree(sshc->quote_path1);
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = result; sshc->actualcode = result;
break; break;
} }
@@ -1186,6 +1190,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
Curl_safefree(sshc->quote_path2); Curl_safefree(sshc->quote_path2);
sshc->quote_path2 = NULL; sshc->quote_path2 = NULL;
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1243,6 +1248,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
failf(data, "Attempt to get SFTP stats failed: %s", failf(data, "Attempt to get SFTP stats failed: %s",
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1259,6 +1265,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path2 = NULL; sshc->quote_path2 = NULL;
failf(data, "Syntax error: chgrp gid not a number"); failf(data, "Syntax error: chgrp gid not a number");
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1275,6 +1282,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path2 = NULL; sshc->quote_path2 = NULL;
failf(data, "Syntax error: chmod permissions not a number"); failf(data, "Syntax error: chmod permissions not a number");
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1289,6 +1297,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path2 = NULL; sshc->quote_path2 = NULL;
failf(data, "Syntax error: chown uid not a number"); failf(data, "Syntax error: chown uid not a number");
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1315,6 +1324,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
failf(data, "Attempt to set SFTP stats failed: %s", failf(data, "Attempt to set SFTP stats failed: %s",
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1339,6 +1349,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
failf(data, "symlink command failed: %s", failf(data, "symlink command failed: %s",
sftp_libssh2_strerror(err)); sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1358,6 +1369,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err)); failf(data, "mkdir command failed: %s", sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1372,6 +1384,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
LIBSSH2_SFTP_RENAME_OVERWRITE | LIBSSH2_SFTP_RENAME_OVERWRITE |
LIBSSH2_SFTP_RENAME_ATOMIC | LIBSSH2_SFTP_RENAME_ATOMIC |
LIBSSH2_SFTP_RENAME_NATIVE); LIBSSH2_SFTP_RENAME_NATIVE);
if(rc == LIBSSH2_ERROR_EAGAIN) { if(rc == LIBSSH2_ERROR_EAGAIN) {
break; break;
} }
@@ -1383,6 +1396,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path2 = NULL; sshc->quote_path2 = NULL;
failf(data, "rename command failed: %s", sftp_libssh2_strerror(err)); failf(data, "rename command failed: %s", sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1401,6 +1415,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err)); failf(data, "rmdir command failed: %s", sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -1419,6 +1434,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
sshc->quote_path1 = NULL; sshc->quote_path1 = NULL;
failf(data, "rm command failed: %s", sftp_libssh2_strerror(err)); failf(data, "rm command failed: %s", sftp_libssh2_strerror(err));
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
sshc->actualcode = CURLE_QUOTE_ERROR; sshc->actualcode = CURLE_QUOTE_ERROR;
break; break;
} }
@@ -2061,11 +2077,18 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
} }
DEBUGF(infof(data, "SFTP DONE done\n")); DEBUGF(infof(data, "SFTP DONE done\n"));
#if 0 /* PREV */
state(conn, SSH_SFTP_SHUTDOWN); /* Check if nextstate is set and move .nextstate could be POSTQUOTE_INIT
#endif After nextstate is executed,the control should come back to
state(conn, SSH_STOP); SSH_SFTP_CLOSE to pass the correct result back */
result = sshc->actualcode; if(sshc->nextstate != SSH_NO_STATE) {
state(conn, sshc->nextstate);
sshc->nextstate = SSH_SFTP_CLOSE;
}
else {
state(conn, SSH_STOP);
result = sshc->actualcode;
}
break; break;
case SSH_SFTP_SHUTDOWN: case SSH_SFTP_SHUTDOWN:
@@ -2923,11 +2946,12 @@ static CURLcode sftp_done(struct connectdata *conn, CURLcode status,
struct ssh_conn *sshc = &conn->proto.sshc; struct ssh_conn *sshc = &conn->proto.sshc;
if(status == CURLE_OK) { if(status == CURLE_OK) {
/* Before we shut down, see if there are any post-quote commands to /* Post quote commands are executed after the SFTP_CLOSE state to avoid
send: */ errors that could happen due to open file handles during POSTQUOTE
operation */
if(!status && !premature && conn->data->set.postquote) { if(!status && !premature && conn->data->set.postquote) {
sshc->nextstate = SSH_SFTP_CLOSE; sshc->nextstate = SSH_SFTP_POSTQUOTE_INIT;
state(conn, SSH_SFTP_POSTQUOTE_INIT); state(conn, SSH_SFTP_CLOSE);
} }
else else
state(conn, SSH_SFTP_CLOSE); state(conn, SSH_SFTP_CLOSE);

View File

@@ -71,7 +71,7 @@
#endif #endif
#include "curl_memory.h" #include "curl_memory.h"
#include "easyif.h" /* for Curl_convert_from_utf8 prototype */ #include "non-ascii.h" /* for Curl_convert_from_utf8 prototype */
/* The last #include file should be: */ /* The last #include file should be: */
#include "memdebug.h" #include "memdebug.h"
@@ -1200,7 +1200,7 @@ static CURLcode verifyhost(struct connectdata *conn,
res = CURLE_PEER_FAILED_VERIFICATION; res = CURLE_PEER_FAILED_VERIFICATION;
} }
else { else {
/* we have to look to the last occurence of a commonName in the /* we have to look to the last occurrence of a commonName in the
distinguished one to get the most significant one. */ distinguished one to get the most significant one. */
int j,i=-1 ; int j,i=-1 ;
@@ -1251,18 +1251,15 @@ static CURLcode verifyhost(struct connectdata *conn,
if(peer_CN == nulstr) if(peer_CN == nulstr)
peer_CN = NULL; peer_CN = NULL;
#ifdef CURL_DOES_CONVERSIONS
else { else {
/* convert peer_CN from UTF8 */ /* convert peer_CN from UTF8 */
size_t rc; size_t rc = Curl_convert_from_utf8(data, peer_CN, strlen(peer_CN));
rc = Curl_convert_from_utf8(data, peer_CN, strlen(peer_CN));
/* Curl_convert_from_utf8 calls failf if unsuccessful */ /* Curl_convert_from_utf8 calls failf if unsuccessful */
if(rc != CURLE_OK) { if(rc) {
OPENSSL_free(peer_CN); OPENSSL_free(peer_CN);
return rc; return rc;
} }
} }
#endif /* CURL_DOES_CONVERSIONS */
if(res) if(res)
/* error already detected, pass through */ /* error already detected, pass through */
@@ -2590,7 +2587,7 @@ static ssize_t ossl_send(struct connectdata *conn,
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
/* The operation did not complete; the same TLS/SSL I/O function /* The operation did not complete; the same TLS/SSL I/O function
should be called again later. This is basicly an EWOULDBLOCK should be called again later. This is basically an EWOULDBLOCK
equivalent. */ equivalent. */
*curlcode = CURLE_AGAIN; *curlcode = CURLE_AGAIN;
return -1; return -1;
@@ -2661,7 +2658,7 @@ static ssize_t ossl_recv(struct connectdata *conn, /* connection data */
size_t Curl_ossl_version(char *buffer, size_t size) size_t Curl_ossl_version(char *buffer, size_t size)
{ {
#ifdef YASSL_VERSION #ifdef YASSL_VERSION
/* yassl provides an OpenSSL API compatiblity layer so it looks identical /* yassl provides an OpenSSL API compatibility layer so it looks identical
to OpenSSL in all other aspects */ to OpenSSL in all other aspects */
return snprintf(buffer, size, "yassl/%s", YASSL_VERSION); return snprintf(buffer, size, "yassl/%s", YASSL_VERSION);
#else /* YASSL_VERSION */ #else /* YASSL_VERSION */

View File

@@ -211,7 +211,7 @@ curl_easy_strerror(CURLcode error)
return "Problem with the SSL CA cert (path? access rights?)"; return "Problem with the SSL CA cert (path? access rights?)";
case CURLE_BAD_CONTENT_ENCODING: case CURLE_BAD_CONTENT_ENCODING:
return "Unrecognized HTTP Content-Encoding"; return "Unrecognized or bad HTTP Content or Transfer-Encoding";
case CURLE_LDAP_INVALID_URL: case CURLE_LDAP_INVALID_URL:
return "Invalid LDAP URL"; return "Invalid LDAP URL";

View File

@@ -1093,7 +1093,7 @@ CURLcode telrcv(struct connectdata *conn,
{ {
/* /*
* This is an error. We only expect to get "IAC IAC" or "IAC SE". * This is an error. We only expect to get "IAC IAC" or "IAC SE".
* Several things may have happend. An IAC was not doubled, the * Several things may have happened. An IAC was not doubled, the
* IAC SE was left off, or another option got inserted into the * IAC SE was left off, or another option got inserted into the
* suboption are all possibilities. If we assume that the IAC was * suboption are all possibilities. If we assume that the IAC was
* not doubled, and really the IAC SE was left off, we could get * not doubled, and really the IAC SE was left off, we could get

View File

@@ -1276,7 +1276,7 @@ static CURLcode tftp_easy_statemach(struct connectdata *conn)
else { else {
if(rc==0) { if(rc==0) {
/* A timeout occured, but our timeout is variable, so maybe /* A timeout occurred, but our timeout is variable, so maybe
just continue? */ just continue? */
long rtms = state->retry_time * 1000; long rtms = state->retry_time * 1000;
if (Curl_tvdiff(k->now, transaction_start) > rtms) { if (Curl_tvdiff(k->now, transaction_start) > rtms) {

View File

@@ -101,9 +101,9 @@
#include "curl_memory.h" #include "curl_memory.h"
#include "select.h" #include "select.h"
#include "multiif.h" #include "multiif.h"
#include "easyif.h" /* for Curl_convert_to_network prototype */
#include "rtsp.h" #include "rtsp.h"
#include "connect.h" #include "connect.h"
#include "non-ascii.h"
#define _MPRINTF_REPLACE /* use our functions only */ #define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h> #include <curl/mprintf.h>
@@ -233,7 +233,7 @@ CURLcode Curl_fillreadbuffer(struct connectdata *conn, int bytes, int *nreadp)
#endif /* CURL_DOES_CONVERSIONS */ #endif /* CURL_DOES_CONVERSIONS */
if((nread - hexlen) == 0) if((nread - hexlen) == 0)
/* mark this as done once this chunk is transfered */ /* mark this as done once this chunk is transferred */
data->req.upload_done = TRUE; data->req.upload_done = TRUE;
nread+=(int)strlen(endofline_native); /* for the added end of line */ nread+=(int)strlen(endofline_native); /* for the added end of line */
@@ -509,7 +509,7 @@ static CURLcode readwrite_data(struct SessionHandle *data,
"Rewinding stream by : %zd" "Rewinding stream by : %zd"
" bytes on url %s (zero-length body)\n", " bytes on url %s (zero-length body)\n",
nread, data->state.path); nread, data->state.path);
read_rewind(conn, (size_t)nread); read_rewind(conn, (size_t)nread);
} }
else { else {
infof(data, infof(data,
@@ -714,12 +714,12 @@ static CURLcode readwrite_data(struct SessionHandle *data,
encodings handled here. */ encodings handled here. */
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
switch (conn->data->set.http_ce_skip ? switch (conn->data->set.http_ce_skip ?
IDENTITY : k->content_encoding) { IDENTITY : k->auto_decoding) {
case IDENTITY: case IDENTITY:
#endif #endif
/* This is the default when the server sends no /* This is the default when the server sends no
Content-Encoding header. See Curl_readwrite_init; the Content-Encoding header. See Curl_readwrite_init; the
memset() call initializes k->content_encoding to zero. */ memset() call initializes k->auto_decoding to zero. */
if(!k->ignorebody) { if(!k->ignorebody) {
#ifndef CURL_DISABLE_POP3 #ifndef CURL_DISABLE_POP3
@@ -2098,7 +2098,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
to retry. Marking it this way should to retry. Marking it this way should
prevent i.e HTTP transfers to return prevent i.e HTTP transfers to return
error just because nothing has been error just because nothing has been
transfered! */ transferred! */
if(data->state.proto.http->writebytecount) if(data->state.proto.http->writebytecount)
Curl_readrewind(conn); Curl_readrewind(conn);

View File

@@ -86,14 +86,16 @@
#ifdef HAVE_IDN_FREE_H #ifdef HAVE_IDN_FREE_H
#include <idn-free.h> #include <idn-free.h>
#else #else
void idn_free (void *ptr); /* prototype from idn-free.h, not provided by /* prototype from idn-free.h, not provided by libidn 0.4.5's make install! */
libidn 0.4.5's make install! */ void idn_free (void *ptr);
#endif #endif
#ifndef HAVE_IDN_FREE #ifndef HAVE_IDN_FREE
/* if idn_free() was not found in this version of libidn, use plain free() /* if idn_free() was not found in this version of libidn use free() instead */
instead */
#define idn_free(x) (free)(x) #define idn_free(x) (free)(x)
#endif #endif
#elif defined(USE_WIN32_IDN)
/* prototype for curl_win32_idn_to_ascii() */
int curl_win32_idn_to_ascii(const char *in, char **out);
#endif /* USE_LIBIDN */ #endif /* USE_LIBIDN */
#include "urldata.h" #include "urldata.h"
@@ -120,6 +122,7 @@ void idn_free (void *ptr); /* prototype from idn-free.h, not provided by
#include "speedcheck.h" #include "speedcheck.h"
#include "rawstr.h" #include "rawstr.h"
#include "warnless.h" #include "warnless.h"
#include "non-ascii.h"
/* And now for the protocols */ /* And now for the protocols */
#include "ftp.h" #include "ftp.h"
@@ -525,18 +528,7 @@ CURLcode Curl_close(struct SessionHandle *data)
/* this destroys the channel and we cannot use it anymore after this */ /* this destroys the channel and we cannot use it anymore after this */
ares_destroy(data->state.areschannel); ares_destroy(data->state.areschannel);
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) Curl_convert_close(data);
/* close iconv conversion descriptors */
if(data->inbound_cd != (iconv_t)-1) {
iconv_close(data->inbound_cd);
}
if(data->outbound_cd != (iconv_t)-1) {
iconv_close(data->outbound_cd);
}
if(data->utf8_cd != (iconv_t)-1) {
iconv_close(data->utf8_cd);
}
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
/* No longer a dirty share, if it exists */ /* No longer a dirty share, if it exists */
if(data->share) { if(data->share) {
@@ -814,12 +806,7 @@ CURLcode Curl_open(struct SessionHandle **curl)
data->state.headersize=HEADERSIZE; data->state.headersize=HEADERSIZE;
#if defined(CURL_DOES_CONVERSIONS) && defined(HAVE_ICONV) Curl_convert_init(data);
/* conversion descriptors for iconv calls */
data->outbound_cd = (iconv_t)-1;
data->inbound_cd = (iconv_t)-1;
data->utf8_cd = (iconv_t)-1;
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
/* most recent connection is not yet defined */ /* most recent connection is not yet defined */
data->state.lastconnect = -1; data->state.lastconnect = -1;
@@ -1076,7 +1063,7 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
data->set.http_auto_referer = (bool)(0 != va_arg(param, long)); data->set.http_auto_referer = (bool)(0 != va_arg(param, long));
break; break;
case CURLOPT_ENCODING: case CURLOPT_ACCEPT_ENCODING:
/* /*
* String to use at the value of Accept-Encoding header. * String to use at the value of Accept-Encoding header.
* *
@@ -1092,6 +1079,10 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
(char *) ALL_CONTENT_ENCODINGS: argptr); (char *) ALL_CONTENT_ENCODINGS: argptr);
break; break;
case CURLOPT_TRANSFER_ENCODING:
data->set.http_transfer_encoding = (bool)(0 != va_arg(param, long));
break;
case CURLOPT_FOLLOWLOCATION: case CURLOPT_FOLLOWLOCATION:
/* /*
* Follow Location: header hints on a HTTP-server. * Follow Location: header hints on a HTTP-server.
@@ -2549,6 +2540,7 @@ static void conn_free(struct connectdata *conn)
Curl_safefree(conn->allocptr.uagent); Curl_safefree(conn->allocptr.uagent);
Curl_safefree(conn->allocptr.userpwd); Curl_safefree(conn->allocptr.userpwd);
Curl_safefree(conn->allocptr.accept_encoding); Curl_safefree(conn->allocptr.accept_encoding);
Curl_safefree(conn->allocptr.te);
Curl_safefree(conn->allocptr.rangeline); Curl_safefree(conn->allocptr.rangeline);
Curl_safefree(conn->allocptr.ref); Curl_safefree(conn->allocptr.ref);
Curl_safefree(conn->allocptr.host); Curl_safefree(conn->allocptr.host);
@@ -3447,7 +3439,7 @@ static void fix_hostname(struct SessionHandle *data,
* Check name for non-ASCII and convert hostname to ACE form. * Check name for non-ASCII and convert hostname to ACE form.
*************************************************************/ *************************************************************/
char *ace_hostname = NULL; char *ace_hostname = NULL;
int rc = curl_win32_idn_to_ascii(host->name, &ace_hostname, 0); int rc = curl_win32_idn_to_ascii(host->name, &ace_hostname);
if(rc == 0) if(rc == 0)
infof(data, "Failed to convert %s to ACE;\n", infof(data, "Failed to convert %s to ACE;\n",
host->name); host->name);

View File

@@ -551,7 +551,7 @@ struct SingleRequest {
long headerbytecount; /* only count received headers */ long headerbytecount; /* only count received headers */
long deductheadercount; /* this amount of bytes doesn't count when we check long deductheadercount; /* this amount of bytes doesn't count when we check
if anything has been transfered at the end of a if anything has been transferred at the end of a
connection. We use this counter to make only a connection. We use this counter to make only a
100 reply (without a following second response 100 reply (without a following second response
code) result in a CURLE_GOT_NOTHING error code */ code) result in a CURLE_GOT_NOTHING error code */
@@ -582,7 +582,7 @@ struct SingleRequest {
struct timeval start100; /* time stamp to wait for the 100 code from */ struct timeval start100; /* time stamp to wait for the 100 code from */
enum expect100 exp100; /* expect 100 continue state */ enum expect100 exp100; /* expect 100 continue state */
int content_encoding; /* What content encoding. sec 3.5, RFC2616. */ int auto_decoding; /* What content encoding. sec 3.5, RFC2616. */
#define IDENTITY 0 /* No encoding */ #define IDENTITY 0 /* No encoding */
#define DEFLATE 1 /* zlib deflate [RFC 1950 & 1951] */ #define DEFLATE 1 /* zlib deflate [RFC 1950 & 1951] */
@@ -778,9 +778,9 @@ struct connectdata {
/* 'primary_ip' and 'primary_port' get filled with peer's numerical /* 'primary_ip' and 'primary_port' get filled with peer's numerical
ip address and port number whenever an outgoing connection is ip address and port number whenever an outgoing connection is
*attemted* from the primary socket to a remote address. When more *attempted* from the primary socket to a remote address. When more
than one address is tried for a connection these will hold data than one address is tried for a connection these will hold data
for the last attempt. When the connection is actualy established for the last attempt. When the connection is actually established
these are updated with data which comes directly from the socket. */ these are updated with data which comes directly from the socket. */
char primary_ip[MAX_IPADR_LEN]; char primary_ip[MAX_IPADR_LEN];
@@ -837,18 +837,19 @@ struct connectdata {
well be the same we read from. well be the same we read from.
CURL_SOCKET_BAD disables */ CURL_SOCKET_BAD disables */
/** Dynamicly allocated strings, may need to be freed before this **/ /** Dynamicly allocated strings, MUST be freed before this **/
/** struct is killed. **/ /** struct is killed. **/
struct dynamically_allocated_data { struct dynamically_allocated_data {
char *proxyuserpwd; /* free later if not NULL! */ char *proxyuserpwd;
char *uagent; /* free later if not NULL! */ char *uagent;
char *accept_encoding; /* free later if not NULL! */ char *accept_encoding;
char *userpwd; /* free later if not NULL! */ char *userpwd;
char *rangeline; /* free later if not NULL! */ char *rangeline;
char *ref; /* free later if not NULL! */ char *ref;
char *host; /* free later if not NULL */ char *host;
char *cookiehost; /* free later if not NULL */ char *cookiehost;
char *rtsp_transport; /* free later if not NULL */ char *rtsp_transport;
char *te; /* TE: request header */
} allocptr; } allocptr;
int sec_complete; /* if kerberos is enabled for this connection */ int sec_complete; /* if kerberos is enabled for this connection */
@@ -996,8 +997,8 @@ struct Progress {
force redraw at next call */ force redraw at next call */
curl_off_t size_dl; /* total expected size */ curl_off_t size_dl; /* total expected size */
curl_off_t size_ul; /* total expected size */ curl_off_t size_ul; /* total expected size */
curl_off_t downloaded; /* transfered so far */ curl_off_t downloaded; /* transferred so far */
curl_off_t uploaded; /* transfered so far */ curl_off_t uploaded; /* transferred so far */
curl_off_t current_speed; /* uses the currently fastest transfer */ curl_off_t current_speed; /* uses the currently fastest transfer */
@@ -1455,6 +1456,7 @@ struct UserDefined {
bool hide_progress; /* don't use the progress meter */ bool hide_progress; /* don't use the progress meter */
bool http_fail_on_error; /* fail on HTTP error codes >= 300 */ bool http_fail_on_error; /* fail on HTTP error codes >= 300 */
bool http_follow_location; /* follow HTTP redirects */ bool http_follow_location; /* follow HTTP redirects */
bool http_transfer_encoding; /* request compressed HTTP transfer-encoding */
bool http_disable_hostname_check_before_authentication; bool http_disable_hostname_check_before_authentication;
bool include_header; /* include received protocol headers in data output */ bool include_header; /* include received protocol headers in data output */
bool http_set_referer; /* is a custom referer used */ bool http_set_referer; /* is a custom referer used */

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -304,7 +304,7 @@
d c 2 d c 2
d CURLE_URL_MALFORMAT... d CURLE_URL_MALFORMAT...
d c 3 d c 3
d CURLE_OBSOLETE4... d CURLE_NOT_BUILT_IN...
d c 4 d c 4
d CURLE_COULDNT_RESOLVE_PROXY... d CURLE_COULDNT_RESOLVE_PROXY...
d c 5 d c 5
@@ -392,7 +392,7 @@
d c 46 d c 46
d CURLE_TOO_MANY_REDIRECTS... d CURLE_TOO_MANY_REDIRECTS...
d c 47 d c 47
d CURLE_UNKNOWN_TELNET_OPTION... d CURLE_UNKNOWN_OPTION...
d c 48 d c 48
d CURLE_TELNET_OPTION_SYNTAX... d CURLE_TELNET_OPTION_SYNTAX...
d c 49 d c 49
@@ -475,6 +475,67 @@
d CURLE_CHUNK_FAILED... d CURLE_CHUNK_FAILED...
d c 88 d c 88
* *
/if not defined(CURL_NO_OLDIES)
d CURLE_URL_MALFORMAT_USER...
d c 4
d CURLE_FTP_ACCESS_DENIED...
d c 9
d CURLE_FTP_USER_PASSWORD_INCORRECT...
d c 10
d CURLE_FTP_WEIRD_USER_REPLY...
d c 12
d CURLE_FTP_CANT_RECONNECT...
d c 16
d CURLE_FTP_COULDNT_SET_BINARY...
d c 17
d CURLE_FTP_PARTIAL_FILE...
d c 18
d CURLE_FTP_WRITE_ERROR...
d c 20
d CURLE_FTP_QUOTE_ERROR...
d c 21
d CURLE_HTTP_NOT_FOUND...
d c 22
d CURLE_MALFORMAT_USER...
d c 24
d CURLE_FTP_COULDNT_STOR_FILE...
d c 25
d CURLE_OPERATION_TIMEOUTED...
d c 28
d CURLE_FTP_COULDNT_SET_ASCII...
d c 29
d CURLE_FTP_COULDNT_GET_SIZE...
d c 32
d CURLE_HTTP_RANGE_ERROR...
d c 33
d CURLE_FTP_BAD_DOWNLOAD_RESUME...
d c 36
d CURLE_LIBRARY_NOT_FOUND...
d c 40
d CURLE_BAD_CALLING_ORDER...
d c 44
d CURLE_HTTP_PORT_FAILED...
d c 45
d CURLE_BAD_PASSWORD_ENTERED...
d c 46
d CURLE_UNKNOWN_TELNET_OPTION...
d c 48
d CURLE_OBSOLETE...
d c 50
d CURLE_SSL_PEER_CERTIFICATE...
d c 51
d CURLE_SHARE_IN_USE...
d c 57
d CURLE_FTP_SSL_FAILED...
d c 64
d CURLE_TFTP_DISKFULL...
d c 70
d CURLE_TFTP_EXISTS...
d c 73
d CURLE_ALREADY_COMPLETE...
d c 99999
/endif
*
d curlioerr s 10i 0 based(######ptr######) Enum d curlioerr s 10i 0 based(######ptr######) Enum
d CURLIOE_OK c 0 d CURLIOE_OK c 0
d CURLIOE_UNKNOWNCMD... d CURLIOE_UNKNOWNCMD...
@@ -569,6 +630,19 @@
d CURLUSESSL_ALL... d CURLUSESSL_ALL...
d c 3 d c 3
* *
/if not defined(CURL_NO_OLDIES)
d curl_ftpssl s like(curl_usessl)
d based(######ptr######)
d CURLFTPSSL_NONE...
d c 0
d CURLFTPSSL_TRY...
d c 1
d CURLFTPSSL_CONTROL...
d c 2
d CURLFTPSSL_ALL...
d c 3
/endif
*
d curl_ftpccc s 10i 0 based(######ptr######) Enum d curl_ftpccc s 10i 0 based(######ptr######) Enum
d CURLFTPSSL_CCC_NONE... d CURLFTPSSL_CCC_NONE...
d c 0 d c 0
@@ -707,8 +781,6 @@
d c 10024 d c 10024
d CURLOPT_SSLCERT... d CURLOPT_SSLCERT...
d c 10025 d c 10025
d CURLOPT_SSLCERTPASSWD...
d c 10026
d CURLOPT_KEYPASSWD... d CURLOPT_KEYPASSWD...
d c 10026 d c 10026
d CURLOPT_CRLF c 00027 d CURLOPT_CRLF c 00027
@@ -1034,10 +1106,24 @@
d CURLOPT_TLSAUTH_TYPE... d CURLOPT_TLSAUTH_TYPE...
d c 10206 d c 10206
* *
/if not defined(CURL_NO_OLDIES)
d CURLOPT_SSLKEYPASSWD...
d c 10026
d CURLOPT_SSLCERTPASSWD...
d c 10026
d CURLOPT_FTPLISTONLY...
d c 00048
d CURLOPT_FTPAPPEND...
d c 00050
d CURLOPT_KRB4LEVEL...
d c 10063
d CURLOPT_SERVER_RESPONSE_TIMEOUT... d CURLOPT_SERVER_RESPONSE_TIMEOUT...
d c 00112 d c 00112
d CURLOPT_FTP_SSL...
d c 00119
d CURLOPT_POST301... d CURLOPT_POST301...
d c 00161 Obsolescent d c 00161
/endif
* *
d CURLFORMcode s 10i 0 based(######ptr######) Enum d CURLFORMcode s 10i 0 based(######ptr######) Enum
d CURL_FORMADD_OK... d CURL_FORMADD_OK...

View File

@@ -11,8 +11,9 @@ cd "${TOPDIR}/lib"
# Create and compile the identification source file. # Create and compile the identification source file.
echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c echo '#pragma comment(user, "libcurl version '"${LIBCURL_VERSION}"'")' > os400.c
echo '#pragma comment(date)' >> os400.c echo '#pragma comment(user, __DATE__)' >> os400.c
echo '#pragma comment(copyright, "Copyright (C) 1998-2010 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c echo '#pragma comment(user, __TIME__)' >> os400.c
echo '#pragma comment(copyright, "Copyright (C) 1998-2011 Daniel Stenberg et al. OS/400 version by P. Monnerat")' >> os400.c
make_module OS400 os400.c make_module OS400 os400.c
LINK= # No need to rebuild service program yet. LINK= # No need to rebuild service program yet.
MODULES= MODULES=

View File

@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___ * | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____| * \___|\___/|_| \_\_____|
* *
* Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
* *
* This software is licensed as described in the file COPYING, which * This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms * you should have received as part of this distribution. The terms
@@ -863,6 +863,7 @@ Curl_ldap_get_dn_a(void * ld, LDAPMessage * entry)
return cp2; return cp2;
QadrtConvertE2A(cp2, cp, i, i); QadrtConvertE2A(cp2, cp, i, i);
cp2[i] = '\0';
/* No way to allocate a buffer here, because it will be released by /* No way to allocate a buffer here, because it will be released by
ldap_memfree() and ldap_memalloc() does not exist. The solution is to ldap_memfree() and ldap_memalloc() does not exist. The solution is to
@@ -894,6 +895,7 @@ Curl_ldap_first_attribute_a(void * ld,
return cp2; return cp2;
QadrtConvertE2A(cp2, cp, i, i); QadrtConvertE2A(cp2, cp, i, i);
cp2[i] = '\0';
/* No way to allocate a buffer here, because it will be released by /* No way to allocate a buffer here, because it will be released by
ldap_memfree() and ldap_memalloc() does not exist. The solution is to ldap_memfree() and ldap_memalloc() does not exist. The solution is to
@@ -925,6 +927,7 @@ Curl_ldap_next_attribute_a(void * ld,
return cp2; return cp2;
QadrtConvertE2A(cp2, cp, i, i); QadrtConvertE2A(cp2, cp, i, i);
cp2[i] = '\0';
/* No way to allocate a buffer here, because it will be released by /* No way to allocate a buffer here, because it will be released by
ldap_memfree() and ldap_memalloc() does not exist. The solution is to ldap_memfree() and ldap_memalloc() does not exist. The solution is to

View File

@@ -78,7 +78,7 @@ ZLIB_ROOT = ..$(DS)..$(DS)zlib-1.2.5
!ifdef %libssh2_root !ifdef %libssh2_root
LIBSSH2_ROOT = $(%libssh2_root) LIBSSH2_ROOT = $(%libssh2_root)
!else !else
LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.7 LIBSSH2_ROOT = ..$(DS)..$(DS)libssh2-1.2.8
!endif !endif
!ifdef %librtmp_root !ifdef %librtmp_root

View File

@@ -1,10 +1,10 @@
######################################################################### #########################################################################
# #
## Makefile for building curl.exe with MingW32 (GCC-3.2 or later) ## Makefile for building curl.exe with MingW32 (GCC-3.2 or later)
## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5) ## and optionally OpenSSL (0.9.8), libssh2 (1.2), zlib (1.2.5), librtmp (2.3)
## ##
## Usage: ## Usage: mingw32-make -f Makefile.m32 CFG=-feature1[-feature2][-feature3][...]
## mingw32-make -f Makefile.m32 [SSL=1] [SSH2=1] [ZLIB=1] [IDN=1] [SSPI=1] [IPV6=1] [LDAPS=1] [RTMP=1] [DYN=1] ## Example: mingw32-make -f Makefile.m32 CFG=-zlib-ssl-spi-winidn
## ##
## Hint: you can also set environment vars to control the build, f.e.: ## Hint: you can also set environment vars to control the build, f.e.:
## set ZLIB_PATH=c:/zlib-1.2.5 ## set ZLIB_PATH=c:/zlib-1.2.5
@@ -24,15 +24,21 @@ OPENSSL_PATH = ../../openssl-0.9.8r
endif endif
# Edit the path below to point to the base of your LibSSH2 package. # Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.2.7 LIBSSH2_PATH = ../../libssh2-1.2.8
endif
# Edit the path below to point to the base of your librtmp package.
ifndef LIBRTMP_PATH
LIBRTMP_PATH = ../../librtmp-2.3
endif endif
# Edit the path below to point to the base of your libidn package. # Edit the path below to point to the base of your libidn package.
ifndef LIBIDN_PATH ifndef LIBIDN_PATH
LIBIDN_PATH = ../../libidn-1.18 LIBIDN_PATH = ../../libidn-1.18
endif endif
# Edit the path below to point to the base of your librtmp package. # Edit the path below to point to the base of your MS idndlpackage.
ifndef LIBRTMP_PATH # Microsoft Internationalized Domain Names (IDN) Mitigation APIs 1.1
LIBRTMP_PATH = ../../librtmp-2.3 # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=ad6158d7-ddba-416a-9109-07607425a815
ifndef WINIDN_PATH
WINIDN_PATH = ../../Microsoft IDN Mitigation APIs
endif endif
# Edit the path below to point to the base of your Novell LDAP NDK. # Edit the path below to point to the base of your Novell LDAP NDK.
ifndef LDAP_SDK ifndef LDAP_SDK
@@ -45,7 +51,7 @@ LIBCARES_PATH = ../ares
endif endif
CC = gcc CC = gcc
CFLAGS = -g -O2 CFLAGS = -g -O2 -Wall
# comment LDFLAGS below to keep debug info # comment LDFLAGS below to keep debug info
LDFLAGS = -s LDFLAGS = -s
RC = windres RC = windres
@@ -60,6 +66,44 @@ CP = copy
######################################################## ########################################################
## Nothing more to do below this line! ## Nothing more to do below this line!
ifeq ($(findstring -dyn,$(CFG)),-dyn)
DYN = 1
endif
ifeq ($(findstring -ares,$(CFG)),-ares)
ARES = 1
endif
ifeq ($(findstring -rtmp,$(CFG)),-rtmp)
RTMP = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssh2,$(CFG)),-ssh2)
SSH2 = 1
SSL = 1
ZLIB = 1
endif
ifeq ($(findstring -ssl,$(CFG)),-ssl)
SSL = 1
endif
ifeq ($(findstring -zlib,$(CFG)),-zlib)
ZLIB = 1
endif
ifeq ($(findstring -idn,$(CFG)),-idn)
IDN = 1
endif
ifeq ($(findstring -winidn,$(CFG)),-winidn)
WINIDN = 1
endif
ifeq ($(findstring -sspi,$(CFG)),-sspi)
SSPI = 1
endif
ifeq ($(findstring -ldaps,$(CFG)),-ldaps)
LDAPS = 1
endif
ifeq ($(findstring -ipv6,$(CFG)),-ipv6)
IPV6 = 1
endif
INCLUDES = -I. -I.. -I../include -I../lib INCLUDES = -I. -I.. -I../include -I../lib
LINK = $(CC) $(LDFLAGS) -o $@ LINK = $(CC) $(LDFLAGS) -o $@
@@ -100,6 +144,11 @@ ifdef IDN
INCLUDES += -I"$(LIBIDN_PATH)/include" INCLUDES += -I"$(LIBIDN_PATH)/include"
CFLAGS += -DUSE_LIBIDN CFLAGS += -DUSE_LIBIDN
curl_LDADD += -L$(LIBIDN_PATH)/lib -lidn curl_LDADD += -L$(LIBIDN_PATH)/lib -lidn
else
ifdef WINIDN
CFLAGS += -DUSE_WIN32_IDN
DLL_LIBS += -L"$(WINIDN_PATH)" -lnormaliz
endif
endif endif
ifdef SSPI ifdef SSPI
CFLAGS += -DUSE_WINDOWS_SSPI CFLAGS += -DUSE_WINDOWS_SSPI

View File

@@ -24,7 +24,7 @@ endif
# Edit the path below to point to the base of your LibSSH2 package. # Edit the path below to point to the base of your LibSSH2 package.
ifndef LIBSSH2_PATH ifndef LIBSSH2_PATH
LIBSSH2_PATH = ../../libssh2-1.2.7 LIBSSH2_PATH = ../../libssh2-1.2.8
endif endif
# Edit the path below to point to the base of your axTLS package. # Edit the path below to point to the base of your axTLS package.

View File

@@ -474,6 +474,7 @@ struct Configurable {
char *cookiefile; /* read from this file */ char *cookiefile; /* read from this file */
bool cookiesession; /* new session? */ bool cookiesession; /* new session? */
bool encoding; /* Accept-Encoding please */ bool encoding; /* Accept-Encoding please */
bool tr_encoding; /* Transfer-Encoding please */
long authtype; /* auth bitmask */ long authtype; /* auth bitmask */
bool use_resume; bool use_resume;
bool resume_from_current; bool resume_from_current;
@@ -625,7 +626,7 @@ struct Configurable {
long alivetime; long alivetime;
bool content_disposition; /* use Content-disposition filename */ bool content_disposition; /* use Content-disposition filename */
int default_node_flags; /* default flags to seach for each 'node', which is int default_node_flags; /* default flags to search for each 'node', which is
basically each given URL to transfer */ basically each given URL to transfer */
struct OutStruct *outs; struct OutStruct *outs;
bool xattr; /* store metadata in extended attributes */ bool xattr; /* store metadata in extended attributes */
@@ -904,6 +905,7 @@ static void help(void)
" --trace <file> Write a debug trace to the given file", " --trace <file> Write a debug trace to the given file",
" --trace-ascii <file> Like --trace but without the hex output", " --trace-ascii <file> Like --trace but without the hex output",
" --trace-time Add time stamps to trace/verbose output", " --trace-time Add time stamps to trace/verbose output",
" --tr-encoding Request compressed transfer encoding (H)",
" -T/--upload-file <file> Transfer <file> to remote site", " -T/--upload-file <file> Transfer <file> to remote site",
" --url <URL> Set URL to work with", " --url <URL> Set URL to work with",
" -B/--use-ascii Use ASCII/text transfer", " -B/--use-ascii Use ASCII/text transfer",
@@ -1823,7 +1825,8 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
{"*g", "trace", TRUE}, {"*g", "trace", TRUE},
{"*h", "trace-ascii", TRUE}, {"*h", "trace-ascii", TRUE},
{"*i", "limit-rate", TRUE}, {"*i", "limit-rate", TRUE},
{"*j", "compressed", FALSE}, /* might take an arg someday */ {"*j", "compressed", FALSE},
{"*J", "tr-encoding", FALSE},
{"*k", "digest", FALSE}, {"*k", "digest", FALSE},
{"*l", "negotiate", FALSE}, {"*l", "negotiate", FALSE},
{"*m", "ntlm", FALSE}, {"*m", "ntlm", FALSE},
@@ -2148,6 +2151,10 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
config->encoding = toggle; config->encoding = toggle;
break; break;
case 'J': /* --tr-encoding */
config->tr_encoding = toggle;
break;
case 'k': /* --digest */ case 'k': /* --digest */
if(toggle) if(toggle)
config->authtype |= CURLAUTH_DIGEST; config->authtype |= CURLAUTH_DIGEST;
@@ -2525,7 +2532,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->cookiefile, nextarg); GetStr(&config->cookiefile, nextarg);
break; break;
case 'B': case 'B':
/* use ASCII/text when transfering */ /* use ASCII/text when transferring */
config->use_ascii = toggle; config->use_ascii = toggle;
break; break;
case 'c': case 'c':
@@ -2765,13 +2772,13 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
GetStr(&config->tls_username, nextarg); GetStr(&config->tls_username, nextarg);
else else
return PARAM_LIBCURL_DOESNT_SUPPORT; return PARAM_LIBCURL_DOESNT_SUPPORT;
break; break;
case 'l': /* TLS password */ case 'l': /* TLS password */
if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP)
GetStr(&config->tls_password, nextarg); GetStr(&config->tls_password, nextarg);
else else
return PARAM_LIBCURL_DOESNT_SUPPORT; return PARAM_LIBCURL_DOESNT_SUPPORT;
break; break;
case 'm': /* TLS authentication type */ case 'm': /* TLS authentication type */
if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) { if(curlinfo->features & CURL_VERSION_TLSAUTH_SRP) {
GetStr(&config->tls_authtype, nextarg); GetStr(&config->tls_authtype, nextarg);
@@ -2780,7 +2787,7 @@ static ParameterError getparameter(char *flag, /* f or -long-flag */
} }
else else
return PARAM_LIBCURL_DOESNT_SUPPORT; return PARAM_LIBCURL_DOESNT_SUPPORT;
break; break;
default: /* certificate file */ default: /* certificate file */
{ {
char *ptr = strchr(nextarg, ':'); char *ptr = strchr(nextarg, ':');
@@ -3972,7 +3979,7 @@ int my_trace(CURL *handle, curl_infotype type,
size_t i; size_t i;
for(i = 0; i < size - 4; i++) { for(i = 0; i < size - 4; i++) {
if(memcmp(&data[i], "\r\n\r\n", 4) == 0) { if(memcmp(&data[i], "\r\n\r\n", 4) == 0) {
/* dump everthing through the CRLFCRLF as a sent header */ /* dump everything through the CRLFCRLF as a sent header */
text = "=> Send header"; text = "=> Send header";
dump(timebuf, text, output, data, i+4, config->tracetype, type); dump(timebuf, text, output, data, i+4, config->tracetype, type);
data += i + 3; data += i + 3;
@@ -4930,7 +4937,7 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
} }
} }
/* Create the directory hierarchy, if not pre-existant to a multiple /* Create the directory hierarchy, if not pre-existent to a multiple
file output call */ file output call */
if(config->create_dirs && if(config->create_dirs &&
@@ -5381,9 +5388,11 @@ operate(struct Configurable *config, int argc, argv_item_t argv[])
if(res != CURLE_OK) if(res != CURLE_OK)
goto show_error; goto show_error;
/* new in curl 7.10 */ if(config->encoding)
my_setopt_str(curl, CURLOPT_ENCODING, my_setopt_str(curl, CURLOPT_ACCEPT_ENCODING, "");
(config->encoding) ? "" : NULL);
if(config->tr_encoding)
my_setopt(curl, CURLOPT_TRANSFER_ENCODING, 1);
/* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */ /* new in curl 7.10.7, extended in 7.19.4 but this only sets 0 or 1 */
my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS, my_setopt(curl, CURLOPT_FTP_CREATE_MISSING_DIRS,

View File

@@ -61,7 +61,7 @@ while (<STDIN>) {
} }
my $text = $line; my $text = $line;
$text =~ s/^\s+//g; # cut off preceeding... $text =~ s/^\s+//g; # cut off preceding...
$text =~ s/\s+$//g; # and trailing whitespaces $text =~ s/\s+$//g; # and trailing whitespaces
$tlen = length($text); $tlen = length($text);

View File

@@ -71,7 +71,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \
test1203 test1117 test1118 test1119 test1120 test1300 test1301 test1302 \ test1203 test1117 test1118 test1119 test1120 test1300 test1301 test1302 \
test1303 test320 test321 test322 test323 test324 test1121 test581 test580 \ test1303 test320 test321 test322 test323 test324 test1121 test581 test580 \
test1304 test1305 test1306 test1307 test582 test583 test808 test809 \ test1304 test1305 test1306 test1307 test582 test583 test808 test809 \
test810 test811 test812 test813 test584 test810 test811 test812 test813 test584 test1122 test1123 test1124 test1125
filecheck: filecheck:
@mkdir test-place; \ @mkdir test-place; \

View File

@@ -11,7 +11,7 @@ RETR
<reply> <reply>
<servercmd> <servercmd>
REPLY CWD 421 Timeout! REPLY CWD 421 Timeout!
</server> </servercmd>
</reply> </reply>
# Client-side # Client-side

70
tests/data/test1122 Normal file
View File

@@ -0,0 +1,70 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
compressed
Transfer-Encoding
</keywords>
</info>
#
# Server-side
<reply>
<data base64="yes">
SFRUUC8xLjEgMjAwIE9LDQpEYXRlOiBNb24sIDI5IE5vdiAyMDA0IDIxOjU2OjUzIEdNVA0KU2Vy
dmVyOiBBcGFjaGUvMS4zLjMxIChEZWJpYW4gR05VL0xpbnV4KSBtb2RfZ3ppcC8xLjMuMjYuMWEg
UEhQLzQuMy45LTEgbW9kX3NzbC8yLjguMjAgT3BlblNTTC8wLjkuN2QgbW9kX3BlcmwvMS4yOQ0K
VmFyeTogQWNjZXB0LUVuY29kaW5nDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1J
U08tODg1OS0xDQpUcmFuc2Zlci1FbmNvZGluZzogZ3ppcA0KQ29udGVudC1MZW5ndGg6IDQ0DQoN
Ch+LCAh5nqtBAANsYWxhbGEAy8nMS1Uw5FLIAdFGXAoQhjEXAAoCcWAYAAAA
</data>
<datacheck>
HTTP/1.1 200 OK
Date: Mon, 29 Nov 2004 21:56:53 GMT
Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29
Vary: Accept-Encoding
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: gzip
Content-Length: 44
line 1
line 2
line 3
</datacheck>
</reply>
#
# Client-side
<client>
<features>
libz
</features>
<server>
http
</server>
<name>
HTTP GET gzip transfer-encoded content
</name>
<command>
http://%HOSTIP:%HTTPPORT/1122 --tr-encoding
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /1122 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Connection: TE
TE: gzip
</protocol>
</verify>
</testcase>

200
tests/data/test1123 Normal file
View File

@@ -0,0 +1,200 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
compressed
</keywords>
</info>
#
# Server-side
<reply>
<data base64="yes">
SFRUUC8xLjEgMjAwIE9LDQpEYXRlOiBNb24sIDI5IE5vdiAyMDA0IDIxOjU2OjUzIEdNVA0KU2Vy
dmVyOiBBcGFjaGUvMS4zLjMxIChEZWJpYW4gR05VL0xpbnV4KSBtb2RfZ3ppcC8xLjMuMjYuMWEg
UEhQLzQuMy45LTEgbW9kX3NzbC8yLjguMjAgT3BlblNTTC8wLjkuN2QgbW9kX3BlcmwvMS4yOQ0K
VmFyeTogQWNjZXB0LUVuY29kaW5nDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1J
U08tODg1OS0xDQpUcmFuc2Zlci1FbmNvZGluZzogZGVmbGF0ZQ0KQ29udGVudC1MZW5ndGg6IDEz
MDUNCg0KeJzcWNtu4zYQfTeQf2D91AK2brYTOXC0KHLZBM02wdoFuk8GLdE2G0kUSMq5PPTbO5Qo
ibEcr3eDvgRIYnLmnMPhDEmTmXx6SmK0IVxQlp51XcvpIpKGLKLp6qx7M73r+/5o3He7n4LO5JeL
u/PZt/tLlHH2DwllP6ZCAhBNv01nl19Qdy1ldmrbS07EOiFYWimR9gKHDySN7GXS1zzRd6yhFcmo
C6JbWkEHocqm2k1vTqPAPXa9iW0YSkSEJZnjKCKAGI/9vuP3PRc5w1PHPfXGE9vwG4Q8Ux9R4DnO
sO86fddHjnfqwc9AUyrEqzhSnJC5WDMugzDncR2OYW/jl3kcF3CE0wjFdNGmFhAdHhGhljpnSVJS
UoIkY7UAx/wZLRlHYUxJKvuCRgT99fUWSY5TsYSKWjCLRshQ3hkMogLhcgSlWqlwVd8ljYk46uRC
ddQY4jmV+MlCNxKJPMtAX6Dr2ey+V/yd9tAVtI86V0X74uZ81kOzy9s/L+Hz9uJ3gF3d3F72iuE/
391fX36FNgzwSGKIqZTqZ0zInm7m0AoZe6BEFNooz2KGIxgCllqekKiZdQ9lWIhHxiPVhMjSPFkU
9un09qgTEi7pkoZQVzD9QTj4mChDgWo8wQjFtCAbGXsknERHncVzlaQekmvyZsarslhHndkaqAjD
74KmajMJSG2dapVgBpsOec5RJ8bpKscrIooYSLqhnKUJDCBAR5fQWBsbKnFM5fNchIyTYHTiD63R
ycTesm+BM8JDkAwGlntsYCvzFhrm8wB7bWwgC5Ne1yzLY8ybsY5HY4hhCMt529MiVAO6A8t3XxFe
h2I4ymCc0Su0EQ7HxbnhWyNnYuuO6ZmHLAddz6282vAKUw7iD2qMMYDIFyLkNJNwRIpgoE6H16YS
BqVPw/Vc7eXggixxHsuJbRpLGNR/Xh1gGZQ92HloVielrdaLPbFbrEZszRLythAsYMpLFXV42iZD
69YCjaZcvRwuB2CtpGiNyOLFO1wEwFpE0RqRF5odLgJgLaJojUi4hj1GYrY6XKqmaMFGopHlWXK4
IIC1lKI1IhFZHC4CYC2iaI0IE0+HiwBYiyiaUS8RqfPyB2pWEqq6abqxzHMOaRMk0Ou36hqF2Ygf
KMlGVMXYCENE3RwOV1FoLVMQG52Ecs744UolXmtpslnXhAVVraBZemIKhxyk4MvNzP4bncPpASmj
eYJuS8fErhAar76n5JyTmNSZa5nn+v4WnFiuZ8EF6Q33G2x1rzo5dvxRi1hdsNocdS/afXHaBSzn
Yu+azATOUQITXjM5l2v4qoactUwlEucSbjKiDqnsV93aoE9gnFISo6kkKXzDrya26WxRoEq76/7v
Aq8ioopsIFt0zmIS3D2mhNe4wlRFapuhVr1qCasveE4TmmJpzk5yuCEUtYGC1p2W1/OO97kHe7n7
nK7v7+W6e8eFpbE/6r1u93i4zz3eS/bHe73OXrc7+k7c3wlsf2SD1tjl/W67/LAmMngywUMMrqO1
Tm18RvI5I2ddTkJ4HSibeknVi7LBmRvZUUPtcuwk6nsLuE+Gqhg7XTuZxuOsRd1+uL3FlVSqDQV2
uLOjX/Vt6redWiW23mkN4u28seLehuP/L2nOT2dsOHhnxtT76uMnyvUGI/cdmXqBp9jHz9LAc4Yn
78jSNaFJhOOPn6jhcDTw3pGosA9PffEzeTIs+qyv/ysUdP4DAAD//4IzEaNjAAAAAP//AwDdOI7R
</data>
<datacheck>
HTTP/1.1 200 OK
Date: Mon, 29 Nov 2004 21:56:53 GMT
Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29
Vary: Accept-Encoding
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: deflate
Content-Length: 1305
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE project-listing SYSTEM "http://freshmeat.net/backend/fm-projects-0.4.dtd">
<project-listing>
<project>
<project_id>1612</project_id>
<date_added>1998-08-21 04:01:29</date_added>
<date_updated>2004-10-18 02:22:23</date_updated>
<projectname_short>curl</projectname_short>
<projectname_full>curl and libcurl</projectname_full>
<desc_short>Command line tool and library for client-side URL transfers.</desc_short>
<desc_full>curl and libcurl is a tool for transferring files
using URL syntax. It supports HTTP, HTTPS, FTP,
FTPS, DICT, TELNET, LDAP, FILE, and GOPHER, as
well as HTTP-post, HTTP-put, cookies, FTP upload,
resumed transfers, passwords, portnumbers, SSL
certificates, Kerberos, and proxies. It is powered
by libcurl, the client-side URL transfer library.
There are bindings to libcurl for over 20
languages and environments.
</desc_full>
<vitality_score>5784.57</vitality_score>
<vitality_percent>3.16</vitality_percent>
<vitality_rank>169</vitality_rank>
<popularity_score>6594.54</popularity_score>
<popularity_percent>13.81</popularity_percent>
<popularity_rank>105</popularity_rank>
<rating>8.50</rating>
<rating_count>21</rating_count>
<rating_rank>183</rating_rank>
<subscriptions>323</subscriptions>
<branch_name>Default</branch_name>
<url_project_page>http://freshmeat.net/projects/curl/</url_project_page>
<url_homepage>http://freshmeat.net/redir/curl/1612/url_homepage/</url_homepage>
<url_tgz>http://freshmeat.net/redir/curl/1612/url_tgz/</url_tgz>
<url_bz2>http://freshmeat.net/redir/curl/1612/url_bz2/</url_bz2>
<url_zip>http://freshmeat.net/redir/curl/1612/url_zip/</url_zip>
<url_changelog>http://freshmeat.net/redir/curl/1612/url_changelog/</url_changelog>
<url_rpm>http://freshmeat.net/redir/curl/1612/url_rpm/</url_rpm>
<url_deb>http://freshmeat.net/redir/curl/1612/url_deb/</url_deb>
<url_osx>http://freshmeat.net/redir/curl/1612/url_osx/</url_osx>
<url_bsdport>http://freshmeat.net/redir/curl/1612/url_bsdport/</url_bsdport>
<url_purchase></url_purchase>
<url_cvs>http://freshmeat.net/redir/curl/1612/url_cvs/</url_cvs>
<url_list>http://freshmeat.net/redir/curl/1612/url_list/</url_list>
<url_mirror>http://freshmeat.net/redir/curl/1612/url_mirror/</url_mirror>
<url_demo></url_demo>
<license>MIT/X Consortium License</license>
<latest_release>
<latest_release_version>7.12.2</latest_release_version>
<latest_release_id>176085</latest_release_id>
<latest_release_date>2004-10-18 02:22:23</latest_release_date>
</latest_release>
<screenshot_thumb></screenshot_thumb>
<authors>
<author>
<author_name>Daniel Stenberg</author_name>
<author_url>http://freshmeat.net/~bagder/</author_url>
<author_role>Owner</author_role>
</author>
</authors>
<descriminators>
<trove_id>12</trove_id>
<trove_id>226</trove_id>
<trove_id>3</trove_id>
<trove_id>2</trove_id>
<trove_id>188</trove_id>
<trove_id>216</trove_id>
<trove_id>200</trove_id>
<trove_id>220</trove_id>
<trove_id>164</trove_id>
<trove_id>90</trove_id>
<trove_id>89</trove_id>
<trove_id>809</trove_id>
<trove_id>150</trove_id>
<trove_id>224</trove_id>
<trove_id>900</trove_id>
<trove_id>839</trove_id>
</descriminators>
<dependencies>
<dependency type="recommended">
<dependency_release_id>0</dependency_release_id>
<dependency_branch_id>7464</dependency_branch_id>
<dependency_project_id>7464</dependency_project_id>
<dependency_project_title>OpenSSL (Default)</dependency_project_title>
</dependency>
<dependency type="optional">
<dependency_release_id>0</dependency_release_id>
<dependency_branch_id>0</dependency_branch_id>
<dependency_project_id>7443</dependency_project_id>
<dependency_project_title>OpenLDAP</dependency_project_title>
</dependency>
<dependency type="optional">
<dependency_release_id>0</dependency_release_id>
<dependency_branch_id>0</dependency_branch_id>
<dependency_project_id>12351</dependency_project_id>
<dependency_project_title>zlib</dependency_project_title>
</dependency>
<dependency type="optional">
<dependency_release_id>0</dependency_release_id>
<dependency_branch_id>0</dependency_branch_id>
<dependency_project_id>32047</dependency_project_id>
<dependency_project_title>Heimdal</dependency_project_title>
</dependency>
<dependency type="optional">
<dependency_release_id>0</dependency_release_id>
<dependency_branch_id>0</dependency_branch_id>
<dependency_project_id>44532</dependency_project_id>
<dependency_project_title>c-ares</dependency_project_title>
</dependency>
</dependencies>
</project>
</project-listing>
</datacheck>
</reply>
#
# Client-side
<client>
<features>
libz
</features>
<server>
http
</server>
<name>
HTTP GET deflate transfer-encoded content
</name>
<command>
http://%HOSTIP:%HTTPPORT/1123 --tr-encoding
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /1123 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Connection: TE
TE: gzip
</protocol>
</verify>
</testcase>

69
tests/data/test1124 Normal file
View File

@@ -0,0 +1,69 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
compressed
Transfer-Encoding
chunked
</keywords>
</info>
#
# Server-side
<reply>
<data base64="yes">
SFRUUC8xLjEgMjAwIE9LDQpEYXRlOiBNb24sIDI5IE5vdiAyMDI0IDIxOjU2OjUzIEdNVA0KU2Vy
dmVyOiBTb21ldGhpbmctVEUtZnJpZW5kbHkvMC4xDQpWYXJ5OiBBY2NlcHQtRW5jb2RpbmcNCkNv
bnRlbnQtVHlwZTogdGV4dC9odG1sOyBjaGFyc2V0PUlTTy04ODU5LTENClRyYW5zZmVyLUVuY29k
aW5nOiBnemlwLCBjaHVua2VkDQoNCjE0DQofiwgIeZ6rQQADbGFsYWxhAMvJzA0KMTgNCktVMORS
yAHRRlwKEIYxFwAKAnFgGAAAAA0KMA0KDQo=
</data>
<datacheck>
HTTP/1.1 200 OK
Date: Mon, 29 Nov 2024 21:56:53 GMT
Server: Something-TE-friendly/0.1
Vary: Accept-Encoding
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: gzip, chunked
line 1
line 2
line 3
</datacheck>
</reply>
#
# Client-side
<client>
<features>
libz
</features>
<server>
http
</server>
<name>
HTTP GET gzip+chunked transfer-encoded content
</name>
<command>
http://%HOSTIP:%HTTPPORT/1124 --tr-encoding
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /1124 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Connection: TE
TE: gzip
</protocol>
</verify>
</testcase>

70
tests/data/test1125 Normal file
View File

@@ -0,0 +1,70 @@
<testcase>
<info>
<keywords>
HTTP
HTTP GET
compressed
Transfer-Encoding
</keywords>
</info>
#
# Server-side
<reply>
<data base64="yes">
SFRUUC8xLjEgMjAwIE9LDQpEYXRlOiBNb24sIDI5IE5vdiAyMDA0IDIxOjU2OjUzIEdNVA0KU2Vy
dmVyOiBBcGFjaGUvMS4zLjMxIChEZWJpYW4gR05VL0xpbnV4KSBtb2RfZ3ppcC8xLjMuMjYuMWEg
UEhQLzQuMy45LTEgbW9kX3NzbC8yLjguMjAgT3BlblNTTC8wLjkuN2QgbW9kX3BlcmwvMS4yOQ0K
VmFyeTogQWNjZXB0LUVuY29kaW5nDQpDb250ZW50LVR5cGU6IHRleHQvaHRtbDsgY2hhcnNldD1J
U08tODg1OS0xDQpUcmFuc2Zlci1FbmNvZGluZzogZ3ppcA0KQ29udGVudC1MZW5ndGg6IDQ0DQoN
Ch+LCAh5nqtBAANsYWxhbGEAy8nMS1Uw5FLIAdFGXAoQhjEXAAoCcWAYAAAA
</data>
<datacheck>
HTTP/1.1 200 OK
Date: Mon, 29 Nov 2004 21:56:53 GMT
Server: Apache/1.3.31 (Debian GNU/Linux) mod_gzip/1.3.26.1a PHP/4.3.9-1 mod_ssl/2.8.20 OpenSSL/0.9.7d mod_perl/1.29
Vary: Accept-Encoding
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: gzip
Content-Length: 44
line 1
line 2
line 3
</datacheck>
</reply>
#
# Client-side
<client>
<features>
libz
</features>
<server>
http
</server>
<name>
HTTP GET transfer-encoding with custom Connection:
</name>
<command>
http://%HOSTIP:%HTTPPORT/1125 --tr-encoding -H "Connection: close"
</command>
</client>
#
# Verify data after the test has been "shot"
<verify>
<strip>
^User-Agent:.*
</strip>
<protocol>
GET /1125 HTTP/1.1
Host: %HOSTIP:%HTTPPORT
Accept: */*
Connection: close, TE
TE: gzip
</protocol>
</verify>
</testcase>

View File

@@ -12,7 +12,7 @@ my $what=$ARGV[2];
open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n"; open(CURL, "$ARGV[1]") || die "Can't open curl --version list in $ARGV[1]\n";
$_ = <CURL>; $_ = <CURL>;
chomp; chomp;
/libcurl\/([\.\d]+(-DEV)?)/; /libcurl\/([\.\d]+((-DEV)|(-\d+))?)/;
my $version = $1; my $version = $1;
close CURL; close CURL;
@@ -22,17 +22,26 @@ my $curlconfigversion;
open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n"; open(CURLCONFIG, "sh $ARGV[0] --$what|") || die "Can't get curl-config --$what list\n";
$_ = <CURLCONFIG>; $_ = <CURLCONFIG>;
chomp; chomp;
my $filever=$_;
if ( $what eq "version" ) { if ( $what eq "version" ) {
/^libcurl ([\.\d]+(-DEV)?)$/ ; if($filever =~ /^libcurl ([\.\d]+((-DEV)|(-\d+))?)$/) {
$curlconfigversion = $1; $curlconfigversion = $1;
}
else {
$curlconfigversion = "illegal value";
}
} }
else { else { # "vernum" case
# Convert hex version to decimal for comparison's sake # Convert hex version to decimal for comparison's sake
/^(..)(..)(..)$/ ; if($filever =~ /^(..)(..)(..)$/) {
$curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3); $curlconfigversion = hex($1) . "." . hex($2) . "." . hex($3);
}
else {
$curlconfigversion = "illegal value";
}
# Strip off the -DEV from the curl version if it's there # Strip off the -DEV from the curl version if it's there
$version =~ s/-DEV$//; $version =~ s/-\w*$//;
} }
close CURLCONFIG; close CURLCONFIG;