Skip to content

Commit

Permalink
Merge pull request boazsegev#141 from fgoepel/patch-1
Browse files Browse the repository at this point in the history
Support X-Sendfile in response to a POST request
  • Loading branch information
boazsegev committed May 1, 2023
2 parents 0b0b47f + 338e3e9 commit 5de6dbd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ext/iodine/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,8 @@ int http_sendfile2(http_s *h, const char *prefix, size_t prefix_len,
http_set_header(h, HTTP_HEADER_CONTENT_LENGTH, fiobj_num_new(length));
http_finish(h);
return 0;
} else if (!strncasecmp("post", s.data, 4)) {
goto open_file;
}
break;
}
Expand Down
3 changes: 2 additions & 1 deletion ext/iodine/http_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ void http_on_request_handler______internal(http_s *h,
fiobj_hash_get2(h->headers, fiobj_obj2hash(HTTP_HEADER_ACCEPT)),
HTTP_HVALUE_SSE_MIME))
goto eventsource;
if (settings->public_folder) {
if (settings->public_folder &&
(fiobj_obj2cstr(h->method).len != 4 || strncasecmp("post", fiobj_obj2cstr(h->method).data, 4))) {
fio_str_info_s path_str = fiobj_obj2cstr(h->path);
if (!http_sendfile2(h, settings->public_folder,
settings->public_folder_length, path_str.data,
Expand Down

0 comments on commit 5de6dbd

Please sign in to comment.