Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by hacker (Priest)
on Sep 30, 2007 at 00:24 UTC ( [id://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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found