Changeset 23196


Ignore:
Timestamp:
2010-10-21T17:56:01+13:00 (11 years ago)
Author:
ak19
Message:

Dr Bainbridge fixed the recent problem to do with how the CGI object was being instantiated, based on whether it was a GET or POST and what type of POST message it was.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/cgi-bin/gsdlCGI.pm

    r23188 r23196  
    4545    my $class = shift @_;
    4646   
    47 #    my $self;
     47    my $self;
    4848   
    4949    # We'll determine the correct config file in this constructor itself
     
    5858    }
    5959
    60 #    if ((defined $ENV{'REQUEST_METHOD'}) && ($ENV{'REQUEST_METHOD'} eq "POST")) {
    61 #
    62 #   # Check if we're dealing with the upload-coll-file cmd. Because it will be a
    63 #   # multipart POST message and must be dealt with by the default CGI() constructor
    64 #   if((defined $ENV{'QUERY_STRING'}) && ($ENV{'QUERY_STRING'} =~ m/upload-collection-file/)) {
    65 #       $self = new CGI();
    66 #   }
    67 #
    68 #   else { # all other POST commands processed using CGI($line)
    69 #       my $line = <STDIN>;
    70 #       if ((defined $line) && ($line ne "")) {
    71 #       $self = new CGI($line);
    72 #       }
    73 #   }
    74 #   
    75 #    }   
    76    
    77     # If one of the conditions above did not hold, then self=new CGI()
    78 #    if (!defined $self) {
    79 #   $self = new CGI();
    80 #    }
    81 
    82     my $self = new CGI(@_);
     60    # POST that is URL-encoded (like a GET) is a line that needs to be read from STDIN
     61    if ((defined $ENV{'CONTENT_TYPE'}) && ($ENV{'CONTENT_TYPE'} =~ m/form-urlencoded/)) {
     62    my $line = <STDIN>;
     63    if ((defined $line) && ($line ne "")) {
     64        $self = new CGI($line);
     65    }
     66    }
     67   
     68    # If the conditions above did not hold, then self=new CGI(@_)
     69    if (!defined $self) {
     70    # It's a GET, or else a POST with Multi-part body
     71    $self = new CGI(@_);
     72    }
     73
    8374
    8475    if ($version == 2) {
Note: See TracChangeset for help on using the changeset viewer.