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(
json='',
SCRIPT_NAME=os.environ.get('SCRIPT_NAME','app.cgi'),
)
try:
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']
else:
try:
#assume json is everything
D['json'] = F.file.read()
except:
log_error()
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
--
https://mail.python.org/mailman/listinfo/python-list