Commit Graph

131 Commits

Author SHA1 Message Date
Daniel Stenberg feea9263e9 http2: setup the new pushed stream properly 2015-06-24 23:44:42 +02:00
Jay Satiro 7da064fdd2 http: Add some include guards for the new HTTP/2 stuff 2015-05-18 20:53:58 -04:00
Daniel Stenberg 897a7b3a13 http2: store upload state per stream
Use a curl_off_t for upload left
2015-05-18 15:41:43 +02:00
Daniel Stenberg 522ca8c035 http2: rename s/data/pausedata 2015-05-18 09:33:47 +02:00
Daniel Stenberg 783b3c7b42 http2: separate multiplex/pipelining + cleanup memory leaks 2015-05-18 08:57:18 +02:00
Tatsuhiro Tsujikawa d722138f29 http2: Don't call nghttp2_session_mem_recv while it is paused by a stream 2015-05-18 08:57:18 +02:00
Tatsuhiro Tsujikawa 0dc0de0351 http2: Read data left in connection buffer after pause
Previously when we do pause because of out of buffer, we just throw
away unread data in connection buffer.  This just broke protocol
framing, and I saw occasional FRAME_SIZE_ERROR.  This commit fix this
issue by remembering how much data read, and in the next iteration, we
process remaining data.
2015-05-18 08:57:18 +02:00
Daniel Stenberg 74a4bd5ecd http2: store incoming h2 SETTINGS 2015-05-18 08:57:18 +02:00
Daniel Stenberg 01e1bdb10c http2: force "drainage" of streams
... which is necessary since the socket won't be readable but there is
data waiting in the buffer.
2015-05-18 08:57:17 +02:00
Daniel Stenberg 7bbac214f5 http2: move the mem+len pair to the stream struct 2015-05-18 08:57:17 +02:00
Daniel Stenberg 84c6b6561f http2: more stream-oriented data, stream ID 0 is for connections 2015-05-18 08:57:17 +02:00
Daniel Stenberg 2c238ea1fc http2: move lots of state data to the 'stream' struct
... from the connection struct. The stream one being the 'struct HTTP'
which is kept in the SessionHandle struct (easy handle).

lookup streams for incoming frames in the stream hash, hashing is based
on the stream id and we get the SessionHandle for the incoming stream
that way.
2015-05-18 08:57:17 +02:00
Daniel Stenberg 5fe71975e4 HTTP: partial start at fixing up hash-lookups on http2 frame receival 2015-05-18 08:57:17 +02:00
Daniel Stenberg 7957d2eb92 http: a stream hash for h2 multiplexing 2015-05-18 08:57:17 +02:00
Daniel Stenberg d6440d7366 http2: move stream_id to the HTTP struct (per-stream) 2015-05-18 08:54:54 +02:00
Tatsuhiro Tsujikawa 48b5374e65 http2: Return error if stream was closed with other than NO_ERROR
Previously, we just ignored error code passed to
on_stream_close_callback and just return 0 (success) after stream
closure even if stream was reset with error.  This patch records error
code in on_stream_close_callback, and return -1 and use CURLE_HTTP2
error code on abnormal stream closure.
2015-02-27 21:17:27 +00:00
Tatsuhiro Tsujikawa 595f5f0e43 HTTP2: Support expect: 100-continue
"Expect: 100-continue", which was once deprecated in HTTP/2, is now
resurrected in HTTP/2 draft 14.  This change adds its support to
HTTP/2 code.  This change also includes stricter header field
checking.
2014-08-02 23:15:46 +02:00
Daniel Stenberg ac887eedbc CURLOPT_PROXYHEADER: set headers for proxy-only
Includes docs and new test cases: 1525, 1526 and 1527

Co-written-by: Vijay Panghal
2014-04-04 17:03:43 +02:00
Tatsuhiro Tsujikawa 035b91a26c http2: Support HTTP POST/PUT
This patch enables HTTP POST/PUT in HTTP2.
We disabled Expect header field and  chunked transfer encoding
since HTTP2 forbids them.
In HTTP1, Curl sends small upload data with request headers, but
HTTP2 requires upload data must be in DATA frame separately.
So we added some conditionals to achieve this.
2014-02-17 23:45:58 +01:00
Tatsuhiro Tsujikawa 0ea9f70049 http2: handle incoming data larger than remaining buffer 2014-02-04 14:57:29 +01:00
Tatsuhiro Tsujikawa 4082dc9de6 http2: Check stream ID we are interested in 2014-02-04 14:55:29 +01:00
Tatsuhiro Tsujikawa dbccf497da http2: store response header in temporary buffer 2014-02-04 14:54:42 +01:00
Tatsuhiro Tsujikawa 63b26d889f HTTP2: add layer between existing http and socket(TLS) layer
This patch chooses different approach to integrate HTTP2 into HTTP curl
stack. The idea is that we insert HTTP2 layer between HTTP code and
socket(TLS) layer. When HTTP2 is initialized (either in NPN or Upgrade),
we replace the Curl_recv/Curl_send callbacks with HTTP2's, but keep the
original callbacks in http_conn struct. When sending serialized data by
nghttp2, we use original Curl_send callback. Likewise, when reading data
from network, we use original Curl_recv callback. In this way we can
treat both TLS and non-TLS connections.

With this patch, one can transfer contents from https://twitter.com and
from nghttp2 test server in plain HTTP as well.

The code still has rough edges. The notable one is I could not figure
out how to call nghttp2_session_send() when underlying socket is
writable.
2014-02-04 14:49:49 +01:00
Daniel Stenberg 48c3bed43b http2: add CRLF when first data arrives 2014-01-30 20:24:15 +01:00
Daniel Stenberg a7affd637f http2: convert HEADER frames to HTTP1-like headers
... and then go through the "normal" HTTP engine.
2014-01-30 15:58:07 +01:00
Daniel Stenberg a878cb3056 http2: do the POST Upgrade dance properly 2014-01-30 14:26:00 +01:00
Daniel Stenberg 53940f8834 http2: switch recv/send functions to http2 ones after 101 2014-01-29 10:24:05 +01:00
Steve Holme 052f24c9b7 http: Post base64 decoding tidy up
Renamed copy_header_value() to Curl_copy_header_value() as this
function is now non static.

Simplified proxy flag in Curl_http_input_auth() when calling
sub-functions.

Removed unnecessary white space removal when using negotiate as it had
been missed in commit cdccb42267.
2013-11-03 10:17:26 +00:00
Steve Holme 3b59696a93 http: Added proxy tunnel authentication message header value extraction
...following recent changes to Curl_base64_decode() rather than trying
to parse a header line for the authentication mechanisms which is CRLF
terminated and inline zero terminate it.
2013-11-02 11:18:39 +00:00
Nick Zitzmann 08fa4fed70 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.
2013-09-07 10:00:11 -05:00
Daniel Stenberg 4344fa926a http2: actually init nghttp2 and send HTTP2-Settings properly 2013-09-07 13:01:43 +02:00
Daniel Stenberg 4ad8e142da urldata: clean up the use of the protocol specific structs
1 - always allocate the struct in protocol->setup_connection. Some
protocol handlers had to get this function added.

2 - always free at the end of a request. This is also an attempt to keep
less memory in the handle after it is completed.
2013-08-12 13:17:57 +02:00
Yang Tse 4a5aa6682d Revert changes relative to lib/*.[ch] recent renaming
This reverts renaming and usage of lib/*.h header files done
28-12-2012, reverting 2 commits:

  f871de0... build: make use of 76 lib/*.h renamed files
  ffd8e12... build: rename 76 lib/*.h files

This also reverts removal of redundant include guard (redundant thanks
to changes in above commits) done 2-12-2013, reverting 1 commit:

  c087374... curl_setup.h: remove redundant include guard

This also reverts renaming and usage of lib/*.c source files done
3-12-2013, reverting 3 commits:

  13606bb... build: make use of 93 lib/*.c renamed files
  5b6e792... build: rename 93 lib/*.c files
  7d83dff... build: commit 13606bbfde follow-up 1

Start of related discussion thread:

  http://curl.haxx.se/mail/lib-2013-01/0012.html

Asking for confirmation on pushing this revertion commit:

  http://curl.haxx.se/mail/lib-2013-01/0048.html

Confirmation summary:

  http://curl.haxx.se/mail/lib-2013-01/0079.html

NOTICE: The list of 2 files that have been modified by other
intermixed commits, while renamed, and also by at least one
of the 6 commits this one reverts follows below. These 2 files
will exhibit a hole in history unless git's '--follow' option
is used when viewing logs.

  lib/curl_imap.h
  lib/curl_smtp.h
2013-01-06 18:20:27 +01:00
Yang Tse ffd8e127e7 build: rename 76 lib/*.h files
76 private header files renamed to use our standard naming scheme.

This commit only does the file renaming.

----------------------------------------

  renamed:    amigaos.h -> curl_amigaos.h
  renamed:    arpa_telnet.h -> curl_arpa_telnet.h
  renamed:    asyn.h -> curl_asyn.h
  renamed:    axtls.h -> curl_axtls.h
  renamed:    bundles.h -> curl_bundles.h
  renamed:    conncache.h -> curl_conncache.h
  renamed:    connect.h -> curl_connect.h
  renamed:    content_encoding.h -> curl_content_encoding.h
  renamed:    cookie.h -> curl_cookie.h
  renamed:    cyassl.h -> curl_cyassl.h
  renamed:    dict.h -> curl_dict.h
  renamed:    easyif.h -> curl_easyif.h
  renamed:    escape.h -> curl_escape.h
  renamed:    file.h -> curl_file.h
  renamed:    fileinfo.h -> curl_fileinfo.h
  renamed:    formdata.h -> curl_formdata.h
  renamed:    ftp.h -> curl_ftp.h
  renamed:    ftplistparser.h -> curl_ftplistparser.h
  renamed:    getinfo.h -> curl_getinfo.h
  renamed:    gopher.h -> curl_gopher.h
  renamed:    gtls.h -> curl_gtls.h
  renamed:    hash.h -> curl_hash.h
  renamed:    hostcheck.h -> curl_hostcheck.h
  renamed:    hostip.h -> curl_hostip.h
  renamed:    http.h -> curl_http.h
  renamed:    http_chunks.h -> curl_http_chunks.h
  renamed:    http_digest.h -> curl_http_digest.h
  renamed:    http_negotiate.h -> curl_http_negotiate.h
  renamed:    http_proxy.h -> curl_http_proxy.h
  renamed:    if2ip.h -> curl_if2ip.h
  renamed:    imap.h -> curl_imap.h
  renamed:    inet_ntop.h -> curl_inet_ntop.h
  renamed:    inet_pton.h -> curl_inet_pton.h
  renamed:    krb4.h -> curl_krb4.h
  renamed:    llist.h -> curl_llist.h
  renamed:    memdebug.h -> curl_memdebug.h
  renamed:    multiif.h -> curl_multiif.h
  renamed:    netrc.h -> curl_netrc.h
  renamed:    non-ascii.h -> curl_non-ascii.h
  renamed:    nonblock.h -> curl_nonblock.h
  renamed:    nssg.h -> curl_nssg.h
  renamed:    parsedate.h -> curl_parsedate.h
  renamed:    pingpong.h -> curl_pingpong.h
  renamed:    polarssl.h -> curl_polarssl.h
  renamed:    pop3.h -> curl_pop3.h
  renamed:    progress.h -> curl_progress.h
  renamed:    qssl.h -> curl_qssl.h
  renamed:    rawstr.h -> curl_rawstr.h
  renamed:    rtsp.h -> curl_rtsp.h
  renamed:    select.h -> curl_select.h
  renamed:    sendf.h -> curl_sendf.h
  renamed:    setup.h -> curl_setup.h
  renamed:    setup_once.h -> curl_setup_once.h
  renamed:    share.h -> curl_share.h
  renamed:    slist.h -> curl_slist.h
  renamed:    smtp.h -> curl_smtp.h
  renamed:    sockaddr.h -> curl_sockaddr.h
  renamed:    socks.h -> curl_socks.h
  renamed:    speedcheck.h -> curl_speedcheck.h
  renamed:    splay.h -> curl_splay.h
  renamed:    ssh.h -> curl_ssh.h
  renamed:    sslgen.h -> curl_sslgen.h
  renamed:    ssluse.h -> curl_ssluse.h
  renamed:    strdup.h -> curl_strdup.h
  renamed:    strequal.h -> curl_strequal.h
  renamed:    strerror.h -> curl_strerror.h
  renamed:    strtok.h -> curl_strtok.h
  renamed:    strtoofft.h -> curl_strtoofft.h
  renamed:    telnet.h -> curl_telnet.h
  renamed:    tftp.h -> curl_tftp.h
  renamed:    timeval.h -> curl_timeval.h
  renamed:    transfer.h -> curl_transfer.h
  renamed:    url.h -> curl_url.h
  renamed:    urldata.h -> curl_urldata.h
  renamed:    warnless.h -> curl_warnless.h
  renamed:    wildcard.h -> curl_wildcard.h

----------------------------------------
2012-12-28 20:21:56 +01:00
Yang Tse ec691ca34b lib/*.h: use our standard naming scheme for header inclusion guards 2012-12-28 18:21:40 +01:00
Daniel Stenberg 5d4e5593d5 privatise: make private functions static 2011-06-03 19:51:08 +02:00
Daniel Stenberg 02dbfa2192 http-proxy: move proxy code to http_proxy.c
The new http_proxy.* files now host HTTP proxy specific code (500+ lines
moved out from http.c), and as a consequence there is a macro introduced
for the Curl_proxyCONNECT() function so that code can use it without
actually supporting proxy (or HTTP) in builds.
2011-04-04 19:38:00 +02:00
Daniel Stenberg 6d2ccfed48 add_buffer_send: fix compiler warning
Win64's 32 bit long but 64 bit size_t caused a warning that we avoid
with a typecast. A small whitespace indent fix was also applied.

Reported by: Adam Light
2010-07-24 22:52:35 +02:00
Daniel Stenberg 2309b4e330 remove the CVSish $Id$ lines 2010-03-24 11:02:54 +01:00
Daniel Stenberg bc4582b68a Chris Conroy brought support for RTSP transfers, and with it comes 8(!) new
libcurl options for controlling what to get and how to receive posssibly
interleaved RTP data. Initial commit.
2010-01-21 13:58:30 +00:00
Daniel Stenberg 8524c04ca9 removed a parameter from the Curl_http_readwrite_headers() prototype to remove
the need for the struct forward declaration from http.h which caused problems
with gcc 2.96 and quite frankly the parameter wasn't necessary anyway
2010-01-07 22:48:28 +00:00
Daniel Stenberg d37a9c4f87 removed Curl_http_header_append() prototype as it isn't used anymore, the
function was moved to http.c and was made static and renamed
2010-01-07 14:02:05 +00:00
Daniel Stenberg 1e9a946e6d move HTTP-specific functions to http.c where they belong 2009-12-29 21:45:02 +00:00
Daniel Stenberg 83a6b34803 split out more protocol-specific structs from urldata.h into their own
protocol-specific header files
2009-12-12 22:17:51 +00:00
Daniel Stenberg 3a499099af - Test cases 1051, 1052 and 1055 were added by Daniel Fandrich on July 30 and
proved how PUT and POST with a redirect could lead to a "hang" due to the
  data stream not being rewound properly when it had to in order to get sent
  properly (again) to the subsequent URL. This is now fixed and these test
  cases are no longer disabled.
2008-08-04 22:00:22 +00:00
Dan Fandrich cc0285da7f Factored out Curl_copy_header_value 2008-07-30 20:11:51 +00:00
Patrick Monnerat 07b6e7363d Added per-protocol callback static tables, replacing callback ptr storage
in the connectdata structure by a single handler table ptr.
2007-10-12 13:36:37 +00:00
Dan Fandrich 8cf0814a14 Fixed some minor type mismatches and missing consts mainly found by splint. 2007-08-27 06:31:28 +00:00
Dan Fandrich 523767660c Fixed some minor mismatched types found by splint. 2007-08-26 05:53:26 +00:00
Yang Tse b6f889085d update copyright year notice 2007-01-27 03:43:05 +00:00
Daniel Stenberg 385e612fa5 - Armel Asselin improved libcurl to behave a lot better when an easy handle
doing an FTP transfer is removed from a multi handle before completion. The
  fix also fixed the "alive counter" to be correct on "premature removal" for
  all protocols.
2007-01-16 22:22:10 +00:00
Daniel Stenberg 490cccba3c Andrew Biggs pointed out a "Expect: 100-continue" flaw where libcurl didn't
send the whole request at once, even though the Expect: header was disabled
by the application. An effect of this change is also that small (< 1024
bytes) POSTs are now always sent without Expect: header since we deem it
more costly to bother about that than the risk that we send the data in
vain.
2006-08-18 22:54:57 +00:00
Daniel Stenberg 686d90745b First curl_multi_socket() commit. Should primarily be considered as an internal
code rearrange to fit the future better.
2006-04-10 15:00:53 +00:00
Daniel Stenberg 83367f67de Xavier Bouchoux made the SSL connection non-blocking for the multi interface
(when using OpenSSL).
2006-03-21 21:54:44 +00:00
Daniel Stenberg 20005a83d2 Andrew Bushnell provided enough info for me to tell that we badly needed to
fix the CONNECT authentication code with multi-pass auth methods (such as
NTLM) as it didn't previously properly ignore response-bodies - in fact it
stopped reading after all response headers had been received. This could
lead to libcurl sending the next request and reading the body from the first
request as response to the second request. (I also renamed the function,
which wasn't strictly necessary but...)

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

Added test case 265 for this. It doesn't work as a _really_ good test case
since the test proxy is too stupid, but the test case helps when running the
debugger to verify.
2005-07-03 22:25:15 +00:00
Daniel Stenberg 6a2e21ec8c FTP code turned into state machine. Not completely yet, but a good start.
The tag 'before_ftp_statemachine' was set just before this commit in case
of future need.
2005-02-09 13:06:40 +00:00
Daniel Stenberg 3e1caa6185 HTTP "auth done right". See lib/README.httpauth 2004-11-24 16:11:35 +00:00
Daniel Stenberg 6b49fd7483 Tim Sneddon's VMS fix for huge HTTP POSTs 2004-11-05 14:43:35 +00:00
Daniel Stenberg 80a1e972fc Fix the auth code to enable us to i.e set DIGEST and then find out that the
server doesn't require any auth at all and then we just continue nicely. We
now have an extra bit in the connection struct named 'authprobe' that is TRUE
when doing pure "HTTP authentication probing".
2004-06-15 08:45:22 +00:00
Daniel Stenberg d60c22572b Curl_done() and the protocol-specific conn->curl_done() functions now all
take a CURLcode as a second argument, that is non-zero when Curl_done()
is called after an error was returned from Curl_do() (or similar).
2004-05-12 12:06:39 +00:00
Daniel Stenberg fc6eff13b5 General HTTP authentication cleanup and fixes 2004-05-04 07:52:53 +00:00
Daniel Stenberg 8e92600ddd David Byron made CURLOPT_FAILONERROR work with authentications such as NTLM
or Digest.
2004-03-30 06:40:01 +00:00
Daniel Stenberg 053f6c85ef updated year in the copyright string 2004-01-07 09:19:33 +00:00
Daniel Stenberg 52ceab5e41 Re-arranged code to make the proxy-CONNECT loop able to do some of the
authentication negotiations needed for NTLM, Digest etc.
2003-09-03 21:51:28 +00:00
Daniel Stenberg 7a19923afa Serge Semashko added CURLOPT_PROXYAUTH support, and now NTLM for proxies
work.
2003-08-11 11:47:45 +00:00
Daniel Stenberg f26a338a54 copyright year update in the source header 2003-01-16 21:08:12 +00:00
Daniel Stenberg 113850a748 added compareheader proto 2002-11-28 15:48:23 +00:00
Daniel Stenberg ba4e69bebc updated source code boilerplate/header 2002-09-03 11:52:59 +00:00
Daniel Stenberg 08ef208fb7 added disable-[protocol] support, largely provided by Miklos Nemeth 2002-06-11 11:13:01 +00:00
Daniel Stenberg 974f314f57 copyright string (year) update 2002-03-19 07:54:55 +00:00
Daniel Stenberg a17a78c477 removed Curl_http_close() 2001-09-18 15:30:59 +00:00
Daniel Stenberg a23db7b7c7 "Transfer-Encoding: chunked" support added 2001-03-07 23:51:41 +00:00
Daniel Stenberg 149d6363b3 modified the Curl_ConnectHTTPProxyTunnel proto 2001-01-25 12:24:34 +00:00
Daniel Stenberg 4031104404 Internal symbols that aren't static are now prefixed with 'Curl_' 2001-01-05 10:11:41 +00:00
Daniel Stenberg 24dee483e9 dual-license fix 2001-01-03 09:29:33 +00:00
Daniel Stenberg 0da7057591 more "anything through http proxy tunnel" fixes 2000-09-15 06:10:52 +00:00
Daniel Stenberg 86ff2c46b7 introduced 'tunnel through http proxy' for ftp 2000-09-14 14:05:01 +00:00
Daniel Stenberg 1156252f92 Added http_close() 2000-07-25 21:16:51 +00:00
Daniel Stenberg 1ef3600a07 haxx.nu => haxx.se 2000-06-20 15:31:26 +00:00
Daniel Stenberg 96dde76b99 moved here from the newlib branch 2000-05-22 14:12:12 +00:00
Daniel Stenberg ae1912cb0d Initial revision 1999-12-29 14:20:26 +00:00