Bug 46530 - File upload using 3rd party cgi-bin binary longer working
Summary: File upload using 3rd party cgi-bin binary longer working
Status: RESOLVED DUPLICATE of bug 46380
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: All (show other bugs)
Version: 2.2.11
Hardware: Sun Solaris
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL: http://www.csd.toshiba.com
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-14 10:01 UTC by Rudy Amid
Modified: 2009-01-22 13:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rudy Amid 2009-01-14 10:01:38 UTC
We are having an issue with Apache HTTPD version 2.2.10 (including latest v11), and a third party cgi-bin binary for uploading files.  The binary is precompiled for Solaris OS and we do not have a way to change it. Prior versions of HTTPD (such as 2.2.9) worked just fine with this binary.  The binary is called “cp_upload.exe”.

We execute the binary using a POST submit using multipart form.  With version 2.2.10+ the following error occurs:

ERROR:
Usage: cp_upload  –a  configure

Using Fiddler, we captured the response of the form POST and it’s below.   Nothing seems out of the ordinary. Based on this output from Fiddler data, we suspect the problem is somewhere between HTTPD and the cgi binary, but we don't know how to debug this. We may be missing something here.  Any help is greatly appreciated.

POST /cgi-bin/cp_upload.exe HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-silverlight, application/x-silverlight-2-b2, */*
Referer: http://idbvap09.tais.net/cgi-bin/lukhondev2/channel/rmaEntry.jsp
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7d820d16f0b1e
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.0.04506; Tablet PC 2.0; InfoPath.2; .NET CLR 1.1.4322)
Proxy-Connection: Keep-Alive
Content-Length: 18246
Host: idbvap09.tais.net
Pragma: no-cache
Cookie: __utma=65947179.326698554.1207608324.1220484260.1220484305.21; __utmz=65947179.1216366188.12.4.utmccn=(referral)|utmcsr=idbvap09.tais.net|utmcct=/cgi-bin/dev2/b2c/home.to|utmcmd=referral; __utma=123205331.338557692.1217432675.1227726498.1228255254.41; __utmz=123205331.1217432675.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)
 
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="event"
 
fileupload
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="sortby"
 
 
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="partToRemove"
 
 
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="rma"
 
 
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="nextPage"
 
http://idbvap09.tais.net/cgi-bin/lukhondev2/channel/rmaEntry.jsp
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="app_name"
 
lukhondev2
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="relative_dir"
 
pr/rmafileupload
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="upload_option"
 
rename_file
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="ProcessChoice"
 
FileUpload
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="ThisPage"
 
channel/rmaEntry.jsp
-----------------------------7d820d16f0b1e
Content-Disposition: form-data; name="FileName"; filename="C:\Users\Lu-Khon\Desktop\lktest.xls"
Content-Type: application/vnd.ms-excel
Comment 1 Nick Kew 2009-01-14 17:41:29 UTC
Please use a user support forum such as the users mailinglist for help questions.

When you do, be sure to tell us what changed when you updated apache.  Did you run exactly the same build (e.g. using the old config.nice) and overlay it on the old one, or did you install it somewhere new?  And what happens when you run your program under a simulator such as cg-eye offline?
Comment 2 Rainer Jung 2009-01-15 01:03:24 UTC
Since you get the usage message of your cgi I'm wildly guessing it could be BZ 46380. Are you using the worker MPM? 46380 does not occur with prefork.

You can apply the patch

http://svn.apache.org/viewvc?view=rev&revision=726636

and report back, whether it helps, so that we add it to the backport list.
Comment 3 Rudy Amid 2009-01-15 10:01:44 UTC
(In reply to comment #2)
> Since you get the usage message of your cgi I'm wildly guessing it could be BZ
> 46380. Are you using the worker MPM? 46380 does not occur with prefork.
> 
> You can apply the patch
> 
> http://svn.apache.org/viewvc?view=rev&revision=726636
> 
> and report back, whether it helps, so that we add it to the backport list.
> 

We are using MPM.  I will try it with prefork and report what happens.

We did suspect it might be mod_cgid when we saw this 2.2.10 revision notes:

  *) mod_cgid: Pass along empty command line arguments from an ISINDEX
     query that has consecutive '+' characters in the QUERY_STRING,
     matching the behavior of mod_cgi.
     [Eric Covener]

I got the patch, as you suggested, from: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?view=markup&pathrev=726636

But compiling it with 2.2.11 I get the following error below.

mod_cgid.c: In function `get_req':
mod_cgid.c:350: error: `core_request_config' undeclared (first use in this function)
mod_cgid.c:350: error: (Each undeclared identifier is reported only once
mod_cgid.c:350: error: for each function it appears in.)
mod_cgid.c:350: error: `temp_core' undeclared (first use in this function)
mod_cgid.c:368: error: `DYNAMIC_MODULE_LIMIT' undeclared (first use in this function)
mod_cgid.c:370: error: parse error before ')' token
mod_cgid.c: In function `send_req':
mod_cgid.c:462: error: `core_module' undeclared (first use in this function)
mod_cgid.c: In function `cgid_server':
mod_cgid.c:625: error: `ap_unixd_config' undeclared (first use in this function)
mod_cgid.c: In function `cgid_init':
mod_cgid.c:877: error: `ap_preloaded_modules' undeclared (first use in this function)
make[3]: *** [mod_cgid.lo] Error 1
make[3]: Leaving directory `/apps/home/ramid/src/httpd-2.2.11/modules/generators'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/apps/home/ramid/src/httpd-2.2.11/modules/generators'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/apps/home/ramid/src/httpd-2.2.11/modules'
make: *** [all-recursive] Error 1
Comment 4 Rainer Jung 2009-01-15 10:56:42 UTC
(In reply to comment #3)
> (In reply to comment #2)
> We are using MPM.  I will try it with prefork and report what happens.

You meant "We are using the worker MPM" ?

> I got the patch, as you suggested, from:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?view=markup&pathrev=726636
> 
> But compiling it with 2.2.11 I get the following error below.
> ...

Sorry, you misunderstood my link

http://svn.apache.org/viewvc?view=rev&revision=726636

You can not simply copy the f8ull mod_cgid from trunk to version 2.2. What you can do is using the link to the changes (link below "text changed"), which is

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_cgid.c?r1=726636&r2=726635&pathrev=726636

There you can see, that the fix is a simple one line change:

--- httpd/httpd/trunk/modules/generators/mod_cgid.c	2008/12/15 07:40:57	726635
+++ httpd/httpd/trunk/modules/generators/mod_cgid.c	2008/12/15 07:47:30	726636
@@ -201,7 +201,7 @@
     char *w;
     int idx = 0;
 
-    if (ap_strchr_c(args, '=')) {
+    if (!(*args) || ap_strchr_c(args, '=')) {
         numwords = 0;
     }
     else {


you can apply to your version of 2.2.11. I checked 2.2.11, the same line that was changed in trunk is there in 2.2.11 as well. In 2.2.11 it is line number 206 instead of line number 204.

Regards,

Rainer
Comment 5 Rudy Amid 2009-01-22 10:04:24 UTC
Thank you, Rainer.  The mod_cgid.c fix works for us and we've confirmed it in several regression tests.
Comment 6 Ruediger Pluem 2009-01-22 13:10:30 UTC

*** This bug has been marked as a duplicate of bug 46380 ***