Skip to content
Open
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
2 changes: 1 addition & 1 deletion include/httpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1161,7 +1161,7 @@ struct request_rec {
* to conclude that no body is there.
*/
unsigned int body_indeterminate :1;
/** Whether a final (status >= 200) RESPONSE BUCKET has been passed down
/** Whether a final (status >= HTTP_OK) RESPONSE BUCKET has been passed down
* the output filters already. Relevant for ap_die().
* TODO: compact elsewhere
*/
Expand Down
2 changes: 1 addition & 1 deletion modules/aaa/mod_authn_socache.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static int authn_cache_post_config(apr_pool_t *pconf, apr_pool_t *plog,
ap_log_perror(APLOG_MARK, APLOG_CRIT, 0, plog, APLOGNO(02612)
"failed to create mod_socache_shmcb socache "
"instance: %s", errmsg);
return 500;
return 500; /* An HTTP status would be a misnomer! */
}
}

Expand Down
4 changes: 2 additions & 2 deletions modules/cache/mod_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1687,10 +1687,10 @@ static apr_status_t cache_invalidate_filter(ap_filter_t *f,
}
else {

if (r->status > 299) {
if (r->status >= HTTP_MULTIPLE_CHOICES) {

ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(02466)
"cache: response status to '%s' method is %d (>299), not invalidating cached entity: %s", r->method, r->status, r->uri);
"cache: response status to '%s' method is %d (>=HTTP_MULTIPLE_CHOICES), not invalidating cached entity: %s", r->method, r->status, r->uri);

}
else {
Expand Down
2 changes: 1 addition & 1 deletion modules/dav/main/mod_dav.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ static int dav_method_put(request_rec *r)
if ((err = (*resource->hooks->open_stream)(resource, mode,
&stream)) != NULL) {
int status = err->status ? err->status : HTTP_FORBIDDEN;
if (status > 299) {
if (status >= HTTP_MULTIPLE_CHOICES) {
err = dav_push_error(r->pool, status, 0,
apr_psprintf(r->pool,
"Unable to PUT new contents for %s.",
Expand Down
2 changes: 1 addition & 1 deletion modules/dav/main/mod_dav.h
Original file line number Diff line number Diff line change
Expand Up @@ -1803,7 +1803,7 @@ DAV_DECLARE_NONSTD(void) dav_prop_exec(dav_prop_ctx *ctx);
DAV_DECLARE_NONSTD(void) dav_prop_commit(dav_prop_ctx *ctx);
DAV_DECLARE_NONSTD(void) dav_prop_rollback(dav_prop_ctx *ctx);

#define DAV_PROP_CTX_HAS_ERR(dpc) ((dpc).err && (dpc).err->status >= 300)
#define DAV_PROP_CTX_HAS_ERR(dpc) ((dpc).err && (dpc).err->status >= HTTP_MULTIPLE_CHOICES)


/* --------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion modules/filters/mod_ext_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ static apr_status_t ef_output_filter(ap_filter_t *f, apr_bucket_brigade *bb)
}
else {
apr_bucket *e;
f->r->status_line = "500 Internal Server Error";
f->r->status_line = ap_get_status_line(HTTP_INTERNAL_SERVER_ERROR);

apr_brigade_cleanup(bb);
e = ap_bucket_error_create(HTTP_INTERNAL_SERVER_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion modules/filters/mod_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ static apr_status_t filter_harness(ap_filter_t *f, apr_bucket_brigade *bb)
harness_ctx *ctx = f->ctx;
ap_filter_rec_t *filter = f->frec;

if (f->r->status != 200
if (f->r->status != HTTP_OK
&& !apr_table_get(f->r->subprocess_env, "filter-errordocs")) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
Expand Down
6 changes: 3 additions & 3 deletions modules/generators/cgi_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ static int cgi_handle_response(request_rec *r, int nph, apr_bucket_brigade *bb,

location = apr_table_get(r->headers_out, "Location");

if (location && r->status == 200) {
if (location && r->status == HTTP_OK) {
/* For a redirect whether internal or not, discard any
* remaining stdout from the script, and log any remaining
* stderr output, as normal. */
Expand All @@ -498,7 +498,7 @@ static int cgi_handle_response(request_rec *r, int nph, apr_bucket_brigade *bb,
}
}

if (location && location[0] == '/' && r->status == 200) {
if (location && location[0] == '/' && r->status == HTTP_OK) {
/* This redirect needs to be a GET no matter what the original
* method was.
*/
Expand All @@ -514,7 +514,7 @@ static int cgi_handle_response(request_rec *r, int nph, apr_bucket_brigade *bb,
ap_internal_redirect_handler(location, r);
return OK;
}
else if (location && r->status == 200) {
else if (location && r->status == HTTP_OK) {
/* XXX: Note that if a script wants to produce its own Redirect
* body, it now has to explicitly *say* "Status: 302"
*/
Expand Down
10 changes: 5 additions & 5 deletions modules/http/http_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_http_header_filter(ap_filter_t *f,
respb = e;
resp = respb->data;
if (!ctx->final_status
&& (resp->status >= 200 || resp->status == HTTP_SWITCHING_PROTOCOLS)) {
&& (resp->status >= HTTP_OK || resp->status == HTTP_SWITCHING_PROTOCOLS)) {
ctx->final_status = resp->status;
ctx->final_header_only = AP_STATUS_IS_HEADER_ONLY(resp->status);
bcontent = APR_BUCKET_NEXT(e);
Expand Down Expand Up @@ -1899,7 +1899,7 @@ static void h1_append_response_head(request_rec *r,
}

typedef struct h1_response_ctx {
int final_response_sent; /* strict: a response status >= 200 was sent */
int final_response_sent; /* strict: a response status >= HTTP_OK was sent */
int discard_body; /* the response is header only, discard body */
apr_bucket_brigade *tmpbb;
} h1_response_ctx;
Expand Down Expand Up @@ -1942,7 +1942,7 @@ apr_status_t ap_h1_response_out_filter(ap_filter_t *f,
ap_log_rerror(APLOG_MARK, APLOG_TRACE2, 0, r,
"ap_h1_response_out_filter seeing response bucket status=%d",
resp->status);
if (strict && resp->status < 100) {
if (strict && resp->status < HTTP_CONTINUE) {
/* error, not a valid http status */
ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(10386)
"ap_h1_response_out_filter seeing headers "
Expand All @@ -1966,8 +1966,8 @@ apr_status_t ap_h1_response_out_filter(ap_filter_t *f,
*/
const char *proto = AP_SERVER_PROTOCOL;

ctx->final_response_sent = (resp->status >= 200)
|| (!strict && resp->status < 100);
ctx->final_response_sent = (resp->status >= HTTP_OK)
|| (!strict && resp->status < HTTP_CONTINUE);
ctx->discard_body = ctx->final_response_sent &&
(r->header_only || AP_STATUS_IS_HEADER_ONLY(resp->status));

Expand Down
6 changes: 3 additions & 3 deletions modules/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,8 @@ static void check_early_hints(request_rec *r, const char *tag)
}
old_status = r->status;
old_line = r->status_line;
r->status = 103;
r->status_line = "103 Early Hints";
r->status = HTTP_EARLY_HINTS;
r->status_line = ap_get_status_line(r->status);
ap_send_interim_response(r, 1);
r->status = old_status;
r->status_line = old_line;
Expand Down
6 changes: 3 additions & 3 deletions modules/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 modules/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 */
16 changes: 5 additions & 11 deletions modules/http2/h2_proxy_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,24 +281,18 @@ 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;
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;
default:
r->status_line = ap_get_status_line(r->status);
break;
Expand All @@ -311,7 +305,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 +411,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 +503,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
14 changes: 7 additions & 7 deletions modules/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,14 @@ static apr_status_t stream_do_response(h2_stream *stream)
}
h2_session_set_prio(stream->session, stream, stream->pref_priority);

if (resp->status == 103
if (resp->status == HTTP_EARLY_HINTS
&& !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 modules/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
4 changes: 2 additions & 2 deletions modules/lua/lua_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -2209,7 +2209,7 @@ static int lua_websocket_greet(lua_State *L)
if (encoded_len) {
encoded = apr_palloc(r->pool, encoded_len);
encoded_len = apr_base64_encode(encoded, (char*) digest, APR_SHA1_DIGESTSIZE);
r->status = 101;
r->status = HTTP_SWITCHING_PROTOCOLS;
apr_table_setn(r->headers_out, "Upgrade", "websocket");
apr_table_setn(r->headers_out, "Connection", "Upgrade");
apr_table_setn(r->headers_out, "Sec-WebSocket-Accept", encoded);
Expand Down Expand Up @@ -2542,7 +2542,7 @@ APLUA_REQ_TRACE(6)
APLUA_REQ_TRACE(7)
APLUA_REQ_TRACE(8)

/* handle r.status = 201 */
/* handle r.status = HTTP_CREATED */
static int req_newindex(lua_State *L)
{
const char *key;
Expand Down
4 changes: 2 additions & 2 deletions modules/mappers/mod_rewrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,7 @@ static cond_return_type apply_rewrite_cond(rewritecond_entry *p, rewrite_ctx *ct
case CONDPAT_LU_URL:
if (*input && subreq_ok(r)) {
rsub = ap_sub_req_lookup_uri(input, r, NULL);
if (rsub->status < 400) {
if (rsub->status < HTTP_BAD_REQUEST) {
rc = COND_RC_MATCH;
}
rewritelog(r, 5, NULL, "RewriteCond URI (-U check: "
Expand All @@ -4218,7 +4218,7 @@ static cond_return_type apply_rewrite_cond(rewritecond_entry *p, rewrite_ctx *ct
return COND_RC_STATUS_SET;
}
rsub = ap_sub_req_lookup_file(input, r, NULL);
if (rsub->status < 300 &&
if (rsub->status < HTTP_MULTIPLE_CHOICES &&
/* double-check that file exists since default result is 200 */
apr_stat(&sb, rsub->filename, APR_FINFO_MIN,
r->pool) == APR_SUCCESS) {
Expand Down
Loading