View Issue Details

IDProjectCategoryView StatusLast Update
0000708Apache 2.x Bugpublic2020-08-24 03:07
ReporterSteven Levine Assigned ToSteven Levine  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformOS2/eCSOSOS/2 or eComstationOS Version1.x 2.x or 4.5
Product Version2.4.x 
Target Version2.4.x 
Summary0000708: mod_cgi appears to lose track of POST data.
Descriptionmod_cgi appears to process GET data as it always had. However, mod_cgi seems to lose POST data. This appears to be a long standing defect that has never been reported before. The testcase also fails for at least some 2.2.x versions.

The following testcase demonstrates the failure.

If the POST data was sent correctly, it would appear between the

  === input begin ===

and

  === input end ===

markers.

There is another possibly related issue with mod_cgi. It appears that mod-cgi is not detecting the completion of the the CGI script as well as it could.

When requesting:

  http://127.0.0.1/cgi-bin/my_test_rex2.cmd

There is a long delay before the script results are display. This may be a localhost only issue. I don't recall these delays when accessing CGI output produced by similar scripts run on www.scoug.com.

More to follow after some quality time with the debugger.
TagsNo tags attached.
Attached Files
my_test_rex2.cmd (2,902 bytes)   
/* rexx cgi test
   reads CGI varibles
   reads stdin
   write results to stdout as text/plain

   2002-05-16 SHL Baseline
   2020-02-12 SHL Add missing say
   2020-03-03 SHL Update
*/

call time 'E'

gCmdName = 'my_test_rex2'
gDbg = 0
gLogFile = '\tmp.out'

gStartTime = time()

msg = gCmdName 'starting at' gStartTime
if gDbg then call lineout gLogFile, msg
if 0 then call lineout 'STDERR', msg

say 'Content-type: text/plain'
say

call charout, 'CGI/1.0 test script report:'

parse arg sz
say 'argc is' arg() 'argv is' sz
say

say 'SERVER_SOFTWARE =' value('SERVER_SOFTWARE',,'OS2ENVIRONMENT')
say 'SERVER_NAME =' value('SERVER_NAME',,'OS2ENVIRONMENT')
say 'GATEWAY_INTERFACE =' value('GATEWAY_INTERFACE',,'OS2ENVIRONMENT')
say 'SERVER_PROTOCOL =' value('SERVER_PROTOCOL',,'OS2ENVIRONMENT')
say 'SERVER_PORT =' value('SERVER_PORT',,'OS2ENVIRONMENT')
say 'REQUEST_METHOD =' value('REQUEST_METHOD',,'OS2ENVIRONMENT')
say 'HTTP_ACCEPT ="' value('HTTP_ACCEPT',,'OS2ENVIRONMENT')
say 'PATH_INFO =' value('PATH_INFO',,'OS2ENVIRONMENT')
say 'PATH_TRANSLATED =' value('PATH_TRANSLATED',,'OS2ENVIRONMENT')
say 'SCRIPT_NAME =' value('SCRIPT_NAME',,'OS2ENVIRONMENT')
say 'QUERY_STRING =' value('QUERY_STRING',,'OS2ENVIRONMENT')
say 'REMOTE_HOST =' value('REMOTE_HOST',,'OS2ENVIRONMENT')
say 'REMOTE_ADDR =' value('REMOTE_ADDR',,'OS2ENVIRONMENT')
say 'REMOTE_USER =' value('REMOTE_USER',,'OS2ENVIRONMENT')
say 'AUTH_TYPE =' value('AUTH_TYPE',,'OS2ENVIRONMENT')
say 'CONTENT_TYPE =' value('CONTENT_TYPE',,'OS2ENVIRONMENT')
say 'CONTENT_LENGTH =' value('CONTENT_LENGTH',,'OS2ENVIRONMENT')

say
if chars() = 0 then
  say 'STDIN empty'
else do
  say 'chars() returned ' chars() ' - reading from STDIN'
  input = ''
  cnt = 0
  do while chars() > 0
    gError = 0
    call on NotReady name Error
    s = charin()
    signal off NotReady
    if gError then
      say 'charin raised not ready while chars() > 0'
    else do
      cnt = cnt + 1
      if input == '' then
        input = s
      else
        input = input || s
    end
  end /* do */
  say 'Read' cnt 'characters from STDIN'
  say 'Input is' length(input) 'characters'
  say '=== input begin ==='
  say input
  say c2x(input)
  say '=== input end ==='
end

elapsedTime = time('E')

gEndTime = time()

msg = gCmdName 'started at' gStartTime 'and ended at' gEndTime 'and ran for' elapsedTime 'seconds'

if gDbg then call lineout gLogFile, msg

say
say msg

/* Enable to force cgi_log output */
if 1 then call charout 'STDERR', msg

if gDbg then call stream gLogFile, 'C', 'CLOSE'

if gDbg then call stream 'STDIN', 'C', 'CLOSE'

/* Does not speed up termination */
if 0 then call stream 'STDOUT', 'C', 'CLOSE'
if 0 then call stream 'STDERR', 'C', 'CLOSE'

/* Does not speed up termination */
if 0 then '@exit'

exit

Error:
  gError = 1
  return
my_test_rex2.cmd (2,902 bytes)   
formtest.html (316 bytes)   
<html>
<head>
</head>

<!--
my_test_rex2.cmd
cgidump
-->


<body>
<form action="/cgi-bin/my_test_rex2.cmd" method="POST">
<label for="a">Your test input</label>
<input name="a" type="text"><br>
<label for="b">Second line</label>
<input name="b" type="text"><br>
<input type="submit" value="Submit!">
</form>
</body>
formtest.html (316 bytes)   

Activities

Steven Levine

2020-05-26 19:17

manager   ~0003469

This issue appears to be resolved by

   httpd-2.4.41-os2-debug-20200209.zip

in conjunction with the

  http://smedley.id.au/tmp/httpd.zip

which contains

 5-20-20 2:41 2,424,872 0 httpd.dll

e758aa85221c46a859785077c025cfcf *httpd.dll

If not, please reopen this ticket.

Steven Levine

2020-05-28 01:07

manager   ~0003471

For posterity, here is the diff for the above change.
proc.c.diff (611 bytes)   
diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c
index 6247597..8231d3f 100644
--- a/threadproc/os2/proc.c
+++ b/threadproc/os2/proc.c
@@ -512,9 +512,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
     }
 
     if (attr->child_in) {
-        if (attr->child_in->filedes != -1) {
-            apr_file_close(attr->child_in);
-        }
+        // if (attr->child_in->filedes != -1) { // 2020-05-20 SHL Leave open until CGI finishes
+        //    apr_file_close(attr->child_in);
+        // }
 
         dup = STDIN_FILENO;
         DosDupHandle(save_in, &dup);
proc.c.diff (611 bytes)   

Issue History

Date Modified Username Field Change
2020-03-04 20:48 Steven Levine New Issue
2020-03-04 20:48 Steven Levine Status new => assigned
2020-03-04 20:48 Steven Levine Assigned To => Steven Levine
2020-03-04 20:48 Steven Levine File Added: my_test_rex2.cmd
2020-03-04 20:48 Steven Levine File Added: formtest.html
2020-05-26 19:17 Steven Levine Status assigned => resolved
2020-05-26 19:17 Steven Levine Resolution open => fixed
2020-05-26 19:17 Steven Levine Note Added: 0003469
2020-05-28 01:07 Steven Levine File Added: proc.c.diff
2020-05-28 01:07 Steven Levine Note Added: 0003471
2020-08-24 03:07 psmedley Status resolved => closed