Show
Ignore:
Timestamp:
01/24/07 14:42:47 (2 years ago)
Author:
stephenson
Message:

Experimenting with the default header values in LWP::UserAgent

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/stephenson-stealth/lib/HoneyClient/Agent/Driver/Browser.pm

    r158 r174  
    897897the "DEFAULT PARAMETER LIST" section. 
    898898 
    899 Once a drive() iteration has completed, the corresponding browser process  
    900 is terminated.  Thus, each call to drive() invokes a new instance of the  
     899Once a drive() iteration has completed, the corresponding browser process 
     900is terminated.  Thus, each call to drive() invokes a new instance of the 
    901901browser. 
    902902 
     
    958958    my $ua = LWP::UserAgent->new( 
    959959        timeout           => $timeout,            # Fixed timeout. 
    960         #max_redirect      => 0,                   # Ignore redirects. 
     960        max_redirect      => 0,                   # Ignore redirects. 
    961961        protocols_allowed => [ 'http', 'https' ], # Allow only web protocols. 
    962962        max_size          => 1*1024*1024,         # Don't get larger than 1MB for testing 
     
    968968    # I'm thinking this could be set by IE/FF and passed via $args{'default_headers'} 
    969969    # as a HTTP::Headers object. 
    970     $ua->default_header( 'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5' ); 
    971  
    972     my $response = $ua->request( 
    973                         HTTP::Request->new( 
    974                             GET => $args{'url'}, 
    975                             HTTP::Headers->new( 
    976                                 # TODO: Add custom headers here? 
    977                                 'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 
    978                             ), 
    979                         ) 
    980     ); 
     970    $ua->default_header( 'Accept' => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, */*', 
     971                         'Accept-Language' => 'en-us, en-uk', 
     972                         'User-Agent' => 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)', 
     973                         'Proxy-Connection' => 'Keep-Alive', 
     974                        ); 
     975 
     976    my $response = $ua->get($args{'url'}); 
    981977 
    982978    # Get the base url from the response 
     
    13811377=over 4 
    13821378 
    1383 Indicates if the Browser driver B<$object> has driven the browser   
     1379Indicates if the Browser driver B<$object> has driven the browser 
    13841380process to all possible links it has found within its hashtables 
    13851381and is unable to navigate the browser further without additional, external