ancruna / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Linux + Python bindings + User Callback + SSL null pointer #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Appears the SSL_INIT event has a NULL request_info, so when the callback tries 
to access request_info.contents upon sending an SSL_INIT event callback 
produces:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 295, in 'calling callback function'
  File "mongoose.py", line 137, in func
    return callback(event, conn, request_info.contents) and 1 or 0
ValueError: NULL pointer access

Patch that appears to resolve:

--- old-mongoose.py   2010-09-26 17:07:14.000000000 -0700
+++ mongoose.py 2011-02-03 16:00:49.000000000 -0800
@@ -133,6 +133,9 @@
                 # Wrap connection pointer into the connection
                 # object and call Python callback
                 conn = Connection(self, connection)
+                if event == INIT_SSL:
+                    return callback(event, conn, request_info) and 1 or 0
+                else:
                 return callback(event, conn, request_info.contents) and 1 or 0

             # Convert the closure into C callable object

Original issue reported on code.google.com by kwo...@gmail.com on 4 Feb 2011 at 12:06

GoogleCodeExporter commented 9 years ago
This should be fine after 
http://code.google.com/p/mongoose/source/detail?r=32b73a3985379c658d747a6763513e
b651456d00

Could you verify that please?

Original comment by valenok on 7 Mar 2011 at 5:29