Date: Mon, 21 Feb 2005 15:39:48 -0800 (PST) From: Kelly Yancey <kbyanc@posi.net> To: freebsd-net@FreeBSD.org Cc: des@FreeBSD.org Subject: [patch] Update to libfetch Message-ID: <20050221153304.J2022@gateway.posi.net>
next in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. --0-1444105768-1109029188=:2022 Content-Type: TEXT/PLAIN; charset=US-ASCII Attached is a patch to address concerns raised by Pawel Worach with regards to the recent change to set TCP_NOPUSH when sending HTTP requests from libfetch. The previous revision also introduced a call to shutdown(2) to close the write half of the socket in order to force the queued request to be sent. While this should be perfectly acceptable behavior for a TCP client, it appears that squid provides a configuration option to disallow half-closed clients (which Pawel is currently using). As such, after introducing the shutdown(2) call, fetch(1) can no longer fetch files via HTTP through such proxies. To address this issue, the attached patch replaces the call to shutdown(2) with some socket option fiddling (clearing TCP_NOPUSH and setting TCP_NODELAY) which does the same job of forcing the client to write the queued request to the network without closing the write half of the socket. This feels a bit hackish to me, but gets the job done. Anyway, I would appreciate any feedback. Thanks, Kelly -- Kelly Yancey - kbyanc@{posi.net,FreeBSD.org} - kelly@nttmcl.com --0-1444105768-1109029188=:2022 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="fetch-nodelay.diff" Content-Transfer-Encoding: BASE64 Content-ID: <20050221153948.B2022@gateway.posi.net> Content-Description: Content-Disposition: attachment; filename="fetch-nodelay.diff" PyBmZXRjaC4zLmd6DQo/IGZ0cGVyci5oDQo/IGh0dHBlcnIuaA0KPyBsaWJm ZXRjaC5zby4zDQo/IH5mZXRjaC1ub2RlbGF5LmRpZmYNCkluZGV4OiBodHRw LmMNCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvaG9tZS9u Y3ZzL3NyYy9saWIvbGliZmV0Y2gvaHR0cC5jLHYNCnJ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GlzYWxsb3cgc3VjaCBoYWxmLWNsb3NlZCBj b25uZWN0aW9ucy4gIFRvDQorCQkgKiBiZSBjb21wYXRpYmxlIHdpdGggc3Vj aCBjb25maWd1cmF0aW9ucywgZmlkZGxlIHdpdGggc29ja2V0DQorCQkgKiBv cHRpb25zIHRvIGZvcmNlIHRoZSBwZW5kaW5nIGRhdGEgdG8gYmUgd3JpdHRl bi4NCisJCSAqLw0KKwkJdmFsID0gMDsNCisJCXNldHNvY2tvcHQoY29ubi0+ c2QsIElQUFJPVE9fVENQLCBUQ1BfTk9QVVNILCAmdmFsLA0KKwkJCSAgIHNp emVvZih2YWwpKTsNCisJCXZhbCA9IDE7DQorCQlzZXRzb2Nrb3B0KGNvbm4t PnNkLCBJUFBST1RPX1RDUCwgVENQX05PREVMQVksICZ2YWwsDQorCQkJICAg c2l6ZW9mKHZhbCkpOw0KIA0KIAkJLyogZ2V0IHJlcGx5ICovDQogCQlzd2l0 Y2ggKF9odHRwX2dldF9yZXBseShjb25uKSkgew0K --0-1444105768-1109029188=:2022--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050221153304.J2022>