MCPcopy Create free account
hub / github.com/mhammond/pywin32 / HttpFilterProc

Function HttpFilterProc

isapi/src/pyISAPI.cpp:184–220  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182}
183
184DWORD WINAPI HttpFilterProc(HTTP_FILTER_CONTEXT *phfc, DWORD NotificationType, VOID *pvData)
185{
186 DWORD action;
187 CEnterLeavePython celp;
188
189 PyObject *resultobject = NULL;
190
191 // create the Python object
192 CFilterContext fc(phfc, NotificationType, pvData);
193 PyHFC *pyHFC = new PyHFC(&fc);
194 if (!pyHFC) {
195 FilterError(&fc, "Out of memory!");
196 return SF_STATUS_REQ_ERROR;
197 }
198 resultobject = filterHandler.Callback(HANDLER_DO, "(O)", pyHFC);
199 if (! resultobject) {
200 FilterError(&fc, "Filter function failed!");
201 action = SF_STATUS_REQ_ERROR;
202 } else {
203 DWORD action;
204 if (resultobject == Py_None)
205 action = SF_STATUS_REQ_NEXT_NOTIFICATION;
206 else if (PyInt_Check(resultobject))
207 action = PyInt_AsLong(resultobject);
208 else {
209 FilterError(&fc, "Filter should return an int, or None");
210 action = SF_STATUS_REQ_ERROR;
211 }
212 }
213 pyHFC->Reset();
214 Py_DECREF(pyHFC);
215 Py_XDECREF(resultobject);
216 // If last message for this filter context, free our context object.
217 if (NotificationType == SF_NOTIFY_END_OF_NET_SESSION)
218 Py_XDECREF((PyObject *)phfc->pFilterContext);
219 return action;
220}
221
222// Hmm - this appears to never be called!?!?
223// http://sf.net/support/tracker.php?aid=1173795

Callers

nothing calls this directly

Calls 3

CallbackMethod · 0.80
FilterErrorFunction · 0.70
ResetMethod · 0.45

Tested by

no test coverage detected