Show
Ignore:
Timestamp:
02/11/09 00:34:38 (4 years ago)
Author:
tokuhirom
Message:

take a host/port information from the 'Host' header.
this behavior is same as Interface::ServerSimple?.
and, with this technique, we can avoid URI.pm's utf-8 flag related problems.

see also.
http://d.hatena.ne.jp/orangevtr/20090208/1234097762

Location:
lang/perl/HTTP-Engine/trunk
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Interface/POE.pm

    r28739 r29878  
    8484    my ($self, $request, $heap) = @_; 
    8585 
     86    my($host, $port) = $request->headers->header('Host') ? 
     87        split(':', $request->headers->header('Host')) : ($self->host, $self->port); 
     88 
    8689    { 
    8790        headers => $request->headers, 
     
    8992            my $uri = $request->uri->clone; 
    9093            $uri->scheme('http'); 
    91             $uri->host($self->host); 
    92             $uri->port($self->port); 
     94            $uri->host($host); 
     95            $uri->port($port); 
    9396            $uri->path('/') if $request->uri =~ m!^https?://!i; 
    9497 
     
    101104            address    => $heap->{remote_ip}, 
    102105            method     => $request->method, 
    103             port       => $self->port, 
     106            port       => $port, 
    104107            user       => undef, 
    105108            _https_info => 'OFF',