about summary refs log tree commit homepage
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/httpd-corner.psgi3
-rw-r--r--t/httpd-corner.t10
2 files changed, 13 insertions, 0 deletions
diff --git a/t/httpd-corner.psgi b/t/httpd-corner.psgi
index c3bf5231..349b35df 100644
--- a/t/httpd-corner.psgi
+++ b/t/httpd-corner.psgi
@@ -44,6 +44,9 @@ my $app = sub {
                                 $fh->close;
                         };
                 }
+        } elsif ($path eq '/host-port') {
+                $code = 200;
+                push @$body, "$env->{REMOTE_ADDR}:$env->{REMOTE_PORT}";
         }
 
         [ $code, $h, $body ]
diff --git a/t/httpd-corner.t b/t/httpd-corner.t
index e73ebd5e..198a7e90 100644
--- a/t/httpd-corner.t
+++ b/t/httpd-corner.t
@@ -76,6 +76,16 @@ sub conn_for {
         return $conn;
 }
 
+{
+        my $conn = conn_for($sock, 'host-port');
+        $conn->write("GET /host-port HTTP/1.0\r\n\r\n");
+        $conn->read(my $buf, 4096);
+        my ($head, $body) = split(/\r\n\r\n/, $buf);
+        my ($addr, $port) = split(/:/, $body);
+        is($addr, $conn->sockhost, 'host matches addr');
+        is($port, $conn->sockport, 'port matches');
+}
+
 # graceful termination
 {
         my $conn = conn_for($sock, 'graceful termination via slow header');