Browse Source

- Combine Cache-Control header value in mod_expire to existing HTTP header if header already added by other modules (fixes #2068)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2621 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.24
Elan Ruusamäe 12 years ago
parent
commit
6c75b7bf24
  1. 1
      NEWS
  2. 15
      src/http-header-glue.c
  3. 2
      src/mod_expire.c
  4. 1
      src/response.h

1
NEWS

@ -36,6 +36,7 @@ NEWS
* Set tm.tm_isdst = 0 before mktime() (fixes #2047)
* Use linux-epoll by default if available (fixes #2021, thx Olaf van der Spek)
* Print an error if you use too many captures in a regex pattern (fixes #2059)
* Combine Cache-Control header value in mod_expire to existing HTTP header if header already added by other modules (fixes #2068)
- 1.4.23 - 2009-06-19
* Added some extra warning options in cmake and fix the resulting warnings (unused/static functions)

15
src/http-header-glue.c

@ -104,6 +104,21 @@ int response_header_overwrite(server *srv, connection *con, const char *key, siz
return response_header_insert(srv, con, key, keylen, value, vallen);
}
int response_header_append(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen) {
data_string *ds;
UNUSED(srv);
/* if there already is a key by this name append the value */
if (NULL != (ds = (data_string *)array_get_element(con->response.headers, key))) {
buffer_append_string_len(ds->value, CONST_STR_LEN(", "));
buffer_append_string_len(ds->value, value, vallen);
return 0;
}
return response_header_insert(srv, con, key, keylen, value, vallen);
}
int http_response_redirect_to_directory(server *srv, connection *con) {
buffer *o;

2
src/mod_expire.c

@ -342,7 +342,7 @@ URIHANDLER_FUNC(mod_expire_path_handler) {
buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
buffer_append_long(p->expire_tstmp, expires - srv->cur_ts); /* as expires >= srv->cur_ts the difference is >= 0 */
response_header_insert(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
response_header_append(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
return HANDLER_GO_ON;
}

1
src/response.h

@ -10,6 +10,7 @@ int http_response_write_header(server *srv, connection *con);
int response_header_insert(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
int response_header_overwrite(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
int response_header_append(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
handler_t http_response_prepare(server *srv, connection *con);
int http_response_redirect_to_directory(server *srv, connection *con);

Loading…
Cancel
Save