- Print error if X-LIGHTTPD-send-file cannot be done; reset header Content-Length for send-file.
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2034 152afb58-edef-0310-8abb-c4023f1b3aa9
This commit is contained in:
parent
bdd2fce478
commit
95769fb3f6
2
NEWS
2
NEWS
|
@ -12,6 +12,8 @@ NEWS
|
|||
* execute fcgi app without /bin/sh if used as argument to spawn-fcgi (#1428)
|
||||
* fixed a bug that made /-prefixed fcgi extensions being handled also when
|
||||
matching the end of the uri (#1489)
|
||||
* Print error if X-LIGHTTPD-send-file cannot be done; reset header
|
||||
Content-Length for send-file. Patches by Stefan Bühler
|
||||
|
||||
- 1.4.18 - 2007-09-09
|
||||
|
||||
|
|
|
@ -2530,15 +2530,28 @@ static int fcgi_demux_response(server *srv, handler_ctx *hctx) {
|
|||
}
|
||||
|
||||
if (host->allow_xsendfile &&
|
||||
NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))) {
|
||||
(NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-LIGHTTPD-send-file"))
|
||||
|| NULL != (ds = (data_string *) array_get_element(con->response.headers, "X-Sendfile")))) {
|
||||
stat_cache_entry *sce;
|
||||
|
||||
if (HANDLER_ERROR != stat_cache_get_entry(srv, con, ds->value, &sce)) {
|
||||
data_string *dcls = data_string_init();
|
||||
/* found */
|
||||
|
||||
http_chunk_append_file(srv, con, ds->value, 0, sce->st.st_size);
|
||||
hctx->send_content_body = 0; /* ignore the content */
|
||||
joblist_append(srv, con);
|
||||
|
||||
buffer_copy_string_len(dcls->key, "Content-Length", sizeof("Content-Length")-1);
|
||||
buffer_copy_long(dcls->value, sce->st.st_size);
|
||||
dcls = (data_string*) array_replace(con->response.headers, (data_unset *)dcls);
|
||||
if (dcls) dcls->free((data_unset*)dcls);
|
||||
|
||||
con->parsed_response |= HTTP_CONTENT_LENGTH;
|
||||
con->response.content_length = sce->st.st_size;
|
||||
} else {
|
||||
log_error_write(srv, __FILE__, __LINE__, "sb",
|
||||
"send-file error: couldn't get stat_cache entry for:",
|
||||
ds->value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@ int http_response_write_header(server *srv, connection *con) {
|
|||
ds = (data_string *)con->response.headers->data[i];
|
||||
|
||||
if (ds->value->used && ds->key->used &&
|
||||
0 != strncmp(ds->key->ptr, "X-LIGHTTPD-", sizeof("X-LIGHTTPD-") - 1)) {
|
||||
0 != strncmp(ds->key->ptr, "X-LIGHTTPD-", sizeof("X-LIGHTTPD-") - 1) &&
|
||||
0 != strncmp(ds->key->ptr, "X-Sendfile", sizeof("X-Sendfile") - 1)) {
|
||||
if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Date"))) have_date = 1;
|
||||
if (buffer_is_equal_string(ds->key, CONST_STR_LEN("Server"))) have_server = 1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue