* [PATCH] http: prevent zero-byte writes
@ 2016-03-12 0:20 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2016-03-12 0:20 UTC (permalink / raw)
To: meta
Plack::Middleware::Deflater (and perhaps other middleware)
triggers zero-byte writes which wastes syscalls when
they get passed to Danga::Socket. This may also trigger
problems when we introduce TLS support in the future.
---
lib/PublicInbox/HTTP.pm | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index 0675f6a..2888311 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -371,6 +371,13 @@ sub quit {
sub event_hup { $_[0]->close }
sub event_err { $_[0]->close }
+sub write ($$) : method {
+ my PublicInbox::HTTP $self = $_[0];
+ return 1 if (defined($_[1]) && ref($_[1]) eq '' && $_[1] eq '');
+
+ $self->SUPER::write($_[1]);
+}
+
# for graceful shutdown in PublicInbox::Daemon:
sub busy () {
my ($self) = @_;
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-12 0:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 0:20 [PATCH] http: prevent zero-byte writes Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).