Browse Source

[core] add xsendfile* check if xdocroot is NULL

personal/stbuehler/ci-build
Glenn Strauss 3 years ago
parent
commit
858352f6e8
  1. 8
      src/http-header-glue.c
  2. 2
      src/response.h

8
src/http-header-glue.c

@ -633,7 +633,7 @@ static void http_response_xsendfile (server *srv, connection *con, buffer *path,
* - xdocroot should have trailing slash appended at config time
* - con->conf.force_lowercase_filenames is not a server-wide setting,
* and so can not be definitively applied to xdocroot at config time*/
if (xdocroot->used) {
if (xdocroot) {
size_t i, xlen = buffer_string_length(path);
for (i = 0; i < xdocroot->used; ++i) {
data_string *ds = (data_string *)xdocroot->data[i];
@ -645,7 +645,7 @@ static void http_response_xsendfile (server *srv, connection *con, buffer *path,
break;
}
}
if (i == xdocroot->used) {
if (i == xdocroot->used && 0 != i) {
log_error_write(srv, __FILE__, __LINE__, "SBs",
"X-Sendfile (", path,
") not under configured x-sendfile-docroot(s)");
@ -707,7 +707,7 @@ static void http_response_xsendfile2(server *srv, connection *con, const buffer
if (con->conf.force_lowercase_filenames) {
buffer_to_lower(b);
}
if (xdocroot->used) {
if (xdocroot) {
size_t i, xlen = buffer_string_length(b);
for (i = 0; i < xdocroot->used; ++i) {
data_string *ds = (data_string *)xdocroot->data[i];
@ -719,7 +719,7 @@ static void http_response_xsendfile2(server *srv, connection *con, const buffer
break;
}
}
if (i == xdocroot->used) {
if (i == xdocroot->used && 0 != i) {
log_error_write(srv, __FILE__, __LINE__, "SBs",
"X-Sendfile2 (", b,
") not under configured x-sendfile-docroot(s)");

2
src/response.h

@ -32,7 +32,7 @@ typedef struct http_response_opts_t {
int authorizer;
unsigned short local_redir;
unsigned short xsendfile_allow;
array *xsendfile_docroot;
const array *xsendfile_docroot;
void *pdata;
handler_t(*parse)(server *, connection *, struct http_response_opts_t *, buffer *, size_t);
handler_t(*headers)(server *, connection *, struct http_response_opts_t *);

Loading…
Cancel
Save