iodine
iodine copied to clipboard
Support X-Sendfile in response to a POST request
I don't see why this shouldn't be supported, NGINX and Apache do allow it.
Is there a chance of getting this merged at some point? I have a use case for this and would prefer to be able to use the official gem.
It would be nice to get some feedback on this. Without this using Rails send_file in response to a post request just ends up downloading a file containing "Forbidden", which is not ideal from any angle.
OMG, I'm so sorry, I totally missed this PR for some reason...
A quick look would suggest that this would be fine, but it will also effect the static file service (it will answer POST
requests... I believe that POST
requests should bypass the static file service to be processed as dynamic requests, no?
If we want X-Sendfile
to work when responding to POST
(but still be ignored by the static file service), that the PR should probably place this conditional in the http_on_request_handler______internal
handler just before the call to http_sendfile2
:
/* untested, written into the text box at GitHub, so... */
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,
path_str.len))
return;
}
OMG, I'm so sorry, I totally missed this PR for some reason...
No worries.
I didn't manage to push to this PR's branch for some reason, so I've opened #141 with the requested changes.
I manually tested that it makes X-Sendfile work for POST requests.