about summary refs log tree commit homepage
path: root/lib/PublicInbox/HTTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-06-24 02:52:13 +0000
committerEric Wong <e@80x24.org>2019-06-24 05:26:26 +0000
commite1b203f218b3fedea3068d6265130c47f0af9f4c (patch)
treef14166500298c29ab8e1e8bd06fc42af0beeb02a /lib/PublicInbox/HTTP.pm
parent676f13ac53bf96eab869514fe9fafcc0169874ab (diff)
downloadpublic-inbox-e1b203f218b3fedea3068d6265130c47f0af9f4c.tar.gz
No sense in having similar Linux-specific functionality in
both our NNTP.pm and HTTP.pm
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r--lib/PublicInbox/HTTP.pm26
1 files changed, 5 insertions, 21 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index 4f1f88fe..a669eb6e 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -19,6 +19,7 @@ use HTTP::Status qw(status_message);
 use HTTP::Date qw(time2str);
 use IO::Handle;
 require PublicInbox::EvCleanup;
+PublicInbox::DS->import('msg_more');
 use constant {
         CHUNK_START => -1,   # [a-f0-9]+\r\n
         CHUNK_END => -2,     # \r\n
@@ -207,7 +208,7 @@ sub response_header_write {
         $h .= 'Date: ' . http_date() . "\r\n\r\n";
 
         if (($len || $chunked) && $env->{REQUEST_METHOD} ne 'HEAD') {
-                more($self, $h);
+                msg_more($self, $h);
         } else {
                 $self->write(\$h);
         }
@@ -219,12 +220,12 @@ sub chunked_wcb ($) {
         my ($self) = @_;
         sub {
                 return if $_[0] eq '';
-                more($self, sprintf("%x\r\n", bytes::length($_[0])));
-                more($self, $_[0]);
+                msg_more($self, sprintf("%x\r\n", bytes::length($_[0])));
+                msg_more($self, $_[0]);
 
                 # use $self->write(\"\n\n") if you care about real-time
                 # streaming responses, public-inbox WWW does not.
-                more($self, "\r\n");
+                msg_more($self, "\r\n");
         }
 }
 
@@ -316,23 +317,6 @@ sub response_write {
         }
 }
 
-use constant MSG_MORE => ($^O eq 'linux') ? 0x8000 : 0;
-sub more ($$) {
-        my $self = $_[0];
-        return unless $self->{sock};
-        if (MSG_MORE && !$self->{wbuf}) {
-                my $n = send($self->{sock}, $_[1], MSG_MORE);
-                if (defined $n) {
-                        my $nlen = length($_[1]) - $n;
-                        return 1 if $nlen == 0; # all done!
-
-                        # PublicInbox::DS::write queues the unwritten substring:
-                        return $self->write(substr($_[1], $n, $nlen));
-                }
-        }
-        $self->write(\($_[1]));
-}
-
 sub input_prepare {
         my ($self, $env) = @_;
         my $input;