httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: mod_proxy duplicated its headers on next balancer's worker or 100-continue ping retries
Date Fri, 04 Apr 2014 16:22:39 GMT
This seems to change some logic which appear only tangentially
associated w/ the "save headers" issue... why is that?

On Apr 4, 2014, at 11:43 AM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
> Index: modules/proxy/mod_proxy_http.c
> ===================================================================
> --- modules/proxy/mod_proxy_http.c    (revision 1584652)
> +++ modules/proxy/mod_proxy_http.c    (working copy)
> @@ -717,24 +717,31 @@ int ap_proxy_http_request(apr_pool_t *p, request_r
>     apr_off_t bytes;
>     int force10, rv;
>     conn_rec *origin = p_conn->connection;
> +    apr_table_t *saved_headers_in;
> 
> -    if (apr_table_get(r->subprocess_env, "force-proxy-request-1.0")) {
> -        if (r->expecting_100) {
> -            return HTTP_EXPECTATION_FAILED;
> -        }
> -        force10 = 1;
> -    } else {
> -        force10 = 0;
> -    }
> +    /*
> +     * Save the original headers in here and restore them when leaving, since
> +     * we will apply proxy purpose only modifications (eg. cleanup hop-by-hop
> +     * headers, add Via or X-Forwarded-* or Expect...), whereas the original
> +     * headers may be needed later to prepare the correct response or logging.
> +     */
> +    saved_headers_in = r->headers_in;
> +    r->headers_in = apr_table_copy(r->pool, saved_headers_in);
> 
>     header_brigade = apr_brigade_create(p, bucket_alloc);
>     rv = ap_proxy_create_hdrbrgd(p, header_brigade, r, p_conn,
>                                  worker, conf, uri, url, server_portstr,
>                                  &old_cl_val, &old_te_val);
>     if (rv != OK) {
> -        return rv;
> +        goto cleanup;
> +cleanup:
> +    /* Restore the original headers in (see comment above),
> +     * we won't modify them anymore.
> +     */
> +    r->headers_in = saved_headers_in;
> +    return rv;
> }
> 

Uggg... I hate gotos. We only use them sparingly and when
breaking out of nasty, nasty code. Here, we are just doing so
to safe some cut/paste... -0


Mime
View raw message