[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cgiapp versus apache & nginx+fcgiwrap

A client is using servicenow to direct requests to a cgi application.

The servicenow mechanism seems to create a whole file json request. For testing 
purposes the cgi application tries to respond to standard posts as well. The 
connection part is handled like this

F = cgi.FieldStorage(keep_blank_values=False)
D = dict(

     K = F.keys()
except TypeError:
     K = None

if K is not None:
     for k in K:
        D[k] = xmlEscape(F.getvalue(k))
     json = D['json']
         #assume json is everything
         D['json'] = F.file.read()

so if we don't see any normal cgi arguments we try to read json from the cgi 
input file.

With nginx+fcgiwrap this seems to work well for both normal post/get and the 
whole file mechanism, but with apache the split never worked; we always seem to 
get keys in K even if it is an empty list.

Looking at the envirnment that the cgi script sees I cannot see anything obvious 
except the expected differences for the two frontend servers.

I assume apache (2.4) is doing something different. The client would feel more 
comfortable with apache.

Does anyone know how to properly distinguish the two mechanisms ie standard POST 
and a POST with no structure?
Robin Becker