validator/httpd/cgi-bin check,1.617,1.618

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv31443/httpd/cgi-bin

Modified Files:
	check 
Log Message:
Move user agent and request defaults to UserAgent constructor.

Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.617
retrieving revision 1.618
diff -u -d -r1.617 -r1.618
--- check	4 Jan 2009 11:13:46 -0000	1.617
+++ check	4 Jan 2009 11:22:19 -0000	1.618
@@ -816,12 +816,8 @@
 
   $File->{ParserName} = "validator.nu";
   $File->{ParserOpts} = "";
-  $ua->env_proxy();
-  $ua->agent($File->{Opt}->{'User Agent'});
-  $ua->parse_head(0);  # Don't parse the http-equiv stuff.
+
   use HTTP::Request::Common;
-  # telling caches in the middle we want a fresh copy (Bug 4998)
-  $ua->default_header(Cache_control=> "max-age=0");
 
   my $res = $ua->request(POST "$CFG->{External}->{HTML5}", Content_Type => 'form-data',
   Content  => [out => "xml", parser=>$html5_parser, content => Encode::encode_utf8(join "\n", @{$File->{Content}})]);
@@ -1429,11 +1425,6 @@
   $uri->fragment(undef);
 
   my $ua = new W3C::Validator::UserAgent ($CFG, $File);
-  $ua->env_proxy();
-  $ua->agent($File->{Opt}->{'User Agent'});
-  $ua->parse_head(0);  # Don't parse the http-equiv stuff.
-
-  $ua->protocols_allowed($CFG->{Protocols}->{Allow} || ['http', 'https']);
 
   unless ($ua->is_protocol_supported($uri)) {
     $File->{'Error Flagged'} = TRUE;
@@ -1453,9 +1444,6 @@
 
   my $req = new HTTP::Request(GET => $uri);
 
-  # telling caches in the middle we want a fresh copy (Bug 4998)
-  $req->header(Cache_control=> "max-age=0");
-
   # if one wants to use the accept, accept-charset and accept-language params
   # in order to trigger specific negotiation
   if ($File->{Opt}->{'Accept Header'}) {
@@ -3070,6 +3058,16 @@
   $self->{'W3C::Validator::CFG'}  = $CFG;
   $self->{'W3C::Validator::File'} = $File;
 
+  $self->env_proxy();
+  $self->agent($File->{Opt}->{'User Agent'});
+  $self->protocols_allowed($CFG->{Protocols}->{Allow} || ['http', 'https']);
+
+  # Don't parse the http-equiv stuff.
+  $self->parse_head(0);
+
+  # Tell caches in the middle we want a fresh copy (Bug 4998).
+  $self->default_header('Cache-Control' => 'max-age=0');
+
   return $self;
 }
 

Received on Sunday, 4 January 2009 11:22:30 UTC