diff options
author | Eric Wong <e@80x24.org> | 2023-10-25 00:29:32 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-10-25 07:28:36 +0000 |
commit | 92fa0f29774642b848ff23fccda51c4e34342dbe (patch) | |
tree | b4835e8508da1949f41133f6ed3e8fb9e66f3d98 /lib/PublicInbox/HTTP.pm | |
parent | 8ea09a53c691e2f2980bb09612f45d2a5946340a (diff) | |
download | public-inbox-92fa0f29774642b848ff23fccda51c4e34342dbe.tar.gz |
This is intended to replace psgi_return and HTTPD/Async entirely, hopefully making our code less convoluted while maintaining the ability to handle slow clients on memory-constrained systems This was made possible by the philosophy shift in commit 21a539a2df0c (httpd/async: switch to buffering-as-fast-as-possible, 2019-06-28). We'll still support generic PSGI via the `pull' model with a GetlineResponse class which is similar to the old GetlineBody.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index ca162939..edc88fe8 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -455,11 +455,12 @@ sub next_step { # They may be exposed to the PSGI application when the PSGI app # returns a CODE ref for "push"-based responses package PublicInbox::HTTP::Chunked; -use strict; +use v5.12; sub write { # ([$http], $buf) = @_; - PublicInbox::HTTP::chunked_write($_[0]->[0], $_[1]) + PublicInbox::HTTP::chunked_write($_[0]->[0], $_[1]); + $_[0]->[0]->{sock} ? length($_[1]) : undef; } sub close { @@ -468,12 +469,13 @@ sub close { } package PublicInbox::HTTP::Identity; -use strict; +use v5.12; our @ISA = qw(PublicInbox::HTTP::Chunked); sub write { # ([$http], $buf) = @_; PublicInbox::HTTP::identity_write($_[0]->[0], $_[1]); + $_[0]->[0]->{sock} ? length($_[1]) : undef; } 1; |