]> Sergey Matveev's repositories - public-inbox.git/commitdiff
git-http-backend: stricter parsing of CRLF
authorEric Wong <e@80x24.org>
Mon, 29 Feb 2016 01:05:16 +0000 (01:05 +0000)
committerEric Wong <e@80x24.org>
Mon, 29 Feb 2016 01:06:56 +0000 (01:06 +0000)
It is not needed as we know git uses CRLF termination.

lib/PublicInbox/GitHTTPBackend.pm

index 6e8ad955d7af9a7deb112366e178e6811b2f4d8c..8e6d8b648985445e93d215b5c8faf0525f2fb41a 100644 (file)
@@ -201,11 +201,11 @@ sub serve_smart {
                if ($fh) { # stream body from git-http-backend to HTTP client
                        $fh->write($buf);
                        $buf = '';
-               } elsif ($buf =~ s/\A(.*?)\r?\n\r?\n//s) { # parse headers
+               } elsif ($buf =~ s/\A(.*?)\r\n\r\n//s) { # parse headers
                        my $h = $1;
                        my $code = 200;
                        my @h;
-                       foreach my $l (split(/\r?\n/, $h)) {
+                       foreach my $l (split(/\r\n/, $h)) {
                                my ($k, $v) = split(/:\s*/, $l, 2);
                                if ($k =~ /\AStatus\z/i) {
                                        $code = int($v);