user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH] http: additional info for write failures
@ 2016-07-07 20:12  7% Eric Wong
  0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2016-07-07 20:12 UTC (permalink / raw)
  To: meta

There was a spurious test failure in t/httpd-corner.t
which I have not been able to reproduce.
---
 lib/PublicInbox/HTTP.pm | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm
index abf648f..17f8930 100644
--- a/lib/PublicInbox/HTTP.pm
+++ b/lib/PublicInbox/HTTP.pm
@@ -98,7 +98,7 @@ sub rbuf_process {
 	$self->{rbuf} = substr($self->{rbuf}, $r);
 
 	my $len = input_prepare($self, \%env);
-	defined $len or return write_err($self); # EMFILE/ENFILE
+	defined $len or return write_err($self, undef); # EMFILE/ENFILE
 
 	$len ? event_read_input($self) : app_dispatch($self);
 }
@@ -118,7 +118,7 @@ sub event_read_input ($) {
 	while ($len > 0) {
 		if ($$rbuf ne '') {
 			my $w = write_in_full($input, $rbuf, $len);
-			return write_err($self) unless $w;
+			return write_err($self, $len) unless $w;
 			$len -= $w;
 			die "BUG: $len < 0 (w=$w)" if $len < 0;
 			if ($len == 0) { # next request may be pipelined
@@ -332,9 +332,10 @@ sub input_prepare {
 sub env_chunked { ($_[0]->{HTTP_TRANSFER_ENCODING} || '') =~ /\bchunked\b/i }
 
 sub write_err {
-	my ($self) = @_;
+	my ($self, $len) = @_;
 	my $err = $self->{httpd}->{env}->{'psgi.errors'};
 	my $msg = $! || '(zero write)';
+	$msg .= " ($len bytes remaining)\n" if defined $len;
 	$err->print("error buffering to input: $msg\n");
 	quit($self, 500);
 }
@@ -410,7 +411,7 @@ sub event_read_input_chunked { # unlikely...
 		until ($len <= 0) {
 			if ($$rbuf ne '') {
 				my $w = write_in_full($input, $rbuf, $len);
-				return write_err($self) unless $w;
+				return write_err($self, "$len chunk") if !$w;
 				$len -= $w;
 				if ($len == 0) {
 					# we may have leftover data to parse
-- 
EW


^ permalink raw reply related	[relevance 7%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2016-07-07 20:12  7% [PATCH] http: additional info for write failures Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).