Commit Graph

37 Commits

Author SHA1 Message Date
Daniel Stenberg a62ece3f57
c-hyper: bail on too long response headers
To match with built-in behaviors. Makes test 1154 work.

Closes #7350
2021-07-05 22:49:12 +02:00
Daniel Stenberg 0b0269341b
c-hyper: add support for transfer-encoding in the request
Closes #7348
2021-07-05 22:46:01 +02:00
Daniel Stenberg 80e1054fe5
hyper: propagate errors back up from read callbacks
Makes test 513 work with hyper

Closes #7266
2021-06-17 08:19:31 +02:00
Daniel Stenberg c214a6a17b
c-hyper: abort CONNECT response reading early on non 2xx responses
Fixes test 493

Closes #7209
2021-06-10 08:42:27 +02:00
Daniel Stenberg 372361f6ca
c-hyper: fix the uploaded field in progress callbacks
Makes test 578 work

Closes #7209
2021-06-10 08:42:15 +02:00
Daniel Stenberg 32311d2d15
c-hyper: support CURLINFO_STARTTRANSFER_TIME
Closes #7204
2021-06-07 23:54:48 +02:00
Daniel Stenberg 7de85d271a
c-hyper: support CURLOPT_HEADER
When enabled, the headers are passed to the body write callback as well.

Like in test 500

Closes #7204
2021-06-07 23:54:42 +02:00
Daniel Stenberg 83036d86af
c-hyper: fix NTLM on closed connection tested with test159
Closes #7154
2021-06-01 18:03:37 +02:00
Daniel Stenberg f2619b1767
c-hyper: handle NULL from hyper_buf_copy()
Closes #7143
2021-05-28 15:08:11 +02:00
Daniel Stenberg 11796231af
c-hyper: convert HYPERE_INVALID_PEER_MESSAGE to CURLE_UNSUPPORTED_PROTOCOL
Makes test 129 work (HTTP/1.2 response).

Closes #7141
2021-05-27 18:14:00 +02:00
Daniel Stenberg 23b99fc94c
c-hyper: clear NTLM auth buffer when request is issued
To prevent previous ones to get reused on subsequent requests. Matches
how the built-in HTTP code works. Makes test 90 to 93 work.

Add test 90 to 93 in travis.

Closes #7139
2021-05-27 16:50:59 +02:00
Daniel Stenberg 2ee761c19b
Revert "c-hyper: handle body on HYPER_TASK_EMPTY"
This reverts commit c3eefa95c3.

Reported-by: Kevin Burke
Fixes #7122
Closes #7136
2021-05-27 07:54:32 +02:00
Jacob Hoffman-Andrews c3eefa95c3
c-hyper: handle body on HYPER_TASK_EMPTY
Some of the time, we get a HYPER_TASK_EMPTY response before the status
line, headers, and body have been read. Previously, that would cause us
to poll again, leading to a 1 second timeout.

The HYPER_TASK_EMPTY docs say:

   The value of this task is null (does not imply an error).

So, if we receive a HYPER_TASK_EMPTY, continue on with processing the
response.

Reported-by: Kevin Burke
Fixes #7064
Closes #7070
2021-05-16 00:48:14 +02:00
Daniel Stenberg 826c438c61
c-hyper: fix unused variable ‘wrote’ 2021-04-27 16:00:48 +02:00
Kevin Burke 76f33fd373
c-hyper: don't write to set.writeheader if null
Previously if a caller set CURLOPT_WRITEFUNCTION but did not set a
CURLOPT_HEADERDATA buffer, Hyper would still attempt to write headers to
the data->set.writeheader header buffer, even though it is null.  This
led to NPE segfaults attempting to use libcurl+Hyper with Git, for
example.

Instead, process the client write for the status line using the same
logic we use to process the client write for the later HTTP headers,
which contains the appropriate guard logic. As a side benefit,
data->set.writeheader is now only read in one file instead of two.

Fixes #6619
Fixes abetterinternet/crustls#49
Fixes hyperium/hyper#2438
Closes #6971
2021-04-27 07:49:05 +02:00
Jacob Hoffman-Andrews 5e7fc49c19
c-hpyer: fix handling of zero-byte chunk from hyper
Closes #6951
2021-04-25 14:11:21 +02:00
Daniel Stenberg 95cbcec8f9
urldata: merge "struct DynamicStatic" into "struct UrlState"
Both were used for the same purposes and there was no logical separation
between them. Combined, this also saves 16 bytes in less holes in my
test build.

Closes #6798
2021-03-26 23:19:20 +01:00
Daniel Stenberg 7098f9fe3a
c-hyper: support automatic content-encoding
Closes #6727
2021-03-11 22:45:26 +01:00
kokke 86338ca698 c-hyper: Remove superfluous pointer check
`n` pointer is never NULL once set. Found by static analysis.

Ref: https://github.com/curl/curl/issues/6696

Closes https://github.com/curl/curl/pull/6697
2021-03-05 17:09:10 -05:00
Daniel Stenberg 88dd1a8a11
urldata: don't touch data->set.httpversion at run-time
Rename it to 'httpwant' and make a cloned field in the state struct as
well for run-time updates.

Also: refuse non-supported HTTP versions. Verified with test 129.

Closes #6585
2021-02-12 08:13:37 +01:00
Daniel Stenberg 3c2210713e
hyper: fix CONNECT to set 'data' as userdata
Follow-up to 14e075d1a7
2021-01-30 17:51:47 +01:00
Ikko Ashimine 73d743cfad
hyper: fix typo in c-hyper.c
settting -> setting

Closes #6538
2021-01-27 16:27:34 +01:00
Daniel Stenberg 14e075d1a7
hyper: remove the conn->data references
Closes #6508
2021-01-22 16:07:17 +01:00
Daniel Stenberg 219d9f8620
transfer: remove conn->data use
Closes #6486
2021-01-19 17:07:02 +01:00
Daniel Stenberg 3acf6fe539
c-hyper: avoid duplicated Proxy-Connection headers 2021-01-19 11:41:23 +01:00
Daniel Stenberg a304051620
lib: more conn->data cleanups
Closes #6479
2021-01-19 09:14:51 +01:00
Daniel Stenberg 8399d89360
hyper: deliver data to application with Curl_client_write
... just as the native code path does. Avoids sending too large data
chunks in the callback and more.

Reported-by: Gisle Vanem
Fixes #6462
Closes #6473
2021-01-18 23:06:03 +01:00
Daniel Stenberg 215db086e0
lib: pass in 'struct Curl_easy *' to most functions
... in most cases instead of 'struct connectdata *' but in some cases in
addition to.

- We mostly operate on transfers and not connections.

- We need the transfer handle to log, store data and more. Everything in
  libcurl is driven by a transfer (the CURL * in the public API).

- This work clarifies and separates the transfers from the connections
  better.

- We should avoid "conn->data". Since individual connections can be used
  by many transfers when multiplexing, making sure that conn->data
  points to the current and correct transfer at all times is difficult
  and has been notoriously error-prone over the years. The goal is to
  ultimately remove the conn->data pointer for this reason.

Closes #6425
2021-01-17 23:56:09 +01:00
Daniel Stenberg 8b2dec6ab7
http: make 'authneg' also work for Hyper
When doing a request with a request body expecting a 401/407 back, that
initial request is sent with a zero content-length. Test 177 and more.

Closes #6424
2021-01-10 14:51:33 +01:00
Daniel Stenberg 25c1d5e6a8
c-hyper: poll the tasks until end correctly
... makes test 36 work.

Closes #6412
2021-01-05 15:33:47 +01:00
Daniel Stenberg 4f95ce8dfe
c-hyper: make CURLE_GOT_NOTHING work
Test 30

Closes #6407
2021-01-05 09:38:25 +01:00
Daniel Stenberg bcce220367
http_proxy: make CONNECT work with the Hyper backend
Makes test 80 run

Closes #6406
2021-01-05 09:37:08 +01:00
Daniel Stenberg fce912139a
c-hyper: add timecondition to the request
Test 77-78

Closes #6391
2021-01-01 00:49:37 +01:00
Daniel Stenberg 3c7483efb4
c-hyper: make Digest and NTLM work
Test 64, 65, 67, 68, 69, 70, 72

Closes #6390
2020-12-30 22:40:29 +01:00
Daniel Stenberg aba01da639
failf: remove newline from formatting strings
... as failf adds one itself.

Also: add an assert() to failf() that triggers on a newline in the
format string!

Closes #6365
2020-12-25 23:42:16 +01:00
Daniel Stenberg e1a4647a42
c-hyper: fix compiler warnings
Identified by clang on windows.

Reported-by: Gisle Vanem
Bug: 58974d25d8

Closes #6351
2020-12-20 23:06:46 +01:00
Daniel Stenberg 58974d25d8
lib: introduce c-hyper for using Hyper
... as an alternative HTTP backend within libcurl.
2020-12-18 09:58:04 +01:00