P
Public Interest
#!/usr/bin/perl
use Net::HTTP;
use LWP::UserAgent;
$ua = LWP::UserAgent->new ( );
$ua->max_size(2000);
$url = 'http://www.yahoo.com';
my $req = HTTP::Request->new(GET => "$url");
$htmlcode = $ua->request($req)->content;
print $htmlcode;
# the problem is if i change 2000 to 1950 in max_size, the $htmlcode is
still the same. Looks to me that the server is flushing and client is using
buffer to hold it and the server decide how much each flushing is giving,
and if each flushing is 1024 bytes, and max_size is checked after each
flushing. So, max size of 1025 to max size of 2047 will give the same
result: both are 2048. Is that right? So max_size in UserAgent is really an
estimated value.
use Net::HTTP;
use LWP::UserAgent;
$ua = LWP::UserAgent->new ( );
$ua->max_size(2000);
$url = 'http://www.yahoo.com';
my $req = HTTP::Request->new(GET => "$url");
$htmlcode = $ua->request($req)->content;
print $htmlcode;
# the problem is if i change 2000 to 1950 in max_size, the $htmlcode is
still the same. Looks to me that the server is flushing and client is using
buffer to hold it and the server decide how much each flushing is giving,
and if each flushing is 1024 bytes, and max_size is checked after each
flushing. So, max size of 1025 to max size of 2047 will give the same
result: both are 2048. Is that right? So max_size in UserAgent is really an
estimated value.