hyper: drop support

lib : remove all hyper code
configure: stop detecting hyper
docs: no more mention of hyper
tests: mo more special-handling of hyper builds
CI: no jobs using hyper

Closes #15120
This commit is contained in:
Daniel Stenberg 2024-12-21 11:33:05 +01:00
parent 46093d9e0e
commit fc3e1cbc50
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
93 changed files with 118 additions and 2546 deletions

View file

@ -114,7 +114,6 @@ LIB_CFILES = \
base64.c \
bufq.c \
bufref.c \
c-hyper.c \
cf-h1-proxy.c \
cf-h2-proxy.c \
cf-haproxy.c \
@ -248,7 +247,6 @@ LIB_HFILES = \
asyn.h \
bufq.h \
bufref.h \
c-hyper.h \
cf-h1-proxy.h \
cf-h2-proxy.h \
cf-haproxy.h \

File diff suppressed because it is too large Load diff

View file

@ -1,63 +0,0 @@
#ifndef HEADER_CURL_HYPER_H
#define HEADER_CURL_HYPER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 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 https://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.
*
* SPDX-License-Identifier: curl
*
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER)
#include <hyper.h>
struct hyp_io_ctx {
struct Curl_easy *data;
int sockindex;
};
/* per-transfer data for the Hyper backend */
struct hyptransfer {
hyper_waker *write_waker;
hyper_waker *read_waker;
const hyper_executor *exec;
hyper_waker *send_body_waker;
struct hyp_io_ctx io_ctx;
};
size_t Curl_hyper_recv(void *userp, hyper_context *ctx,
uint8_t *buf, size_t buflen);
size_t Curl_hyper_send(void *userp, hyper_context *ctx,
const uint8_t *buf, size_t buflen);
CURLcode Curl_hyper_stream(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
int select_res);
CURLcode Curl_hyper_header(struct Curl_easy *data, hyper_headers *headers,
const char *line);
void Curl_hyper_done(struct Curl_easy *);
#else
#define Curl_hyper_done(x)
#endif /* !defined(CURL_DISABLE_HTTP) && defined(USE_HYPER) */
#endif /* HEADER_CURL_HYPER_H */

View file

@ -27,9 +27,6 @@
#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP)
#include <curl/curl.h>
#ifdef USE_HYPER
#include <hyper.h>
#endif
#include "urldata.h"
#include "dynbuf.h"
#include "sendf.h"
@ -184,9 +181,6 @@ static void h1_tunnel_go_state(struct Curl_cfilter *cf,
make sure that it is not accidentally used for the document request
after we have connected. So let's free and clear it here. */
Curl_safefree(data->state.aptr.proxyuserpwd);
#ifdef USE_HYPER
data->state.hconnect = FALSE;
#endif
break;
}
}
@ -212,7 +206,6 @@ static bool tunnel_want_send(struct h1_tunnel_state *ts)
return (ts->tunnel_state == H1_TUNNEL_CONNECT);
}
#ifndef USE_HYPER
static CURLcode start_CONNECT(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct h1_tunnel_state *ts)
@ -529,337 +522,6 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
return result;
}
#else /* USE_HYPER */
static CURLcode CONNECT_host(struct Curl_cfilter *cf,
struct Curl_easy *data,
char **pauthority,
char **phost_header)
{
const char *hostname;
int port;
bool ipv6_ip;
CURLcode result;
char *authority; /* for CONNECT, the destination host + port */
char *host_header = NULL; /* Host: authority */
result = Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip);
if(result)
return result;
authority = aprintf("%s%s%s:%d", ipv6_ip ? "[":"", hostname,
ipv6_ip ? "]" : "", port);
if(!authority)
return CURLE_OUT_OF_MEMORY;
/* If user is not overriding the Host header later */
if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("Host"))) {
host_header = aprintf("Host: %s\r\n", authority);
if(!host_header) {
free(authority);
return CURLE_OUT_OF_MEMORY;
}
}
*pauthority = authority;
*phost_header = host_header;
return CURLE_OK;
}
/* The Hyper version of CONNECT */
static CURLcode start_CONNECT(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct h1_tunnel_state *ts)
{
struct connectdata *conn = cf->conn;
struct hyptransfer *h = &data->hyp;
curl_socket_t tunnelsocket = Curl_conn_cf_get_socket(cf, data);
hyper_io *io = NULL;
hyper_request *req = NULL;
hyper_headers *headers = NULL;
hyper_clientconn_options *options = NULL;
hyper_task *handshake = NULL;
hyper_task *task = NULL; /* for the handshake */
hyper_clientconn *client = NULL;
hyper_task *sendtask = NULL; /* for the send */
char *authority = NULL; /* for CONNECT */
char *host_header = NULL; /* Host: */
CURLcode result = CURLE_OUT_OF_MEMORY;
(void)ts;
io = hyper_io_new();
if(!io) {
failf(data, "Couldn't create hyper IO");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
/* tell Hyper how to read/write network data */
h->io_ctx.data = data;
h->io_ctx.sockindex = cf->sockindex;
hyper_io_set_userdata(io, &h->io_ctx);
hyper_io_set_read(io, Curl_hyper_recv);
hyper_io_set_write(io, Curl_hyper_send);
conn->sockfd = tunnelsocket;
data->state.hconnect = TRUE;
/* create an executor to poll futures */
if(!h->exec) {
h->exec = hyper_executor_new();
if(!h->exec) {
failf(data, "Couldn't create hyper executor");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
}
options = hyper_clientconn_options_new();
if(!options) {
failf(data, "Couldn't create hyper client options");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
hyper_clientconn_options_set_preserve_header_case(options, 1);
hyper_clientconn_options_set_preserve_header_order(options, 1);
hyper_clientconn_options_exec(options, h->exec);
/* "Both the `io` and the `options` are consumed in this function
call" */
handshake = hyper_clientconn_handshake(io, options);
if(!handshake) {
failf(data, "Couldn't create hyper client handshake");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
io = NULL;
options = NULL;
if(HYPERE_OK != hyper_executor_push(h->exec, handshake)) {
failf(data, "Couldn't hyper_executor_push the handshake");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
handshake = NULL; /* ownership passed on */
task = hyper_executor_poll(h->exec);
if(!task) {
failf(data, "Couldn't hyper_executor_poll the handshake");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
client = hyper_task_value(task);
hyper_task_free(task);
req = hyper_request_new();
if(!req) {
failf(data, "Couldn't hyper_request_new");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
if(hyper_request_set_method(req, (uint8_t *)"CONNECT",
strlen("CONNECT"))) {
failf(data, "error setting method");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
/* This only happens if we have looped here due to authentication
reasons, and we do not really use the newly cloned URL here
then. Just free() it. */
Curl_safefree(data->req.newurl);
result = CONNECT_host(cf, data, &authority, &host_header);
if(result)
goto error;
infof(data, "Establish HTTP proxy tunnel to %s", authority);
if(hyper_request_set_uri(req, (uint8_t *)authority,
strlen(authority))) {
failf(data, "error setting path");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
if(data->set.verbose) {
char *se = aprintf("CONNECT %s HTTP/1.1\r\n", authority);
if(!se) {
result = CURLE_OUT_OF_MEMORY;
goto error;
}
Curl_debug(data, CURLINFO_HEADER_OUT, se, strlen(se));
free(se);
}
/* Setup the proxy-authorization header, if any */
result = Curl_http_output_auth(data, conn, "CONNECT", HTTPREQ_GET,
authority, TRUE);
if(result)
goto error;
Curl_safefree(authority);
/* default is 1.1 */
if((conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) &&
(HYPERE_OK != hyper_request_set_version(req,
HYPER_HTTP_VERSION_1_0))) {
failf(data, "error setting HTTP version");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
headers = hyper_request_headers(req);
if(!headers) {
failf(data, "hyper_request_headers");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
if(host_header) {
result = Curl_hyper_header(data, headers, host_header);
if(result)
goto error;
Curl_safefree(host_header);
}
if(data->state.aptr.proxyuserpwd) {
result = Curl_hyper_header(data, headers,
data->state.aptr.proxyuserpwd);
if(result)
goto error;
}
if(!Curl_checkProxyheaders(data, conn, STRCONST("User-Agent")) &&
data->set.str[STRING_USERAGENT] && *data->set.str[STRING_USERAGENT]) {
struct dynbuf ua;
Curl_dyn_init(&ua, DYN_HTTP_REQUEST);
result = Curl_dyn_addf(&ua, "User-Agent: %s\r\n",
data->set.str[STRING_USERAGENT]);
if(result)
goto error;
result = Curl_hyper_header(data, headers, Curl_dyn_ptr(&ua));
if(result)
goto error;
Curl_dyn_free(&ua);
}
if(!Curl_checkProxyheaders(data, conn, STRCONST("Proxy-Connection"))) {
result = Curl_hyper_header(data, headers,
"Proxy-Connection: Keep-Alive");
if(result)
goto error;
}
result = Curl_add_custom_headers(data, TRUE, headers);
if(result)
goto error;
result = Curl_creader_set_null(data);
if(result)
goto error;
sendtask = hyper_clientconn_send(client, req);
if(!sendtask) {
failf(data, "hyper_clientconn_send");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
req = NULL;
if(HYPERE_OK != hyper_executor_push(h->exec, sendtask)) {
failf(data, "Couldn't hyper_executor_push the send");
result = CURLE_OUT_OF_MEMORY;
goto error;
}
sendtask = NULL; /* ownership passed on */
hyper_clientconn_free(client);
client = NULL;
error:
free(host_header);
free(authority);
if(io)
hyper_io_free(io);
if(options)
hyper_clientconn_options_free(options);
if(handshake)
hyper_task_free(handshake);
if(client)
hyper_clientconn_free(client);
if(req)
hyper_request_free(req);
return result;
}
static CURLcode send_CONNECT(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct h1_tunnel_state *ts,
bool *done)
{
struct hyptransfer *h = &data->hyp;
struct connectdata *conn = cf->conn;
hyper_task *task = NULL;
hyper_error *hypererr = NULL;
CURLcode result = CURLE_OK;
(void)ts;
(void)conn;
do {
task = hyper_executor_poll(h->exec);
if(task) {
bool error = hyper_task_type(task) == HYPER_TASK_ERROR;
if(error)
hypererr = hyper_task_value(task);
hyper_task_free(task);
if(error) {
/* this could probably use a better error code? */
result = CURLE_OUT_OF_MEMORY;
goto error;
}
}
} while(task);
error:
*done = (result == CURLE_OK);
if(hypererr) {
uint8_t errbuf[256];
size_t errlen = hyper_error_print(hypererr, errbuf, sizeof(errbuf));
failf(data, "Hyper: %.*s", (int)errlen, errbuf);
hyper_error_free(hypererr);
}
return result;
}
static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct h1_tunnel_state *ts,
bool *done)
{
struct hyptransfer *h = &data->hyp;
CURLcode result;
int didwhat;
(void)ts;
result = Curl_hyper_stream(data, cf->conn, &didwhat,
CURL_CSELECT_IN | CURL_CSELECT_OUT);
*done = data->req.done;
if(result || !*done)
return result;
if(h->exec) {
hyper_executor_free(h->exec);
h->exec = NULL;
}
if(h->read_waker) {
hyper_waker_free(h->read_waker);
h->read_waker = NULL;
}
if(h->write_waker) {
hyper_waker_free(h->write_waker);
h->write_waker = NULL;
}
return result;
}
#endif /* USE_HYPER */
static CURLcode H1_CONNECT(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct h1_tunnel_state *ts)

View file

@ -24,7 +24,7 @@
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)
#if !defined(CURL_DISABLE_HTTP)
#include "urldata.h"
#include <curl/curl.h>
@ -617,4 +617,4 @@ out:
return result;
}
#endif /* !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER) */
#endif /* !defined(CURL_DISABLE_HTTP) */

View file

@ -25,7 +25,7 @@
***************************************************************************/
#include "curl_setup.h"
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)
#if !defined(CURL_DISABLE_HTTP)
struct Curl_cfilter;
struct Curl_easy;
@ -54,5 +54,5 @@ CURLcode Curl_cf_https_setup(struct Curl_easy *data,
const struct Curl_dns_entry *remotehost);
#endif /* !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER) */
#endif /* !defined(CURL_DISABLE_HTTP) */
#endif /* HEADER_CURL_CF_HTTP_H */

View file

@ -1485,7 +1485,7 @@ CURLcode Curl_conn_setup(struct Curl_easy *data,
DEBUGASSERT(data);
DEBUGASSERT(conn->handler);
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)
#if !defined(CURL_DISABLE_HTTP)
if(!conn->cfilter[sockindex] &&
conn->handler->protocol == CURLPROTO_HTTPS) {
DEBUGASSERT(ssl_mode != CURL_CF_SSL_DISABLE);
@ -1493,7 +1493,7 @@ CURLcode Curl_conn_setup(struct Curl_easy *data,
if(result)
goto out;
}
#endif /* !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER) */
#endif /* !defined(CURL_DISABLE_HTTP) */
/* Still no cfilter set, apply default. */
if(!conn->cfilter[sockindex]) {

View file

@ -939,7 +939,6 @@ int getpwuid_r(uid_t uid, struct passwd *pwd, char *buf,
#define UNITTEST static
#endif
/* Hyper supports HTTP2 also, but Curl's integration with Hyper does not */
#if defined(USE_NGHTTP2)
#define USE_HTTP2
#endif

View file

@ -319,7 +319,7 @@ static struct trc_cft_def trc_cfts[] = {
#ifdef USE_HTTP3
{ &Curl_cft_http3, TRC_CT_PROTOCOL },
#endif
#if !defined(CURL_DISABLE_HTTP) && !defined(USE_HYPER)
#if !defined(CURL_DISABLE_HTTP)
{ &Curl_cft_http_connect, TRC_CT_PROTOCOL },
#endif
};

View file

@ -47,10 +47,6 @@
#include <sys/param.h>
#endif
#ifdef USE_HYPER
#include <hyper.h>
#endif
#include "urldata.h"
#include <curl/curl.h>
#include "transfer.h"
@ -88,7 +84,6 @@
#include "altsvc.h"
#include "hsts.h"
#include "ws.h"
#include "c-hyper.h"
#include "curl_ctype.h"
/* The last 3 #include files should be in this order */
@ -104,6 +99,31 @@ static bool http_should_fail(struct Curl_easy *data, int httpcode);
static bool http_exp100_is_waiting(struct Curl_easy *data);
static CURLcode http_exp100_add_reader(struct Curl_easy *data);
static void http_exp100_send_anyway(struct Curl_easy *data);
static bool http_exp100_is_selected(struct Curl_easy *data);
static void http_exp100_got100(struct Curl_easy *data);
static CURLcode http_firstwrite(struct Curl_easy *data);
static CURLcode http_header(struct Curl_easy *data,
const char *hd, size_t hdlen);
static CURLcode http_host(struct Curl_easy *data, struct connectdata *conn);
static CURLcode http_range(struct Curl_easy *data,
Curl_HttpReq httpreq);
static CURLcode http_req_complete(struct Curl_easy *data,
struct dynbuf *r, Curl_HttpReq httpreq);
static CURLcode http_req_set_reader(struct Curl_easy *data,
Curl_HttpReq httpreq,
const char **tep);
static CURLcode http_size(struct Curl_easy *data);
static CURLcode http_statusline(struct Curl_easy *data,
struct connectdata *conn);
static CURLcode http_target(struct Curl_easy *data, struct connectdata *conn,
struct dynbuf *req);
static CURLcode http_useragent(struct Curl_easy *data);
#ifdef HAVE_LIBZ
static CURLcode http_transferencode(struct Curl_easy *data);
#endif
static bool use_http_1_1plus(const struct Curl_easy *data,
const struct connectdata *conn);
/*
* HTTP handler interface.
@ -1169,7 +1189,6 @@ CURLcode Curl_http_done(struct Curl_easy *data,
data->state.authproxy.multipass = FALSE;
Curl_dyn_reset(&data->state.headerb);
Curl_hyper_done(data);
if(status)
return status;
@ -1202,8 +1221,8 @@ CURLcode Curl_http_done(struct Curl_easy *data,
* - if any server previously contacted to handle this request only supports
* 1.0.
*/
bool Curl_use_http_1_1plus(const struct Curl_easy *data,
const struct connectdata *conn)
static bool use_http_1_1plus(const struct Curl_easy *data,
const struct connectdata *conn)
{
if((data->state.httpversion == 10) || (conn->httpversion == 10))
return FALSE;
@ -1214,7 +1233,6 @@ bool Curl_use_http_1_1plus(const struct Curl_easy *data,
(data->state.httpwant >= CURL_HTTP_VERSION_1_1));
}
#ifndef USE_HYPER
static const char *get_http_string(const struct Curl_easy *data,
const struct connectdata *conn)
{
@ -1222,21 +1240,15 @@ static const char *get_http_string(const struct Curl_easy *data,
return "3";
if(Curl_conn_is_http2(data, conn, FIRSTSOCKET))
return "2";
if(Curl_use_http_1_1plus(data, conn))
if(use_http_1_1plus(data, conn))
return "1.1";
return "1.0";
}
#endif
CURLcode Curl_add_custom_headers(struct Curl_easy *data,
bool is_connect,
#ifndef USE_HYPER
struct dynbuf *req
#else
void *req
#endif
)
struct dynbuf *req)
{
struct connectdata *conn = data->conn;
char *ptr;
@ -1303,9 +1315,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
/* copy the source */
semicolonp = strdup(headers->data);
if(!semicolonp) {
#ifndef USE_HYPER
Curl_dyn_free(req);
#endif
return CURLE_OUT_OF_MEMORY;
}
/* put a colon where the semicolon is */
@ -1364,11 +1374,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
!Curl_auth_allowed_to_host(data))
;
else {
#ifdef USE_HYPER
result = Curl_hyper_header(data, req, compare);
#else
result = Curl_dyn_addf(req, "%s\r\n", compare);
#endif
}
if(semicolonp)
free(semicolonp);
@ -1385,12 +1391,7 @@ CURLcode Curl_add_custom_headers(struct Curl_easy *data,
#ifndef CURL_DISABLE_PARSEDATE
CURLcode Curl_add_timecondition(struct Curl_easy *data,
#ifndef USE_HYPER
struct dynbuf *req
#else
void *req
#endif
)
struct dynbuf *req)
{
const struct tm *tm;
struct tm keeptime;
@ -1453,12 +1454,7 @@ CURLcode Curl_add_timecondition(struct Curl_easy *data,
tm->tm_min,
tm->tm_sec);
#ifndef USE_HYPER
result = Curl_dyn_add(req, datestr);
#else
result = Curl_hyper_header(data, req, datestr);
#endif
return result;
}
#else
@ -1512,7 +1508,7 @@ void Curl_http_method(struct Curl_easy *data, struct connectdata *conn,
*reqp = httpreq;
}
CURLcode Curl_http_useragent(struct Curl_easy *data)
static CURLcode http_useragent(struct Curl_easy *data)
{
/* The User-Agent string might have been allocated in url.c already, because
it might have been used in the proxy connect, but if we have got a header
@ -1526,7 +1522,7 @@ CURLcode Curl_http_useragent(struct Curl_easy *data)
}
CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn)
static CURLcode http_host(struct Curl_easy *data, struct connectdata *conn)
{
const char *ptr;
struct dynamically_allocated_data *aptr = &data->state.aptr;
@ -1616,9 +1612,9 @@ CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn)
/*
* Append the request-target to the HTTP request
*/
CURLcode Curl_http_target(struct Curl_easy *data,
struct connectdata *conn,
struct dynbuf *r)
static CURLcode http_target(struct Curl_easy *data,
struct connectdata *conn,
struct dynbuf *r)
{
CURLcode result = CURLE_OK;
const char *path = data->state.up.path;
@ -1898,9 +1894,9 @@ static CURLcode http_resume(struct Curl_easy *data, Curl_HttpReq httpreq)
return CURLE_OK;
}
CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
Curl_HttpReq httpreq,
const char **tep)
static CURLcode http_req_set_reader(struct Curl_easy *data,
Curl_HttpReq httpreq,
const char **tep)
{
CURLcode result = CURLE_OK;
const char *ptr;
@ -1920,7 +1916,7 @@ CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
Curl_compareheader(ptr,
STRCONST("Transfer-Encoding:"), STRCONST("chunked"));
if(data->req.upload_chunky &&
Curl_use_http_1_1plus(data, data->conn) &&
use_http_1_1plus(data, data->conn) &&
(data->conn->httpversion >= 20)) {
infof(data, "suppressing chunked transfer encoding on connection "
"using HTTP version 2 or higher");
@ -1932,7 +1928,7 @@ CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
if(req_clen < 0) {
/* indeterminate request content length */
if(Curl_use_http_1_1plus(data, data->conn)) {
if(use_http_1_1plus(data, data->conn)) {
/* On HTTP/1.1, enable chunked, on HTTP/2 and later we do not
* need it */
data->req.upload_chunky = (data->conn->httpversion < 20);
@ -1974,7 +1970,7 @@ static CURLcode addexpect(struct Curl_easy *data, struct dynbuf *r,
Curl_compareheader(ptr, STRCONST("Expect:"), STRCONST("100-continue"));
}
else if(!data->state.disableexpect &&
Curl_use_http_1_1plus(data, data->conn) &&
use_http_1_1plus(data, data->conn) &&
(data->conn->httpversion < 20)) {
/* if not doing HTTP 1.0 or version 2, or disabled explicitly, we add an
Expect: 100-continue to the headers which actually speeds up post
@ -1990,21 +1986,19 @@ static CURLcode addexpect(struct Curl_easy *data, struct dynbuf *r,
return CURLE_OK;
}
CURLcode Curl_http_req_complete(struct Curl_easy *data,
struct dynbuf *r, Curl_HttpReq httpreq)
static CURLcode http_req_complete(struct Curl_easy *data,
struct dynbuf *r, Curl_HttpReq httpreq)
{
CURLcode result = CURLE_OK;
curl_off_t req_clen;
bool announced_exp100 = FALSE;
DEBUGASSERT(data->conn);
#ifndef USE_HYPER
if(data->req.upload_chunky) {
result = Curl_httpchunk_add_reader(data);
if(result)
return result;
}
#endif
/* Get the request body length that has been set up */
req_clen = Curl_creader_total_length(data);
@ -2079,9 +2073,9 @@ out:
#if !defined(CURL_DISABLE_COOKIES)
CURLcode Curl_http_cookies(struct Curl_easy *data,
struct connectdata *conn,
struct dynbuf *r)
static CURLcode http_cookies(struct Curl_easy *data,
struct connectdata *conn,
struct dynbuf *r)
{
CURLcode result = CURLE_OK;
char *addcookies = NULL;
@ -2157,8 +2151,8 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
}
#endif
CURLcode Curl_http_range(struct Curl_easy *data,
Curl_HttpReq httpreq)
static CURLcode http_range(struct Curl_easy *data,
Curl_HttpReq httpreq)
{
if(data->state.use_range) {
/*
@ -2214,7 +2208,7 @@ CURLcode Curl_http_range(struct Curl_easy *data,
return CURLE_OK;
}
CURLcode Curl_http_firstwrite(struct Curl_easy *data)
static CURLcode http_firstwrite(struct Curl_easy *data)
{
struct connectdata *conn = data->conn;
struct SingleRequest *k = &data->req;
@ -2277,7 +2271,7 @@ CURLcode Curl_http_firstwrite(struct Curl_easy *data)
}
#ifdef HAVE_LIBZ
CURLcode Curl_transferencode(struct Curl_easy *data)
static CURLcode http_transferencode(struct Curl_easy *data)
{
if(!Curl_checkheaders(data, STRCONST("TE")) &&
data->set.http_transfer_encoding) {
@ -2309,7 +2303,6 @@ CURLcode Curl_transferencode(struct Curl_easy *data)
}
#endif
#ifndef USE_HYPER
/*
* Curl_http() gets called from the generic multi_do() function when an HTTP
* request is to be performed. This creates and sends a properly constructed
@ -2370,11 +2363,11 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(result)
goto fail;
result = Curl_http_host(data, conn);
result = http_host(data, conn);
if(result)
goto fail;
result = Curl_http_useragent(data);
result = http_useragent(data);
if(result)
goto fail;
@ -2415,19 +2408,19 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
#ifdef HAVE_LIBZ
/* we only consider transfer-encoding magic if libz support is built-in */
result = Curl_transferencode(data);
result = http_transferencode(data);
if(result)
goto fail;
#endif
result = Curl_http_req_set_reader(data, httpreq, &te);
result = http_req_set_reader(data, httpreq, &te);
if(result)
goto fail;
p_accept = Curl_checkheaders(data,
STRCONST("Accept")) ? NULL : "Accept: */*\r\n";
result = Curl_http_range(data, httpreq);
result = http_range(data, httpreq);
if(result)
goto fail;
@ -2444,7 +2437,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
/* GET/HEAD/POST/PUT */
result = Curl_dyn_addf(&req, "%s ", request);
if(!result)
result = Curl_http_target(data, conn, &req);
result = http_target(data, conn, &req);
if(result) {
Curl_dyn_free(&req);
goto fail;
@ -2538,7 +2531,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
}
}
result = Curl_http_cookies(data, conn, &req);
result = http_cookies(data, conn, &req);
#ifndef CURL_DISABLE_WEBSOCKETS
if(!result && conn->handler->protocol&(CURLPROTO_WS|CURLPROTO_WSS))
result = Curl_ws_request(data, &req);
@ -2550,7 +2543,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
if(!result) {
/* req_send takes ownership of the 'req' memory on success */
result = Curl_http_req_complete(data, &req, httpreq);
result = http_req_complete(data, &req, httpreq);
if(!result)
result = Curl_req_send(data, &req);
}
@ -2569,8 +2562,6 @@ fail:
return result;
}
#endif /* USE_HYPER */
typedef enum {
STATUS_UNKNOWN, /* not enough data to tell yet */
STATUS_DONE, /* a status line was read */
@ -2657,10 +2648,10 @@ checkprotoprefix(struct Curl_easy *data, struct connectdata *conn,
Curl_compareheader(hd, STRCONST(n), STRCONST(v)))
/*
* Curl_http_header() parses a single response header.
* http_header() parses a single response header.
*/
CURLcode Curl_http_header(struct Curl_easy *data,
const char *hd, size_t hdlen)
static CURLcode http_header(struct Curl_easy *data,
const char *hd, size_t hdlen)
{
struct connectdata *conn = data->conn;
CURLcode result;
@ -3022,8 +3013,8 @@ CURLcode Curl_http_header(struct Curl_easy *data,
* Called after the first HTTP response line (the status line) has been
* received and parsed.
*/
CURLcode Curl_http_statusline(struct Curl_easy *data,
struct connectdata *conn)
static CURLcode http_statusline(struct Curl_easy *data,
struct connectdata *conn)
{
struct SingleRequest *k = &data->req;
@ -3116,7 +3107,7 @@ CURLcode Curl_http_statusline(struct Curl_easy *data,
figured out here after all headers have been received but before the final
call to the user's header callback, so that a valid content length can be
retrieved by the user in the final call. */
CURLcode Curl_http_size(struct Curl_easy *data)
static CURLcode http_size(struct Curl_easy *data)
{
struct SingleRequest *k = &data->req;
if(data->req.ignore_cl || k->chunk) {
@ -3264,7 +3255,7 @@ static CURLcode http_on_response(struct Curl_easy *data,
* that tells us that the server is OK with this and ready
* to receive the data.
*/
Curl_http_exp100_got100(data);
http_exp100_got100(data);
break;
case 101:
/* Switching Protocols only allowed from HTTP/1.1 */
@ -3423,7 +3414,7 @@ static CURLcode http_on_response(struct Curl_easy *data,
* connection for closure after we have read the entire response.
*/
if(!Curl_req_done_sending(data)) {
if((k->httpcode == 417) && Curl_http_exp100_is_selected(data)) {
if((k->httpcode == 417) && http_exp100_is_selected(data)) {
/* 417 Expectation Failed - try again without the Expect
header */
if(!k->writebytecount && http_exp100_is_waiting(data)) {
@ -3486,13 +3477,13 @@ static CURLcode http_on_response(struct Curl_easy *data,
k->download_done = TRUE;
/* final response without error, prepare to receive the body */
result = Curl_http_firstwrite(data);
result = http_firstwrite(data);
if(!result)
/* This is the last response that we get for the current request.
* Check on the body size and determine if the response is complete.
*/
result = Curl_http_size(data);
result = http_size(data);
out:
if(last_hd) {
@ -3645,7 +3636,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
}
if(fine_statusline) {
result = Curl_http_statusline(data, data->conn);
result = http_statusline(data, data->conn);
if(result)
return result;
writetype |= CLIENTWRITE_STATUS;
@ -3660,7 +3651,7 @@ static CURLcode http_rw_hd(struct Curl_easy *data,
if(result)
return result;
result = Curl_http_header(data, hd, hdlen);
result = http_header(data, hd, hdlen);
if(result)
return result;
@ -4359,7 +4350,7 @@ static CURLcode http_exp100_add_reader(struct Curl_easy *data)
return result;
}
void Curl_http_exp100_got100(struct Curl_easy *data)
static void http_exp100_got100(struct Curl_easy *data)
{
struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
if(r)
@ -4383,7 +4374,7 @@ static void http_exp100_send_anyway(struct Curl_easy *data)
http_exp100_continue(data, r);
}
bool Curl_http_exp100_is_selected(struct Curl_easy *data)
static bool http_exp100_is_selected(struct Curl_easy *data)
{
struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
return !!r;

View file

@ -74,40 +74,14 @@ char *Curl_checkProxyheaders(struct Curl_easy *data,
const char *thisheader,
const size_t thislen);
CURLcode Curl_add_timecondition(struct Curl_easy *data,
#ifndef USE_HYPER
struct dynbuf *req
#else
void *headers
#endif
);
CURLcode Curl_add_custom_headers(struct Curl_easy *data,
bool is_connect,
#ifndef USE_HYPER
struct dynbuf *req
#else
void *headers
#endif
);
CURLcode Curl_add_timecondition(struct Curl_easy *data, struct dynbuf *req);
CURLcode Curl_add_custom_headers(struct Curl_easy *data, bool is_connect,
struct dynbuf *req);
CURLcode Curl_dynhds_add_custom(struct Curl_easy *data, bool is_connect,
struct dynhds *hds);
void Curl_http_method(struct Curl_easy *data, struct connectdata *conn,
const char **method, Curl_HttpReq *);
CURLcode Curl_http_useragent(struct Curl_easy *data);
CURLcode Curl_http_host(struct Curl_easy *data, struct connectdata *conn);
CURLcode Curl_http_target(struct Curl_easy *data, struct connectdata *conn,
struct dynbuf *req);
CURLcode Curl_http_statusline(struct Curl_easy *data,
struct connectdata *conn);
CURLcode Curl_http_header(struct Curl_easy *data,
const char *hd, size_t hdlen);
CURLcode Curl_transferencode(struct Curl_easy *data);
CURLcode Curl_http_req_set_reader(struct Curl_easy *data,
Curl_HttpReq httpreq,
const char **tep);
CURLcode Curl_http_req_complete(struct Curl_easy *data,
struct dynbuf *r, Curl_HttpReq httpreq);
bool Curl_use_http_1_1plus(const struct Curl_easy *data,
const struct connectdata *conn);
#ifndef CURL_DISABLE_COOKIES
CURLcode Curl_http_cookies(struct Curl_easy *data,
struct connectdata *conn,
@ -115,9 +89,6 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
#else
#define Curl_http_cookies(a,b,c) CURLE_OK
#endif
CURLcode Curl_http_range(struct Curl_easy *data,
Curl_HttpReq httpreq);
CURLcode Curl_http_firstwrite(struct Curl_easy *data);
/* protocol-specific functions set up to be called by the main engine */
CURLcode Curl_http_setup_conn(struct Curl_easy *data,
@ -175,8 +146,6 @@ CURLcode Curl_http_auth_act(struct Curl_easy *data);
version. This count includes CONNECT response headers. */
#define MAX_HTTP_RESP_HEADER_SIZE (300*1024)
bool Curl_http_exp100_is_selected(struct Curl_easy *data);
void Curl_http_exp100_got100(struct Curl_easy *data);
#endif /* CURL_DISABLE_HTTP */
@ -184,8 +153,6 @@ void Curl_http_exp100_got100(struct Curl_easy *data);
* HTTP unique setup
***************************************************************************/
CURLcode Curl_http_size(struct Curl_easy *data);
CURLcode Curl_http_write_resp_hds(struct Curl_easy *data,
const char *buf, size_t blen,
size_t *pconsumed);

View file

@ -29,9 +29,6 @@
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY)
#include <curl/curl.h>
#ifdef USE_HYPER
#include <hyper.h>
#endif
#include "sendf.h"
#include "http.h"
#include "url.h"

View file

@ -162,9 +162,6 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data)
req->no_body = data->set.opt_no_body;
req->authneg = FALSE;
req->shutdown = FALSE;
#ifdef USE_HYPER
req->bodywritten = FALSE;
#endif
}
void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data)
@ -261,7 +258,7 @@ static CURLcode req_send_buffer_flush(struct Curl_easy *data)
return result;
}
CURLcode Curl_req_set_upload_done(struct Curl_easy *data)
static CURLcode req_set_upload_done(struct Curl_easy *data)
{
DEBUGASSERT(!data->req.upload_done);
data->req.upload_done = TRUE;
@ -339,7 +336,7 @@ static CURLcode req_flush(struct Curl_easy *data)
if(!done)
return CURLE_AGAIN;
}
return Curl_req_set_upload_done(data);
return req_set_upload_done(data);
}
return CURLE_OK;
}
@ -360,8 +357,6 @@ static ssize_t add_from_client(void *reader_ctx,
return (ssize_t)nread;
}
#ifndef USE_HYPER
static CURLcode req_send_buffer_add(struct Curl_easy *data,
const char *buf, size_t blen,
size_t hds_len)
@ -411,7 +406,6 @@ CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *req)
}
return CURLE_OK;
}
#endif /* !USE_HYPER */
bool Curl_req_sendbuf_empty(struct Curl_easy *data)
{
@ -464,7 +458,7 @@ CURLcode Curl_req_abort_sending(struct Curl_easy *data)
data->req.upload_aborted = TRUE;
/* no longer KEEP_SEND and KEEP_SEND_PAUSE */
data->req.keepon &= ~KEEP_SENDBITS;
return Curl_req_set_upload_done(data);
return req_set_upload_done(data);
}
return CURLE_OK;
}

View file

@ -152,9 +152,6 @@ struct SingleRequest {
BIT(sendbuf_init); /* sendbuf is initialized */
BIT(shutdown); /* request end will shutdown connection */
BIT(shutdown_err_ignore); /* errors in shutdown will not fail request */
#ifdef USE_HYPER
BIT(bodywritten);
#endif
};
/**
@ -196,7 +193,6 @@ void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data);
*/
void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data);
#ifndef USE_HYPER
/**
* Send request headers. If not all could be sent
* they will be buffered. Use `Curl_req_flush()` to make sure
@ -207,8 +203,6 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data);
*/
CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *buf);
#endif /* !USE_HYPER */
/**
* TRUE iff the request has sent all request headers and data.
*/

View file

@ -24,7 +24,7 @@
#include "curl_setup.h"
#if !defined(CURL_DISABLE_RTSP) && !defined(USE_HYPER)
#if !defined(CURL_DISABLE_RTSP)
#include "urldata.h"
#include <curl/curl.h>
@ -1043,4 +1043,4 @@ CURLcode rtsp_parse_transport(struct Curl_easy *data, const char *transport)
}
#endif /* CURL_DISABLE_RTSP or using Hyper */
#endif /* CURL_DISABLE_RTSP */

View file

@ -23,9 +23,6 @@
* SPDX-License-Identifier: curl
*
***************************************************************************/
#ifdef USE_HYPER
#define CURL_DISABLE_RTSP 1
#endif
#ifndef CURL_DISABLE_RTSP

View file

@ -316,9 +316,6 @@ static CURLcode cw_download_write(struct Curl_easy *data,
}
/* Update stats, write and report progress */
data->req.bytecount += nwrite;
#ifdef USE_HYPER
data->req.bodywritten = TRUE;
#endif
result = Curl_pgrsSetDownloadCounter(data, data->req.bytecount);
if(result)
return result;
@ -497,22 +494,6 @@ struct Curl_cwriter *Curl_cwriter_get_by_type(struct Curl_easy *data,
return NULL;
}
void Curl_cwriter_remove_by_name(struct Curl_easy *data,
const char *name)
{
struct Curl_cwriter **anchor = &data->req.writer_stack;
while(*anchor) {
if(!strcmp(name, (*anchor)->cwt->name)) {
struct Curl_cwriter *w = (*anchor);
*anchor = w->next;
Curl_cwriter_free(data, w);
continue;
}
anchor = &((*anchor)->next);
}
}
bool Curl_cwriter_is_paused(struct Curl_easy *data)
{
return Curl_cw_out_is_paused(data);

View file

@ -166,9 +166,6 @@ CURLcode Curl_cwriter_add(struct Curl_easy *data,
struct Curl_cwriter *Curl_cwriter_get_by_type(struct Curl_easy *data,
const struct Curl_cwtype *cwt);
void Curl_cwriter_remove_by_name(struct Curl_easy *data,
const char *name);
struct Curl_cwriter *Curl_cwriter_get_by_name(struct Curl_easy *data,
const char *name);

View file

@ -644,13 +644,7 @@ static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
break;
case CURLOPT_HTTP09_ALLOWED:
#ifdef USE_HYPER
/* Hyper does not support HTTP/0.9 */
if(enabled)
return CURLE_BAD_FUNCTION_ARGUMENT;
#else
data->set.http09_allowed = enabled;
#endif
break;
#endif /* ! CURL_DISABLE_HTTP */

View file

@ -435,15 +435,6 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
data->state.select_bits = 0;
}
#ifdef USE_HYPER
if(data->conn->datastream) {
result = data->conn->datastream(data, data->conn, &didwhat,
CURL_CSELECT_OUT|CURL_CSELECT_IN);
if(result || data->req.done)
goto out;
}
else {
#endif
/* We go ahead and do a read if we have a readable socket or if the stream
was rewound (in which case we have data in a buffer) */
if(k->keepon & KEEP_RECV) {
@ -458,9 +449,6 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
if(result)
goto out;
}
#ifdef USE_HYPER
}
#endif
if(!didwhat) {
/* Transfer wanted to send/recv, but nothing was possible. */

View file

@ -180,13 +180,6 @@ typedef ssize_t (Curl_recv)(struct Curl_easy *data, /* transfer */
size_t len, /* max amount to read */
CURLcode *err); /* error to return */
#ifdef USE_HYPER
typedef CURLcode (*Curl_datastream)(struct Curl_easy *data,
struct connectdata *conn,
int *didwhat,
int select_res);
#endif
#include "mime.h"
#include "imap.h"
#include "pop3.h"
@ -200,7 +193,6 @@ typedef CURLcode (*Curl_datastream)(struct Curl_easy *data,
#include "mqtt.h"
#include "ftplistparser.h"
#include "multihandle.h"
#include "c-hyper.h"
#include "cf-socket.h"
#ifdef HAVE_GSSAPI
@ -930,10 +922,7 @@ struct connectdata {
#ifdef USE_UNIX_SOCKETS
char *unix_domain_socket;
#endif
#ifdef USE_HYPER
/* if set, an alternative data transfer function */
Curl_datastream datastream;
#endif
/* When this connection is created, store the conditions for the local end
bind. This is stored before the actual bind and before any connection is
made and will serve the purpose of being used for comparison reasons so
@ -1276,10 +1265,6 @@ struct UrlState {
struct curl_slist *cookielist; /* list of cookie files set by
curl_easy_setopt(COOKIEFILE) calls */
#endif
#ifdef USE_HYPER
bool hconnect; /* set if a CONNECT request */
CURLcode hresult; /* used to pass return codes back from hyper callbacks */
#endif
#ifndef CURL_DISABLE_VERBOSE_STRINGS
struct curl_trc_feat *feat; /* opt. trace feature transfer is part of */
@ -1923,9 +1908,6 @@ struct Curl_easy {
struct PureInfo info; /* stats, reports and info data */
struct curl_tlssessioninfo tsi; /* Information about the TLS session, only
valid after a client has asked for it */
#ifdef USE_HYPER
struct hyptransfer hyp;
#endif
};
#define LIBCURL_NAME "libcurl"

View file

@ -210,9 +210,6 @@ char *curl_version(void)
#ifdef USE_LIBRTMP
char rtmp_version[30];
#endif
#ifdef USE_HYPER
char hyper_buf[30];
#endif
#ifdef USE_GSASL
char gsasl_buf[30];
#endif
@ -277,10 +274,6 @@ char *curl_version(void)
Curl_rtmp_version(rtmp_version, sizeof(rtmp_version));
src[i++] = rtmp_version;
#endif
#ifdef USE_HYPER
msnprintf(hyper_buf, sizeof(hyper_buf), "Hyper/%s", hyper_version());
src[i++] = hyper_buf;
#endif
#ifdef USE_GSASL
msnprintf(gsasl_buf, sizeof(gsasl_buf), "libgsasl/%s",
gsasl_check_version(NULL));
@ -676,14 +669,6 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
}
#endif
#ifdef USE_HYPER
{
static char hyper_buffer[30];
msnprintf(hyper_buffer, sizeof(hyper_buffer), "Hyper/%s", hyper_version());
version_info.hyper_version = hyper_buffer;
}
#endif
#ifdef USE_GSASL
{
version_info.gsasl_version = gsasl_check_version(NULL);

View file

@ -676,7 +676,7 @@ struct wsfield {
const char *val;
};
CURLcode Curl_ws_request(struct Curl_easy *data, REQTYPE *req)
CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req)
{
unsigned int i;
CURLcode result = CURLE_OK;
@ -729,16 +729,8 @@ CURLcode Curl_ws_request(struct Curl_easy *data, REQTYPE *req)
free(randstr);
for(i = 0; !result && (i < sizeof(heads)/sizeof(heads[0])); i++) {
if(!Curl_checkheaders(data, STRCONST(heads[i].name))) {
#ifdef USE_HYPER
char field[128];
msnprintf(field, sizeof(field), "%s %s", heads[i].name,
heads[i].val);
result = Curl_hyper_header(data, req, field);
#else
(void)data;
result = Curl_dyn_addf(req, "%s %s\r\n", heads[i].name,
heads[i].val);
#endif
}
}
k->upgr101 = UPGR101_WS;

View file

@ -27,12 +27,6 @@
#if !defined(CURL_DISABLE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)
#ifdef USE_HYPER
#define REQTYPE void
#else
#define REQTYPE struct dynbuf
#endif
/* a client-side WS frame decoder, parsing frame headers and
* payload, keeping track of current position and stats */
enum ws_dec_state {
@ -73,7 +67,7 @@ struct websocket {
struct curl_ws_frame frame; /* the current WS FRAME received */
};
CURLcode Curl_ws_request(struct Curl_easy *data, REQTYPE *req);
CURLcode Curl_ws_request(struct Curl_easy *data, struct dynbuf *req);
CURLcode Curl_ws_accept(struct Curl_easy *data, const char *mem, size_t len);
extern const struct Curl_handler Curl_handler_ws;