Skip to content
This repository was archived by the owner on Jun 9, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion mod_http2/h2_c2.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ static apr_status_t h2_c2_filter_out(ap_filter_t* f, apr_bucket_brigade* bb)
{
if (AP_BUCKET_IS_RESPONSE(e)) {
ap_bucket_response *resp = e->data;
if (resp->status >= 200) {
if (resp->status >= HTTP_OK) {
conn_ctx->has_final_response = 1;
break;
}
Expand Down Expand Up @@ -461,8 +461,13 @@ static void check_early_hints(request_rec *r, const char *tag)
}
old_status = r->status;
old_line = r->status_line;
#ifdef HTTP_EARLY_HINTS
r->status = HTTP_EARLY_HINTS;
r->status_line = ap_get_status_line(r->status);
#else
r->status = 103;
r->status_line = "103 Early Hints";
#endif
ap_send_interim_response(r, 1);
r->status = old_status;
r->status_line = old_line;
Expand Down
6 changes: 3 additions & 3 deletions mod_http2/h2_c2_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ apr_status_t h2_c2_filter_notes_out(ap_filter_t *f, apr_bucket_brigade *bb)
{
if (AP_BUCKET_IS_RESPONSE(b)) {
resp = b->data;
if (resp->status >= 400 && f->r->prev) {
if (resp->status >= HTTP_BAD_REQUEST && f->r->prev) {
/* Error responses are commonly handled via internal
* redirects to error documents. That creates a new
* request_rec with 'prev' set to the original.
Expand Down Expand Up @@ -547,7 +547,7 @@ static apr_status_t pass_response(h2_conn_ctx_t *conn_ctx, ap_filter_t *f,
parser->state = H2_RP_STATUS_LINE;
apr_array_clear(parser->hlines);

if (response->status >= 200) {
if (response->status >= HTTP_OK) {
conn_ctx->has_final_response = 1;
}
ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, parser->c,
Expand Down Expand Up @@ -657,7 +657,7 @@ apr_status_t h2_c2_filter_catch_h1_out(ap_filter_t* f, apr_bucket_brigade* bb)
HTTP_INTERNAL_SERVER_ERROR);
request_rec *r = h2_create_request_rec(conn_ctx->request, f->c, 1);
if (r) {
ap_die((result >= 400)? result : HTTP_INTERNAL_SERVER_ERROR, r);
ap_die((result >= HTTP_BAD_REQUEST)? result : HTTP_INTERNAL_SERVER_ERROR, r);
b = ap_bucket_eor_create(f->c->bucket_alloc, r);
APR_BRIGADE_INSERT_TAIL(bb, b);
}
Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_headers.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ h2_headers *h2_headers_die(apr_status_t type,
char *date;

headers = apr_pcalloc(pool, sizeof(h2_headers));
headers->status = (type >= 200 && type < 600)? type : 500;
headers->status = (type >= HTTP_OK && type < 600)? type : HTTP_INTERNAL_SERVER_ERROR;
headers->headers = apr_table_make(pool, 5);
headers->notes = apr_table_make(pool, 5);

Expand All @@ -213,7 +213,7 @@ h2_headers *h2_headers_die(apr_status_t type,

int h2_headers_are_final_response(h2_headers *headers)
{
return headers->status >= 200;
return headers->status >= HTTP_OK;
}

#endif /* !AP_HAS_RESPONSE_BUCKETS */
12 changes: 7 additions & 5 deletions mod_http2/h2_proxy_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,26 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame,
return NGHTTP2_ERR_CALLBACK_FAILURE;
}
r = stream->r;
if (r->status >= 100 && r->status < 200) {
if (ap_is_HTTP_INFO(r->status)) {
/* By default, we will forward all interim responses when
* we are sitting on a HTTP/2 connection to the client */
int forward = session->h2_front;
switch(r->status) {
case 100:
case HTTP_CONTINUE:
if (stream->waiting_on_100) {
stream->waiting_on_100 = 0;
r->status_line = ap_get_status_line(r->status);
forward = 1;
}
break;
#ifndef HTTP_EARLY_HINTS
case 103:
/* workaround until we get this into http protocol base
* parts. without this, unknown codes are converted to
* 500... */
r->status_line = "103 Early Hints";
break;
#endif
default:
r->status_line = ap_get_status_line(r->status);
break;
Expand All @@ -311,7 +313,7 @@ static int on_frame_recv(nghttp2_session *ngh2, const nghttp2_frame *frame,
ap_send_interim_response(r, 1);
}
}
else if (r->status >= 400) {
else if (r->status >= HTTP_BAD_REQUEST) {
proxy_dir_conf *dconf;
dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
if (ap_proxy_should_override(dconf, r->status)) {
Expand Down Expand Up @@ -417,7 +419,7 @@ static apr_status_t h2_proxy_stream_add_header_out(h2_proxy_stream *stream,
stream->session->id, stream->id, s);
stream->r->status = (int)apr_atoi64(s);
if (stream->r->status <= 0) {
stream->r->status = 500;
stream->r->status = HTTP_INTERNAL_SERVER_ERROR;
return APR_EGENERAL;
}
}
Expand Down Expand Up @@ -509,7 +511,7 @@ static void h2_proxy_stream_end_headers_out(h2_proxy_stream *stream)
server_name, portstr)
);
}
if (r->status >= 200) stream->headers_ended = 1;
if (r->status >= HTTP_OK) stream->headers_ended = 1;

if (APLOGrtrace2(stream->r)) {
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, stream->r,
Expand Down
16 changes: 10 additions & 6 deletions mod_http2/h2_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1022,10 +1022,10 @@ static void stream_do_error_bucket(h2_stream *stream, apr_bucket *b)
int err = ((ap_bucket_error *)(b->data))->status;
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c1,
H2_STRM_MSG(stream, "error bucket received, err=%d"), err);
if (err >= 500) {
if (err >= HTTP_INTERNAL_SERVER_ERROR) {
err = NGHTTP2_INTERNAL_ERROR;
}
else if (err >= 400) {
else if (err >= HTTP_BAD_REQUEST) {
err = NGHTTP2_STREAM_CLOSED;
}
else {
Expand Down Expand Up @@ -1649,7 +1649,7 @@ static apr_status_t stream_do_response(h2_stream *stream)
goto cleanup;
}

if (resp->status < 100) {
if (resp->status < HTTP_CONTINUE) {
h2_stream_rst(stream, resp->status);
goto cleanup;
}
Expand Down Expand Up @@ -1691,8 +1691,8 @@ static apr_status_t stream_do_response(h2_stream *stream)
&& !stream->response
&& stream->request && stream->request->method
&& !strcmp("GET", stream->request->method)
&& (resp->status < 400)
&& (resp->status != 304)
&& (resp->status < HTTP_BAD_REQUEST)
&& (resp->status != HTTP_NOT_MODIFIED)
&& h2_session_push_enabled(stream->session)) {
/* PUSH is possible and enabled on server, unless the request
* denies it, submit resources to push */
Expand All @@ -1709,14 +1709,18 @@ static apr_status_t stream_do_response(h2_stream *stream)
}
h2_session_set_prio(stream->session, stream, stream->pref_priority);

#ifdef HTTP_EARLY_HINTS
if (resp->status == HTTP_EARLY_HINTS
#else
if (resp->status == 103
#endif
&& !h2_config_sgeti(stream->session->s, H2_CONF_EARLY_HINTS)) {
/* suppress sending this to the client, it might have triggered
* pushes and served its purpose nevertheless */
rv = APR_SUCCESS;
goto cleanup;
}
if (resp->status >= 200) {
if (resp->status >= HTTP_OK) {
stream->response = resp;
}

Expand Down
4 changes: 2 additions & 2 deletions mod_http2/h2_ws.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@ static void ws_handle_resp(conn_rec *c2, h2_conn_ctx_t *conn_ctx,
override_body = is_final = 1;
}
}
else if (resp->status < 200) {
else if (resp->status < HTTP_OK) {
/* other intermediate response, pass through */
}
else if (resp->status < 300) {
else if (resp->status < HTTP_MULTIPLE_CHOICES) {
/* Failure, we might be talking to a plain http resource */
ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c2,
"h2_c2(%s-%d): websocket CONNECT, invalid response %d",
Expand Down
Loading