markup-validator commit: Handle uploaded_file without Content-Disposition filename as a fragment.

changeset:   3174:9bdd2cf9552a
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Sat Dec 04 22:28:26 2010 +0200
files:       httpd/cgi-bin/check
description:
Handle uploaded_file without Content-Disposition filename as a fragment.


diff -r 294f25fe9480 -r 9bdd2cf9552a httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Sat Dec 04 21:48:33 2010 +0200
+++ b/httpd/cgi-bin/check	Sat Dec 04 22:28:26 2010 +0200
@@ -1903,8 +1903,17 @@
     my $q    = shift;    # The CGI object.
     my $File = shift;    # The master datastructure.
 
+    my $p = $q->param('uploaded_file');
     my $f = $q->upload('uploaded_file');
-    my $h = $q->uploadInfo($q->param('uploaded_file'));
+    if (!defined($f)) {
+
+        # Probably not an uploaded file as far as CGI is concerned,
+        # treat as a fragment.
+        $q->param('fragment', $p);
+        return &handle_frag($q, $File);
+    }
+
+    my $h = $q->uploadInfo($p);
 
     local $/ = undef;    # set line delimiter so that <> reads rest of file
     my $file = <$f>;
@@ -1919,7 +1928,7 @@
     $File->{Modified}        = $q->http('Last-Modified');
     $File->{Server}          = $q->http('User-Agent');   # Fake a "server". :-)
     $File->{Size}           = $q->http('Content-Length');
-    $File->{URI}            = "$f";
+    $File->{URI}            = "$p";
     $File->{'Is Upload'}    = TRUE;
     $File->{'Direct Input'} = FALSE;
 

Received on Saturday, 4 December 2010 20:28:59 UTC