1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-07 04:02:58 +03:00

*) mod_http2: use the new RESPONSE buckets introduced in r1899648.

This replaces the internal H2_HEADERS bucket, removing its
     source file and also obsoletes any interim response parsing
     needs.



git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899649 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stefan Eissing
2022-04-07 10:55:09 +00:00
parent 0296d7dfea
commit 8ce99f9ef1
25 changed files with 227 additions and 1160 deletions

View File

@@ -22,6 +22,7 @@
#include <httpd.h>
#include <http_core.h>
#include <http_log.h>
#include <http_protocol.h>
#include <http_request.h>
#include <nghttp2/nghttp2.h>
@@ -1620,30 +1621,30 @@ static apr_status_t ngheader_create(h2_ngheader **ph, apr_pool_t *p,
return ctx.status;
}
static int is_unsafe(h2_headers *h)
static int is_unsafe(ap_bucket_response *h)
{
const char *v = apr_table_get(h->notes, H2_HDR_CONFORMANCE);
const char *v = h->notes? apr_table_get(h->notes, H2_HDR_CONFORMANCE) : NULL;
return (v && !strcmp(v, H2_HDR_CONFORMANCE_UNSAFE));
}
apr_status_t h2_res_create_ngtrailer(h2_ngheader **ph, apr_pool_t *p,
h2_headers *headers)
apr_status_t h2_res_create_ngtrailer(h2_ngheader **ph, apr_pool_t *p,
ap_bucket_headers *headers)
{
return ngheader_create(ph, p, is_unsafe(headers),
return ngheader_create(ph, p, 0,
0, NULL, NULL, headers->headers);
}
apr_status_t h2_res_create_ngheader(h2_ngheader **ph, apr_pool_t *p,
h2_headers *headers)
ap_bucket_response *response)
{
const char *keys[] = {
":status"
};
const char *values[] = {
apr_psprintf(p, "%d", headers->status)
apr_psprintf(p, "%d", response->status)
};
return ngheader_create(ph, p, is_unsafe(headers),
H2_ALEN(keys), keys, values, headers->headers);
return ngheader_create(ph, p, is_unsafe(response),
H2_ALEN(keys), keys, values, response->headers);
}
apr_status_t h2_req_create_ngheader(h2_ngheader **ph, apr_pool_t *p,
@@ -1942,3 +1943,24 @@ apr_status_t h2_util_wait_on_pipe(apr_file_t *pipe)
return apr_file_read(pipe, rb, &nr);
}
static int add_header_lengths(void *ctx, const char *name, const char *value)
{
apr_size_t *plen = ctx;
*plen += strlen(name) + strlen(value);
return 1;
}
apr_size_t headers_length_estimate(ap_bucket_headers *hdrs)
{
apr_size_t len = 0;
apr_table_do(add_header_lengths, &len, hdrs->headers, NULL);
return len;
}
apr_size_t response_length_estimate(ap_bucket_response *resp)
{
apr_size_t len = 3 + 1 + 8 + (resp->reason? strlen(resp->reason) : 10);
apr_table_do(add_header_lengths, &len, resp->headers, NULL);
return len;
}