From 28dd4e4f1f4dc2311d4e1870161dfa73ae93aeb3 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Tue, 18 Sep 2001 15:26:54 +0000
Subject: [PATCH] made it respond as a http proxy on CONNECT

---
 tests/httpserver.pl | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/tests/httpserver.pl b/tests/httpserver.pl
index 64d9d21001..9e473f3c92 100755
--- a/tests/httpserver.pl
+++ b/tests/httpserver.pl
@@ -66,7 +66,6 @@ for ( $waitedpid = 0;
 
         my @headers;
 
-      stdin:
         while(<STDIN>) {
             if($_ =~ /([A-Z]*) (.*) HTTP\/1.(\d)/) {
                 $request=$1;
@@ -96,6 +95,12 @@ for ( $waitedpid = 0;
                 if($request =~ /^(POST|PUT)$/) {
                     $left=$cl;
                 }
+                elsif($request =~ /^CONNECT$/) {
+                    if($verbose) {
+                        print STDERR "We're emulating a SSL proxy!\n";
+                    }
+                    $left = -1;
+                }
                 else {
                     $left = -1; # force abort
                 }
@@ -105,7 +110,13 @@ for ( $waitedpid = 0;
             }
         }
 
-        if($path =~ /verifiedserver/) {
+        if($request =~ /^CONNECT$/) {
+            # ssl proxy mode
+            print "HTTP/1.1 400 WE CANNOT ROOL NOW\r\n",
+            "Server: bahoooba\r\n\r\n";
+            exit;
+        }
+        elsif($path =~ /verifiedserver/) {
             # this is a hard-coded query-string for the test script
             # to verify that this is the server actually running!
             print "HTTP/1.1 999 WE ROOLZ\r\n";
-- 
GitLab