python: don't ignore decode exception from cnv2pynv
This commit is contained in:
parent
45c07bec4d
commit
27989fe121
|
@ -65,7 +65,7 @@ cdef class SynStreamFrame(CtrlFrame):
|
||||||
cdef uint8_t slot
|
cdef uint8_t slot
|
||||||
cdef object nv
|
cdef object nv
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_syn_stream *frame):
|
cdef fill(self, cspdylay.spdylay_syn_stream *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.stream_id = frame.stream_id
|
self.stream_id = frame.stream_id
|
||||||
|
@ -94,7 +94,7 @@ cdef class SynReplyFrame(CtrlFrame):
|
||||||
cdef int32_t stream_id
|
cdef int32_t stream_id
|
||||||
cdef object nv
|
cdef object nv
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_syn_reply *frame):
|
cdef fill(self, cspdylay.spdylay_syn_reply *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.stream_id = frame.stream_id
|
self.stream_id = frame.stream_id
|
||||||
|
@ -111,7 +111,7 @@ cdef class HeadersFrame(CtrlFrame):
|
||||||
cdef int32_t stream_id
|
cdef int32_t stream_id
|
||||||
cdef object nv
|
cdef object nv
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_headers *frame):
|
cdef fill(self, cspdylay.spdylay_headers *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.stream_id = frame.stream_id
|
self.stream_id = frame.stream_id
|
||||||
|
@ -129,7 +129,7 @@ cdef class RstStreamFrame(CtrlFrame):
|
||||||
cdef int32_t stream_id
|
cdef int32_t stream_id
|
||||||
cdef uint32_t status_code
|
cdef uint32_t status_code
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_rst_stream *frame):
|
cdef fill(self, cspdylay.spdylay_rst_stream *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.stream_id = frame.stream_id
|
self.stream_id = frame.stream_id
|
||||||
|
@ -146,7 +146,7 @@ cdef class RstStreamFrame(CtrlFrame):
|
||||||
cdef class SettingsFrame(CtrlFrame):
|
cdef class SettingsFrame(CtrlFrame):
|
||||||
cdef object iv
|
cdef object iv
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_settings *frame):
|
cdef fill(self, cspdylay.spdylay_settings *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.iv = csettings2pysettings(frame.niv, frame.iv)
|
self.iv = csettings2pysettings(frame.niv, frame.iv)
|
||||||
|
@ -159,7 +159,7 @@ cdef class SettingsFrame(CtrlFrame):
|
||||||
cdef class PingFrame(CtrlFrame):
|
cdef class PingFrame(CtrlFrame):
|
||||||
cdef uint32_t unique_id
|
cdef uint32_t unique_id
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_ping *frame):
|
cdef fill(self, cspdylay.spdylay_ping *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.unique_id = frame.unique_id
|
self.unique_id = frame.unique_id
|
||||||
|
@ -172,7 +172,7 @@ cdef class GoawayFrame(CtrlFrame):
|
||||||
cdef int32_t last_good_stream_id
|
cdef int32_t last_good_stream_id
|
||||||
cdef uint32_t status_code
|
cdef uint32_t status_code
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_goaway *frame):
|
cdef fill(self, cspdylay.spdylay_goaway *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.last_good_stream_id = frame.last_good_stream_id
|
self.last_good_stream_id = frame.last_good_stream_id
|
||||||
|
@ -190,7 +190,7 @@ cdef class WindowUpdateFrame(CtrlFrame):
|
||||||
cdef int32_t stream_id
|
cdef int32_t stream_id
|
||||||
cdef int32_t delta_window_size
|
cdef int32_t delta_window_size
|
||||||
|
|
||||||
cdef void fill(self, cspdylay.spdylay_window_update *frame):
|
cdef fill(self, cspdylay.spdylay_window_update *frame):
|
||||||
self.fillhd(&frame.hd)
|
self.fillhd(&frame.hd)
|
||||||
|
|
||||||
self.stream_id = frame.stream_id
|
self.stream_id = frame.stream_id
|
||||||
|
@ -204,7 +204,7 @@ cdef class WindowUpdateFrame(CtrlFrame):
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.delta_window_size
|
return self.delta_window_size
|
||||||
|
|
||||||
cdef object cnv2pynv(char **nv):
|
cdef cnv2pynv(char **nv):
|
||||||
''' Convert C-style name/value pairs ``nv`` to Python style
|
''' Convert C-style name/value pairs ``nv`` to Python style
|
||||||
pairs. We assume that strings in nv is UTF-8 encoded as per SPDY
|
pairs. We assume that strings in nv is UTF-8 encoded as per SPDY
|
||||||
spec. In Python pairs, we use unicode string.'''
|
spec. In Python pairs, we use unicode string.'''
|
||||||
|
@ -322,14 +322,14 @@ cdef void _call_frame_callback(Session pysession,
|
||||||
object callback):
|
object callback):
|
||||||
if not callback:
|
if not callback:
|
||||||
return
|
return
|
||||||
pyframe = cframe2pyframe(frame_type, frame)
|
try:
|
||||||
if pyframe:
|
pyframe = cframe2pyframe(frame_type, frame)
|
||||||
try:
|
if pyframe:
|
||||||
callback(pysession, pyframe)
|
callback(pysession, pyframe)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pysession.error = e
|
pysession.error = e
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
pysession.base_error = e
|
pysession.base_error = e
|
||||||
|
|
||||||
cdef void on_ctrl_recv_callback(cspdylay.spdylay_session *session,
|
cdef void on_ctrl_recv_callback(cspdylay.spdylay_session *session,
|
||||||
cspdylay.spdylay_frame_type frame_type,
|
cspdylay.spdylay_frame_type frame_type,
|
||||||
|
@ -348,14 +348,14 @@ cdef void on_invalid_ctrl_recv_callback(cspdylay.spdylay_session *session,
|
||||||
|
|
||||||
if not pysession.on_invalid_ctrl_recv_cb:
|
if not pysession.on_invalid_ctrl_recv_cb:
|
||||||
return
|
return
|
||||||
pyframe = cframe2pyframe(frame_type, frame)
|
try:
|
||||||
if pyframe:
|
pyframe = cframe2pyframe(frame_type, frame)
|
||||||
try:
|
if pyframe:
|
||||||
pysession.on_invalid_ctrl_recv_cb(pysession, pyframe, status_code)
|
pysession.on_invalid_ctrl_recv_cb(pysession, pyframe, status_code)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pysession.error = e
|
pysession.error = e
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
pysession.base_error = e
|
pysession.base_error = e
|
||||||
|
|
||||||
cdef void before_ctrl_send_callback(cspdylay.spdylay_session *session,
|
cdef void before_ctrl_send_callback(cspdylay.spdylay_session *session,
|
||||||
cspdylay.spdylay_frame_type frame_type,
|
cspdylay.spdylay_frame_type frame_type,
|
||||||
|
@ -382,14 +382,14 @@ cdef void on_ctrl_not_send_callback(cspdylay.spdylay_session *session,
|
||||||
|
|
||||||
if not pysession.on_ctrl_not_send_cb:
|
if not pysession.on_ctrl_not_send_cb:
|
||||||
return
|
return
|
||||||
pyframe = cframe2pyframe(frame_type, frame)
|
try:
|
||||||
if pyframe:
|
pyframe = cframe2pyframe(frame_type, frame)
|
||||||
try:
|
if pyframe:
|
||||||
pysession.on_ctrl_not_send_cb(pysession, pyframe, error_code)
|
pysession.on_ctrl_not_send_cb(pysession, pyframe, error_code)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pysession.error = e
|
pysession.error = e
|
||||||
except BaseException as e:
|
except BaseException as e:
|
||||||
pysession.base_error = e
|
pysession.base_error = e
|
||||||
|
|
||||||
cdef void on_ctrl_recv_parse_error_callback(\
|
cdef void on_ctrl_recv_parse_error_callback(\
|
||||||
cspdylay.spdylay_session *session,
|
cspdylay.spdylay_session *session,
|
||||||
|
|
Loading…
Reference in New Issue