summaryrefslogtreecommitdiff
path: root/lib/bufq.c
diff options
context:
space:
mode:
authorStefan Eissing <stefan@eissing.org>2023-04-14 11:38:14 +0200
committerDaniel Stenberg <daniel@haxx.se>2023-04-17 17:27:49 +0200
commitfc2f1e547a4a4b4bec5fd3c8bfde5136706488a1 (patch)
tree3d3194251c317144d529b35bb928567a84a9b57b /lib/bufq.c
parentfb1d62ff0736961032a489a0a8bff4b79b13eccb (diff)
downloadcurl-fc2f1e547a4a4b4bec5fd3c8bfde5136706488a1.tar.gz
http2: support HTTP/2 to forward proxies, non-tunneling
- with `--proxy-http2` allow h2 ALPN negotiation to forward proxies - applies to http: requests against a https: proxy only, as https: requests will auto-tunnel - adding a HTTP/1 request parser in http1.c - removed h2h3.c - using new request parser in nghttp2 and all h3 backends - adding test 2603 for request parser - adding h2 proxy test cases to test_10_* scorecard.py: request scoring accidentally always run curl with '-v'. Removed that, expect double numbers. labeller: added http1.* and h2-proxy sources to detection Closes #10967
Diffstat (limited to 'lib/bufq.c')
-rw-r--r--lib/bufq.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/bufq.c b/lib/bufq.c
index b598c9081..8702cabe3 100644
--- a/lib/bufq.c
+++ b/lib/bufq.c
@@ -142,6 +142,21 @@ static size_t chunk_skip(struct buf_chunk *chunk, size_t amount)
return n;
}
+static void chunk_shift(struct buf_chunk *chunk)
+{
+ if(chunk->r_offset) {
+ if(!chunk_is_empty(chunk)) {
+ size_t n = chunk->w_offset - chunk->r_offset;
+ memmove(chunk->x.data, chunk->x.data + chunk->r_offset, n);
+ chunk->w_offset -= chunk->r_offset;
+ chunk->r_offset = 0;
+ }
+ else {
+ chunk->r_offset = chunk->w_offset = 0;
+ }
+ }
+}
+
static void chunk_list_free(struct buf_chunk **anchor)
{
struct buf_chunk *chunk;
@@ -479,6 +494,13 @@ void Curl_bufq_skip(struct bufq *q, size_t amount)
}
}
+void Curl_bufq_skip_and_shift(struct bufq *q, size_t amount)
+{
+ Curl_bufq_skip(q, amount);
+ if(q->tail)
+ chunk_shift(q->tail);
+}
+
ssize_t Curl_bufq_pass(struct bufq *q, Curl_bufq_writer *writer,
void *writer_ctx, CURLcode *err)
{