Add ssi.content-type option (default text/html, fixes #615)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2519 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.23
Stefan Bühler 14 years ago
parent 2f4120b37b
commit bcc65ae59f

@ -49,6 +49,7 @@ NEWS
* Allow using pcre with cross-compiling (pcre-config got fixed; fixes #1986)
* Add "lighty.req_env" table to mod_magnet for setting/getting environment values for cgi (fixes #1967, thx presbrey)
* Fix segfault in mod_expire after failed config parsing (fixes #1992)
* Add ssi.content-type option (default text/html, fixes #615)
- 1.4.22 - 2009-03-07
* Fix wrong lua type for CACHE_MISS/CACHE_HIT in mod_cml (fixes #533)

@ -70,6 +70,7 @@ FREE_FUNC(mod_ssi_free) {
plugin_config *s = p->config_storage[i];
array_free(s->ssi_extension);
buffer_free(s->content_type);
free(s);
}
@ -101,6 +102,7 @@ SETDEFAULTS_FUNC(mod_ssi_set_defaults) {
config_values_t cv[] = {
{ "ssi.extension", NULL, T_CONFIG_ARRAY, T_CONFIG_SCOPE_CONNECTION }, /* 0 */
{ "ssi.content-type", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_CONNECTION }, /* 1 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@ -113,8 +115,10 @@ SETDEFAULTS_FUNC(mod_ssi_set_defaults) {
s = calloc(1, sizeof(plugin_config));
s->ssi_extension = array_init();
s->content_type = buffer_init();
cv[0].destination = s->ssi_extension;
cv[1].destination = s->content_type;
p->config_storage[i] = s;
@ -1063,7 +1067,11 @@ static int mod_ssi_handle_request(server *srv, connection *con, plugin_data *p)
con->file_finished = 1;
con->mode = p->id;
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
if (p->conf.content_type->used <= 1) {
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_STR_LEN("text/html"));
} else {
response_header_overwrite(srv, con, CONST_STR_LEN("Content-Type"), CONST_BUF_LEN(p->conf.content_type));
}
{
/* Generate "ETag" & "Last-Modified" headers */
@ -1102,6 +1110,7 @@ static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p
plugin_config *s = p->config_storage[0];
PATCH(ssi_extension);
PATCH(content_type);
/* skip the first, the global context */
for (i = 1; i < srv->config_context->used; i++) {
@ -1117,6 +1126,8 @@ static int mod_ssi_patch_connection(server *srv, connection *con, plugin_data *p
if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssi.extension"))) {
PATCH(ssi_extension);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssi.content-type"))) {
PATCH(content_type);
}
}
}

@ -15,6 +15,7 @@
typedef struct {
array *ssi_extension;
buffer *content_type;
} plugin_config;
typedef struct {

Loading…
Cancel
Save