Commit 041282f8 authored by Stefan Fritsch's avatar Stefan Fritsch
Browse files

Avoid some memory allocations by using apr_table_setn where the string arguments

are allocated from the request pool and not modified later on.

Submitted by: Christophe JAILLET <christophe jaillet wanadoo fr>
PR: 51358


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1135084 13f79535-47bb-0310-9956-ffa450edef68
parent 414b5feb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -832,7 +832,7 @@ static void fake_basic_authentication(request_rec *r, auth_form_config_rec *conf
        char *base64 = apr_palloc(r->pool,
                                  apr_base64_encode_len(size + 1) * sizeof(char));
        apr_base64_encode(base64, basic, size);
        apr_table_set(r->headers_in, "Authorization",
        apr_table_setn(r->headers_in, "Authorization",
                       apr_pstrcat(r->pool, "Basic ", base64, NULL));
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -2667,7 +2667,7 @@ static int dav_method_copymove(request_rec *r, int is_move)
        if (lookup.rnew->status == HTTP_UNAUTHORIZED && auth != NULL) {
            /* propagate the WWW-Authorization header up from the
             * subreq so the client sees it. */
            apr_table_set(r->err_headers_out, "WWW-Authenticate",
            apr_table_setn(r->err_headers_out, "WWW-Authenticate",
                           apr_pstrdup(r->pool, auth));
        }

@@ -3148,7 +3148,7 @@ static int dav_method_lock(request_rec *r)
                                        lock->locktoken),
                                    ">", NULL);

        apr_table_set(r->headers_out, "Lock-Token", locktoken_txt);
        apr_table_setn(r->headers_out, "Lock-Token", locktoken_txt);
    }

    (*locks_hooks->close_lockdb)(lockdb);
+2 −2
Original line number Diff line number Diff line
@@ -4482,7 +4482,7 @@ static int hook_uri2file(request_rec *r)
         *  now apply the rules ...
         */
        rulestatus = apply_rewrite_list(r, conf->rewriterules, NULL);
        apr_table_set(r->notes,"mod_rewrite_rewritten",
        apr_table_setn(r->notes, "mod_rewrite_rewritten",
                       apr_psprintf(r->pool,"%d",rulestatus));
    }
    else {
+2 −2
Original line number Diff line number Diff line
@@ -880,7 +880,7 @@ static int proxy_handler(request_rec *r)
        maxfwd = conf->maxfwd;
    }
    if (maxfwd >= 0) {
        apr_table_set(r->headers_in, "Max-Forwards",
        apr_table_setn(r->headers_in, "Max-Forwards",
                       apr_psprintf(r->pool, "%ld", maxfwd));
    }

+2 −2
Original line number Diff line number Diff line
@@ -1165,7 +1165,7 @@ static int proxy_ftp_handler(request_rec *r, proxy_worker *worker,
                break;
        if (*secs_str != '\0') {
            secs = atol(secs_str);
            apr_table_add(r->headers_out, "Retry-After",
            apr_table_addn(r->headers_out, "Retry-After",
                           apr_psprintf(p, "%lu", (unsigned long)(60 * secs)));
        }
        return ftp_proxyerror(r, backend, HTTP_SERVICE_UNAVAILABLE, ftpmessage);
Loading