platform/upstream/curl.git
10 years agohttp2: include curl_memory.h
Daniel Stenberg [Sat, 7 Sep 2013 17:47:26 +0000 (19:47 +0200)]
http2: include curl_memory.h

Detected by test 1132

10 years agohttp: fix build warning under LLVM
Nick Zitzmann [Sat, 7 Sep 2013 15:00:11 +0000 (10:00 -0500)]
http: fix build warning under LLVM

When building the code using LLVM Clang without NGHTTP2, I was getting
this warning:
../lib/http.h:155:1: warning: empty struct is a GNU extension [-Wgnu]
Placing a dummy variable into the data structure silenced the warning.

10 years agohttp2: actually init nghttp2 and send HTTP2-Settings properly
Daniel Stenberg [Sat, 7 Sep 2013 11:01:43 +0000 (13:01 +0200)]
http2: actually init nghttp2 and send HTTP2-Settings properly

10 years agoREADME.http2: how to use it best with the multi API?
Daniel Stenberg [Sat, 7 Sep 2013 09:12:12 +0000 (11:12 +0200)]
README.http2: how to use it best with the multi API?

10 years agohttp2: first embryo toward Upgrade:
Daniel Stenberg [Sat, 7 Sep 2013 09:03:23 +0000 (11:03 +0200)]
http2: first embryo toward Upgrade:

10 years agohttp: rename use_http_1_1 to use_http_1_1plus
Daniel Stenberg [Wed, 4 Sep 2013 21:24:15 +0000 (23:24 +0200)]
http: rename use_http_1_1 to use_http_1_1plus

Since it now actually says if 1.1 or a later version should be used.

10 years agoconfigure: improve CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH
Daniel Stenberg [Sat, 7 Sep 2013 09:12:36 +0000 (11:12 +0200)]
configure: improve CURL_CHECK_COMPILER_PROTOTYPE_MISMATCH

The compiler test used a variable before it was assigned when it tried
to see how it acts on a mismatching prototype, which could cause a false
positive.

10 years agoPass password to OpenSSL engine by user interface
Petr Písař [Tue, 20 Aug 2013 15:02:53 +0000 (17:02 +0200)]
Pass password to OpenSSL engine by user interface

Recent OpenSSL uses user interface abstraction to negotiate access to
private keys in the cryprographical engines. An OpenSSL application is
expected to implement the user interface. Otherwise a default one
provided by OpenSSL (interactive standard I/O) will be used and the
aplication will have no way how to pass a password to the engine.

Longer-desc: http://curl.haxx.se/mail/lib-2013-08/0265.html

10 years agourlglob: improved error messages and column number on bad use
Daniel Stenberg [Fri, 6 Sep 2013 21:27:47 +0000 (23:27 +0200)]
urlglob: improved error messages and column number on bad use

Introduce a convenience macro and keep of the column better so that it
can point out the offending column better.

Updated test 75 accordingly.

10 years agourlglob: avoid error code translation
Daniel Stenberg [Fri, 6 Sep 2013 12:20:03 +0000 (14:20 +0200)]
urlglob: avoid error code translation

By using the correct values from the start we don't have to translate
them!

10 years agourlglob: avoid NULL pointer dereference
Daniel Stenberg [Fri, 6 Sep 2013 12:12:44 +0000 (14:12 +0200)]
urlglob: avoid NULL pointer dereference

Thanks to clang-analyzer

10 years agohttp2: use correct include for snprintf
Gisle Vanem [Fri, 6 Sep 2013 11:56:35 +0000 (13:56 +0200)]
http2: use correct include for snprintf

Using the first little merge of nghttp2 into libcurl, I stumbeled on the
missing 'snprintf' in MSVCRT. Isn't this how we do it for other libcurl
files?  I.e. use 'curl_msnprintf' and not 'snprintf' directly:

10 years ago--data: mention CRLF treatment when reading from file
Daniel Stenberg [Fri, 6 Sep 2013 11:52:56 +0000 (13:52 +0200)]
--data: mention CRLF treatment when reading from file

10 years agoLDAP: fix bad free() when URL parsing failed
Geoff Beier [Thu, 5 Sep 2013 21:51:53 +0000 (17:51 -0400)]
LDAP: fix bad free() when URL parsing failed

When an error occurs parsing an LDAP URL, The ludp->lud_attrs[i] entries
could be freed even though they sometimes point to data within an
allocated area.

This change introduces a lud_attrs_dup[] array for the duplicated string
pointers, and it removes the unused lud_exts array.

Bug: http://curl.haxx.se/mail/lib-2013-08/0209.html

10 years agodarwinssl: add support for PKCS#12 files for client authentication
Nick Zitzmann [Thu, 5 Sep 2013 23:57:06 +0000 (18:57 -0500)]
darwinssl: add support for PKCS#12 files for client authentication

I also documented the fact that the OpenSSL engine also supports them.

10 years agosymbols: added HTTP2 symbols and sorted list
Daniel Stenberg [Thu, 5 Sep 2013 10:04:41 +0000 (12:04 +0200)]
symbols: added HTTP2 symbols and sorted list

CURL_HTTP_VERSION_2_0 and CURL_VERSION_HTTP2 are new

10 years agoconfigure: add HTTP2 as a curl-config --feature output
Daniel Stenberg [Thu, 5 Sep 2013 10:03:24 +0000 (12:03 +0200)]
configure: add HTTP2 as a curl-config --feature output

Fixes the test 1014 failure

10 years agocurl: unbreak --http1.0 again
Daniel Stenberg [Thu, 5 Sep 2013 07:56:05 +0000 (09:56 +0200)]
curl: unbreak --http1.0 again

I broke it in 2eabb7d590

10 years agoSASL: fix compiler warnings
Daniel Stenberg [Wed, 4 Sep 2013 20:32:57 +0000 (22:32 +0200)]
SASL: fix compiler warnings

comparison between signed and unsigned integer expressions

suggest parentheses around '&&' within '||' (twice)

10 years agocurl: add --http1.1 and --http2.0 options
Daniel Stenberg [Wed, 4 Sep 2013 20:28:16 +0000 (22:28 +0200)]
curl: add --http1.1 and --http2.0 options

10 years agoCurl_setopt: refuse CURL_HTTP_VERSION_2_0 if built without support
Daniel Stenberg [Tue, 3 Sep 2013 21:32:08 +0000 (23:32 +0200)]
Curl_setopt: refuse CURL_HTTP_VERSION_2_0 if built without support

10 years agohttp2: add http2.[ch] and add nghttp2 version output
Daniel Stenberg [Tue, 3 Sep 2013 21:17:06 +0000 (23:17 +0200)]
http2: add http2.[ch] and add nghttp2 version output

10 years agocurl -V: output HTTP2 as a feature if present
Daniel Stenberg [Tue, 3 Sep 2013 21:14:51 +0000 (23:14 +0200)]
curl -V: output HTTP2 as a feature if present

10 years agocurl.h: add CURL_VERSION_HTTP2 as a feature
Daniel Stenberg [Tue, 3 Sep 2013 21:11:07 +0000 (23:11 +0200)]
curl.h: add CURL_VERSION_HTTP2 as a feature

It isn't added as a separate protocol as HTTP2 will be done over HTTP://
URLs that can be upgraded to HTTP2 if the server supports it as well.

10 years agoimap/smtp: Fixed incorrect SASL mechanism selection with XOAUTH2 servers
Steve Holme [Wed, 4 Sep 2013 20:27:01 +0000 (21:27 +0100)]
imap/smtp: Fixed incorrect SASL mechanism selection with XOAUTH2 servers

XOAUTH2 would be selected in preference to LOGIN and PLAIN if the IMAP
or SMTP server advertised support for it even though a user's password
was supplied but bearer token wasn't.

Modified the selection logic so that XOAUTH2 will only be selected if
the server supports it and A) The curl user/libcurl programmer has
specifically asked for XOAUTH via the ;AUTH=XOAUTH login option or 2)
The bearer token is specified. Obviously if XOAUTH is asked for via
the login option but no token is specified the user will receive a
authentication failure which makes more sense than no known
authentication mechanisms supported!

10 years agocurl.h: added CURL_HTTP_VERSION_2_0
Daniel Stenberg [Mon, 2 Sep 2013 21:30:38 +0000 (23:30 +0200)]
curl.h: added CURL_HTTP_VERSION_2_0

Initial library considerations documented in lib/README.http2

10 years agoconfigure: added --with-nghttp2
Daniel Stenberg [Mon, 2 Sep 2013 21:14:23 +0000 (23:14 +0200)]
configure: added --with-nghttp2

10 years agoacinclude: fix --without-ca-path when cross-compiling
Daniel Stenberg [Tue, 3 Sep 2013 22:01:03 +0000 (00:01 +0200)]
acinclude: fix --without-ca-path when cross-compiling

The commit 7b074a460b64811 to CURL_CHECK_CA_BUNDLE in 7.31 (don't check
for paths when cross-compiling) causes --without-ca-path to no longer
works when cross-compiling, since ca and capath only ever get set to
"no" when not cross-compiling, I attach a patch that works for me. Also
in the cross-compilation case, no ca-path seems to be a better default
(IMVHO) than empty ca-path.

Bug: http://curl.haxx.se/bug/view.cgi?id=1273
Patch-by: Stefan Neis
10 years agolib1512.c: Fixed compilation warning
Steve Holme [Mon, 2 Sep 2013 19:39:53 +0000 (20:39 +0100)]
lib1512.c: Fixed compilation warning

An enumerated type is mixed with another type.

...as well as a small coding style error.

10 years agoKilled warning 'res' might be used uninitialized.
Guenter Knauf [Sun, 1 Sep 2013 21:08:29 +0000 (23:08 +0200)]
Killed warning 'res' might be used uninitialized.

10 years agourl.c: Fixed compilation warning
Steve Holme [Sun, 1 Sep 2013 12:30:12 +0000 (13:30 +0100)]
url.c: Fixed compilation warning

An enumerated type is mixed with another type

10 years agoeasy.c: Fixed compilation warning
Steve Holme [Sun, 1 Sep 2013 11:48:50 +0000 (12:48 +0100)]
easy.c: Fixed compilation warning

warning: `code' might be used uninitialized in this function

10 years ago-x: rephrased the --proxy section somewhat
Daniel Stenberg [Sat, 31 Aug 2013 20:55:53 +0000 (22:55 +0200)]
-x: rephrased the --proxy section somewhat

10 years agotests: Added test for IMAP CHECK command
Steve Holme [Sat, 31 Aug 2013 17:31:47 +0000 (18:31 +0100)]
tests: Added test for IMAP CHECK command

10 years agoftpserver.pl: Added support for the IMAP CHECK command
Steve Holme [Sat, 31 Aug 2013 17:29:15 +0000 (18:29 +0100)]
ftpserver.pl: Added support for the IMAP CHECK command

10 years agoRemoved reference to krb4.c.
Guenter Knauf [Sat, 31 Aug 2013 17:12:35 +0000 (19:12 +0200)]
Removed reference to krb4.c.

10 years agoftpserver.pl: Corrected flawed logic in commit 1ca6ed7b75cad0
Steve Holme [Sat, 31 Aug 2013 10:10:20 +0000 (11:10 +0100)]
ftpserver.pl: Corrected flawed logic in commit 1ca6ed7b75cad0

10 years agoimap: Fixed response check for EXPUNGE command
Steve Holme [Sat, 31 Aug 2013 09:49:49 +0000 (10:49 +0100)]
imap: Fixed response check for EXPUNGE command

10 years agoftpserver.pl: Added argument check to IMAP command handlers
Steve Holme [Sat, 31 Aug 2013 09:41:25 +0000 (10:41 +0100)]
ftpserver.pl: Added argument check to IMAP command handlers

Added BAD argument check to the following IMAP command handlers:

APPEND, STORE, LIST, EXAMINE, STATUS and SEARCH

10 years agoftpserver.pl: More whitespace corrections
Steve Holme [Sat, 31 Aug 2013 09:35:05 +0000 (10:35 +0100)]
ftpserver.pl: More whitespace corrections

LIST_imap() had a second level of indentation at 9 characters and not 8.

10 years agoftpserver.pl: Small correction tidy up
Steve Holme [Fri, 30 Aug 2013 21:11:17 +0000 (22:11 +0100)]
ftpserver.pl: Small correction tidy up

Corrected some IMAP variable names and whitespace issues.

10 years agodocs: Added documentation for CURLOPT_BEARER
Kyle L. Huff [Fri, 30 Aug 2013 12:50:13 +0000 (08:50 -0400)]
docs: Added documentation for CURLOPT_BEARER

10 years agocurl.1: Add usage of '--bearer' option
Kyle L. Huff [Fri, 30 Aug 2013 12:47:04 +0000 (08:47 -0400)]
curl.1: Add usage of '--bearer' option

10 years agotests: Added tests for IMAP CREATE, DELETE and RENAME commands
Steve Holme [Fri, 30 Aug 2013 17:56:56 +0000 (18:56 +0100)]
tests: Added tests for IMAP CREATE, DELETE and RENAME commands

10 years agoftpserver: Bareword "to_mailbox" not allowed
Daniel Stenberg [Fri, 30 Aug 2013 13:21:39 +0000 (15:21 +0200)]
ftpserver: Bareword "to_mailbox" not allowed

Added missing $

10 years agoftpserver.pl: Added support for IMAP CREATE, DELETE and RENAME commands
Steve Holme [Fri, 30 Aug 2013 06:35:00 +0000 (07:35 +0100)]
ftpserver.pl: Added support for IMAP CREATE, DELETE and RENAME commands

10 years agoFTP: fix getsock during DO_MORE state
Daniel Stenberg [Tue, 20 Aug 2013 20:45:47 +0000 (22:45 +0200)]
FTP: fix getsock during DO_MORE state

... when doing upload it would return the wrong values at times. This
commit attempts to cleanup the mess.

Bug: http://curl.haxx.se/mail/lib-2013-08/0109.html
Reported-by: Mike Mio
10 years agocurl_multi_remove_handle: allow multiple removes
Daniel Stenberg [Thu, 29 Aug 2013 20:08:01 +0000 (22:08 +0200)]
curl_multi_remove_handle: allow multiple removes

When removing an already removed handle, avoid that to ruin the
internals and just return OK instead.

10 years agoftpserver.pl: Updated IMAP EXAMINE handler to use dynamic test data
Steve Holme [Thu, 29 Aug 2013 19:08:27 +0000 (20:08 +0100)]
ftpserver.pl: Updated IMAP EXAMINE handler to use dynamic test data

10 years agounit1304: include memdebug and free everything correctly
Daniel Stenberg [Thu, 29 Aug 2013 10:50:15 +0000 (12:50 +0200)]
unit1304: include memdebug and free everything correctly

10 years agoCurl_parsenetrc: document that the arguments must be allocated
Daniel Stenberg [Thu, 29 Aug 2013 10:49:56 +0000 (12:49 +0200)]
Curl_parsenetrc: document that the arguments must be allocated

10 years agoeasy: rename struct monitor to socketmonitor
Daniel Stenberg [Thu, 29 Aug 2013 07:57:14 +0000 (09:57 +0200)]
easy: rename struct monitor to socketmonitor

'struct monitor', introduced in 6cf8413e, already exists in an IRIX
header file (sys/mon.h) which gets included via various standard headers
by lib/easy.c

cc-1101 cc: ERROR File = ../../curl/lib/easy.c, Line = 458
"monitor" has already been declared in the current scope.

Reported-by: Tor Arntsen
10 years agoftpserver.pl: Added SELECT check to IMAP FETCH and STORE handlers
Steve Holme [Thu, 29 Aug 2013 06:20:03 +0000 (07:20 +0100)]
ftpserver.pl: Added SELECT check to IMAP FETCH and STORE handlers

10 years agoftpserver.pl: Corrected accidental move of logmsg() call
Steve Holme [Wed, 28 Aug 2013 21:58:33 +0000 (22:58 +0100)]
ftpserver.pl: Corrected accidental move of logmsg() call

Corrected the call to logmsg() in the IMAP SEARCH handler from commit
4ae7b7ea691497 as it should have been outputting the what argument and
not the test number.

10 years agoftpserver: add missing '}' from 4ae7b7ea69149
Daniel Stenberg [Wed, 28 Aug 2013 20:59:19 +0000 (22:59 +0200)]
ftpserver: add missing '}' from 4ae7b7ea69149

10 years agoftpserver.pl: Added SELECT check to IMAP SEARCH command
Steve Holme [Wed, 28 Aug 2013 17:56:19 +0000 (18:56 +0100)]
ftpserver.pl: Added SELECT check to IMAP SEARCH command

10 years agoftpserver.pl: Fixed IMAP SEARCH command
Steve Holme [Wed, 28 Aug 2013 17:51:59 +0000 (18:51 +0100)]
ftpserver.pl: Fixed IMAP SEARCH command

10 years agobump: next release is 7.33.0 due to added features
Daniel Stenberg [Wed, 28 Aug 2013 07:32:48 +0000 (09:32 +0200)]
bump: next release is 7.33.0 due to added features

10 years agosymbols-in-versions: add CURLOPT_XOAUTH2_BEARER
Daniel Stenberg [Wed, 28 Aug 2013 07:31:37 +0000 (09:31 +0200)]
symbols-in-versions: add CURLOPT_XOAUTH2_BEARER

10 years agotests: Added test for IMAP SEARCH command
Steve Holme [Wed, 28 Aug 2013 06:27:10 +0000 (07:27 +0100)]
tests: Added test for IMAP SEARCH command

10 years agovalgrind.supp: fix for regular curl_easy_perform too
Daniel Stenberg [Tue, 27 Aug 2013 22:09:27 +0000 (00:09 +0200)]
valgrind.supp: fix for regular curl_easy_perform too

When we introduced curl_easy_perform_ev, this got a slightly modified
call trace. Without this, test 165 causes a false positive valgrind
error.

10 years agovalgrind.supp: add the event-based call stack-trace too
Daniel Stenberg [Tue, 27 Aug 2013 21:34:51 +0000 (23:34 +0200)]
valgrind.supp: add the event-based call stack-trace too

Without this, test 165 triggers a valgrind error when ran with
curl_easy_perform_ev

10 years agomulti_socket: improved 100-continue timeout handling
Daniel Stenberg [Tue, 27 Aug 2013 20:32:51 +0000 (22:32 +0200)]
multi_socket: improved 100-continue timeout handling

When waiting for a 100-continue response from the server, the
Curl_readwrite() will refuse to run if called until the timeout has been
reached.

We timeout code in multi_socket() allows code to run slightly before the
actual timeout time, so for test 154 it could lead to the function being
executed but refused in Curl_readwrite() and then the application would
just sit idling forever.

This was detected with runtests.pl -e on test 154.

10 years agoftpserver.pl: Added support for IMAP SEARCH command
Steve Holme [Tue, 27 Aug 2013 19:47:31 +0000 (20:47 +0100)]
ftpserver.pl: Added support for IMAP SEARCH command

10 years agotool_operate.c: Fixed compilation warning
Steve Holme [Tue, 27 Aug 2013 15:39:16 +0000 (16:39 +0100)]
tool_operate.c: Fixed compilation warning

warning: implicit declaration of function 'checkpasswd'

10 years agocurl: Moved check for password out of get parameter loop
Steve Holme [Sun, 25 Aug 2013 21:32:34 +0000 (22:32 +0100)]
curl: Moved check for password out of get parameter loop

Moved the calls to checkpasswd() out of the getparameter() function
which allows for any related arguments to be specified on the command
line before or after --user (and --proxy-user).

For example: --bearer doesn't need to be specified before --user to
prevent curl from asking for an unnecessary password as is the case
with commit e7dcc454c67a2f.

10 years agoRELEASE-NOTES: synced with acf59be7f09a7
Steve Holme [Mon, 26 Aug 2013 22:27:07 +0000 (23:27 +0100)]
RELEASE-NOTES: synced with acf59be7f09a7

10 years agocurl: added --bearer option to help
Kyle L. Huff [Sun, 25 Aug 2013 17:19:46 +0000 (13:19 -0400)]
curl: added --bearer option to help

Added the --bearer option to the help output

10 years agocurl: added basic SASL XOAUTH2 support
Kyle L. Huff [Sun, 25 Aug 2013 17:18:59 +0000 (13:18 -0400)]
curl: added basic SASL XOAUTH2 support

Added the ability to specify an XOAUTH2 bearer token [RFC6750] via the
--bearer option.

Example usage:
  curl --url "imaps://imap.gmail.com:993/INBOX/;UID=1" --ssl-reqd
  --bearer ya29.AHES6Z...OMfsHYI --user username@example.com

10 years agotool_urlglob.c: Fixed compiler warnings
Steve Holme [Mon, 26 Aug 2013 10:41:35 +0000 (11:41 +0100)]
tool_urlglob.c: Fixed compiler warnings

warning: 'variable' may be used uninitialized in this function

10 years agosecurity.h: rename to curl_sec.h to avoid name collision
Daniel Stenberg [Mon, 26 Aug 2013 09:51:18 +0000 (11:51 +0200)]
security.h: rename to curl_sec.h to avoid name collision

I brought back security.h in commit bb5529331334e. As we actually
already found out back in 2005 in commit 62970da675249, the file name
security.h causes problems so I renamed it curl_sec.h instead.

10 years agoruntests.pl: allow -vc point to a separate curl binary to verify with
Daniel Stenberg [Mon, 26 Aug 2013 07:17:55 +0000 (09:17 +0200)]
runtests.pl: allow -vc point to a separate curl binary to verify with

The specified curl binary will then be used to verify the running
server(s) instead of the development version. This is very useful in
some cases when the development version fails to verify correctly as
then the test case may not run at all.

The actual test will still be run with the "normal" curl executable
(unless the test case specifies something differently).

10 years agosmtp: added basic SASL XOAUTH2 support
Kyle L. Huff [Sun, 25 Aug 2013 17:17:58 +0000 (13:17 -0400)]
smtp: added basic SASL XOAUTH2 support

Added the ability to use an XOAUTH2 bearer token [RFC6750] with SMTP for
authentication using RFC6749 "OAuth 2.0 Authorization Framework".

The bearer token is expected to be valid for the user specified in
conn->user. If CURLOPT_XOAUTH2_BEARER is defined and the connection has
an advertised auth mechanism of "XOAUTH2", the user and access token are
formatted as a base64 encoded string and sent to the server as
"AUTH XOAUTH2 <bearer token>".

10 years agoimap: added basic SASL XOAUTH2 support
Kyle L. Huff [Sun, 25 Aug 2013 17:17:35 +0000 (13:17 -0400)]
imap: added basic SASL XOAUTH2 support

Added the ability to use an XOAUTH2 bearer token [RFC6750] with IMAP for
authentication using RFC6749 "OAuth 2.0 Authorization Framework".

The bearer token is expected to be valid for the user specified in
conn->user. If CURLOPT_XOAUTH2_BEARER is defined and the connection has
an advertised auth mechanism of "XOAUTH2", the user and access token are
formatted as a base64 encoded string and sent to the server as
"A001 AUTHENTICATE XOAUTH2 <bearer token>".

10 years agosecurity.h: Fixed compilation warning
Steve Holme [Mon, 26 Aug 2013 09:14:16 +0000 (10:14 +0100)]
security.h: Fixed compilation warning

ISO C forbids forward references to 'enum' types

10 years agoKNOWN_BUGS: refer to bug numbers with the existing number series
Daniel Stenberg [Sun, 25 Aug 2013 22:29:33 +0000 (00:29 +0200)]
KNOWN_BUGS: refer to bug numbers with the existing number series

The old numbers would still redirect but who knows for how long...

10 years agooptions: added basic SASL XOAUTH2 support
Kyle L. Huff [Sun, 25 Aug 2013 17:17:20 +0000 (13:17 -0400)]
options: added basic SASL XOAUTH2 support

Added the ability to specify an XOAUTH2 bearer token [RFC6750] via the
option CURLOPT_XOAUTH2_BEARER for authentication using RFC6749 "OAuth
2.0 Authorization Framework".

10 years agosasl: added basic SASL XOAUTH2 support
Kyle L. Huff [Sun, 25 Aug 2013 17:17:01 +0000 (13:17 -0400)]
sasl: added basic SASL XOAUTH2 support

Added the ability to generated a base64 encoded XOAUTH2 token
containing: "user=<username>^Aauth=Bearer <bearer token>^A^A"
as per RFC6749 "OAuth 2.0 Authorization Framework".

10 years agoFTP: remove krb4 support
Daniel Stenberg [Fri, 23 Aug 2013 14:16:42 +0000 (16:16 +0200)]
FTP: remove krb4 support

We've announced this pending removal for a long time and we've
repeatedly asked if anyone would care or if anyone objects. Nobody has
objected. It has probably not even been working for a good while since
nobody has tested/used this code recently.

The stuff in krb4.h that was generic enough to be used by other sources
is now present in security.h

10 years agoeasy: define away easy_events() for non-debug builds
Daniel Stenberg [Sun, 25 Aug 2013 17:10:02 +0000 (19:10 +0200)]
easy: define away easy_events() for non-debug builds

10 years agoFAQ: editorial updates
Daniel Stenberg [Sat, 24 Aug 2013 15:13:46 +0000 (17:13 +0200)]
FAQ: editorial updates

Several language fixes. Several reformats that should make the HTML
generation of this document look better.

Reported-by: Dave Thompson
10 years agoRELEASE-NOTES: synced with 22adb46a32bee
Daniel Stenberg [Fri, 23 Aug 2013 13:39:03 +0000 (15:39 +0200)]
RELEASE-NOTES: synced with 22adb46a32bee

10 years agomulti: move on from STATE_DONE faster
Daniel Stenberg [Wed, 21 Aug 2013 21:08:38 +0000 (23:08 +0200)]
multi: move on from STATE_DONE faster

Make sure we always return CURLM_CALL_MULTI_PERFORM when we reach
CURLM_STATE_DONE since the state is transient and it can very well
continue executing as there is nothing to wait for.

Bug: http://curl.haxx.se/mail/lib-2013-08/0211.html
Reported-by: Yi Huang
10 years agocurl.h: name space pollution by "enum type"
Daniel Stenberg [Wed, 21 Aug 2013 20:46:10 +0000 (22:46 +0200)]
curl.h: name space pollution by "enum type"

Renamed to "enum curl_khtype" now. Will break compilation for programs
that rely on the enum name.

Bug: https://github.com/bagder/curl/pull/76
Reported-by: Shawn Landden
10 years agoTFTP: make the CURLOPT_LOW_SPEED* options work
Daniel Stenberg [Thu, 22 Aug 2013 20:40:38 +0000 (22:40 +0200)]
TFTP: make the CURLOPT_LOW_SPEED* options work

... this also makes sure that the progess callback gets called more
often during TFTP transfers.

Added test 1238 to verify.

Bug: http://curl.haxx.se/bug/view.cgi?id=1269
Reported-by: Jo3
10 years agotftpd: support "writedelay" within <servercmd>
Daniel Stenberg [Thu, 22 Aug 2013 17:23:08 +0000 (19:23 +0200)]
tftpd: support "writedelay" within <servercmd>

10 years agotftpd: convert 6 global variables into local ones
Daniel Stenberg [Thu, 22 Aug 2013 11:44:37 +0000 (13:44 +0200)]
tftpd: convert 6 global variables into local ones

10 years agocurl_easy_perform_ev: make it CURL_EXTERN
Gisle Vanem [Wed, 21 Aug 2013 20:19:52 +0000 (22:19 +0200)]
curl_easy_perform_ev: make it CURL_EXTERN

I build curl.exe (using MingW) with '-DCURLDEBUG' and by importing from
libcurl.dll.  Which means the new curl_easy_perform_ev() must be
exported from libcurl.dll.

10 years agoCURLM_ADDED_ALREADY: new error code
Daniel Stenberg [Tue, 20 Aug 2013 10:27:50 +0000 (12:27 +0200)]
CURLM_ADDED_ALREADY: new error code

Doing curl_multi_add_handle() on an easy handle that is already added to
a multi handle now returns this error code. It previously returned
CURLM_BAD_EASY_HANDLE for this condition.

10 years agomulti_init: moved init code here from add_handle
Daniel Stenberg [Tue, 20 Aug 2013 12:48:08 +0000 (14:48 +0200)]
multi_init: moved init code here from add_handle

The closure_handle is "owned" by the multi handle and it is
unconditional so the setting up of it should be in the Curl_multi_handle
function rather than curl_multi_add_handle.

10 years agomulti: remove dns cache creation code from *add_handle
Daniel Stenberg [Tue, 20 Aug 2013 11:21:07 +0000 (13:21 +0200)]
multi: remove dns cache creation code from *add_handle

As it is done unconditionally in multi_init() this code will never run!

10 years agocurl_easy_perform_ev: debug/test function
Daniel Stenberg [Sat, 10 Aug 2013 20:55:59 +0000 (22:55 +0200)]
curl_easy_perform_ev: debug/test function

This function is meant to work *exactly* as curl_easy_perform() but will
use the event-based libcurl API internally instead of
curl_multi_perform(). To avoid relying on an actual event-based library
and to not use non-portable functions (like epoll or similar), there's a
rather inefficient emulation layer implemented on top of Curl_poll()
instead.

There's currently some convenience logging done in curl_easy_perform_ev
which helps when tracking down problems. They may be suitable to remove
or change once things seem to be fine enough.

curl has a new --test-event option when built with debug enabled that
then uses curl_easy_perform_ev() instead of curl_easy_perform(). If
built without debug, using --test-event will only output a warning
message.

NOTE: curl_easy_perform_ev() is not part if the public API on purpose.
It is only present in debug builds of libcurl and MUST NOT be considered
stable even then. Use it for libcurl-testing purposes only.

runtests.pl now features an -e command line option that makes it use
--test-event for all curl command line tests. The man page is updated.

10 years agotransfer: the recent sessionhandle change broke CURL_DOES_CONVERSIONS
Gisle Vanem [Tue, 20 Aug 2013 09:42:34 +0000 (11:42 +0200)]
transfer: the recent sessionhandle change broke CURL_DOES_CONVERSIONS

10 years agotest1237: verify 1000+ letter user name + passwords
Daniel Stenberg [Tue, 20 Aug 2013 09:23:31 +0000 (11:23 +0200)]
test1237: verify 1000+ letter user name + passwords

10 years agourl: handle arbitrary-length username and password before '@'
Jonathan Nieder [Mon, 19 Aug 2013 08:36:46 +0000 (01:36 -0700)]
url: handle arbitrary-length username and password before '@'

libcurl quietly truncates usernames, passwords, and options from
before an '@' sign in a URL to 255 (= MAX_CURL_PASSWORD_LENGTH - 1)
characters to fit in fixed-size buffers on the stack.  Allocate a
buffer large enough to fit the parsed fields on the fly instead to
support longer passwords.

After this change, there are no more uses of MAX_CURL_OPTIONS_LENGTH
left, so stop defining that constant while at it.  The hardcoded max
username and password length constants, on the other hand, are still
used in HTTP proxy credential handling (which this patch doesn't
touch).

Reported-by: Colby Ranger
10 years agourl: handle exceptional cases first in parse_url_login()
Jonathan Nieder [Mon, 19 Aug 2013 08:01:26 +0000 (01:01 -0700)]
url: handle exceptional cases first in parse_url_login()

Instead of nesting "if(success)" blocks and leaving the reader in
suspense about what happens in the !success case, deal with failure
cases early, usually with a simple goto to clean up and return from
the function.

No functional change intended.  The main effect is to decrease the
indentation of this function slightly.

10 years agoCurl_setopt: handle arbitrary-length username and password
Jonathan Nieder [Mon, 19 Aug 2013 07:57:54 +0000 (00:57 -0700)]
Curl_setopt: handle arbitrary-length username and password

libcurl truncates usernames, passwords, and options set with
curl_easy_setopt to 255 (= MAX_CURL_PASSWORD_LENGTH - 1) characters.
This doesn't affect the return value from curl_easy_setopt(), so from
the caller's point of view, there is no sign anything strange has
happened, except that authentication fails.

For example:

  # Prepare a long (300-char) password.
  s=0123456789; s=$s$s$s$s$s$s$s$s$s$s; s=$s$s$s;
  # Start a server.
  nc -l -p 8888 | tee out & pid=$!
  # Tell curl to pass the password to the server.
  curl --user me:$s http://localhost:8888 & sleep 1; kill $pid
  # Extract the password.
  userpass=$(
awk '/Authorization: Basic/ {print $3}' <out |
tr -d '\r' |
base64 -d
  )
  password=${userpass#me:}
  echo ${#password}

Expected result: 300
Actual result: 255

The fix is simple: allocate appropriately sized buffers on the heap
instead of trying to squeeze the provided values into fixed-size
on-stack buffers.

Bug: http://bugs.debian.org/719856
Reported-by: Colby Ranger
10 years agonetrc: handle longer username and password
Jonathan Nieder [Mon, 19 Aug 2013 07:48:24 +0000 (00:48 -0700)]
netrc: handle longer username and password

libcurl truncates usernames and passwords it reads from .netrc to
LOGINSIZE and PASSWORDSIZE (64) characters without any indication to
the user, to ensure the values returned from Curl_parsenetrc fit in a
caller-provided buffer.

Fix the interface by passing back dynamically allocated buffers
allocated to fit the user's input.  The parser still relies on a
256-character buffer to read each line, though.

So now you can include an ~246-character password in your .netrc,
instead of the previous limit of 63 characters.

Reported-by: Colby Ranger
10 years agourl: allocate username, password, and options on the heap
Jonathan Nieder [Mon, 19 Aug 2013 07:39:05 +0000 (00:39 -0700)]
url: allocate username, password, and options on the heap

This makes it possible to increase the size of the buffers when needed
in later patches.  No functional change yet.

10 years agourl: use goto in create_conn() for exception handling
Jonathan Nieder [Mon, 19 Aug 2013 07:38:08 +0000 (00:38 -0700)]
url: use goto in create_conn() for exception handling

Instead of remembering before each "return" statement which temporary
allocations, if any, need to be freed, take care to set pointers to
NULL when no longer needed and use a goto to a common block to exit
the function and free all temporaries.

No functional change intended.  Currently the only temporary buffer in
this function is "proxy" which is already correctly freed when
appropriate, but there will be more soon.