Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Determining Content-Length when there is no Content-Length header

by hacker (Priest)
on Sep 30, 2007 at 00:24 UTC ( #641735=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
       my $req         = HTTP::Request->new(HEAD => $url);   
       my $resp        = $ua->request($req);
       my $type        = $resp->header('Content-Type');
       my $content     = $resp->content;   
       my $content_len = $resp->header('Content-Length');   
    
  2. or download this
       my $req         = HTTP::Request->new(GET => $url); 
       my $content     = $resp->content;
       my $content_len = length($content);
    
  3. or download this
       my $req         = HTTP::Request->new(HEAD => $pl_url);
       my $resp        = $ua->request($req);
    ...
           $content     = $resp->content;  
           $content_len = length($content);
       }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://641735]
Approved by calin
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-08-16 19:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (171 votes). Check out past polls.

    Notices?