-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
71 additions
and
219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/src/request.c b/src/request.c | ||
index 3a22e110..e684f7c6 100644 | ||
--- a/src/request.c | ||
+++ b/src/request.c | ||
@@ -1222,9 +1222,10 @@ http_request_parse (request_st * const restrict r, const int scheme_port) | ||
} | ||
|
||
if (0 == r->reqbody_length) { | ||
- /* POST requires Content-Length (or Transfer-Encoding) | ||
+ /* POST generally expects Content-Length (or Transfer-Encoding) | ||
* (-1 == r->reqbody_length when Transfer-Encoding: chunked)*/ | ||
if (HTTP_METHOD_POST == r->http_method | ||
+ && r->http_version <= HTTP_VERSION_1_1 | ||
&& !light_btst(r->rqst_htags, HTTP_HEADER_CONTENT_LENGTH)) { | ||
return http_request_header_line_invalid(r, 411, "POST-request, but content-length missing -> 411"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/src/mod_ssi.c b/src/mod_ssi.c | ||
index 11659927..bc0ee3b8 100644 | ||
--- a/src/mod_ssi.c | ||
+++ b/src/mod_ssi.c | ||
@@ -1160,6 +1160,9 @@ static int process_ssi_stmt(request_st * const r, handler_ctx * const p, const c | ||
/* send cmd output to a temporary file */ | ||
if (0 != chunkqueue_append_mem_to_tempfile(cq, "", 0, errh)) break; | ||
c = cq->last; | ||
+ off_t flen = c->file.length; | ||
+ if (flen && flen != lseek(c->file.fd, flen, SEEK_SET)) | ||
+ log_perror(errh, __FILE__, __LINE__, "lseek failed"); | ||
|
||
int status = 0; | ||
struct stat stb; | ||
@@ -1184,7 +1187,7 @@ static int process_ssi_stmt(request_st * const r, handler_ctx * const p, const c | ||
if (0 == fstat(c->file.fd, &stb)) { | ||
} | ||
} | ||
- chunkqueue_update_file(cq, c, stb.st_size); | ||
+ chunkqueue_update_file(cq, c, stb.st_size - flen); | ||
break; | ||
} | ||
case SSI_IF: { | ||
diff --git a/src/t/test_mod_ssi.c b/src/t/test_mod_ssi.c | ||
index 622e29ea..32d5b01d 100644 | ||
--- a/src/t/test_mod_ssi.c | ||
+++ b/src/t/test_mod_ssi.c | ||
@@ -87,20 +87,22 @@ test_mod_ssi_read_fd (request_st * const r, handler_ctx * const hctx) | ||
assert(NULL == cq->first); | ||
|
||
#ifndef _WIN32 /* TODO: command for cmd.exe */ | ||
+ const char ssi_exec2[] = | ||
+ "result: <!--#exec cmd=\"expr 1 + 1\"-->"; | ||
hctx->conf.ssi_exec = 1; | ||
- test_mod_ssi_write_testfile(fd, ssi_exec, sizeof(ssi_exec)-1); | ||
+ test_mod_ssi_write_testfile(fd, ssi_exec2, sizeof(ssi_exec2)-1); | ||
test_mod_ssi_reset(r, hctx); | ||
mod_ssi_read_fd(r, hctx, &st, fd); | ||
assert(cq->first); | ||
assert(cq->first->type == FILE_CHUNK); | ||
- assert(2 == chunkqueue_length(cq)); | ||
+ assert(10 == chunkqueue_length(cq)); | ||
char buf[80]; | ||
if (0 != lseek(cq->first->file.fd, 0, SEEK_SET) | ||
- || 2 != read(cq->first->file.fd, buf, sizeof(buf))) { | ||
+ || 10 != read(cq->first->file.fd, buf, sizeof(buf))) { | ||
perror("lseek(),read()"); | ||
exit(1); | ||
} | ||
- assert(0 == memcmp(buf, "2\n", 2)); | ||
+ assert(0 == memcmp(buf, "result: 2\n", 10)); | ||
hctx->conf.ssi_exec = 0; | ||
#endif | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.