www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randall Britten <rand...@is.co.za>
Subject mod_cgi/5828: CGI does not support PATH_INFO and QUERY_STRING simultaneously
Date Wed, 01 Mar 2000 22:07:05 GMT

>Number:         5828
>Category:       mod_cgi
>Synopsis:       CGI does not support PATH_INFO and QUERY_STRING simultaneously
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Wed Mar 01 14:10:00 PST 2000
>Originator:     randall@is.co.za
>Release:        1.3.6
Redhat x86 Linux 6.0, with Apache in distribution.
The CGI script that I am running cannot access both the PATH_INFO and the QUERY_STRING at
the same time.  This is an issue in the following simple proxy script.  If this is the URL:


Then the QUERY_STRING should be var1=val123 but it isn't set.

Here is the script, which works on Netscape Enterprise Server 3.6.2

#!/usr/bin/perl -w
use strict;
use Socket;
my ($server, $sn, $sc, $rm, $ct, $cl, $rq, $qs, $buf, $dummy, @addrs, $remote,$port, $iaddr,
$paddr, $proto, $line);
my ($co, $len, $data);

$server = "hidden.host.co.za";
$port = 80;
$proto   = getprotobyname('tcp');

$sn = $ENV{"SERVER_NAME"};
$sc = $ENV{"SCRIPT_NAME"};
$rq = $ENV{"PATH_INFO"};
if (not $qs eq "") { $rq = "${rq}?${qs}"; }
$buf = "${rm} $rq HTTP/1.0\r\n";
$buf = "${buf}Host: ${sn}${sc}\r\n";
if (not $ct eq "") { $buf = "${buf}Content-type: ${ct}\r\n"; }
if (not $cl eq "") { $buf = "${buf}Content-length: ${cl}\r\n"; }
$buf = "${buf}\r\n";
if (not $cl eq "") { read(STDIN,$co,$cl); $buf = "${buf}${co}"; }
if ($server =~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) {
   @addrs = pack('C4',split(/\./,$server));
} else {
   ($dummy,$dummy,$dummy,$dummy,@addrs) = gethostbyname($server);

$remote  = $server;
if ($port =~ /\D/) { $port = getservbyname($port, 'tcp') }
die "No port" unless $port;
$iaddr   = inet_aton($remote)               || die "no host: $remote";
$paddr   = sockaddr_in($port, $iaddr);

$proto   = getprotobyname('tcp');
socket(S, PF_INET, SOCK_STREAM, $proto)  || die "socket: $!";
connect(S, $paddr)    || die "connect: $!";

#socket(S,2,2,$proto) || die "socket: $!";
#connect(S,pack("S n a4 x8",2,$port,$addrs[0])) || die "connect: $!";
select(STDOUT) || die "select: $!"; $| = 1;
select(S) || die "select: $!"; $| = 1;
syswrite(S,$buf,length($buf)) || die "syswrite: $!";
while ($len = sysread(S,$data,65536)) { syswrite(STDOUT,$data,$len); }
close(S) || die "close: $!";
The description above should give enough info to reproduce the problem.
Set both PATH_INFO and QUERY_STRING env variables.
 [In order for any reply to be added to the PR database, you need]
 [to include <apbugs@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]

View raw message