#1259 closed defect (fixed)
HTTP POST support in FastCGI mode
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | high | Milestone: | FUTURE |
Component: | MapServer C Library | Version: | 4.4 |
Severity: | normal | Keywords: | |
Cc: | huub@… |
Description
Bart, Yikes, I see that FastCGI mode does *not* support post mode. If you can file a bug report against this I could try and fix it. However, the msIO_* stuff hasn't been used much for reading from the stdin pipe so I might end up only fixing this in 4.5 to avoid messing up the 4.4.x. On Mon, 28 Feb 2005 12:21:44 +0100, Bart van den Eijnden <bartvde@xs4all.nl> wrote: > Hi list, > > did anybody test HTTP POST against a Mapserver FastCGI? > > We are receiving an error message containing "POST body is short" in > FastCGI mode, in CGI mode there is no problem. > > Is HTTP POST supported in FastCGI mode? > > cgiutil.c: > > if ( (int) fread(data, 1, data_max, stdin) < data_max ) { > msIO_printf("Content-type: text/html%c%c",10,10); > msIO_printf("POST body is short\n"); > exit(1);
Attachments (1)
Change History (13)
comment:1 by , 19 years ago
Status: | new → assigned |
---|
comment:3 by , 19 years ago
It's not impossible I will get it done for 4.6, but it does seem unlikely at this point. The hard part is setting up a "post" test environment. That could easily take me a couple hours.
comment:4 by , 19 years ago
Cc: | added |
---|
Adding Huub to the cc since he might be able to provide a HTTP POST testcase for Mapserver. Huub do you have a HTTP POST testcase by any chance (including MAP file)?
comment:5 by , 19 years ago
Hi Frank I send you this also in the mail I've put a minimal apache / fcgi installation + mapserv.fcgi + sample dataset on http://mercurius.vz.geodan.nl/huub/apache2.zip (4.5Mb) unpack it on a windows installation in a [drive]:\ (so the DocumentRoot =/apache2/htdocs) launch /Apache2/bin/apache.exe it runs on local port 81 http://localhost:81/ http://localhost:81/form.htm form.htm containes also some compilation info Hopefully this is all info you need. Regards, Huub
comment:6 by , 19 years ago
Hi Frank, I tried to fix it myself but didn't succeed (report included). I was wondering. Do you have the time to fix this in the very near future (Target Milestone:(near)FUTURE)? The reason is that we have to send mapserver an big array of ids (more than 10Kb of data). On the former occasion (in April) we worked around it by adding (a still larger amount of) ids to a databasetable per session, but we don't want to do this again if we don't have to. -- I took the time to look into FastCGI applications. I noticed in mapserv.c that mapserver works with the technique used in \fcgi- 2.4.0\examples\echo.c. like: #include "fcgi_stdio.h" int main () { while (FCGI_Accept() >= 0) { char *contentLength = getenv("CONTENT_LENGTH"); (...) } } But to my surpise echo.c did't work properly on my machine (win2000/apache2.53/fcgi2.4.0): I found no way to get to the environment "CONTENT_LENGTH" or "QUERY_STRING". This in contrast to \fcgi-2.4.0\examples\echo-x.c, which is programmed like: #include "fcgiapp.h" int main () { FCGX_Stream *in, *out, *err; FCGX_ParamArray envp; int count = 0; while (FCGX_Accept(&in, &out, &err, &envp) >= 0) { char *contentLength = FCGX_GetParam("CONTENT_LENGTH", envp); (...) } } In this way a POSTED request also works. I tried to change cgiutils.c and mapserv.c to work in this way but I didn't succeed. I made different functions for loadParams and readPostBody, but all i got was internal server error... both compilations are attached -- Can you give an assessment of your plans for this issue? Best regards, Huub Fleuren (out for the next 3 weeks)
comment:7 by , 19 years ago
First, I applogise for the long delay in dealing with this. I have applied patches to mapio.h, mapio.c, and cgiutil.c that gets POST support working on Linux. In particular I implemented msIO_fread() and modified readPostBody() to use it. I also altered readPostBody() to avoid use of feof(). On linux the getenv() function works fine, apparently because the fastcgi support libraries modifies the environment list "in place" as part of the accept request. It seems to me I read somewhere that this does not work on win32. If that is the case additional work may be needed to get things working smoothly on win32. Changes are applied only in the 4.7 CVS tree. I don't currently plan to backport to 4.6.x, though I could if needed. Would someone be able to test the current CVS tree on win32 and/or a unixy platform? What I really want to know is if I need to "wrap" the getenv() call to get things working on win32.
comment:8 by , 19 years ago
Hi Frank, Just now i tested the new sources with my own setup (the one i sent you) on win2000 and a posted WMS request works. I will try and test it in the production environment this evening. Happy for now Best regards, Huub
comment:10 by , 19 years ago
I put mapserver 4.7.fcgi in our project environment (actually test environment for that one). It seems to work, but there are other errors; these errors are the same however for a get request of mapserver 4.6. ... some other configuration issue, i'm enjoying a vacation time so, i won't be able to handle that. So the actual test of 400 ids has to wait. I think it is OKE though: the request is handled by the ColdFusion object that launches mapserver: an appropiate error image appears Thank you so far. I will inform you later, by 12. aug.
comment:11 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Huub, Thanks! It sounds like the FastCGI post support is complete, so I will close the bug report. If you find otherwise, please feel free to reopen it. And enjoy your vacation! I always say, it isn't vacation unless I can't be reached by email. :-)
comment:12 by , 19 years ago
Hi Frank, A little sooner than expected, i can confirm again that mapserver fcgi-post works fine. There are still other concerns when working with fcgi. Hard for us to nail them down. (Apache, Oracle, FastCGI, Mapserver ...). But the fact that 30 mapserver.fcgi processes do not stop when i stop Apache is not something we have to discuss here.... Thanks again. Huub
Note:
See TracTickets
for help on using tickets.