https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412019-01-09T07:58:27Zlighty labsLighttpd - Feature #2924: Suboptimal keep-alive handling when request body is not readhttps://redmine.lighttpd.net/issues/2924?journal_id=116222019-01-09T07:58:27Zhelmut
<ul></ul>I should also mention relevant versions:
<ul>
<li>Not reproducible on 1.4.35</li>
<li>Reproducible on 1.4.45</li>
<li>Reproducible on 1.4.52</li>
</ul> Lighttpd - Feature #2924: Suboptimal keep-alive handling when request body is not readhttps://redmine.lighttpd.net/issues/2924?journal_id=116232019-01-09T23:57:12Zgstrauss
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Feature</i></li><li><strong>Target version</strong> changed from <i>1.4.x</i> to <i>1.4.53</i></li></ul><blockquote>
<p>A remote client may be unprepared for such a shutdown, because lighttpd did not include a "Connection: close" header in its reply and attempt a second request on the same connection.</p>
</blockquote>
<p>That is a bug, but not in lighttpd.</p>
<p>This ticket is a feature request.</p>
<p>The patch as provided is too blunt. As noted, it may result in premature closure of keep-alive connections when <code>server.stream-request-body = 1</code> is in use and the backend has not yet read the full request body.</p>
<p>The following might be a better solution, since it will trigger "Connection: close" if the response body has not been fully read <em>and</em> one of: there is no backend which might be streaming the request body or there is no streaming request body. The short-circuit to check for any content length in the patch below is because many requests are GET requests without a request body.</p>
<pre>
/* disable keep-alive if requested */
if (con->request_count > con->conf.max_keep_alive_requests || 0 == con->conf.max_keep_alive_idle) {
con->keep_alive = 0;
+ } else if (0 != con->request.content_length
+ && con->request.content_length != con->request_content_queue->bytes_in
+ && (con->mode == DIRECT || 0 == con->conf.stream_request_body)) {
+ con->keep_alive = 0;
} else {
con->keep_alive_idle = con->conf.max_keep_alive_idle;
}
</pre> Lighttpd - Feature #2924: Suboptimal keep-alive handling when request body is not readhttps://redmine.lighttpd.net/issues/2924?journal_id=116242019-01-10T07:25:06Zgstrauss
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Fixed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset <a class="changeset" title="[core] send Connection: close if reqbody not read (fixes #2924) send Connection: close if it is ..." href="https://redmine.lighttpd.net/projects/lighttpd/repository/14/revisions/629b16f188173b1d4d7434fc68fb85938b2fc582">629b16f188173b1d4d7434fc68fb85938b2fc582</a>.</p> Lighttpd - Feature #2924: Suboptimal keep-alive handling when request body is not readhttps://redmine.lighttpd.net/issues/2924?journal_id=116252019-01-10T07:37:36Zhelmut
<ul></ul><p>Thank you for your review and fixing the issue with improved checks. I expect that your version fully resolves the pratical problems I'm seeing.</p>