From c5b0b54de93f0af835976f64113ec1e725eadac0 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Wed, 19 Aug 2015 14:13:49 +0000 Subject: [PATCH] mod_h2 compiles warning free in maintainer-mode git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1696592 13f79535-47bb-0310-9956-ffa450edef68 --- modules/http2/h2_alt_svc.c | 4 +- modules/http2/h2_conn.c | 3 +- modules/http2/h2_from_h1.c | 81 -------------------------------------- modules/http2/h2_request.c | 2 +- modules/http2/h2_switch.c | 3 -- 5 files changed, 4 insertions(+), 89 deletions(-) diff --git a/modules/http2/h2_alt_svc.c b/modules/http2/h2_alt_svc.c index 9db208149e..ab1d726484 100644 --- a/modules/http2/h2_alt_svc.c +++ b/modules/http2/h2_alt_svc.c @@ -42,13 +42,13 @@ void h2_alt_svc_register_hooks(void) * - do not use quotation marks */ h2_alt_svc *h2_alt_svc_parse(const char *s, apr_pool_t *pool) { - const char *sep = strchr(s, '='); + const char *sep = strchr((char *)s, '='); if (sep) { const char *alpn = apr_pstrndup(pool, s, sep - s); const char *host = NULL; int port = 0; s = sep + 1; - sep = strchr(s, ':'); /* mandatory : */ + sep = strchr((char *)s, ':'); /* mandatory : */ if (sep) { if (sep != s) { /* optional host */ host = apr_pstrndup(pool, s, sep - s); diff --git a/modules/http2/h2_conn.c b/modules/http2/h2_conn.c index 1d4d704ecc..df1de9e7d3 100644 --- a/modules/http2/h2_conn.c +++ b/modules/http2/h2_conn.c @@ -132,7 +132,7 @@ h2_mpm_type_t h2_conn_mpm_type(void) { return mpm_type; } -module *h2_conn_mpm_module(void) { +static module *h2_conn_mpm_module(void) { check_modules(); return mpm_module; } @@ -366,7 +366,6 @@ conn_rec *h2_conn_create(conn_rec *master, apr_pool_t *pool) apr_status_t h2_conn_setup(h2_task_env *env, struct h2_worker *worker) { conn_rec *master = env->mplx->c; - h2_config *cfg = h2_config_get(master); ap_log_perror(APLOG_MARK, APLOG_TRACE3, 0, env->pool, "h2_conn(%ld): created from master", master->id); diff --git a/modules/http2/h2_from_h1.c b/modules/http2/h2_from_h1.c index a382f3311a..be11f5c317 100644 --- a/modules/http2/h2_from_h1.c +++ b/modules/http2/h2_from_h1.c @@ -313,86 +313,6 @@ static void fix_vary(request_rec *r) } } -/* Confirm that the status line is well-formed and matches r->status. - * If they don't match, a filter may have negated the status line set by a - * handler. - * Zap r->status_line if bad. - */ -static apr_status_t validate_status_line(request_rec *r) -{ - char *end; - - if (r->status_line) { - apr_size_t len = strlen(r->status_line); - if (len < 3 - || apr_strtoi64(r->status_line, &end, 10) != r->status - || (end - 3) != r->status_line - || (len >= 4 && ! apr_isspace(r->status_line[3]))) { - r->status_line = NULL; - return APR_EGENERAL; - } - /* Since we passed the above check, we know that length three - * is equivalent to only a 3 digit numeric http status. - * RFC2616 mandates a trailing space, let's add it. - */ - if (len == 3) { - r->status_line = apr_pstrcat(r->pool, r->status_line, " ", NULL); - return APR_EGENERAL; - } - return APR_SUCCESS; - } - return APR_EGENERAL; -} - -/* - * Determine the protocol to use for the response. Potentially downgrade - * to HTTP/1.0 in some situations and/or turn off keepalives. - * - * also prepare r->status_line. - */ -static void basic_http_header_check(request_rec *r, - const char **protocol) -{ - apr_status_t rv; - - if (r->assbackwards) { - /* no such thing as a response protocol */ - return; - } - - rv = validate_status_line(r); - - if (!r->status_line) { - r->status_line = ap_get_status_line(r->status); - } else if (rv != APR_SUCCESS) { - /* Status line is OK but our own reason phrase - * would be preferred if defined - */ - const char *tmp = ap_get_status_line(r->status); - if (!strncmp(tmp, r->status_line, 3)) { - r->status_line = tmp; - } - } - - /* Note that we must downgrade before checking for force responses. */ - if (r->proto_num > HTTP_VERSION(1,0) - && apr_table_get(r->subprocess_env, "downgrade-1.0")) { - r->proto_num = HTTP_VERSION(1,0); - } - - /* kludge around broken browsers when indicated by force-response-1.0 - */ - if (r->proto_num == HTTP_VERSION(1,0) - && apr_table_get(r->subprocess_env, "force-response-1.0")) { - *protocol = "HTTP/1.0"; - r->connection->keepalive = AP_CONN_CLOSE; - } - else { - *protocol = AP_SERVER_PROTOCOL; - } - -} - static void set_basic_http_header(request_rec *r, apr_table_t *headers) { char *date = NULL; @@ -444,7 +364,6 @@ static int copy_header(void *ctx, const char *name, const char *value) static h2_response *create_response(h2_from_h1 *from_h1, request_rec *r) { - apr_status_t status = APR_SUCCESS; const char *clheader; const char *ctype; apr_table_t *headers; diff --git a/modules/http2/h2_request.c b/modules/http2/h2_request.c index 5653a40233..83fa085600 100644 --- a/modules/http2/h2_request.c +++ b/modules/http2/h2_request.c @@ -58,7 +58,7 @@ apr_status_t h2_request_rwrite(h2_request *req, request_rec *r, h2_mplx *m) req->method = r->method; req->authority = r->hostname; req->path = r->uri; - if (!strchr(req->authority, ':') && r->parsed_uri.port_str) { + if (!strchr((char *)req->authority, ':') && r->parsed_uri.port_str) { req->authority = apr_psprintf(req->pool, "%s:%s", req->authority, r->parsed_uri.port_str); } diff --git a/modules/http2/h2_switch.c b/modules/http2/h2_switch.c index ae138ace44..68db770adf 100644 --- a/modules/http2/h2_switch.c +++ b/modules/http2/h2_switch.c @@ -57,9 +57,6 @@ apr_status_t h2_switch_init(apr_pool_t *pool, server_rec *s) return APR_SUCCESS; } -static const char *const mod_ssl[] = { "mod_ssl.c", NULL}; -static const char *const mod_core[] = { "core.c", NULL}; - static int h2_protocol_propose(conn_rec *c, request_rec *r, server_rec *s, const apr_array_header_t *offers, -- 2.40.0