Bug 13914 - CGI script command line broken
Summary: CGI script command line broken
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_cgi (show other bugs)
Version: 2.0-HEAD
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://cgi-spec.golux.com/draft-coar-...
Keywords: PatchAvailable
Depends on:
Reported: 2002-10-24 05:17 UTC by Ville Skyttä
Modified: 2004-11-16 19:05 UTC (History)
0 users

CGI command line argument fix (701 bytes, patch)
2002-10-24 05:18 UTC, Ville Skyttä
Details | Diff
Perl CGI for testing CGI command line arguments (917 bytes, text/plain)
2002-10-27 16:45 UTC, Ville Skyttä

Note You need to log in before you can comment on or make changes to this bug.
Description Ville Skyttä 2002-10-24 05:17:21 UTC
CGI script command line is broken in 2.0.40, the query string is *always* passed
to all CGI scripts as the first argument, whether it contains '=' or not.

I took a look and the patch I'm attaching to this report seems obviously correct
to me (it's against CVS HEAD), but I haven't tested it.  Please take a look
ASAP, this prevents running eg. the W3C checklink,

For more info, see the CGI spec at
Comment 1 Ville Skyttä 2002-10-24 05:18:12 UTC
Created attachment 3590 [details]
CGI command line argument fix
Comment 2 Joshua Slive 2002-10-25 17:12:50 UTC
This seems pretty obviously correct to me, but I'm not setup to test it at the
Comment 3 William A. Rowe Jr. 2002-10-25 17:29:10 UTC
  The patch appears correct.  As simple as it is to patch and move on, it
  seems like the sort of exception we should be looking for in the test
  suite.  I'll see what we can do about that, since we aught to prove 
  the old module wrong (from the perl-testsuite), apply the patch and 
  confirm it solves the bug complete.

Comment 4 Ville Skyttä 2002-10-27 16:44:44 UTC
Ok, I tested this a bit further with 1.3.26 and 2.0.40 and made a perl CGI that
can be used for testing (attaching it in a jiffy).  The script contains test
URLs, expected results and results for the two tested servers.

1.3.26 passed all tests, while 2.0.40 failed 3 of them; 2) and 6) supposedly
because of the bug described here, and 9) since it doesn't seem to check if the
query string after '?' is empty, but passes an empty string.
Comment 5 Ville Skyttä 2002-10-27 16:45:34 UTC
Created attachment 3622 [details]
Perl CGI for testing CGI command line arguments
Comment 6 Jeff Trawick 2002-11-22 14:47:16 UTC
Fixes were just committed for mod_cgi and mod_cgid.

Thanks for the mod_cgi fix and the testcase, and thanks for using