From b38de6f02fa04e36b881d2aad9c7f792beb0b6a1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 3 Mar 2016 05:14:31 +0000 Subject: daemon: introduce host_with_port for identifying sockets This allows us to share more code between daemons and avoids having to make additional syscalls for preparing REMOTE_HOST and REMOTE_PORT in the PSGI env in -httpd. This will also make supporting HTTP (and NNTP) over Unix sockets easier in a future commit. --- t/httpd-corner.t | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't/httpd-corner.t') 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'); -- cgit v1.2.3-24-ge0c7