continuation on bugfix #13757

make argv/argc *and* query_string work correctly when running cgi in shell
This commit is contained in:
Shane Caraveo 2003-05-19 06:46:19 +00:00
parent 8e3772a827
commit 92dfadb1e0

View file

@ -1320,6 +1320,9 @@ consult the installation file that came with this distribution, or visit \n\
case 'f': /* parse file */
script_file = estrdup(optarg);
no_headers = 1;
/* arguments after the file are considered script args */
SG(request_info).argc = argc - (optind-1);
SG(request_info).argv = &argv[optind-1];
break;
case 'g': /* define global variables on command line */
@ -1415,6 +1418,9 @@ consult the installation file that came with this distribution, or visit \n\
}
if (!SG(request_info).path_translated && argc > optind) {
/* arguments after the file are considered script args */
SG(request_info).argc = argc - optind;
SG(request_info).argv = &argv[optind];
/* file is on command line, but not in -f opt */
SG(request_info).path_translated = estrdup(argv[optind++]);
}
@ -1428,7 +1434,7 @@ consult the installation file that came with this distribution, or visit \n\
test.php "v1=test&v2=hello world!"
test.php v1=test "v2=hello world!"
*/
if (!SG(request_info).query_string) {
if (!SG(request_info).query_string && argc > optind) {
len = 0;
for (i = optind; i < argc; i++) {
len += strlen(argv[i]) + 1;