| 95 | } |
| 96 | |
| 97 | DWORD WINAPI HttpExtensionProc(EXTENSION_CONTROL_BLOCK *pECB) |
| 98 | { |
| 99 | DWORD result; |
| 100 | CEnterLeavePython celp; |
| 101 | CControlBlock * pcb = new CControlBlock(pECB); |
| 102 | // PyECB takes ownership of pcb - so when it dies, so does pcb. |
| 103 | // As this may die inside Callback, we need to keep our own |
| 104 | // reference so it is still valid should we wind up in ExtensionError. |
| 105 | PyECB *pyECB = new PyECB(pcb); |
| 106 | if (!pyECB || !pcb) |
| 107 | // This is pretty fatal! |
| 108 | return HSE_STATUS_ERROR; |
| 109 | Py_INCREF(pyECB); |
| 110 | PyObject *resultobject = extensionHandler.Callback(HANDLER_DO, "(N)", pyECB); |
| 111 | if (! resultobject) { |
| 112 | ExtensionError(pcb, "HttpExtensionProc function failed!"); |
| 113 | result = HSE_STATUS_ERROR; |
| 114 | } else { |
| 115 | if (PyInt_Check(resultobject)) |
| 116 | result = PyInt_AsLong(resultobject); |
| 117 | else { |
| 118 | ExtensionError(pcb, "HttpExtensionProc should return an int"); |
| 119 | result = HSE_STATUS_ERROR; |
| 120 | } |
| 121 | } |
| 122 | Py_DECREF(pyECB); |
| 123 | Py_XDECREF(resultobject); |
| 124 | return result; |
| 125 | } |
| 126 | |
| 127 | BOOL WINAPI TerminateExtension(DWORD dwFlags) |
| 128 | { |
nothing calls this directly
no test coverage detected