Changeset 534
- Timestamp:
- 06/18/07 12:41:39 (1 year ago)
- Files:
-
- honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser.pm (modified) (2 diffs)
- honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/FF.pm (modified) (1 diff)
- honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/IE.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser.pm
r526 r534 965 965 my $ua = LWP::UserAgent->new( 966 966 timeout => $timeout, # Fixed timeout. 967 #max_redirect => 0, # Ignore redirects. 967 #max_redirect => 0, # Ignore redirects. Do we want to do that? 968 968 protocols_allowed => [ 'http', 'https' ], # Allow only web protocols. 969 # This actually puts a "range = " header in the request, might want to get rid of that... 969 970 max_size => 1*1024*1024, # Don't get larger than 1MB for testing 970 971 ); … … 973 974 # a little better. 974 975 # TODO: Set the default headers, to mimic a regular browser (if need be). 975 # I'm thinking this could be set by IE/FF and passed via $args{'default_headers'}976 # I'm thinking this could be set by IE/FF and/or passed via $args{'default_headers'} 976 977 # as a HTTP::Headers object. 977 $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' ); 978 979 my $response = $ua->request( 980 HTTP::Request->new( 981 GET => $args{'url'}, 982 HTTP::Headers->new( 983 # TODO: Add custom headers here? 984 'Accept' => 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5', 985 ), 986 ) 987 ); 988 978 my $req = HTTP::Request->new(GET => $args{'url'}, $self->getHeaders()); 979 my $response = $ua->request($req); 980 989 981 # Get the base url from the response 990 982 my $base = $response->base; honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/FF.pm
r411 r534 241 241 ####################################################################### 242 242 243 #sub getHeaders { 244 # 245 # # - This function returns the appropriate headers for this 246 # # particular browser type (application) 247 #} 248 249 sub getHeaders { 250 return HTTP::Headers->new( 251 Accept => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-shockwave-flash, */*', 252 Accept-Language => 'en-us', 253 UA-CPU => 'x86', 254 Accept-Encoding => 'gzip, deflate', 255 User-Agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 256 #Host: ldscatalog.com, 257 Proxy-Connection => 'Keep-Alive', 258 ); 259 } 260 261 ####################################################################### 262 243 263 1; honeyclient/branches/exp/stephenson-browser_headers/lib/HoneyClient/Agent/Driver/Browser/IE.pm
r411 r534 154 154 # TODO: Need unit testing. 155 155 use Win32::Job; 156 157 # TODO: Need unit testing 158 use HTTP::Headers; 156 159 157 160 # TODO: clean this up. … … 262 265 ####################################################################### 263 266 267 #sub getHeaders { 268 # 269 # # - This function returns the appropriate headers for this 270 # # particular browser type (application) 271 #} 272 273 sub getHeaders { 274 return HTTP::Headers->new( 275 Accept => 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-shockwave-flash, */*', 276 Accept-Language => 'en-us', 277 UA-CPU => 'x86', 278 Accept-Encoding => 'gzip, deflate', 279 User-Agent => 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)', 280 #Host: ldscatalog.com, 281 Proxy-Connection => 'Keep-Alive', 282 ); 283 } 284 285 ####################################################################### 286 264 287 1; 265
