diff --git a/include/httpd.h b/include/httpd.h index 03376db9958..5db96fb4d17 100644 --- a/include/httpd.h +++ b/include/httpd.h @@ -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 */ diff --git a/modules/aaa/mod_authn_socache.c b/modules/aaa/mod_authn_socache.c index c5461d8f624..757083e40fe 100644 --- a/modules/aaa/mod_authn_socache.c +++ b/modules/aaa/mod_authn_socache.c @@ -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! */ } } diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 37c06e94727..80205bd27c9 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -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 { diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 69aa811a3e7..42b651f2819 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -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.", diff --git a/modules/dav/main/mod_dav.h b/modules/dav/main/mod_dav.h index 8d9be2ad42a..a481c4dd28f 100644 --- a/modules/dav/main/mod_dav.h +++ b/modules/dav/main/mod_dav.h @@ -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) /* -------------------------------------------------------------------- diff --git a/modules/filters/mod_ext_filter.c b/modules/filters/mod_ext_filter.c index b479d522304..2f548498566 100644 --- a/modules/filters/mod_ext_filter.c +++ b/modules/filters/mod_ext_filter.c @@ -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, diff --git a/modules/filters/mod_filter.c b/modules/filters/mod_filter.c index 5b5ecf69712..fbdb84c2676 100644 --- a/modules/filters/mod_filter.c +++ b/modules/filters/mod_filter.c @@ -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); diff --git a/modules/generators/cgi_common.h b/modules/generators/cgi_common.h index c8571321d11..9bf08a58e91 100644 --- a/modules/generators/cgi_common.h +++ b/modules/generators/cgi_common.h @@ -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. */ @@ -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. */ @@ -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" */ diff --git a/modules/http/http_filters.c b/modules/http/http_filters.c index 8e5f76102ea..3b042c34c13 100644 --- a/modules/http/http_filters.c +++ b/modules/http/http_filters.c @@ -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); @@ -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; @@ -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 " @@ -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)); diff --git a/modules/http2/h2_c2.c b/modules/http2/h2_c2.c index 5a9019aa0cf..ad30f96d0f5 100644 --- a/modules/http2/h2_c2.c +++ b/modules/http2/h2_c2.c @@ -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; } @@ -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; diff --git a/modules/http2/h2_c2_filter.c b/modules/http2/h2_c2_filter.c index 523a941450b..7874cae138c 100644 --- a/modules/http2/h2_c2_filter.c +++ b/modules/http2/h2_c2_filter.c @@ -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. @@ -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, @@ -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); } diff --git a/modules/http2/h2_headers.c b/modules/http2/h2_headers.c index d9b3fd09b06..c21a360bbe9 100644 --- a/modules/http2/h2_headers.c +++ b/modules/http2/h2_headers.c @@ -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); @@ -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 */ diff --git a/modules/http2/h2_proxy_session.c b/modules/http2/h2_proxy_session.c index 166b6468f1d..f1634eec9b6 100644 --- a/modules/http2/h2_proxy_session.c +++ b/modules/http2/h2_proxy_session.c @@ -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; @@ -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)) { @@ -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; } } @@ -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, diff --git a/modules/http2/h2_stream.c b/modules/http2/h2_stream.c index f0e671ca5d6..653af3fb18c 100644 --- a/modules/http2/h2_stream.c +++ b/modules/http2/h2_stream.c @@ -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 { @@ -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; } @@ -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 */ @@ -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; } diff --git a/modules/http2/h2_ws.c b/modules/http2/h2_ws.c index 4643660f306..9e3d5087673 100644 --- a/modules/http2/h2_ws.c +++ b/modules/http2/h2_ws.c @@ -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", diff --git a/modules/lua/lua_request.c b/modules/lua/lua_request.c index 15605cd76c1..587b690c6fa 100644 --- a/modules/lua/lua_request.c +++ b/modules/lua/lua_request.c @@ -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); @@ -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; diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 75b41110b31..346c504f9a6 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -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: " @@ -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) { diff --git a/modules/md/md_acme.c b/modules/md/md_acme.c index a62438da4df..7c876c62c9e 100644 --- a/modules/md/md_acme.c +++ b/modules/md/md_acme.c @@ -23,6 +23,8 @@ #include #include +#include + #include "md.h" #include "md_crypt.h" #include "md_json.h" @@ -74,10 +76,10 @@ static acme_problem_status_t Problems[] = { static apr_status_t problem_status_get(const char *type) { size_t i; - if (strstr(type, "urn:ietf:params:") == type) { + if (ap_strstr_c(type, "urn:ietf:params:") == type) { type += strlen("urn:ietf:params:"); } - else if (strstr(type, "urn:") == type) { + else if (ap_strstr_c(type, "urn:") == type) { type += strlen("urn:"); } @@ -93,10 +95,10 @@ int md_acme_problem_is_input_related(const char *problem) { size_t i; if (!problem) return 0; - if (strstr(problem, "urn:ietf:params:") == problem) { + if (ap_strstr_c(problem, "urn:ietf:params:") == problem) { problem += strlen("urn:ietf:params:"); } - else if (strstr(problem, "urn:") == problem) { + else if (ap_strstr_c(problem, "urn:") == problem) { problem += strlen("urn:"); } @@ -205,12 +207,12 @@ static apr_status_t inspect_problem(md_acme_req_t *req, const md_http_response_t } switch (res->status) { - case 400: + case HTTP_BAD_REQUEST: return APR_EINVAL; - case 401: /* sectigo returns this instead of 403 */ - case 403: + case HTTP_UNAUTHORIZED: /* sectigo returns this instead of 403 */ + case HTTP_FORBIDDEN: return APR_EACCES; - case 404: + case HTTP_NOT_FOUND: return APR_ENOENT; default: md_log_perror(MD_LOG_MARK, MD_LOG_WARNING, 0, req->p, @@ -282,7 +284,7 @@ static apr_status_t on_response(const md_http_response_t *res, void *data) req_update_nonce(req->acme, res->headers); md_log_perror(MD_LOG_MARK, MD_LOG_TRACE1, rv, req->p, "response: %d", res->status); - if (res->status >= 200 && res->status < 300) { + if (ap_is_HTTP_SUCCESS(res->status)) { int processed = 0; if (req->on_json) { @@ -687,7 +689,7 @@ static apr_status_t update_directory(const md_http_response_t *res, void *data) const char *s; md_log_perror(MD_LOG_MARK, MD_LOG_TRACE1, 0, req->pool, "directory lookup response: %d", res->status); - if (res->status == 503) { + if (res->status == HTTP_SERVICE_UNAVAILABLE) { md_result_printf(result, APR_EAGAIN, "The ACME server at <%s> reports that Service is Unavailable (503). This " "may happen during maintenance for short periods of time.", acme->url); @@ -695,7 +697,7 @@ static apr_status_t update_directory(const md_http_response_t *res, void *data) rv = result->status; goto leave; } - else if (res->status < 200 || res->status >= 300) { + else if (res->status < HTTP_OK || res->status >= HTTP_MULTIPLE_CHOICES) { md_result_printf(result, APR_EAGAIN, "The ACME server at <%s> responded with HTTP status %d. This " "is unusual. Please verify that the URL is correct and that you can indeed " diff --git a/modules/md/md_curl.c b/modules/md/md_curl.c index fac2ab8ec91..2484faf51a1 100644 --- a/modules/md/md_curl.c +++ b/modules/md/md_curl.c @@ -22,6 +22,8 @@ #include #include +#include + #include "md.h" #include "md_http.h" #include "md_log.h" @@ -168,8 +170,8 @@ static int curlify_headers(void *baton, const char *key, const char *value) curlify_hdrs_ctx *ctx = baton; const char *s; - if (strchr(key, '\r') || strchr(key, '\n') - || strchr(value, '\r') || strchr(value, '\n')) { + if (ap_strchr_c(key, '\r') || ap_strchr_c(key, '\n') + || ap_strchr_c(value, '\r') || ap_strchr_c(value, '\n')) { ctx->rv = APR_EINVAL; return 0; } @@ -273,7 +275,7 @@ static apr_status_t internals_setup(md_http_request_t *req) internals->response = apr_pcalloc(req->pool, sizeof(md_http_response_t)); internals->response->req = req; - internals->response->status = 400; + internals->response->status = HTTP_BAD_REQUEST; internals->response->headers = apr_table_make(req->pool, 5); internals->response->body = apr_brigade_create(req->pool, req->bucket_alloc); diff --git a/modules/proxy/mod_proxy_ajp.c b/modules/proxy/mod_proxy_ajp.c index 9c6573b59ac..e269ae31d96 100644 --- a/modules/proxy/mod_proxy_ajp.c +++ b/modules/proxy/mod_proxy_ajp.c @@ -490,7 +490,7 @@ static int ap_proxy_ajp_request(apr_pool_t *p, request_rec *r, if (status != APR_SUCCESS) { backend_failed = 1; } - else if ((r->status == 401) && conf->error_override) { + else if ((r->status == HTTP_UNAUTHORIZED) && conf->error_override) { const char *buf; const char *wa = "WWW-Authenticate"; if ((buf = apr_table_get(r->headers_out, wa))) { diff --git a/modules/proxy/mod_proxy_ftp.c b/modules/proxy/mod_proxy_ftp.c index f33360efa51..f8833560efd 100644 --- a/modules/proxy/mod_proxy_ftp.c +++ b/modules/proxy/mod_proxy_ftp.c @@ -1870,7 +1870,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker, } r->status = HTTP_OK; - r->status_line = "200 OK"; + r->status_line = ap_get_status_line(r->status); apr_rfc822_date(dates, r->request_time); apr_table_setn(r->headers_out, "Date", dates); diff --git a/modules/proxy/mod_proxy_hcheck.c b/modules/proxy/mod_proxy_hcheck.c index 92e1bced286..7b8e336fead 100644 --- a/modules/proxy/mod_proxy_hcheck.c +++ b/modules/proxy/mod_proxy_hcheck.c @@ -906,7 +906,7 @@ static apr_status_t hc_check_http(baton_t *baton, apr_thread_t *thread) hc->s->name, worker->s->name); status = !OK; } - } else if (r->status < 200 || r->status > 399) { + } else if (r->status < HTTP_OK || r->status >= HTTP_BAD_REQUEST) { ap_log_error(APLOG_MARK, APLOG_TRACE2, 0, ctx->s, "Response status %i for %s (%s): failed", r->status, hc->s->name, worker->s->name); diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index 98387d62b3f..970487be6ea 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -1288,7 +1288,7 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) */ r->headers_out = apr_table_make(r->pool,1); r->status = HTTP_BAD_GATEWAY; - r->status_line = "bad gateway"; + r->status_line = ap_get_status_line(r->status); return r->status; } @@ -1413,8 +1413,8 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) } else { /* an http/0.9 response */ backasswards = 1; - r->status = proxy_status = 200; - r->status_line = "200 OK"; + r->status = proxy_status = HTTP_OK; + r->status_line = ap_get_status_line(r->status); backend->close = 1; } diff --git a/modules/test/mod_policy.c b/modules/test/mod_policy.c index 841b1b16bdb..1051209db4c 100644 --- a/modules/test/mod_policy.c +++ b/modules/test/mod_policy.c @@ -258,7 +258,7 @@ static apr_status_t policy_length_out_filter(ap_filter_t *f, &policy_module); policy_result result = check_enabled(r, conf, conf->length_action); - if (result != policy_ignore && r->status >= 200 && r->status < 300 + if (result != policy_ignore && ap_is_HTTP_SUCCESS(r->status) && r->status != HTTP_NO_CONTENT) { if (!apr_table_get(r->headers_out, "Content-Length")) { diff --git a/server/util_expr_eval.c b/server/util_expr_eval.c index f9db28e7044..603ade679cc 100644 --- a/server/util_expr_eval.c +++ b/server/util_expr_eval.c @@ -1650,7 +1650,7 @@ static int op_url_subr(ap_expr_eval_ctx_t *ctx, const void *data, const char *ar return FALSE; rsub = ap_sub_req_lookup_uri(arg, r, NULL); - if (rsub->status < 400) { + if (rsub->status < HTTP_BAD_REQUEST) { rc = TRUE; } expr_eval_log(ctx, APLOG_TRACE5, @@ -1672,7 +1672,7 @@ static int op_file_subr(ap_expr_eval_ctx_t *ctx, const void *data, const char *a return FALSE; } rsub = ap_sub_req_lookup_file(arg, 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, ctx->p) == APR_SUCCESS) { rc = TRUE; diff --git a/test/modules/http1/mod_h1test/mod_h1test.c b/test/modules/http1/mod_h1test/mod_h1test.c index cbd87b5b6c1..8c5ac4a42f9 100644 --- a/test/modules/http1/mod_h1test/mod_h1test.c +++ b/test/modules/http1/mod_h1test/mod_h1test.c @@ -60,7 +60,7 @@ static int h1test_echo_handler(request_rec *r) } ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "echo_handler: processing request"); - r->status = 200; + r->status = HTTP_OK; r->clength = -1; r->chunked = 1; ct = apr_table_get(r->headers_in, "content-type"); diff --git a/test/modules/http2/mod_h2test/mod_h2test.c b/test/modules/http2/mod_h2test/mod_h2test.c index f20b9547e70..59a606b6449 100644 --- a/test/modules/http2/mod_h2test/mod_h2test.c +++ b/test/modules/http2/mod_h2test/mod_h2test.c @@ -186,7 +186,7 @@ static int h2test_echo_handler(request_rec *r) } ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "echo_handler: processing request"); - r->status = 200; + r->status = HTTP_OK; r->clength = -1; r->chunked = 1; apr_table_unset(r->headers_out, "Content-Length"); @@ -290,7 +290,7 @@ static int h2test_delay_handler(request_rec *r) ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "delay_handler: processing request, %ds delay", (int)apr_time_sec(delay)); - r->status = 200; + r->status = HTTP_OK; r->clength = -1; r->chunked = 1; apr_table_unset(r->headers_out, "Content-Length"); @@ -373,7 +373,7 @@ static int h2test_trailer_handler(request_rec *r) ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r, "trailer_handler: processing request, %d body length", body_len); - r->status = 200; + r->status = HTTP_OK; r->clength = body_len; ap_set_content_length(r, body_len); @@ -437,7 +437,7 @@ static int h2test_error_handler(request_rec *r) long l; apr_time_t delay = 0, body_delay = 0; apr_array_header_t *args = NULL; - int http_status = 200; + int http_status = HTTP_OK; apr_status_t error = APR_SUCCESS, body_error = APR_SUCCESS; if (strcmp(r->handler, "h2test-error")) {