privoxy-regression-test: Skip the connection-established response in get_status_code()
authorFabian Keil <fk@fabiankeil.de>
Sun, 13 Dec 2020 08:02:04 +0000 (09:02 +0100)
committerFabian Keil <fk@fabiankeil.de>
Mon, 14 Dec 2020 07:49:17 +0000 (08:49 +0100)
... when looking for the status code with a CGI prefix
that starts with https://. We care about the status code
sent by the impersonated web server.

tools/privoxy-regression-test.pl

index 2d38663..4c305a3 100755 (executable)
@@ -1299,10 +1299,20 @@ sub get_server_header($$) {
 sub get_status_code($) {
 
     my $buffer_ref = shift;
+    our $privoxy_cgi_url;
+
+    my $skip_connection_established_response = $privoxy_cgi_url =~ m@^https://@;
     my @buffer = @{$buffer_ref}; 
 
     foreach (@buffer) {
 
+        if ($skip_connection_established_response) {
+
+            next if (m@^HTTP/1\.1 200 Connection established@);
+            next if (m@^\r\n$@);
+            $skip_connection_established_response = 0;
+        }
+
         if (/^HTTP\/\d\.\d (\d{3})/) {
 
             return $1;