use strict;
use warnings;
use LWP;
use HTTP::Cookies;
my $text = 'test';
my $url = 'http://localhost:60000/';
my $cookie_jar = new HTTP::Cookies;
$cookie_jar -> set_cookie (1, 'blah', 'blah', '/', 'localhost', '60000', 0, 0, 1000000, 0);
print $cookie_jar -> as_string;
my $browser = new LWP::UserAgent(agent => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)", cookie_jar => $cookie_jar);
print "cookie set\n" if ($browser -> cookie_jar);
my $response = $browser -> post ($url, [ type => 1, code => $text ] ) or die;
Специально шлю на локальный неткат и вижу там только:
use strict;
use warnings;
use LWP;
use HTTP::Cookies;
my $text = 'test';
my $url = 'http://localhost:60000/';
my $cookie_jar = new HTTP::Cookies;
$cookie_jar -> set_cookie (1, 'blah', 'blah', '/', 'localhost', '60000', 0, 0, 1000000, 0);
print $cookie_jar -> as_string;
my $browser = new LWP::UserAgent(agent => "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)", cookie_jar => $cookie_jar);
print "cookie set\n" if ($browser -> cookie_jar);
my $response = $browser -> post ($url, [ type => 1, code => $text ] ) or die;
Специально шлю на локальный неткат и вижу там только:
POST / HTTP/1.1
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: localhost:60000
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)
Content-Length: 16
Content-Type: application/x-www-form-urlencoded
type=1&code=test
Разобрались?
Насколько я понимаю(или не понимаю) проблема из-за имени localhost
Вот отрывок из rfc2965
If a host name contains no dots, the effective host name is that name with the string .local appended to it. Otherwise the effective host name is the same as the host name. Note that all effective host names contain at least one dot.
Замена localhost на localhost.localdomain мне помогла