From: Jim Jagielski Date: Thu, 2 Jul 2026 19:54:30 +0000 (+0000) Subject: *) Constify static arrays of string constants. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=95e4ddaaa01d6f38e0773ba4ba49e299ede77422;p=thirdparty%2Fapache%2Fhttpd.git *) Constify static arrays of string constants. trunk patch: https://svn.apache.org/r1933659 git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1935817 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 183006a768..f0b832b089 100644 --- a/STATUS +++ b/STATUS @@ -163,11 +163,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) Constify static arrays of string constants. - trunk patch: https://svn.apache.org/r1933659 - 2.4.x patch: svn merge -c 1933659 ^/httpd/httpd/trunk . - +1: rjung, jorton, jim - *) include/httpd.h: Define HTTP_EARLY_HINTS (103) per RFC 8297. modules/http/http_protocol.c (status_lines): Add 103 response. Needed by backport 1934913 below. diff --git a/modules/cache/mod_cache.c b/modules/cache/mod_cache.c index 3b4469ef79..9392e77043 100644 --- a/modules/cache/mod_cache.c +++ b/modules/cache/mod_cache.c @@ -39,7 +39,7 @@ static ap_filter_rec_t *cache_invalidate_filter_handle; /** * Entity headers' names */ -static const char *MOD_CACHE_ENTITY_HEADERS[] = { +static const char *const MOD_CACHE_ENTITY_HEADERS[] = { "Allow", "Content-Encoding", "Content-Language", @@ -819,7 +819,7 @@ static apr_status_t cache_save_filter(ap_filter_t *f, apr_bucket_brigade *in) apr_time_t exp, date, lastmod, now; apr_off_t size = -1; cache_info *info = NULL; - const char *reason, **eh; + const char *reason, *const *eh; apr_pool_t *p; apr_bucket *e; apr_table_t *headers; diff --git a/modules/filters/mod_proxy_html.c b/modules/filters/mod_proxy_html.c index f05ba1e158..c629614037 100644 --- a/modules/filters/mod_proxy_html.c +++ b/modules/filters/mod_proxy_html.c @@ -1304,7 +1304,7 @@ static void proxy_html_insert(request_rec *r) } static void proxy_html_hooks(apr_pool_t *p) { - static const char *aszSucc[] = { "mod_filter.c", NULL }; + static const char *const aszSucc[] = { "mod_filter.c", NULL }; ap_register_output_filter_protocol("proxy-html", proxy_html_filter, NULL, AP_FTYPE_RESOURCE, AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH); diff --git a/modules/http2/h2_protocol.c b/modules/http2/h2_protocol.c index 874753e498..84a17ef894 100644 --- a/modules/http2/h2_protocol.c +++ b/modules/http2/h2_protocol.c @@ -58,7 +58,7 @@ const char *H2_MAGIC_TOKEN = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"; /******************************************************************************* * HTTP/2 error stuff */ -static const char *h2_err_descr[] = { +static const char *const h2_err_descr[] = { "no error", /* 0x0 */ "protocol error", "internal error", @@ -91,7 +91,7 @@ const char *h2_protocol_err_description(unsigned int h2_error) * Black Listed Ciphers from RFC 7549 Appendix A * */ -static const char *RFC7540_names[] = { +static const char *const RFC7540_names[] = { /* ciphers with NULL encrpytion */ "NULL-MD5", /* TLS_NULL_WITH_NULL_NULL */ /* same */ /* TLS_RSA_WITH_NULL_MD5 */ diff --git a/modules/http2/h2_proxy_session.c b/modules/http2/h2_proxy_session.c index 3561c241e1..166b6468f1 100644 --- a/modules/http2/h2_proxy_session.c +++ b/modules/http2/h2_proxy_session.c @@ -1188,7 +1188,7 @@ static apr_status_t session_shutdown(h2_proxy_session *session, int reason, } -static const char *StateNames[] = { +static const char *const StateNames[] = { "INIT", /* H2_PROXYS_ST_INIT */ "DONE", /* H2_PROXYS_ST_DONE */ "IDLE", /* H2_PROXYS_ST_IDLE */ diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index dda6c77178..3affaf2a20 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -1416,7 +1416,7 @@ static void on_stream_output(void *ctx, h2_stream *stream) } -static const char *StateNames[] = { +static const char *const StateNames[] = { "INIT", /* H2_SESSION_ST_INIT */ "DONE", /* H2_SESSION_ST_DONE */ "IDLE", /* H2_SESSION_ST_IDLE */ diff --git a/modules/loggers/mod_logio.c b/modules/loggers/mod_logio.c index b609f7f270..4c764ed3f3 100644 --- a/modules/loggers/mod_logio.c +++ b/modules/loggers/mod_logio.c @@ -254,7 +254,7 @@ static const command_rec logio_cmds[] = { static void register_hooks(apr_pool_t *p) { - static const char *pre[] = { "mod_log_config.c", NULL }; + static const char *const pre[] = { "mod_log_config.c", NULL }; ap_hook_pre_connection(logio_pre_conn, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_pre_config(logio_pre_config, NULL, NULL, APR_HOOK_REALLY_FIRST); diff --git a/modules/mappers/mod_speling.c b/modules/mappers/mod_speling.c index 2ed65eb810..99b8765416 100644 --- a/modules/mappers/mod_speling.c +++ b/modules/mappers/mod_speling.c @@ -125,7 +125,7 @@ typedef enum { SP_VERYDIFFERENT = 6 } sp_reason; -static const char *sp_reason_str[] = +static const char *const sp_reason_str[] = { "identical", "miscapitalized", diff --git a/modules/md/md_log.c b/modules/md/md_log.c index d236e0f088..1b85b3db16 100644 --- a/modules/md/md_log.c +++ b/modules/md/md_log.c @@ -22,7 +22,7 @@ #define LOG_BUFFER_LEN 1024 -static const char *level_names[] = { +static const char *const level_names[] = { "emergency", "alert", "crit", diff --git a/modules/md/md_store.c b/modules/md/md_store.c index 5ed0848f99..381bbbc4a2 100644 --- a/modules/md/md_store.c +++ b/modules/md/md_store.c @@ -47,7 +47,7 @@ #define GNAME_STAGING #define GNAME_ARCHIVE -static const char *GROUP_NAME[] = { +static const char *const GROUP_NAME[] = { "none", "accounts", "challenges", diff --git a/modules/proxy/ajp_header.c b/modules/proxy/ajp_header.c index 334d0aebb1..af2f27b241 100644 --- a/modules/proxy/ajp_header.c +++ b/modules/proxy/ajp_header.c @@ -21,7 +21,7 @@ APLOG_USE_MODULE(proxy_ajp); -static const char *response_trans_headers[] = { +static const char *const response_trans_headers[] = { "Content-Type", "Content-Language", "Content-Length", diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index bd57b4d936..9ab7147a65 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -772,7 +772,7 @@ static request_rec *make_fake_req(conn_rec *c, request_rec *r) static void process_proxy_header(request_rec *r, proxy_dir_conf *c, const char *key, const char *value) { - static const char *date_hdrs[] + static const char *const date_hdrs[] = { "Date", "Expires", "Last-Modified", NULL }; static const struct { const char *name; @@ -1038,7 +1038,7 @@ int ap_proxy_http_process_response(proxy_http_req_t *req) int pread_len = 0; apr_table_t *save_table; int backend_broke = 0; - static const char *hop_by_hop_hdrs[] = + static const char *const hop_by_hop_hdrs[] = {"Keep-Alive", "Proxy-Authenticate", "TE", "Trailer", "Upgrade", NULL}; int i; const char *te = NULL; diff --git a/modules/ssl/mod_ssl.c b/modules/ssl/mod_ssl.c index c0fdafd582..c04cc148c9 100644 --- a/modules/ssl/mod_ssl.c +++ b/modules/ssl/mod_ssl.c @@ -714,12 +714,12 @@ static void ssl_register_hooks(apr_pool_t *p) { /* ssl_hook_ReadReq needs to use the BrowserMatch settings so must * run after mod_setenvif's post_read_request hook. */ - static const char *pre_prr[] = { "mod_setenvif.c", NULL }; + static const char *const pre_prr[] = { "mod_setenvif.c", NULL }; /* The ssl_init_Module post_config hook should run before mod_proxy's * for the ssl proxy main configs to be merged with vhosts' before being * themselves merged with mod_proxy's in proxy_hook_section_post_config. */ - static const char *b_pc[] = { "mod_proxy.c", NULL}; + static const char *const b_pc[] = { "mod_proxy.c", NULL}; ssl_io_filter_register(p); diff --git a/server/protocol.c b/server/protocol.c index 6f9540ad1d..3a989cfb04 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -76,7 +76,7 @@ AP_DECLARE_DATA ap_filter_rec_t *ap_old_write_func = NULL; /* Patterns to match in ap_make_content_type() */ -static const char *needcset[] = { +static const char *const needcset[] = { "text/plain", "text/html", NULL