Changeset 8c96802 in lab.git for misc/httpbench.pl


Ignore:
Timestamp:
Mar 6, 2014 3:40:19 PM (11 years ago)
Author:
Ken-ichi Mito <mitty@…>
Branches:
master
Children:
45d3453
Parents:
560dfd2
Message:

use LWP::UserAgent instead of LWP::Simple

  • LWP::Simple does not support verify_hostname option
File:
1 edited

Legend:

Unmodified
Added
Removed
  • misc/httpbench.pl

    r560dfd2 r8c96802  
    77use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat); 
    88use Parallel::ForkManager; 
    9 use LWP::Simple; 
     9use LWP::UserAgent; 
    1010use Time::HiRes qw(sleep gettimeofday); 
    1111 
     
    3434warn "wait for $wait second between requests\n" if ($wait); 
    3535 
    36  
     36my $ua = LWP::UserAgent->new( 
     37    ssl_opts => { verify_hostname => 0 }, 
     38); 
    3739my $transfer = 0; 
    3840my $pm = Parallel::ForkManager->new($concurrency); 
     
    5860                print STDERR "processing $i/$loops loop\r"; 
    5961                foreach my $url (@urls) { 
    60                     my $res = get($url) or print STDERR "\nfail: $url"; 
    61                     if ($res) { 
    62                         $transfer += length($res); 
     62                    my $res = $ua->get($url); 
     63                    if ($res->is_success) { 
     64                        $transfer += length($res->content); 
     65                    } 
     66                    else { 
     67                        print STDERR "\nfail: $url"; 
    6368                    } 
    6469                    sleep($wait); 
Note: See TracChangeset for help on using the changeset viewer.