http: remove "struct HTTP"

It is not actually used anymore and only contained a dummy struct field.
Remove all traces and uses of it.

Closes #13927
This commit is contained in:
Daniel Stenberg 2024-06-12 11:05:44 +02:00
parent 69b6c10568
commit 7208ff6534
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
9 changed files with 8 additions and 52 deletions

View File

@ -65,7 +65,6 @@ typedef enum {
/* struct for HTTP CONNECT tunneling */
struct h1_tunnel_state {
struct HTTP CONNECT;
struct dynbuf rcvbuf;
struct dynbuf request_data;
size_t nsent;

View File

@ -169,14 +169,6 @@ CURLcode Curl_http_setup_conn(struct Curl_easy *data,
{
/* allocate the HTTP-specific struct for the Curl_easy, only to survive
during this request */
struct HTTP *http;
DEBUGASSERT(data->req.p.http == NULL);
http = calloc(1, sizeof(struct HTTP));
if(!http)
return CURLE_OUT_OF_MEMORY;
data->req.p.http = http;
connkeep(conn, "HTTP default");
if(data->state.httpwant == CURL_HTTP_VERSION_3ONLY) {
@ -1174,16 +1166,12 @@ CURLcode Curl_http_done(struct Curl_easy *data,
CURLcode status, bool premature)
{
struct connectdata *conn = data->conn;
struct HTTP *http = data->req.p.http;
/* Clear multipass flag. If authentication isn't done yet, then it will get
* a chance to be set back to true when we output the next auth header */
data->state.authhost.multipass = FALSE;
data->state.authproxy.multipass = FALSE;
if(!http)
return CURLE_OK;
Curl_dyn_reset(&data->state.headerb);
Curl_hyper_done(data);

View File

@ -73,7 +73,6 @@ char *Curl_checkProxyheaders(struct Curl_easy *data,
const struct connectdata *conn,
const char *thisheader,
const size_t thislen);
struct HTTP; /* see below */
CURLcode Curl_add_timecondition(struct Curl_easy *data,
#ifndef USE_HYPER
@ -187,10 +186,6 @@ void Curl_http_exp100_got100(struct Curl_easy *data);
/****************************************************************************
* HTTP unique setup
***************************************************************************/
struct HTTP {
/* TODO: no longer used, we should remove it from SingleRequest */
char unused;
};
CURLcode Curl_http_size(struct Curl_easy *data);

View File

@ -292,10 +292,6 @@ static CURLcode http2_data_setup(struct Curl_cfilter *cf,
(void)cf;
DEBUGASSERT(data);
if(!data->req.p.http) {
failf(data, "initialization failure, transfer not http initialized");
return CURLE_FAILED_INIT;
}
stream = H2_STREAM_CTX(ctx, data);
if(stream) {
*pstream = stream;
@ -797,18 +793,9 @@ static struct Curl_easy *h2_duphandle(struct Curl_cfilter *cf,
{
struct Curl_easy *second = curl_easy_duphandle(data);
if(second) {
/* setup the request struct */
struct HTTP *http = calloc(1, sizeof(struct HTTP));
if(!http) {
(void)Curl_close(&second);
}
else {
struct h2_stream_ctx *second_stream;
second->req.p.http = http;
http2_data_setup(cf, second, &second_stream);
second->state.priority.weight = data->state.priority.weight;
}
struct h2_stream_ctx *second_stream;
http2_data_setup(cf, second, &second_stream);
second->state.priority.weight = data->state.priority.weight;
}
return second;
}
@ -870,9 +857,7 @@ fail:
static void discard_newhandle(struct Curl_cfilter *cf,
struct Curl_easy *newhandle)
{
if(newhandle->req.p.http) {
http2_data_done(cf, newhandle);
}
http2_data_done(cf, newhandle);
(void)Curl_close(&newhandle);
}

View File

@ -109,7 +109,7 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data)
/* This is a bit ugly. `req->p` is a union and we assume we can
* free this safely without leaks. */
Curl_safefree(req->p.http);
Curl_safefree(req->p.ftp);
Curl_safefree(req->newurl);
Curl_client_reset(data);
if(req->sendbuf_init)
@ -164,7 +164,7 @@ void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data)
{
/* This is a bit ugly. `req->p` is a union and we assume we can
* free this safely without leaks. */
Curl_safefree(req->p.http);
Curl_safefree(req->p.ftp);
Curl_safefree(req->newurl);
if(req->sendbuf_init)
Curl_bufq_free(&req->sendbuf);

View File

@ -104,7 +104,6 @@ struct SingleRequest {
union {
struct FILEPROTO *file;
struct FTP *ftp;
struct HTTP *http;
struct IMAP *imap;
struct ldapreqinfo *ldap;
struct MQTT *mqtt;

View File

@ -62,16 +62,6 @@ struct rtsp_conn {
* RTSP unique setup
***************************************************************************/
struct RTSP {
/*
* http_wrapper MUST be the first element of this structure for the wrap
* logic to work. In this way, we get a cheap polymorphism because
* &(data->state.proto.rtsp) == &(data->state.proto.http) per the C spec
*
* HTTP functions can safely treat this as an HTTP struct, but RTSP aware
* functions can also index into the later elements.
*/
struct HTTP http_wrapper; /* wrap HTTP to do the heavy lifting */
long CSeq_sent; /* CSeq of this request */
long CSeq_recv; /* CSeq received */
};

View File

@ -198,7 +198,7 @@ static CURLcode h3_data_setup(struct Curl_cfilter *cf,
struct cf_ngtcp2_ctx *ctx = cf->ctx;
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
if(!data || !data->req.p.http) {
if(!data) {
failf(data, "initialization failure, transfer not http initialized");
return CURLE_FAILED_INIT;
}

View File

@ -521,7 +521,7 @@ static CURLcode h3_data_setup(struct Curl_cfilter *cf,
struct cf_osslq_ctx *ctx = cf->ctx;
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
if(!data || !data->req.p.http) {
if(!data) {
failf(data, "initialization failure, transfer not http initialized");
return CURLE_FAILED_INIT;
}