Message ID | 56152229.7010009@gmail.com |
---|---|
State | Rejected |
Headers | show |
Hi Luigi, thank you for your patch proposal, it prompted me to take a deeper look into the problem. The issue should be fixed with the following commit: http://nbd.name/gitweb.cgi?p=uhttpd2.git;a=commitdiff;h=7ed2edc40dd6d0171266f3bfbc96466e1d25e3cd Regards, Jow
thank you Jow for the promptly feedback. I tried to better understand the problem and now I'm reading at your commit. My patch works but is logically broken. I'm trying to produce a better one. If I'm not wrong the problem is this (without applying your commit): the client request handling code go though 3 steps (callback): CLIENT_STATE_INIT -> client_init_cb () CLIENT_STATE_HEADER -> client_header_cb () CLIENT_STATE_DATA -> client_data_cb () actually in the INIT portion we test for the http_code 204 or 304 but this is wrong, we still don't know if the client cached file is updated or not and I think the chunking code apply only to data, not headers. a 204 message have no data. this test should be done in the HEADER phase (uf_file_data call -> uf_file_if_unmodified_since) If for testing purpose we completely skip this test I think it's safe because in the HEADER phase (file.c line 617) if we are going to handle a file request we disable chunked writes. If we are going to handle a script this does not happens. to this add the fact that when we are going to execute a script after a file has been handled there is no place where cl->http_code get resetted. this trigger the bug. (for scripts only req->redirect_status = 200 is executed, file.c line 827) I'm going to try a new simple patch and then your suggested one. I will update you. regards Luigi On 10/08/2015 12:21 AM, Jo-Philipp Wich wrote: > Hi Luigi, > > thank you for your patch proposal, it prompted me to take a deeper look > into the problem. > > The issue should be fixed with the following commit: > > http://nbd.name/gitweb.cgi?p=uhttpd2.git;a=commitdiff;h=7ed2edc40dd6d0171266f3bfbc96466e1d25e3cd > > > Regards, > Jow > > > > _______________________________________________ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
--- file.c 2015-10-07 15:39:45.169056639 +0200 +++ file.c 2015-10-07 15:39:55.859056443 +0200 @@ -807,9 +807,10 @@ return true; d = dispatch_find(url, pi); - if (d) + if (d) { + cl->request.respond_chunked = true; uh_invoke_handler(cl, d, url, pi); - else + } else uh_file_request(cl, url, pi, tb); return true;