Do not set headers twice.

For historic reasons, we added several headers to both "headers_out"
and "err_headers_out". This has the unfortunate side effect of sending
the headers twice. This change modifies the code to only add those
headers to "err_headers_out", which is sent both for successful
requests and for errors.

git-svn-id: https://modmellon.googlecode.com/svn/trunk/mod_mellon2@145 a716ebb1-153a-0410-b759-cfb97c6a1b53
This commit is contained in:
olavmrk 2012-01-12 13:30:39 +00:00
parent aca9396809
commit 3ebab79c16
2 changed files with 4 additions and 14 deletions

View File

@ -166,12 +166,9 @@ void am_cookie_set(request_rec *r, const char *id)
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"cookie_set: %s", cookie);
/* For now we're setting the cookie in both header tables since
* it is unclear which the user will be sent. After a minor release
* this suddenly changed from headers_out to err_headers_out, so to
* be on the safe side...
/* Setting the headers inn err_headers_out ensures that they will be
* sent for all responses.
*/
apr_table_addn(r->headers_out, "Set-Cookie", cookie);
apr_table_addn(r->err_headers_out, "Set-Cookie", cookie);
/* Add a note on the current request, to allow us to retrieve this
@ -208,6 +205,5 @@ void am_cookie_delete(request_rec *r)
" path=/",
name);
apr_table_addn(r->headers_out, "Set-Cookie", cookie);
apr_table_addn(r->err_headers_out, "Set-Cookie", cookie);
}

View File

@ -405,13 +405,9 @@ void am_set_nocache(request_rec *r)
{
const char *user_agent;
/* We set headers in both r->headers_out and r->err_headers_out, so that
* we can be sure that they will be included.
/* Setting the headers inn err_headers_out ensures that they will be
* sent for all responses.
*/
apr_table_setn(r->headers_out,
"Expires", "Thu, 01 Jan 1970 00:00:00 GMT");
apr_table_setn(r->headers_out,
"Cache-Control", "private, must-revalidate");
apr_table_setn(r->err_headers_out,
"Expires", "Thu, 01 Jan 1970 00:00:00 GMT");
apr_table_setn(r->err_headers_out,
@ -424,8 +420,6 @@ void am_set_nocache(request_rec *r)
if ((user_agent == NULL) ||
(strstr(user_agent, "compatible; MSIE ") == NULL) ||
(strstr(user_agent, "Opera") != NULL)) {
apr_table_addn(r->headers_out,
"Cache-Control", "no-cache, no-store");
apr_table_addn(r->err_headers_out,
"Cache-Control", "no-cache, no-store");
}