/* Generated by Cython 0.22 */

#define PY_SSIZE_T_CLEAN
#ifndef CYTHON_USE_PYLONG_INTERNALS
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 0
#else
#include "pyconfig.h"
#ifdef PYLONG_BITS_IN_DIGIT
#define CYTHON_USE_PYLONG_INTERNALS 1
#else
#define CYTHON_USE_PYLONG_INTERNALS 0
#endif
#endif
#endif
#include "Python.h"
#ifndef Py_PYTHON_H
    #error Python headers needed to compile C extensions, please install development version of Python.
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_22"
#include <stddef.h>
#ifndef offsetof
#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
#define CYTHON_COMPILING_IN_PYPY 1
#define CYTHON_COMPILING_IN_CPYTHON 0
#else
#define CYTHON_COMPILING_IN_PYPY 0
#define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
#define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \
          PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#if PY_MAJOR_VERSION >= 3
  #define Py_TPFLAGS_CHECKTYPES 0
  #define Py_TPFLAGS_HAVE_INDEX 0
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE)
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ? \
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_LENGTH(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
  #define __Pyx_PyUnicode_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
  #define __Pyx_PyFrozenSet_Size(s)         PyObject_Size(s)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
  #define __Pyx_PyFrozenSet_Size(s)         PySet_Size(s)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and
   a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is
   a quiet NaN. */
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#define __Pyx_void_to_None(void_result) (void_result, Py_INCREF(Py_None), Py_None)
#ifdef __cplusplus
template<typename T>
void __Pyx_call_destructor(T* x) {
    x->~T();
}
template<typename T>
class __Pyx_FakeReference {
  public:
    __Pyx_FakeReference() : ptr(NULL) { }
    __Pyx_FakeReference(T& ref) : ptr(&ref) { }
    T *operator->() { return ptr; }
    operator T&() { return *ptr; }
  private:
    T *ptr;
};
#endif


#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
#define _USE_MATH_DEFINES
#endif
#include <math.h>
#define __PYX_HAVE__nghttp2
#define __PYX_HAVE_API__nghttp2
#include "stdint.h"
#include "nghttp2/nghttp2.h"
#include "string.h"
#include "stdlib.h"
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (    \
    (sizeof(type) < sizeof(Py_ssize_t))  ||             \
    (sizeof(type) > sizeof(Py_ssize_t) &&               \
          likely(v < (type)PY_SSIZE_T_MAX ||            \
                 v == (type)PY_SSIZE_T_MAX)  &&         \
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||       \
                                v == (type)PY_SSIZE_T_MIN)))  ||  \
    (sizeof(type) == sizeof(Py_ssize_t) &&              \
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||        \
                               v == (type)PY_SSIZE_T_MAX)))  )
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "nghttp2.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_7nghttp2_HDDeflater;
struct __pyx_obj_7nghttp2_HDInflater;
struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase;
struct __pyx_obj_7nghttp2__HTTP2SessionCore;
struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore;
struct __pyx_obj_7nghttp2___pyx_scope_struct____init__;
struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__;

/* "nghttp2.pyx":50
 *     return b[:blen]
 * 
 * cdef class HDDeflater:             # <<<<<<<<<<<<<<
 *     '''Performs header compression. The constructor takes
 *     |hd_table_bufsize_max| parameter, which limits the usage of header
 */
struct __pyx_obj_7nghttp2_HDDeflater {
  PyObject_HEAD
  nghttp2_hd_deflater *_deflater;
};


/* "nghttp2.pyx":159
 *         return res
 * 
 * cdef class HDInflater:             # <<<<<<<<<<<<<<
 *     '''Performs header decompression.
 * 
 */
struct __pyx_obj_7nghttp2_HDInflater {
  PyObject_HEAD
  nghttp2_hd_inflater *_inflater;
};


/* "nghttp2.pyx":642
 *         http2._start_settings_timer()
 * 
 * cdef class _HTTP2SessionCoreBase:             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_session *session
 *     cdef transport
 */
struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase {
  PyObject_HEAD
  nghttp2_session *session;
  PyObject *transport;
  PyObject *handler_class;
  PyObject *handlers;
  PyObject *settings_timer;
  PyObject *inside_callback;
};


/* "nghttp2.pyx":795
 *             return
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):             # <<<<<<<<<<<<<<
 *     def __cinit__(self, *args, **kwargs):
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 */
struct __pyx_obj_7nghttp2__HTTP2SessionCore {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase __pyx_base;
};


/* "nghttp2.pyx":909
 *         self.handlers = set()
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):             # <<<<<<<<<<<<<<
 *     def __cinit__(self, *args, **kwargs):
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 */
struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase __pyx_base;
};


/* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ {
  PyObject_HEAD
  PyObject *__pyx_v_RequestHandlerClass;
};


/* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ {
  PyObject_HEAD
  PyObject *__pyx_v_self;
};


/* --- Runtime support code (head) --- */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          if (acquire_gil) { \
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
              PyGILState_Release(__pyx_gilstate_save); \
          } else { \
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil) \
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext() \
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {                            \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_XDECREF(tmp);                              \
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {                             \
        PyObject *tmp = (PyObject *) r;                         \
        r = v; __Pyx_DECREF(tmp);                               \
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name);

static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \
    const char* function_name);

#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

static CYTHON_INLINE int __Pyx_IterFinish(void);

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb);
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed);

#include <string.h>

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors));

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

static void __Pyx_WriteUnraisable(const char *name, int clineno,
                                  int lineno, const char *filename,
                                  int full_traceback);

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) : \
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) : \
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

#if PY_MAJOR_VERSION < 3
#define __Pyx_PyString_Join __Pyx_PyBytes_Join
#define __Pyx_PyBaseString_Join(s, v) (PyUnicode_CheckExact(s) ? PyUnicode_Join(s, v) : __Pyx_PyBytes_Join(s, v))
#else
#define __Pyx_PyString_Join PyUnicode_Join
#define __Pyx_PyBaseString_Join PyUnicode_Join
#endif
#if CYTHON_COMPILING_IN_CPYTHON
    #if PY_MAJOR_VERSION < 3
    #define __Pyx_PyBytes_Join _PyString_Join
    #else
    #define __Pyx_PyBytes_Join _PyBytes_Join
    #endif
#else
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values);
#endif

#ifndef __PYX_FORCE_INIT_THREADS
  #define __PYX_FORCE_INIT_THREADS 0
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f) \
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f) \
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f) \
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g) \
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code) \
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __Pyx_CyFunction_init(void);

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

typedef struct {
    int code_line;
    PyCodeObject* code_object;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value);

static int __Pyx_Print(PyObject*, PyObject *, int);
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

static int __Pyx_PrintOne(PyObject* stream, PyObject *o);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value);

static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *);

static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *);

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

static int __Pyx_check_binary_version(void);

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'libc.stdint' */

/* Module declarations from 'cnghttp2' */

/* Module declarations from 'libc.string' */

/* Module declarations from 'libc.stdlib' */

/* Module declarations from 'nghttp2' */
static PyTypeObject *__pyx_ptype_7nghttp2_HDDeflater = 0;
static PyTypeObject *__pyx_ptype_7nghttp2_HDInflater = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2SessionCoreBase = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2SessionCore = 0;
static PyTypeObject *__pyx_ptype_7nghttp2__HTTP2ClientSessionCore = 0;
static PyTypeObject *__pyx_ptype_7nghttp2___pyx_scope_struct____init__ = 0;
static PyTypeObject *__pyx_ptype_7nghttp2___pyx_scope_struct_1___init__ = 0;
static PyObject *__pyx_f_7nghttp2__get_pybytes(uint8_t *, uint16_t); /*proto*/
static PyObject *__pyx_f_7nghttp2__strerror(int); /*proto*/
static PyObject *__pyx_f_7nghttp2__get_stream_user_data(nghttp2_session *, int32_t); /*proto*/
static size_t __pyx_f_7nghttp2__make_nva(nghttp2_nv **, PyObject *); /*proto*/
static int __pyx_f_7nghttp2_server_on_header(nghttp2_session *, nghttp2_frame const *, uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_header(nghttp2_session *, nghttp2_frame const *, uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, void *); /*proto*/
static int __pyx_f_7nghttp2_on_header(uint8_t const *, size_t, uint8_t const *, size_t, uint8_t, PyObject *); /*proto*/
static int __pyx_f_7nghttp2_server_on_begin_request_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_begin_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_recv(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_on_data_chunk_recv(nghttp2_session *, uint8_t, int32_t, uint8_t const *, size_t, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_send(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_server_on_frame_not_send(nghttp2_session *, nghttp2_frame const *, int, void *); /*proto*/
static int __pyx_f_7nghttp2_on_stream_close(nghttp2_session *, int32_t, uint32_t, void *); /*proto*/
static Py_ssize_t __pyx_f_7nghttp2_data_source_read(nghttp2_session *, int32_t, uint8_t *, size_t, uint32_t *, nghttp2_data_source *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_begin_headers(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_frame_recv(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
static int __pyx_f_7nghttp2_client_on_frame_send(nghttp2_session *, nghttp2_frame const *, void *); /*proto*/
#define __Pyx_MODULE_NAME "nghttp2"
int __pyx_module_is_main_nghttp2 = 0;

/* Implementation of 'nghttp2' */
static PyObject *__pyx_builtin_ImportError;
static PyObject *__pyx_builtin_property;
static PyObject *__pyx_builtin_Exception;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_enumerate;
static PyObject *__pyx_builtin_AttributeError;
static PyObject *__pyx_builtin_super;
static PyObject *__pyx_builtin_OSError;
static PyObject *__pyx_pf_7nghttp2_12HDTableEntry___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_namelen, PyObject *__pyx_v_value, PyObject *__pyx_v_valuelen); /* proto */
static PyObject *__pyx_pf_7nghttp2_12HDTableEntry_2space(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static int __pyx_pf_7nghttp2_10HDDeflater___cinit__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static void __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_4deflate(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_6change_table_size(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self); /* proto */
static int __pyx_pf_7nghttp2_10HDInflater___cinit__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static void __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_4inflate(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_6change_table_size(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /* proto */
static PyObject *__pyx_pf_7nghttp2_10HDInflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_print_hd_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_hdtable); /* proto */
static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b); /* proto */
static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n); /* proto */
static PyObject *__pyx_pf_7nghttp2_2wrap_body(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_body); /* proto */
static int __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_transport, PyObject *__pyx_v_handler_class); /* proto */
static void __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_4data_received(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id, PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self); /* proto */
static int __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_promised_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self); /* proto */
static int __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_16push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_method, PyObject *__pyx_v_request_headers, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body); /* proto */
static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_20resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_4_encode_headers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_headers); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_RequestHandlerClass); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_RequestHandlerClass, PyObject *__pyx_v_ssl); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_18resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_client); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(PyObject *__pyx_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_loop, PyObject *__pyx_v_ssl); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_2io_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_4close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_6send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_url, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler); /* proto */
static PyObject *__pyx_tp_new_7nghttp2_HDDeflater(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2_HDInflater(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2__HTTP2ClientSessionCore(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static char __pyx_k_P[] = "P";
static char __pyx_k_b[] = "b";
static char __pyx_k_e[] = "e";
static char __pyx_k_k[] = "k";
static char __pyx_k_n[] = "n";
static char __pyx_k_s[] = "[{}] (s={}) {}: {}";
static char __pyx_k_v[] = "v";
static char __pyx_k__5[] = "\000";
static char __pyx_k__7[] = "; ";
static char __pyx_k_io[] = "io";
static char __pyx_k_GET[] = "GET";
static char __pyx_k__14[] = "-";
static char __pyx_k__42[] = "/";
static char __pyx_k__43[] = ":";
static char __pyx_k__44[] = ";";
static char __pyx_k__45[] = "?";
static char __pyx_k__46[] = "#";
static char __pyx_k_add[] = "add";
static char __pyx_k_doc[] = "__doc__";
static char __pyx_k_end[] = "end";
static char __pyx_k_err[] = "err";
static char __pyx_k_exc[] = "exc";
static char __pyx_k_idx[] = "idx";
static char __pyx_k_now[] = "now";
static char __pyx_k_ssl[] = "ssl";
static char __pyx_k_sys[] = "sys";
static char __pyx_k_url[] = "url";
static char __pyx_k__136[] = "_";
static char __pyx_k_body[] = "body";
static char __pyx_k_coro[] = "coro";
static char __pyx_k_data[] = "data";
static char __pyx_k_file[] = "file";
static char __pyx_k_host[] = "host";
static char __pyx_k_http[] = "http";
static char __pyx_k_info[] = "info";
static char __pyx_k_init[] = "__init__";
static char __pyx_k_join[] = "join";
static char __pyx_k_loop[] = "loop";
static char __pyx_k_main[] = "__main__";
static char __pyx_k_name[] = "name";
static char __pyx_k_path[] = ":path";
static char __pyx_k_port[] = "port";
static char __pyx_k_push[] = "push";
static char __pyx_k_self[] = "self";
static char __pyx_k_sock[] = "sock";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_time[] = "time";
static char __pyx_k_abort[] = "abort";
static char __pyx_k_close[] = "close";
static char __pyx_k_debug[] = "debug";
static char __pyx_k_email[] = "email";
static char __pyx_k_entry[] = "entry";
static char __pyx_k_http2[] = "http2";
static char __pyx_k_https[] = "https";
static char __pyx_k_print[] = "print";
static char __pyx_k_query[] = "query";
static char __pyx_k_range[] = "range";
static char __pyx_k_read1[] = "read1";
static char __pyx_k_space[] = "space";
static char __pyx_k_split[] = "split";
static char __pyx_k_super[] = "super";
static char __pyx_k_utf_8[] = "utf-8";
static char __pyx_k_utils[] = "utils";
static char __pyx_k_value[] = "value";
static char __pyx_k_write[] = "write";
static char __pyx_k_IOBase[] = "IOBase";
static char __pyx_k_append[] = "append";
static char __pyx_k_cancel[] = "cancel";
static char __pyx_k_client[] = "client";
static char __pyx_k_cookie[] = "cookie";
static char __pyx_k_decode[] = "decode";
static char __pyx_k_encode[] = "encode";
static char __pyx_k_extend[] = "extend";
static char __pyx_k_format[] = "format";
static char __pyx_k_import[] = "__import__";
static char __pyx_k_method[] = ":method";
static char __pyx_k_mktime[] = "mktime";
static char __pyx_k_module[] = "__module__";
static char __pyx_k_netloc[] = "netloc";
static char __pyx_k_params[] = "params";
static char __pyx_k_path_2[] = "path";
static char __pyx_k_pushed[] = "pushed";
static char __pyx_k_remove[] = "remove";
static char __pyx_k_resume[] = "resume";
static char __pyx_k_scheme[] = ":scheme";
static char __pyx_k_server[] = "server";
static char __pyx_k_socket[] = "socket";
static char __pyx_k_status[] = ":status";
static char __pyx_k_stderr[] = "stderr";
static char __pyx_k_usegmt[] = "usegmt";
static char __pyx_k_BytesIO[] = "BytesIO";
static char __pyx_k_DATA_OK[] = "DATA_OK";
static char __pyx_k_OSError[] = "OSError";
static char __pyx_k_address[] = "address";
static char __pyx_k_asyncio[] = "asyncio";
static char __pyx_k_cookies[] = "cookies";
static char __pyx_k_handler[] = "handler";
static char __pyx_k_hdtable[] = "hdtable";
static char __pyx_k_headers[] = "headers";
static char __pyx_k_io_loop[] = "io_loop";
static char __pyx_k_logging[] = "logging";
static char __pyx_k_namelen[] = "namelen";
static char __pyx_k_nghttp2[] = "nghttp2";
static char __pyx_k_on_data[] = "on_data";
static char __pyx_k_pending[] = "pending";
static char __pyx_k_prepare[] = "__prepare__";
static char __pyx_k_session[] = "session";
static char __pyx_k_ssl_ctx[] = "ssl_ctx";
static char __pyx_k_timeval[] = "timeval";
static char __pyx_k_DATA_EOF[] = "DATA_EOF";
static char __pyx_k_Protocol[] = "Protocol";
static char __pyx_k_datetime[] = "datetime";
static char __pyx_k_fragment[] = "fragment";
static char __pyx_k_generate[] = "generate";
static char __pyx_k_method_2[] = "method";
static char __pyx_k_on_close[] = "on_close";
static char __pyx_k_peername[] = "peername";
static char __pyx_k_property[] = "property";
static char __pyx_k_protocol[] = "protocol";
static char __pyx_k_qualname[] = "__qualname__";
static char __pyx_k_scheme_2[] = "scheme";
static char __pyx_k_status_2[] = "status";
static char __pyx_k_urlparse[] = "urlparse";
static char __pyx_k_valuelen[] = "valuelen";
static char __pyx_k_Exception[] = "Exception";
static char __pyx_k_authority[] = ":authority";
static char __pyx_k_enumerate[] = "enumerate";
static char __pyx_k_localtime[] = "localtime";
static char __pyx_k_metaclass[] = "__metaclass__";
static char __pyx_k_send_data[] = "send_data";
static char __pyx_k_stream_id[] = "stream_id";
static char __pyx_k_timetuple[] = "timetuple";
static char __pyx_k_traceback[] = "traceback";
static char __pyx_k_transport[] = "transport";
static char __pyx_k_wrap_body[] = "wrap_body";
static char __pyx_k_OUTBUF_MAX[] = "OUTBUF_MAX";
static char __pyx_k_call_later[] = "call_later";
static char __pyx_k_error_code[] = "error_code";
static char __pyx_k_format_exc[] = "format_exc";
static char __pyx_k_formatdate[] = "formatdate";
static char __pyx_k_on_headers[] = "on_headers";
static char __pyx_k_rst_stream[] = "_rst_stream";
static char __pyx_k_setsockopt[] = "setsockopt";
static char __pyx_k_sslcontext[] = "sslcontext";
static char __pyx_k_HTTP2Client[] = "HTTP2Client";
static char __pyx_k_HTTP2Server[] = "HTTP2Server";
static char __pyx_k_IPPROTO_TCP[] = "IPPROTO_TCP";
static char __pyx_k_ImportError[] = "ImportError";
static char __pyx_k_TCP_NODELAY[] = "TCP_NODELAY";
static char __pyx_k_accept_push[] = "accept_push";
static char __pyx_k_add_handler[] = "_add_handler";
static char __pyx_k_email_utils[] = "email.utils";
static char __pyx_k_getpeercert[] = "getpeercert";
static char __pyx_k_log_request[] = "_log_request";
static char __pyx_k_reject_push[] = "reject_push";
static char __pyx_k_run_forever[] = "run_forever";
static char __pyx_k_HDTableEntry[] = "HDTableEntry";
static char __pyx_k_HTTP2Session[] = "_HTTP2Session";
static char __pyx_k_make_handler[] = "_make_handler";
static char __pyx_k_push_promise[] = "push_promise";
static char __pyx_k_send_pending[] = "send_pending";
static char __pyx_k_send_request[] = "send_request";
static char __pyx_k_urllib_parse[] = "urllib.parse";
static char __pyx_k_ByteIOWrapper[] = "_ByteIOWrapper";
static char __pyx_k_DATA_DEFERRED[] = "DATA_DEFERRED";
static char __pyx_k_create_server[] = "create_server";
static char __pyx_k_data_received[] = "data_received";
static char __pyx_k_handler_class[] = "handler_class";
static char __pyx_k_response_body[] = "response_body";
static char __pyx_k_send_response[] = "send_response";
static char __pyx_k_serve_forever[] = "serve_forever";
static char __pyx_k_AttributeError[] = "AttributeError";
static char __pyx_k_client_address[] = "client_address";
static char __pyx_k_encode_headers[] = "_encode_headers";
static char __pyx_k_enter_callback[] = "enter_callback";
static char __pyx_k_get_event_loop[] = "get_event_loop";
static char __pyx_k_get_extra_info[] = "get_extra_info";
static char __pyx_k_leave_callback[] = "leave_callback";
static char __pyx_k_npn_protocol_s[] = "npn, protocol:%s";
static char __pyx_k_print_hd_table[] = "print_hd_table";
static char __pyx_k_remote_address[] = "remote_address";
static char __pyx_k_remove_handler[] = "_remove_handler";
static char __pyx_k_resume_writing[] = "resume_writing";
static char __pyx_k_server_address[] = "server_address";
static char __pyx_k_connection_lost[] = "connection_lost";
static char __pyx_k_connection_made[] = "connection_made";
static char __pyx_k_on_push_promise[] = "on_push_promise";
static char __pyx_k_on_request_done[] = "on_request_done";
static char __pyx_k_request_headers[] = "request_headers";
static char __pyx_k_session_factory[] = "session_factory";
static char __pyx_k_SETTINGS_TIMEOUT[] = "SETTINGS_TIMEOUT";
static char __pyx_k_on_response_done[] = "on_response_done";
static char __pyx_k_promised_handler[] = "promised_handler";
static char __pyx_k_push_stream_id_s[] = "push, stream_id:%s";
static char __pyx_k_response_headers[] = "response_headers";
static char __pyx_k_settings_timeout[] = "_settings_timeout";
static char __pyx_k_HD_ENTRY_OVERHEAD[] = "HD_ENTRY_OVERHEAD";
static char __pyx_k_HTTP2Client_close[] = "HTTP2Client.close";
static char __pyx_k_create_connection[] = "create_connection";
static char __pyx_k_set_npn_protocols[] = "set_npn_protocols";
static char __pyx_k_set_response_prop[] = "_set_response_prop";
static char __pyx_k_BaseRequestHandler[] = "BaseRequestHandler";
static char __pyx_k_HDTableEntry_space[] = "HDTableEntry.space";
static char __pyx_k_HTTP2ClientSession[] = "_HTTP2ClientSession";
static char __pyx_k_HTTP2Client___init[] = "HTTP2Client.__init__";
static char __pyx_k_HTTP2Server___init[] = "HTTP2Server.__init__";
static char __pyx_k_client_certificate[] = "client_certificate";
static char __pyx_k_get_remote_address[] = "_get_remote_address";
static char __pyx_k_run_until_complete[] = "run_until_complete";
static char __pyx_k_s_s_s_s_HTTP_2_s_s[] = "%s - - [%s] \"%s %s HTTP/2\" %s - %s";
static char __pyx_k_BaseResponseHandler[] = "BaseResponseHandler";
static char __pyx_k_HDTableEntry___init[] = "HDTableEntry.__init__";
static char __pyx_k_HTTP2Client_io_loop[] = "HTTP2Client.io_loop";
static char __pyx_k_HTTP2Session___init[] = "_HTTP2Session.__init__";
static char __pyx_k_RequestHandlerClass[] = "RequestHandlerClass";
static char __pyx_k_request_stream_id_s[] = "request, stream_id:%s";
static char __pyx_k_stop_settings_timer[] = "_stop_settings_timer";
static char __pyx_k_ByteIOWrapper___init[] = "_ByteIOWrapper.__init__";
static char __pyx_k_client_certificate_2[] = "_client_certificate";
static char __pyx_k_hd_table_bufsize_max[] = "hd_table_bufsize_max";
static char __pyx_k_start_settings_timer[] = "_start_settings_timer";
static char __pyx_k_get_write_buffer_size[] = "get_write_buffer_size";
static char __pyx_k_selected_npn_protocol[] = "selected_npn_protocol";
static char __pyx_k_ByteIOWrapper_generate[] = "_ByteIOWrapper.generate";
static char __pyx_k_get_client_certificate[] = "_get_client_certificate";
static char __pyx_k_path_must_not_be_empty[] = "path must not be empty";
static char __pyx_k_BaseRequestHandler_push[] = "BaseRequestHandler.push";
static char __pyx_k_add_handler_stream_id_s[] = "_add_handler, stream_id:%s";
static char __pyx_k_listen_address_s_port_s[] = "listen, address:%s, port:%s";
static char __pyx_k_HTTP2ClientSession_close[] = "_HTTP2ClientSession.close";
static char __pyx_k_HTTP2Client_send_request[] = "HTTP2Client.send_request";
static char __pyx_k_connect_address_s_port_s[] = "connect, address:%s, port:%s";
static char __pyx_k_make_handler_stream_id_s[] = "_make_handler, stream_id:%s";
static char __pyx_k_method_must_not_be_empty[] = "method must not be empty";
static char __pyx_k_status_must_not_be_empty[] = "status must not be empty";
static char __pyx_k_BaseRequestHandler___init[] = "BaseRequestHandler.__init__";
static char __pyx_k_BaseRequestHandler_resume[] = "BaseRequestHandler.resume";
static char __pyx_k_DEFAULT_HEADER_TABLE_SIZE[] = "DEFAULT_HEADER_TABLE_SIZE";
static char __pyx_k_HTTP2ClientSession___init[] = "_HTTP2ClientSession.__init__";
static char __pyx_k_HTTP2Server_serve_forever[] = "HTTP2Server.serve_forever";
static char __pyx_k_send_response_stream_id_s[] = "send_response, stream_id:%s";
static char __pyx_k_BaseRequestHandler_on_data[] = "BaseRequestHandler.on_data";
static char __pyx_k_BaseResponseHandler___init[] = "BaseResponseHandler.__init__";
static char __pyx_k_BaseResponseHandler_resume[] = "BaseResponseHandler.resume";
static char __pyx_k_HTTP2Session_data_received[] = "_HTTP2Session.data_received";
static char __pyx_k_remove_handler_stream_id_s[] = "_remove_handler, stream_id:%s";
static char __pyx_k_BaseRequestHandler_on_close[] = "BaseRequestHandler.on_close";
static char __pyx_k_BaseResponseHandler_on_data[] = "BaseResponseHandler.on_data";
static char __pyx_k_HTTP2Session_resume_writing[] = "_HTTP2Session.resume_writing";
static char __pyx_k_failed_to_set_tcp_nodelay_s[] = "failed to set tcp-nodelay: %s";
static char __pyx_k_on_stream_close_stream_id_s[] = "on_stream_close, stream_id:%s";
static char __pyx_k_BaseResponseHandler_on_close[] = "BaseResponseHandler.on_close";
static char __pyx_k_HTTP2Session_connection_lost[] = "_HTTP2Session.connection_lost";
static char __pyx_k_HTTP2Session_connection_made[] = "_HTTP2Session.connection_made";
static char __pyx_k_BaseRequestHandler_on_headers[] = "BaseRequestHandler.on_headers";
static char __pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE[] = "DEFLATE_MAX_HEADER_TABLE_SIZE";
static char __pyx_k_nghttp2_submit_request_failed[] = "nghttp2_submit_request failed: {}";
static char __pyx_k_BaseResponseHandler_on_headers[] = "BaseResponseHandler.on_headers";
static char __pyx_k_nghttp2_session_mem_send_faild[] = "nghttp2_session_mem_send faild: {}";
static char __pyx_k_nghttp2_submit_response_failed[] = "nghttp2_submit_response failed: {}";
static char __pyx_k_nghttp2_submit_settings_failed[] = "nghttp2_submit_settings failed: {}";
static char __pyx_k_response_has_already_been_sent[] = "response has already been sent";
static char __pyx_k_BaseResponseHandler_accept_push[] = "BaseResponseHandler.accept_push";
static char __pyx_k_BaseResponseHandler_on_response[] = "BaseResponseHandler.on_response_done";
static char __pyx_k_BaseResponseHandler_reject_push[] = "BaseResponseHandler.reject_push";
static char __pyx_k_HTTP2ClientSession_connection_l[] = "_HTTP2ClientSession.connection_lost";
static char __pyx_k_HTTP2ClientSession_connection_m[] = "_HTTP2ClientSession.connection_made";
static char __pyx_k_HTTP2ClientSession_data_receive[] = "_HTTP2ClientSession.data_received";
static char __pyx_k_HTTP2ClientSession_resume_writi[] = "_HTTP2ClientSession.resume_writing";
static char __pyx_k_HTTP2ClientSession_send_request[] = "_HTTP2ClientSession.send_request";
static char __pyx_k_HTTP_2_client_This_class_builds[] = "HTTP/2 client.\n\n        This class builds on top of the asyncio event loop.\n\n        ";
static char __pyx_k_HTTP_2_server_This_class_builds[] = "HTTP/2 server.\n\n        This class builds on top of the asyncio event loop. On\n        construction, RequestHandlerClass must be given, which must be a\n        subclass of BaseRequestHandler class.\n\n        ";
static char __pyx_k_nghttp2_session_mem_recv_failed[] = "nghttp2_session_mem_recv failed: {}";
static char __pyx_k_server_on_frame_not_send_type_s[] = "server_on_frame_not_send, type:%s, stream_id:%s";
static char __pyx_k_usr_src_ports_nghttp2_nghttp2_1[] = "/usr/src/ports/nghttp2/nghttp2-1.7.1-1.x86_64/src/nghttp2-1.7.1/python/nghttp2.pyx";
static char __pyx_k_BaseRequestHandler__set_response[] = "BaseRequestHandler._set_response_prop";
static char __pyx_k_BaseRequestHandler_client_addres[] = "BaseRequestHandler.client_address";
static char __pyx_k_BaseRequestHandler_client_certif[] = "BaseRequestHandler.client_certificate";
static char __pyx_k_BaseRequestHandler_on_request_do[] = "BaseRequestHandler.on_request_done";
static char __pyx_k_BaseRequestHandler_send_response[] = "BaseRequestHandler.send_response";
static char __pyx_k_BaseResponseHandler_on_push_prom[] = "BaseResponseHandler.on_push_promise";
static char __pyx_k_BaseResponseHandler_server_addre[] = "BaseResponseHandler.server_address";
static char __pyx_k_HTTP2Client___init___locals_sess[] = "HTTP2Client.__init__.<locals>.session_factory";
static char __pyx_k_HTTP2Server___init___locals_sess[] = "HTTP2Server.__init__.<locals>.session_factory";
static char __pyx_k_HTTP_2_request_stream_handler_ba[] = "HTTP/2 request (stream) handler base class.\n\n        The class is used to handle the HTTP/2 stream. By default, it does\n        not nothing. It must be subclassed to handle each event callback\n        method.\n\n        The first callback method invoked is on_headers(). It is called\n        when HEADERS frame, which includes request header fields, is\n        arrived.\n\n        If request has request body, on_data(data) is invoked for each\n        chunk of received data.\n\n        When whole request is received, on_request_done() is invoked.\n\n        When stream is closed, on_close(error_code) is called.\n\n        The application can send response using send_response() method. It\n        can be used in on_headers(), on_data() or on_request_done().\n\n        The application can push resource using push() method. It must be\n        used before send_response() call.\n\n        The following instance variables are available:\n\n        client_address\n          Contains a tuple of the form (host, port) referring to the client's\n          address.\n\n        client_certificate\n          May contain the client certifcate in its non-binary form\n\n        stream_id\n          Stream ID of this stream\n\n        scheme\n          Scheme of the request URI. This is a value of :scheme header field.\n\n        method\n          Method of this stream. This is a value of :method header field.\n\n        host\n          This is a value of :authority or host header field.\n\n        path\n          This is a value of :path header field.\n\n        headers\n          Request header fields\n\n        ";
static char __pyx_k_HTTP_2_response_stream_handler_b[] = "HTTP/2 response (stream) handler base class.\n\n        The class is used to handle the HTTP/2 stream. By default, it does\n        not nothing. It must be subclassed to handle each event callback\n        method.\n\n        The first callback method invoked is on_headers(). It is called\n        when HEADERS frame, which includes response header fields, is\n        arrived.\n\n        If response has a body, on_data(data) is invoked for each\n        chunk of received data.\n\n        When whole response is received, on_response_done() is invoked.\n\n        When stream is closed or underlying connection is lost,\n        on_close(error_code) is called.\n\n        The application can send follow up requests using HTTP2Client.send_request() method.\n\n        The application can handle push resource using on_push_promise() method.\n\n        The following instance variables are available:\n\n        server_address\n          Contains a tuple of the form (host, port) referring to the server's\n          address.\n\n        stream_id\n          Stream ID of this stream\n\n        scheme\n          Scheme of the request URI. This is a value of :scheme header field.\n\n        method\n          Method of this stream. This is a value of :method header field.\n\n        host\n          This is a value of :authority or host header field.\n\n        path\n          This is a value of :path header field.\n\n        headers\n          Response header fields.  There is a special exception.  If this\n          object is passed to push_promise(), this instance variable contains\n          pushed request header fields.\n\n        ";
static char __pyx_k_client_on_frame_recv_type_s_stre[] = "client_on_frame_recv, type:%s, stream_id:%s";
static char __pyx_k_client_on_frame_send_type_s_stre[] = "client_on_frame_send, type:%s, stream_id:%s";
static char __pyx_k_client_on_header_type_s_stream_i[] = "client_on_header, type:%s, stream_id:%s";
static char __pyx_k_connection_made_address_s_port_s[] = "connection_made, address:%s, port:%s";
static char __pyx_k_nghttp2_session_callbacks_new_fa[] = "nghttp2_session_callbacks_new failed: {}";
static char __pyx_k_nghttp2_session_client_new_faile[] = "nghttp2_session_client_new failed: {}";
static char __pyx_k_nghttp2_session_server_new_faile[] = "nghttp2_session_server_new failed: {}";
static char __pyx_k_nghttp2_submit_push_promise_fail[] = "nghttp2_submit_push_promise failed: {}";
static char __pyx_k_server_on_frame_recv_type_s_stre[] = "server_on_frame_recv, type:%s, stream_id:%s";
static char __pyx_k_server_on_frame_send_type_s_stre[] = "server_on_frame_send, type:%s, stream_id:%s";
static char __pyx_k_server_on_header_type_s_stream_i[] = "server_on_header, type:%s, stream_id:%s";
static PyObject *__pyx_n_s_AttributeError;
static PyObject *__pyx_n_s_BaseRequestHandler;
static PyObject *__pyx_n_s_BaseRequestHandler___init;
static PyObject *__pyx_n_s_BaseRequestHandler__set_response;
static PyObject *__pyx_n_s_BaseRequestHandler_client_addres;
static PyObject *__pyx_n_s_BaseRequestHandler_client_certif;
static PyObject *__pyx_n_s_BaseRequestHandler_on_close;
static PyObject *__pyx_n_s_BaseRequestHandler_on_data;
static PyObject *__pyx_n_s_BaseRequestHandler_on_headers;
static PyObject *__pyx_n_s_BaseRequestHandler_on_request_do;
static PyObject *__pyx_n_s_BaseRequestHandler_push;
static PyObject *__pyx_n_s_BaseRequestHandler_resume;
static PyObject *__pyx_n_s_BaseRequestHandler_send_response;
static PyObject *__pyx_n_s_BaseResponseHandler;
static PyObject *__pyx_n_s_BaseResponseHandler___init;
static PyObject *__pyx_n_s_BaseResponseHandler_accept_push;
static PyObject *__pyx_n_s_BaseResponseHandler_on_close;
static PyObject *__pyx_n_s_BaseResponseHandler_on_data;
static PyObject *__pyx_n_s_BaseResponseHandler_on_headers;
static PyObject *__pyx_n_s_BaseResponseHandler_on_push_prom;
static PyObject *__pyx_n_s_BaseResponseHandler_on_response;
static PyObject *__pyx_n_s_BaseResponseHandler_reject_push;
static PyObject *__pyx_n_s_BaseResponseHandler_resume;
static PyObject *__pyx_n_s_BaseResponseHandler_server_addre;
static PyObject *__pyx_n_s_ByteIOWrapper;
static PyObject *__pyx_n_s_ByteIOWrapper___init;
static PyObject *__pyx_n_s_ByteIOWrapper_generate;
static PyObject *__pyx_n_s_BytesIO;
static PyObject *__pyx_n_s_DATA_DEFERRED;
static PyObject *__pyx_n_s_DATA_EOF;
static PyObject *__pyx_n_s_DATA_OK;
static PyObject *__pyx_n_s_DEFAULT_HEADER_TABLE_SIZE;
static PyObject *__pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE;
static PyObject *__pyx_n_s_Exception;
static PyObject *__pyx_n_s_GET;
static PyObject *__pyx_n_s_HDTableEntry;
static PyObject *__pyx_n_s_HDTableEntry___init;
static PyObject *__pyx_n_s_HDTableEntry_space;
static PyObject *__pyx_n_s_HD_ENTRY_OVERHEAD;
static PyObject *__pyx_n_s_HTTP2Client;
static PyObject *__pyx_n_s_HTTP2ClientSession;
static PyObject *__pyx_n_s_HTTP2ClientSession___init;
static PyObject *__pyx_n_s_HTTP2ClientSession_close;
static PyObject *__pyx_n_s_HTTP2ClientSession_connection_l;
static PyObject *__pyx_n_s_HTTP2ClientSession_connection_m;
static PyObject *__pyx_n_s_HTTP2ClientSession_data_receive;
static PyObject *__pyx_n_s_HTTP2ClientSession_resume_writi;
static PyObject *__pyx_n_s_HTTP2ClientSession_send_request;
static PyObject *__pyx_n_s_HTTP2Client___init;
static PyObject *__pyx_n_s_HTTP2Client___init___locals_sess;
static PyObject *__pyx_n_s_HTTP2Client_close;
static PyObject *__pyx_n_s_HTTP2Client_io_loop;
static PyObject *__pyx_n_s_HTTP2Client_send_request;
static PyObject *__pyx_n_s_HTTP2Server;
static PyObject *__pyx_n_s_HTTP2Server___init;
static PyObject *__pyx_n_s_HTTP2Server___init___locals_sess;
static PyObject *__pyx_n_s_HTTP2Server_serve_forever;
static PyObject *__pyx_n_s_HTTP2Session;
static PyObject *__pyx_n_s_HTTP2Session___init;
static PyObject *__pyx_n_s_HTTP2Session_connection_lost;
static PyObject *__pyx_n_s_HTTP2Session_connection_made;
static PyObject *__pyx_n_s_HTTP2Session_data_received;
static PyObject *__pyx_n_s_HTTP2Session_resume_writing;
static PyObject *__pyx_kp_s_HTTP_2_client_This_class_builds;
static PyObject *__pyx_kp_s_HTTP_2_request_stream_handler_ba;
static PyObject *__pyx_kp_s_HTTP_2_response_stream_handler_b;
static PyObject *__pyx_kp_s_HTTP_2_server_This_class_builds;
static PyObject *__pyx_n_s_IOBase;
static PyObject *__pyx_n_s_IPPROTO_TCP;
static PyObject *__pyx_n_s_ImportError;
static PyObject *__pyx_n_s_OSError;
static PyObject *__pyx_n_s_OUTBUF_MAX;
static PyObject *__pyx_n_s_P;
static PyObject *__pyx_n_s_Protocol;
static PyObject *__pyx_n_s_RequestHandlerClass;
static PyObject *__pyx_n_s_SETTINGS_TIMEOUT;
static PyObject *__pyx_n_s_TCP_NODELAY;
static PyObject *__pyx_n_s__136;
static PyObject *__pyx_kp_s__14;
static PyObject *__pyx_kp_s__42;
static PyObject *__pyx_kp_s__43;
static PyObject *__pyx_kp_s__44;
static PyObject *__pyx_kp_s__45;
static PyObject *__pyx_kp_s__46;
static PyObject *__pyx_kp_b__5;
static PyObject *__pyx_kp_b__7;
static PyObject *__pyx_n_s_abort;
static PyObject *__pyx_n_s_accept_push;
static PyObject *__pyx_n_s_add;
static PyObject *__pyx_n_s_add_handler;
static PyObject *__pyx_kp_s_add_handler_stream_id_s;
static PyObject *__pyx_n_s_address;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_asyncio;
static PyObject *__pyx_kp_b_authority;
static PyObject *__pyx_n_s_b;
static PyObject *__pyx_n_s_body;
static PyObject *__pyx_n_s_call_later;
static PyObject *__pyx_n_s_cancel;
static PyObject *__pyx_n_s_client;
static PyObject *__pyx_n_s_client_address;
static PyObject *__pyx_n_s_client_certificate;
static PyObject *__pyx_n_s_client_certificate_2;
static PyObject *__pyx_kp_s_client_on_frame_recv_type_s_stre;
static PyObject *__pyx_kp_s_client_on_frame_send_type_s_stre;
static PyObject *__pyx_kp_s_client_on_header_type_s_stream_i;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_kp_s_connect_address_s_port_s;
static PyObject *__pyx_n_s_connection_lost;
static PyObject *__pyx_n_s_connection_made;
static PyObject *__pyx_kp_s_connection_made_address_s_port_s;
static PyObject *__pyx_n_b_cookie;
static PyObject *__pyx_n_s_cookies;
static PyObject *__pyx_n_s_coro;
static PyObject *__pyx_n_s_create_connection;
static PyObject *__pyx_n_s_create_server;
static PyObject *__pyx_n_s_data;
static PyObject *__pyx_n_s_data_received;
static PyObject *__pyx_n_s_datetime;
static PyObject *__pyx_n_s_debug;
static PyObject *__pyx_n_s_decode;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_e;
static PyObject *__pyx_n_s_email;
static PyObject *__pyx_n_s_email_utils;
static PyObject *__pyx_n_s_encode;
static PyObject *__pyx_n_s_encode_headers;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_enter_callback;
static PyObject *__pyx_n_s_entry;
static PyObject *__pyx_n_s_enumerate;
static PyObject *__pyx_n_s_err;
static PyObject *__pyx_n_s_error_code;
static PyObject *__pyx_n_s_exc;
static PyObject *__pyx_n_s_extend;
static PyObject *__pyx_kp_s_failed_to_set_tcp_nodelay_s;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_format_exc;
static PyObject *__pyx_n_s_formatdate;
static PyObject *__pyx_n_s_fragment;
static PyObject *__pyx_n_s_generate;
static PyObject *__pyx_n_s_get_client_certificate;
static PyObject *__pyx_n_s_get_event_loop;
static PyObject *__pyx_n_s_get_extra_info;
static PyObject *__pyx_n_s_get_remote_address;
static PyObject *__pyx_n_s_get_write_buffer_size;
static PyObject *__pyx_n_s_getpeercert;
static PyObject *__pyx_n_s_handler;
static PyObject *__pyx_n_s_handler_class;
static PyObject *__pyx_n_s_hd_table_bufsize_max;
static PyObject *__pyx_n_s_hdtable;
static PyObject *__pyx_n_s_headers;
static PyObject *__pyx_n_b_host;
static PyObject *__pyx_n_s_host;
static PyObject *__pyx_n_s_http;
static PyObject *__pyx_n_s_http2;
static PyObject *__pyx_n_s_https;
static PyObject *__pyx_n_s_idx;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_info;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_io;
static PyObject *__pyx_n_s_io_loop;
static PyObject *__pyx_n_s_join;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_leave_callback;
static PyObject *__pyx_kp_s_listen_address_s_port_s;
static PyObject *__pyx_n_s_localtime;
static PyObject *__pyx_n_s_log_request;
static PyObject *__pyx_n_s_logging;
static PyObject *__pyx_n_s_loop;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_make_handler;
static PyObject *__pyx_kp_s_make_handler_stream_id_s;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_kp_b_method;
static PyObject *__pyx_n_s_method_2;
static PyObject *__pyx_kp_s_method_must_not_be_empty;
static PyObject *__pyx_n_s_mktime;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_n;
static PyObject *__pyx_n_s_name;
static PyObject *__pyx_n_s_namelen;
static PyObject *__pyx_n_s_netloc;
static PyObject *__pyx_n_s_nghttp2;
static PyObject *__pyx_kp_s_nghttp2_session_callbacks_new_fa;
static PyObject *__pyx_kp_s_nghttp2_session_client_new_faile;
static PyObject *__pyx_kp_s_nghttp2_session_mem_recv_failed;
static PyObject *__pyx_kp_s_nghttp2_session_mem_send_faild;
static PyObject *__pyx_kp_s_nghttp2_session_server_new_faile;
static PyObject *__pyx_kp_s_nghttp2_submit_push_promise_fail;
static PyObject *__pyx_kp_s_nghttp2_submit_request_failed;
static PyObject *__pyx_kp_s_nghttp2_submit_response_failed;
static PyObject *__pyx_kp_s_nghttp2_submit_settings_failed;
static PyObject *__pyx_n_s_now;
static PyObject *__pyx_kp_s_npn_protocol_s;
static PyObject *__pyx_n_s_on_close;
static PyObject *__pyx_n_s_on_data;
static PyObject *__pyx_n_s_on_headers;
static PyObject *__pyx_n_s_on_push_promise;
static PyObject *__pyx_n_s_on_request_done;
static PyObject *__pyx_n_s_on_response_done;
static PyObject *__pyx_kp_s_on_stream_close_stream_id_s;
static PyObject *__pyx_n_s_params;
static PyObject *__pyx_kp_b_path;
static PyObject *__pyx_n_s_path_2;
static PyObject *__pyx_kp_s_path_must_not_be_empty;
static PyObject *__pyx_n_s_peername;
static PyObject *__pyx_n_s_pending;
static PyObject *__pyx_n_s_port;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_print_hd_table;
static PyObject *__pyx_n_s_promised_handler;
static PyObject *__pyx_n_s_property;
static PyObject *__pyx_n_s_protocol;
static PyObject *__pyx_n_s_push;
static PyObject *__pyx_n_s_push_promise;
static PyObject *__pyx_kp_s_push_stream_id_s;
static PyObject *__pyx_n_s_pushed;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_query;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_n_s_read1;
static PyObject *__pyx_n_s_reject_push;
static PyObject *__pyx_n_s_remote_address;
static PyObject *__pyx_n_s_remove;
static PyObject *__pyx_n_s_remove_handler;
static PyObject *__pyx_kp_s_remove_handler_stream_id_s;
static PyObject *__pyx_n_s_request_headers;
static PyObject *__pyx_kp_s_request_stream_id_s;
static PyObject *__pyx_n_s_response_body;
static PyObject *__pyx_kp_s_response_has_already_been_sent;
static PyObject *__pyx_n_s_response_headers;
static PyObject *__pyx_n_s_resume;
static PyObject *__pyx_n_s_resume_writing;
static PyObject *__pyx_n_s_rst_stream;
static PyObject *__pyx_n_s_run_forever;
static PyObject *__pyx_n_s_run_until_complete;
static PyObject *__pyx_kp_s_s;
static PyObject *__pyx_kp_s_s_s_s_s_HTTP_2_s_s;
static PyObject *__pyx_kp_b_scheme;
static PyObject *__pyx_n_s_scheme_2;
static PyObject *__pyx_n_s_selected_npn_protocol;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send_data;
static PyObject *__pyx_n_s_send_pending;
static PyObject *__pyx_n_s_send_request;
static PyObject *__pyx_n_s_send_response;
static PyObject *__pyx_kp_s_send_response_stream_id_s;
static PyObject *__pyx_n_s_serve_forever;
static PyObject *__pyx_n_s_server;
static PyObject *__pyx_n_s_server_address;
static PyObject *__pyx_kp_s_server_on_frame_not_send_type_s;
static PyObject *__pyx_kp_s_server_on_frame_recv_type_s_stre;
static PyObject *__pyx_kp_s_server_on_frame_send_type_s_stre;
static PyObject *__pyx_kp_s_server_on_header_type_s_stream_i;
static PyObject *__pyx_n_s_session;
static PyObject *__pyx_n_s_session_factory;
static PyObject *__pyx_n_s_set_npn_protocols;
static PyObject *__pyx_n_s_set_response_prop;
static PyObject *__pyx_n_s_setsockopt;
static PyObject *__pyx_n_s_settings_timeout;
static PyObject *__pyx_n_s_sock;
static PyObject *__pyx_n_s_socket;
static PyObject *__pyx_n_s_space;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_ssl;
static PyObject *__pyx_n_s_ssl_ctx;
static PyObject *__pyx_n_s_sslcontext;
static PyObject *__pyx_n_s_start_settings_timer;
static PyObject *__pyx_kp_b_status;
static PyObject *__pyx_n_s_status_2;
static PyObject *__pyx_kp_s_status_must_not_be_empty;
static PyObject *__pyx_n_s_stderr;
static PyObject *__pyx_n_s_stop_settings_timer;
static PyObject *__pyx_n_s_stream_id;
static PyObject *__pyx_n_s_super;
static PyObject *__pyx_n_s_sys;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_timetuple;
static PyObject *__pyx_n_s_timeval;
static PyObject *__pyx_n_s_traceback;
static PyObject *__pyx_n_s_transport;
static PyObject *__pyx_n_s_url;
static PyObject *__pyx_n_s_urllib_parse;
static PyObject *__pyx_n_s_urlparse;
static PyObject *__pyx_n_s_usegmt;
static PyObject *__pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1;
static PyObject *__pyx_kp_s_utf_8;
static PyObject *__pyx_n_s_utils;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_value;
static PyObject *__pyx_n_s_valuelen;
static PyObject *__pyx_n_s_wrap_body;
static PyObject *__pyx_n_s_write;
static PyObject *__pyx_float_5_0;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_32;
static PyObject *__pyx_int_200;
static PyObject *__pyx_int_4096;
static PyObject *__pyx_int_65535;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_k_;
static PyObject *__pyx_k__8;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
static PyObject *__pyx_tuple__4;
static PyObject *__pyx_tuple__6;
static PyObject *__pyx_tuple__9;
static PyObject *__pyx_tuple__10;
static PyObject *__pyx_tuple__11;
static PyObject *__pyx_tuple__12;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__15;
static PyObject *__pyx_tuple__16;
static PyObject *__pyx_tuple__17;
static PyObject *__pyx_tuple__18;
static PyObject *__pyx_tuple__19;
static PyObject *__pyx_tuple__20;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__22;
static PyObject *__pyx_tuple__23;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__26;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__28;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__30;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__32;
static PyObject *__pyx_tuple__33;
static PyObject *__pyx_tuple__34;
static PyObject *__pyx_tuple__36;
static PyObject *__pyx_tuple__37;
static PyObject *__pyx_tuple__38;
static PyObject *__pyx_tuple__39;
static PyObject *__pyx_tuple__40;
static PyObject *__pyx_tuple__47;
static PyObject *__pyx_tuple__49;
static PyObject *__pyx_tuple__51;
static PyObject *__pyx_tuple__53;
static PyObject *__pyx_tuple__55;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__59;
static PyObject *__pyx_tuple__61;
static PyObject *__pyx_tuple__63;
static PyObject *__pyx_tuple__65;
static PyObject *__pyx_tuple__67;
static PyObject *__pyx_tuple__69;
static PyObject *__pyx_tuple__71;
static PyObject *__pyx_tuple__73;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__76;
static PyObject *__pyx_tuple__78;
static PyObject *__pyx_tuple__79;
static PyObject *__pyx_tuple__81;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__89;
static PyObject *__pyx_tuple__91;
static PyObject *__pyx_tuple__93;
static PyObject *__pyx_tuple__95;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_tuple__98;
static PyObject *__pyx_tuple__100;
static PyObject *__pyx_tuple__102;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__120;
static PyObject *__pyx_tuple__122;
static PyObject *__pyx_tuple__124;
static PyObject *__pyx_tuple__126;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__132;
static PyObject *__pyx_tuple__134;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__140;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_codeobj__35;
static PyObject *__pyx_codeobj__41;
static PyObject *__pyx_codeobj__48;
static PyObject *__pyx_codeobj__50;
static PyObject *__pyx_codeobj__52;
static PyObject *__pyx_codeobj__54;
static PyObject *__pyx_codeobj__56;
static PyObject *__pyx_codeobj__58;
static PyObject *__pyx_codeobj__60;
static PyObject *__pyx_codeobj__62;
static PyObject *__pyx_codeobj__64;
static PyObject *__pyx_codeobj__66;
static PyObject *__pyx_codeobj__68;
static PyObject *__pyx_codeobj__70;
static PyObject *__pyx_codeobj__72;
static PyObject *__pyx_codeobj__74;
static PyObject *__pyx_codeobj__77;
static PyObject *__pyx_codeobj__80;
static PyObject *__pyx_codeobj__82;
static PyObject *__pyx_codeobj__84;
static PyObject *__pyx_codeobj__86;
static PyObject *__pyx_codeobj__88;
static PyObject *__pyx_codeobj__90;
static PyObject *__pyx_codeobj__92;
static PyObject *__pyx_codeobj__94;
static PyObject *__pyx_codeobj__96;
static PyObject *__pyx_codeobj__99;
static PyObject *__pyx_codeobj__101;
static PyObject *__pyx_codeobj__104;
static PyObject *__pyx_codeobj__106;
static PyObject *__pyx_codeobj__108;
static PyObject *__pyx_codeobj__110;
static PyObject *__pyx_codeobj__112;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__121;
static PyObject *__pyx_codeobj__123;
static PyObject *__pyx_codeobj__125;
static PyObject *__pyx_codeobj__127;
static PyObject *__pyx_codeobj__129;
static PyObject *__pyx_codeobj__131;
static PyObject *__pyx_codeobj__133;
static PyObject *__pyx_codeobj__135;
static PyObject *__pyx_codeobj__138;
static PyObject *__pyx_codeobj__141;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__145;

/* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_12HDTableEntry_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_12HDTableEntry_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_name = 0;
  PyObject *__pyx_v_namelen = 0;
  PyObject *__pyx_v_value = 0;
  PyObject *__pyx_v_valuelen = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_name,&__pyx_n_s_namelen,&__pyx_n_s_value,&__pyx_n_s_valuelen,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_namelen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_valuelen)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_self = values[0];
    __pyx_v_name = values[1];
    __pyx_v_namelen = values[2];
    __pyx_v_value = values[3];
    __pyx_v_valuelen = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HDTableEntry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_12HDTableEntry___init__(__pyx_self, __pyx_v_self, __pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_12HDTableEntry___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_namelen, PyObject *__pyx_v_value, PyObject *__pyx_v_valuelen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":39
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 *         self.name = name             # <<<<<<<<<<<<<<
 *         self.namelen = namelen
 *         self.value = value
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_name, __pyx_v_name) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":40
 *     def __init__(self, name, namelen, value, valuelen):
 *         self.name = name
 *         self.namelen = namelen             # <<<<<<<<<<<<<<
 *         self.value = value
 *         self.valuelen = valuelen
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_namelen, __pyx_v_namelen) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":41
 *         self.name = name
 *         self.namelen = namelen
 *         self.value = value             # <<<<<<<<<<<<<<
 *         self.valuelen = valuelen
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_value, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":42
 *         self.namelen = namelen
 *         self.value = value
 *         self.valuelen = valuelen             # <<<<<<<<<<<<<<
 * 
 *     def space(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_valuelen, __pyx_v_valuelen) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("nghttp2.HDTableEntry.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_3space(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_12HDTableEntry_3space = {"space", (PyCFunction)__pyx_pw_7nghttp2_12HDTableEntry_3space, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_12HDTableEntry_3space(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("space (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_12HDTableEntry_2space(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_12HDTableEntry_2space(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("space", 0);

  /* "nghttp2.pyx":45
 * 
 *     def space(self):
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD             # <<<<<<<<<<<<<<
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_namelen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_valuelen); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_HD_ENTRY_OVERHEAD); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HDTableEntry.space", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":47
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):             # <<<<<<<<<<<<<<
 *     return b[:blen]
 * 
 */

static PyObject *__pyx_f_7nghttp2__get_pybytes(uint8_t *__pyx_v_b, uint16_t __pyx_v_blen) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_pybytes", 0);

  /* "nghttp2.pyx":48
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):
 *     return b[:blen]             # <<<<<<<<<<<<<<
 * 
 * cdef class HDDeflater:
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_b) + 0, __pyx_v_blen - 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":47
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 * cdef _get_pybytes(uint8_t *b, uint16_t blen):             # <<<<<<<<<<<<<<
 *     return b[:blen]
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._get_pybytes", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_10HDDeflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_10HDDeflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_hd_table_bufsize_max = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_hd_table_bufsize_max,0};
    PyObject* values[1] = {0};
    values[0] = __pyx_k_;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_hd_table_bufsize_max);
          if (value) { values[0] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_hd_table_bufsize_max = values[0];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HDDeflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater___cinit__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), __pyx_v_hd_table_bufsize_max);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nghttp2_10HDDeflater___cinit__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":77
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":76
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,             # <<<<<<<<<<<<<<
 *                                              hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_deflate_new((&__pyx_v_self->_deflater), __pyx_t_1);

  /* "nghttp2.pyx":78
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":79
 *                                              hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDDeflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":81
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7nghttp2_10HDDeflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":82
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)             # <<<<<<<<<<<<<<
 * 
 *     def deflate(self, headers):
 */
  nghttp2_hd_deflate_del(__pyx_v_self->_deflater);

  /* "nghttp2.pyx":81
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "nghttp2.pyx":84
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 *     def deflate(self, headers):             # <<<<<<<<<<<<<<
 *         '''Compresses the |headers|. The |headers| must be sequence of tuple
 *         of name/value pair, which are sequence of bytes (not unicode
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_5deflate(PyObject *__pyx_v_self, PyObject *__pyx_v_headers); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_4deflate[] = "Compresses the |headers|. The |headers| must be sequence of tuple\n        of name/value pair, which are sequence of bytes (not unicode\n        string).\n\n        This function returns the encoded header block in byte string.\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_5deflate(PyObject *__pyx_v_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("deflate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_4deflate(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), ((PyObject *)__pyx_v_headers));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_4deflate(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_headers) {
  nghttp2_nv *__pyx_v_nva;
  nghttp2_nv *__pyx_v_nvap;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  CYTHON_UNUSED size_t __pyx_v_outcap;
  Py_ssize_t __pyx_v_rv;
  uint8_t *__pyx_v_out;
  size_t __pyx_v_outlen;
  PyObject *__pyx_v_res = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *(*__pyx_t_8)(PyObject *);
  uint8_t *__pyx_t_9;
  Py_ssize_t __pyx_t_10;
  int __pyx_t_11;
  int __pyx_t_12;
  int __pyx_t_13;
  char const *__pyx_t_14;
  PyObject *__pyx_t_15 = NULL;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  PyObject *__pyx_t_19 = NULL;
  PyObject *__pyx_t_20 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("deflate", 0);

  /* "nghttp2.pyx":95
 *         cdef cnghttp2.nghttp2_nv *nva = <cnghttp2.nghttp2_nv*>\
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":93
 * 
 *         '''
 *         cdef cnghttp2.nghttp2_nv *nva = <cnghttp2.nghttp2_nv*>\             # <<<<<<<<<<<<<<
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))
 */
  __pyx_v_nva = ((nghttp2_nv *)malloc(((sizeof(nghttp2_nv)) * __pyx_t_1)));

  /* "nghttp2.pyx":96
 *                                         malloc(sizeof(cnghttp2.nghttp2_nv)*\
 *                                         len(headers))
 *         cdef cnghttp2.nghttp2_nv *nvap = nva             # <<<<<<<<<<<<<<
 * 
 *         for k, v in headers:
 */
  __pyx_v_nvap = __pyx_v_nva;

  /* "nghttp2.pyx":98
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 *         for k, v in headers:             # <<<<<<<<<<<<<<
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 */
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_2 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_2);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
      PyObject* sequence = __pyx_t_4;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      #else
      __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      #endif
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_7 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext;
      index = 0; __pyx_t_5 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_5)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_5);
      index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_7), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = NULL;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_8 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
    __pyx_t_6 = 0;

    /* "nghttp2.pyx":99
 * 
 *         for k, v in headers:
 *             nvap[0].name = k             # <<<<<<<<<<<<<<
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v
 */
    __pyx_t_9 = __Pyx_PyObject_AsUString(__pyx_v_k); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nvap[0]).name = __pyx_t_9;

    /* "nghttp2.pyx":100
 *         for k, v in headers:
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)             # <<<<<<<<<<<<<<
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nvap[0]).namelen = __pyx_t_10;

    /* "nghttp2.pyx":101
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v             # <<<<<<<<<<<<<<
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 */
    __pyx_t_9 = __Pyx_PyObject_AsUString(__pyx_v_v); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nvap[0]).value = __pyx_t_9;

    /* "nghttp2.pyx":102
 *             nvap[0].namelen = len(k)
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)             # <<<<<<<<<<<<<<
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 *             nvap += 1
 */
    __pyx_t_10 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nvap[0]).valuelen = __pyx_t_10;

    /* "nghttp2.pyx":103
 *             nvap[0].value = v
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE             # <<<<<<<<<<<<<<
 *             nvap += 1
 * 
 */
    (__pyx_v_nvap[0]).flags = NGHTTP2_NV_FLAG_NONE;

    /* "nghttp2.pyx":104
 *             nvap[0].valuelen = len(v)
 *             nvap[0].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 *             nvap += 1             # <<<<<<<<<<<<<<
 * 
 *         cdef size_t outcap = 0
 */
    __pyx_v_nvap = (__pyx_v_nvap + 1);

    /* "nghttp2.pyx":98
 *         cdef cnghttp2.nghttp2_nv *nvap = nva
 * 
 *         for k, v in headers:             # <<<<<<<<<<<<<<
 *             nvap[0].name = k
 *             nvap[0].namelen = len(k)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":106
 *             nvap += 1
 * 
 *         cdef size_t outcap = 0             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 *         cdef uint8_t *out
 */
  __pyx_v_outcap = 0;

  /* "nghttp2.pyx":112
 * 
 *         outlen = cnghttp2.nghttp2_hd_deflate_bound(self._deflater,
 *                                                    nva, len(headers))             # <<<<<<<<<<<<<<
 * 
 *         out = <uint8_t*>malloc(outlen)
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":111
 *         cdef size_t outlen
 * 
 *         outlen = cnghttp2.nghttp2_hd_deflate_bound(self._deflater,             # <<<<<<<<<<<<<<
 *                                                    nva, len(headers))
 * 
 */
  __pyx_v_outlen = nghttp2_hd_deflate_bound(__pyx_v_self->_deflater, __pyx_v_nva, __pyx_t_1);

  /* "nghttp2.pyx":114
 *                                                    nva, len(headers))
 * 
 *         out = <uint8_t*>malloc(outlen)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 */
  __pyx_v_out = ((uint8_t *)malloc(__pyx_v_outlen));

  /* "nghttp2.pyx":117
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 *                                             nva, len(headers))             # <<<<<<<<<<<<<<
 *         free(nva)
 * 
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":116
 *         out = <uint8_t*>malloc(outlen)
 * 
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,             # <<<<<<<<<<<<<<
 *                                             nva, len(headers))
 *         free(nva)
 */
  __pyx_v_rv = nghttp2_hd_deflate_hd(__pyx_v_self->_deflater, __pyx_v_out, __pyx_v_outlen, __pyx_v_nva, __pyx_t_1);

  /* "nghttp2.pyx":118
 *         rv = cnghttp2.nghttp2_hd_deflate_hd(self._deflater, out, outlen,
 *                                             nva, len(headers))
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if rv < 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":120
 *         free(nva)
 * 
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             free(out)
 * 
 */
  __pyx_t_11 = ((__pyx_v_rv < 0) != 0);
  if (__pyx_t_11) {

    /* "nghttp2.pyx":121
 * 
 *         if rv < 0:
 *             free(out)             # <<<<<<<<<<<<<<
 * 
 *             raise Exception(_strerror(rv))
 */
    free(__pyx_v_out);

    /* "nghttp2.pyx":123
 *             free(out)
 * 
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *         cdef bytes res
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":127
 *         cdef bytes res
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             res = out[:rv]
 *         finally:
 */
  /*try:*/ {

    /* "nghttp2.pyx":128
 * 
 *         try:
 *             res = out[:rv]             # <<<<<<<<<<<<<<
 *         finally:
 *             free(out)
 */
    __pyx_t_2 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_out) + 0, __pyx_v_rv - 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L9_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_v_res = ((PyObject*)__pyx_t_2);
    __pyx_t_2 = 0;
  }

  /* "nghttp2.pyx":130
 *             res = out[:rv]
 *         finally:
 *             free(out)             # <<<<<<<<<<<<<<
 * 
 *         return res
 */
  /*finally:*/ {
    /*normal exit:*/{
      free(__pyx_v_out);
      goto __pyx_L10;
    }
    /*exception exit:*/{
      __pyx_L9_error:;
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_18, &__pyx_t_19, &__pyx_t_20);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17) < 0)) __Pyx_ErrFetch(&__pyx_t_15, &__pyx_t_16, &__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_15);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __Pyx_XGOTREF(__pyx_t_19);
      __Pyx_XGOTREF(__pyx_t_20);
      __pyx_t_12 = __pyx_lineno; __pyx_t_13 = __pyx_clineno; __pyx_t_14 = __pyx_filename;
      {
        free(__pyx_v_out);
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_XGIVEREF(__pyx_t_19);
        __Pyx_XGIVEREF(__pyx_t_20);
        __Pyx_ExceptionReset(__pyx_t_18, __pyx_t_19, __pyx_t_20);
      }
      __Pyx_XGIVEREF(__pyx_t_15);
      __Pyx_XGIVEREF(__pyx_t_16);
      __Pyx_XGIVEREF(__pyx_t_17);
      __Pyx_ErrRestore(__pyx_t_15, __pyx_t_16, __pyx_t_17);
      __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0;
      __pyx_lineno = __pyx_t_12; __pyx_clineno = __pyx_t_13; __pyx_filename = __pyx_t_14;
      goto __pyx_L1_error;
    }
    __pyx_L10:;
  }

  /* "nghttp2.pyx":132
 *             free(out)
 * 
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def change_table_size(self, hd_table_bufsize_max):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":84
 *         cnghttp2.nghttp2_hd_deflate_del(self._deflater)
 * 
 *     def deflate(self, headers):             # <<<<<<<<<<<<<<
 *         '''Compresses the |headers|. The |headers| must be sequence of tuple
 *         of name/value pair, which are sequence of bytes (not unicode
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2.HDDeflater.deflate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":134
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_6change_table_size[] = "Changes header table size to |hd_table_bufsize_max| byte.\n\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_table_size (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_6change_table_size(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self), ((PyObject *)__pyx_v_hd_table_bufsize_max));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_6change_table_size(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("change_table_size", 0);

  /* "nghttp2.pyx":142
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,
 *                                                            hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":141
 *         '''
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,             # <<<<<<<<<<<<<<
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_deflate_change_table_size(__pyx_v_self->_deflater, __pyx_t_1);

  /* "nghttp2.pyx":143
 *         rv = cnghttp2.nghttp2_hd_deflate_change_table_size(self._deflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":144
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def get_hd_table(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":134
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDDeflater.change_table_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":146
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7nghttp2_10HDDeflater_8get_hd_table[] = "Returns copy of current dynamic header table.";
static PyObject *__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(((struct __pyx_obj_7nghttp2_HDDeflater *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDDeflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDDeflater *__pyx_v_self) {
  size_t __pyx_v_length;
  nghttp2_nv const *__pyx_v_nv;
  PyObject *__pyx_v_res = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_hd_table", 0);

  /* "nghttp2.pyx":148
 *     def get_hd_table(self):
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(             # <<<<<<<<<<<<<<
 *             self._deflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 */
  __pyx_v_length = nghttp2_hd_deflate_get_num_table_entries(__pyx_v_self->_deflater);

  /* "nghttp2.pyx":151
 *             self._deflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []             # <<<<<<<<<<<<<<
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":152
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []
 *         for i in range(62, length + 1):             # <<<<<<<<<<<<<<
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 */
  __pyx_t_2 = (__pyx_v_length + 1);
  for (__pyx_t_3 = 62; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "nghttp2.pyx":153
 *         res = []
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)             # <<<<<<<<<<<<<<
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 */
    __pyx_v_nv = nghttp2_hd_deflate_get_table_entry(__pyx_v_self->_deflater, __pyx_v_i);

    /* "nghttp2.pyx":154
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)             # <<<<<<<<<<<<<<
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->name, __pyx_v_nv->namelen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":155
 *             nv = cnghttp2.nghttp2_hd_deflate_get_table_entry(self._deflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)             # <<<<<<<<<<<<<<
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->value, __pyx_v_nv->valuelen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":156
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_HDTableEntry); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->namelen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->valuelen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_v);
    __Pyx_GIVEREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":157
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res             # <<<<<<<<<<<<<<
 * 
 * cdef class HDInflater:
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":146
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_deflate_get_num_table_entries(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("nghttp2.HDDeflater.get_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":173
 *     cdef cnghttp2.nghttp2_hd_inflater *_inflater
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_10HDInflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_10HDInflater_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) {
    __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;}
  if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1;
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater___cinit__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nghttp2_10HDInflater___cinit__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":174
 * 
 *     def __cinit__(self):
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_v_rv = nghttp2_hd_inflate_new((&__pyx_v_self->_inflater));

  /* "nghttp2.pyx":175
 *     def __cinit__(self):
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_1 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":176
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_2, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":173
 *     cdef cnghttp2.nghttp2_hd_inflater *_inflater
 * 
 *     def __cinit__(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_inflate_new(&self._inflater)
 *         if rv != 0:
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HDInflater.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":178
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7nghttp2_10HDInflater_2__dealloc__(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":179
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)             # <<<<<<<<<<<<<<
 * 
 *     def inflate(self, data):
 */
  nghttp2_hd_inflate_del(__pyx_v_self->_inflater);

  /* "nghttp2.pyx":178
 *             raise Exception(_strerror(rv))
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "nghttp2.pyx":181
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 *     def inflate(self, data):             # <<<<<<<<<<<<<<
 *         '''Decompresses the compressed header block |data|. The |data| must be
 *         byte string (not unicode string).
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_5inflate(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_4inflate[] = "Decompresses the compressed header block |data|. The |data| must be\n        byte string (not unicode string).\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_5inflate(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("inflate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_4inflate(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self), ((PyObject *)__pyx_v_data));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDInflater_4inflate(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_data) {
  nghttp2_nv __pyx_v_nv;
  int __pyx_v_inflate_flags;
  Py_ssize_t __pyx_v_rv;
  uint8_t *__pyx_v_buf;
  size_t __pyx_v_buflen;
  PyObject *__pyx_v_res = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint8_t *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("inflate", 0);

  /* "nghttp2.pyx":189
 *         cdef int inflate_flags
 *         cdef ssize_t rv
 *         cdef uint8_t *buf = data             # <<<<<<<<<<<<<<
 *         cdef size_t buflen = len(data)
 *         res = []
 */
  __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_buf = __pyx_t_1;

  /* "nghttp2.pyx":190
 *         cdef ssize_t rv
 *         cdef uint8_t *buf = data
 *         cdef size_t buflen = len(data)             # <<<<<<<<<<<<<<
 *         res = []
 *         while True:
 */
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_buflen = __pyx_t_2;

  /* "nghttp2.pyx":191
 *         cdef uint8_t *buf = data
 *         cdef size_t buflen = len(data)
 *         res = []             # <<<<<<<<<<<<<<
 *         while True:
 *             inflate_flags = 0
 */
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_res = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":192
 *         cdef size_t buflen = len(data)
 *         res = []
 *         while True:             # <<<<<<<<<<<<<<
 *             inflate_flags = 0
 *             rv = cnghttp2.nghttp2_hd_inflate_hd(self._inflater, &nv,
 */
  while (1) {

    /* "nghttp2.pyx":193
 *         res = []
 *         while True:
 *             inflate_flags = 0             # <<<<<<<<<<<<<<
 *             rv = cnghttp2.nghttp2_hd_inflate_hd(self._inflater, &nv,
 *                                                 &inflate_flags,
 */
    __pyx_v_inflate_flags = 0;

    /* "nghttp2.pyx":194
 *         while True:
 *             inflate_flags = 0
 *             rv = cnghttp2.nghttp2_hd_inflate_hd(self._inflater, &nv,             # <<<<<<<<<<<<<<
 *                                                 &inflate_flags,
 *                                                 buf, buflen, 1)
 */
    __pyx_v_rv = nghttp2_hd_inflate_hd(__pyx_v_self->_inflater, (&__pyx_v_nv), (&__pyx_v_inflate_flags), __pyx_v_buf, __pyx_v_buflen, 1);

    /* "nghttp2.pyx":197
 *                                                 &inflate_flags,
 *                                                 buf, buflen, 1)
 *             if rv < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception(_strerror(rv))
 *             buf += rv
 */
    __pyx_t_4 = ((__pyx_v_rv < 0) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":198
 *                                                 buf, buflen, 1)
 *             if rv < 0:
 *                 raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 *             buf += rv
 *             buflen -= rv
 */
      __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "nghttp2.pyx":199
 *             if rv < 0:
 *                 raise Exception(_strerror(rv))
 *             buf += rv             # <<<<<<<<<<<<<<
 *             buflen -= rv
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 */
    __pyx_v_buf = (__pyx_v_buf + __pyx_v_rv);

    /* "nghttp2.pyx":200
 *                 raise Exception(_strerror(rv))
 *             buf += rv
 *             buflen -= rv             # <<<<<<<<<<<<<<
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 *                 # may throw
 */
    __pyx_v_buflen = (__pyx_v_buflen - __pyx_v_rv);

    /* "nghttp2.pyx":201
 *             buf += rv
 *             buflen -= rv
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:             # <<<<<<<<<<<<<<
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 */
    __pyx_t_4 = ((__pyx_v_inflate_flags & NGHTTP2_HD_INFLATE_EMIT) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":203
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_EMIT:
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))             # <<<<<<<<<<<<<<
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:
 *                 break
 */
      __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_nv.name) + 0, __pyx_v_nv.namelen - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_5 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_nv.value) + 0, __pyx_v_nv.valuelen - 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_3 = 0;
      __pyx_t_5 = 0;
      __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_6); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6;
    }
    __pyx_L6:;

    /* "nghttp2.pyx":204
 *                 # may throw
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:             # <<<<<<<<<<<<<<
 *                 break
 * 
 */
    __pyx_t_4 = ((__pyx_v_inflate_flags & NGHTTP2_HD_INFLATE_FINAL) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":205
 *                 res.append((nv.name[:nv.namelen], nv.value[:nv.valuelen]))
 *             if inflate_flags & cnghttp2.NGHTTP2_HD_INFLATE_FINAL:
 *                 break             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)
 */
      goto __pyx_L4_break;
    }
  }
  __pyx_L4_break:;

  /* "nghttp2.pyx":207
 *                 break
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
  nghttp2_hd_inflate_end_headers(__pyx_v_self->_inflater);

  /* "nghttp2.pyx":208
 * 
 *         cnghttp2.nghttp2_hd_inflate_end_headers(self._inflater)
 *         return res             # <<<<<<<<<<<<<<
 * 
 *     def change_table_size(self, hd_table_bufsize_max):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":181
 *         cnghttp2.nghttp2_hd_inflate_del(self._inflater)
 * 
 *     def inflate(self, data):             # <<<<<<<<<<<<<<
 *         '''Decompresses the compressed header block |data|. The |data| must be
 *         byte string (not unicode string).
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2.HDInflater.inflate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":210
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_6change_table_size[] = "Changes header table size to |hd_table_bufsize_max| byte.\n\n        An exception will be raised on error.\n\n        ";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_7change_table_size(PyObject *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_table_size (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_6change_table_size(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self), ((PyObject *)__pyx_v_hd_table_bufsize_max));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDInflater_6change_table_size(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self, PyObject *__pyx_v_hd_table_bufsize_max) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  size_t __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("change_table_size", 0);

  /* "nghttp2.pyx":218
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,
 *                                                            hd_table_bufsize_max)             # <<<<<<<<<<<<<<
 *         if rv != 0:
 *             raise Exception(_strerror(rv))
 */
  __pyx_t_1 = __Pyx_PyInt_As_size_t(__pyx_v_hd_table_bufsize_max); if (unlikely((__pyx_t_1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":217
 *         '''
 *         cdef int rv
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,             # <<<<<<<<<<<<<<
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_hd_inflate_change_table_size(__pyx_v_self->_inflater, __pyx_t_1);

  /* "nghttp2.pyx":219
 *         rv = cnghttp2.nghttp2_hd_inflate_change_table_size(self._inflater,
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception(_strerror(rv))
 * 
 */
  __pyx_t_2 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":220
 *                                                            hd_table_bufsize_max)
 *         if rv != 0:
 *             raise Exception(_strerror(rv))             # <<<<<<<<<<<<<<
 * 
 *     def get_hd_table(self):
 */
    __pyx_t_3 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":210
 *         return res
 * 
 *     def change_table_size(self, hd_table_bufsize_max):             # <<<<<<<<<<<<<<
 *         '''Changes header table size to |hd_table_bufsize_max| byte.
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HDInflater.change_table_size", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":222
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_10HDInflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static char __pyx_doc_7nghttp2_10HDInflater_8get_hd_table[] = "Returns copy of current dynamic header table.";
static PyObject *__pyx_pw_7nghttp2_10HDInflater_9get_hd_table(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("get_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_10HDInflater_8get_hd_table(((struct __pyx_obj_7nghttp2_HDInflater *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_10HDInflater_8get_hd_table(struct __pyx_obj_7nghttp2_HDInflater *__pyx_v_self) {
  size_t __pyx_v_length;
  nghttp2_nv const *__pyx_v_nv;
  PyObject *__pyx_v_res = NULL;
  size_t __pyx_v_i;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  size_t __pyx_t_2;
  size_t __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("get_hd_table", 0);

  /* "nghttp2.pyx":224
 *     def get_hd_table(self):
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(             # <<<<<<<<<<<<<<
 *             self._inflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 */
  __pyx_v_length = nghttp2_hd_inflate_get_num_table_entries(__pyx_v_self->_inflater);

  /* "nghttp2.pyx":227
 *             self._inflater)
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []             # <<<<<<<<<<<<<<
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_res = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":228
 *         cdef const cnghttp2.nghttp2_nv *nv
 *         res = []
 *         for i in range(62, length + 1):             # <<<<<<<<<<<<<<
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 */
  __pyx_t_2 = (__pyx_v_length + 1);
  for (__pyx_t_3 = 62; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
    __pyx_v_i = __pyx_t_3;

    /* "nghttp2.pyx":229
 *         res = []
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)             # <<<<<<<<<<<<<<
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 */
    __pyx_v_nv = nghttp2_hd_inflate_get_table_entry(__pyx_v_self->_inflater, __pyx_v_i);

    /* "nghttp2.pyx":230
 *         for i in range(62, length + 1):
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)             # <<<<<<<<<<<<<<
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->name, __pyx_v_nv->namelen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":231
 *             nv = cnghttp2.nghttp2_hd_inflate_get_table_entry(self._inflater, i)
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)             # <<<<<<<<<<<<<<
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_pybytes(__pyx_v_nv->value, __pyx_v_nv->valuelen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_1);
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":232
 *             k = _get_pybytes(nv.name, nv.namelen)
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))             # <<<<<<<<<<<<<<
 *         return res
 * 
 */
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_HDTableEntry); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->namelen); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyInt_From_uint16_t(__pyx_v_nv->valuelen); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    __pyx_t_8 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_8 = 1;
      }
    }
    __pyx_t_9 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (__pyx_t_7) {
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    }
    __Pyx_INCREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_k);
    __Pyx_GIVEREF(__pyx_v_k);
    PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_v);
    __Pyx_GIVEREF(__pyx_v_v);
    PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_5 = 0;
    __pyx_t_6 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_res, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":233
 *             v = _get_pybytes(nv.value, nv.valuelen)
 *             res.append(HDTableEntry(k, nv.namelen, v, nv.valuelen))
 *         return res             # <<<<<<<<<<<<<<
 * 
 * cdef _strerror(int liberror_code):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_res);
  __pyx_r = __pyx_v_res;
  goto __pyx_L0;

  /* "nghttp2.pyx":222
 *             raise Exception(_strerror(rv))
 * 
 *     def get_hd_table(self):             # <<<<<<<<<<<<<<
 *         '''Returns copy of current dynamic header table.'''
 *         cdef size_t length = cnghttp2.nghttp2_hd_inflate_get_num_table_entries(
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("nghttp2.HDInflater.get_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_res);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":235
 *         return res
 * 
 * cdef _strerror(int liberror_code):             # <<<<<<<<<<<<<<
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 */

static PyObject *__pyx_f_7nghttp2__strerror(int __pyx_v_liberror_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  char const *__pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_strerror", 0);

  /* "nghttp2.pyx":236
 * 
 * cdef _strerror(int liberror_code):
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')             # <<<<<<<<<<<<<<
 * 
 * def print_hd_table(hdtable):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = nghttp2_strerror(__pyx_v_liberror_code);
  __pyx_t_2 = __Pyx_decode_c_string(__pyx_t_1, 0, strlen(__pyx_t_1), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_t_2);
  __pyx_r = __pyx_t_2;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":235
 *         return res
 * 
 * cdef _strerror(int liberror_code):             # <<<<<<<<<<<<<<
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("nghttp2._strerror", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_1print_hd_table(PyObject *__pyx_self, PyObject *__pyx_v_hdtable); /*proto*/
static char __pyx_doc_7nghttp2_print_hd_table[] = "Convenient function to print |hdtable| to the standard output. This\n    function does not work if header name/value cannot be decoded using\n    UTF-8 encoding.\n\n    s=N means the entry occupies N bytes in header table.\n\n    ";
static PyMethodDef __pyx_mdef_7nghttp2_1print_hd_table = {"print_hd_table", (PyCFunction)__pyx_pw_7nghttp2_1print_hd_table, METH_O, __pyx_doc_7nghttp2_print_hd_table};
static PyObject *__pyx_pw_7nghttp2_1print_hd_table(PyObject *__pyx_self, PyObject *__pyx_v_hdtable) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("print_hd_table (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_print_hd_table(__pyx_self, ((PyObject *)__pyx_v_hdtable));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_print_hd_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_hdtable) {
  PyObject *__pyx_v_idx = NULL;
  PyObject *__pyx_v_entry = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  Py_ssize_t __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("print_hd_table", 0);

  /* "nghttp2.pyx":246
 * 
 *     '''
 *     idx = 0             # <<<<<<<<<<<<<<
 *     for entry in hdtable:
 *         idx += 1
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_v_idx = __pyx_int_0;

  /* "nghttp2.pyx":247
 *     '''
 *     idx = 0
 *     for entry in hdtable:             # <<<<<<<<<<<<<<
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 */
  if (likely(PyList_CheckExact(__pyx_v_hdtable)) || PyTuple_CheckExact(__pyx_v_hdtable)) {
    __pyx_t_1 = __pyx_v_hdtable; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_hdtable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_entry, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "nghttp2.pyx":248
 *     idx = 0
 *     for entry in hdtable:
 *         idx += 1             # <<<<<<<<<<<<<<
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),
 */
    __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_idx, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF_SET(__pyx_v_idx, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "nghttp2.pyx":250
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),             # <<<<<<<<<<<<<<
 *                       entry.name.decode('utf-8'),
 *                       entry.value.decode('utf-8')))
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_s, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_space); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (__pyx_t_8) {
      __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    } else {
      __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":251
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),             # <<<<<<<<<<<<<<
 *                       entry.value.decode('utf-8')))
 * 
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_name); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_decode); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

    /* "nghttp2.pyx":252
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),
 *                       entry.value.decode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 * try:
 */
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_entry, __pyx_n_s_value); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_decode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = NULL;
    __pyx_t_10 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_9)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_9);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_10 = 1;
      }
    }
    __pyx_t_11 = PyTuple_New(4+__pyx_t_10); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_9) {
      PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
    }
    __Pyx_INCREF(__pyx_v_idx);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_idx);
    __Pyx_GIVEREF(__pyx_v_idx);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_6 = 0;
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":247
 *     '''
 *     idx = 0
 *     for entry in hdtable:             # <<<<<<<<<<<<<<
 *         idx += 1
 *         print('[{}] (s={}) {}: {}'\
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("nghttp2.print_hd_table", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_idx);
  __Pyx_XDECREF(__pyx_v_entry);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":274
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_14_ByteIOWrapper_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_b = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_b,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_b)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_b = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_14_ByteIOWrapper___init__(__pyx_self, __pyx_v_self, __pyx_v_b);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_b) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":275
 * 
 *     def __init__(self, b):
 *         self.b = b             # <<<<<<<<<<<<<<
 * 
 *     def generate(self, n):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_b, __pyx_v_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":274
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":277
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_14_ByteIOWrapper_3generate = {"generate", (PyCFunction)__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_14_ByteIOWrapper_3generate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_n = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_n,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_n = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(__pyx_self, __pyx_v_self, __pyx_v_n);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_14_ByteIOWrapper_2generate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_n) {
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("generate", 0);

  /* "nghttp2.pyx":278
 * 
 *     def generate(self, n):
 *         data = self.b.read1(n)             # <<<<<<<<<<<<<<
 *         if not data:
 *             return None, DATA_EOF
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_b); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_read1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_n);
    __Pyx_GIVEREF(__pyx_v_n);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_data = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":279
 *     def generate(self, n):
 *         data = self.b.read1(n)
 *         if not data:             # <<<<<<<<<<<<<<
 *             return None, DATA_EOF
 *         return data, DATA_OK
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_6 = ((!__pyx_t_5) != 0);
  if (__pyx_t_6) {

    /* "nghttp2.pyx":280
 *         data = self.b.read1(n)
 *         if not data:
 *             return None, DATA_EOF             # <<<<<<<<<<<<<<
 *         return data, DATA_OK
 * 
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DATA_EOF); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None);
    __Pyx_GIVEREF(Py_None);
    PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":281
 *         if not data:
 *             return None, DATA_EOF
 *         return data, DATA_OK             # <<<<<<<<<<<<<<
 * 
 * def wrap_body(body):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DATA_OK); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data);
  __Pyx_GIVEREF(__pyx_v_data);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":277
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._ByteIOWrapper.generate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":283
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_3wrap_body(PyObject *__pyx_self, PyObject *__pyx_v_body); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_3wrap_body = {"wrap_body", (PyCFunction)__pyx_pw_7nghttp2_3wrap_body, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_3wrap_body(PyObject *__pyx_self, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("wrap_body (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_2wrap_body(__pyx_self, ((PyObject *)__pyx_v_body));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_2wrap_body(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("wrap_body", 0);

  /* "nghttp2.pyx":284
 * 
 * def wrap_body(body):
 *     if body is None:             # <<<<<<<<<<<<<<
 *         return body
 *     elif isinstance(body, str):
 */
  __pyx_t_1 = (__pyx_v_body == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":285
 * def wrap_body(body):
 *     if body is None:
 *         return body             # <<<<<<<<<<<<<<
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_body);
    __pyx_r = __pyx_v_body;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":286
 *     if body is None:
 *         return body
 *     elif isinstance(body, str):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):
 */
  __pyx_t_2 = PyString_Check(__pyx_v_body); 
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":287
 *         return body
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate             # <<<<<<<<<<<<<<
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_body, __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8);
      __Pyx_GIVEREF(__pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_9, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_generate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_4;
    __pyx_t_4 = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":288
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):
 */
  __pyx_t_1 = PyBytes_Check(__pyx_v_body); 
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":289
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate             # <<<<<<<<<<<<<<
 *     elif isinstance(body, io.IOBase):
 *         return _ByteIOWrapper(body).generate
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_BytesIO); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_5) {
      __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_body); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
      __Pyx_INCREF(__pyx_v_body);
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_body);
      __Pyx_GIVEREF(__pyx_v_body);
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_8, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_9);
      __Pyx_GIVEREF(__pyx_t_9);
      __pyx_t_9 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_generate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":290
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):             # <<<<<<<<<<<<<<
 *         return _ByteIOWrapper(body).generate
 *     else:
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_io); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_IOBase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_2 = PyObject_IsInstance(__pyx_v_body, __pyx_t_4); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":291
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 *     elif isinstance(body, io.IOBase):
 *         return _ByteIOWrapper(body).generate             # <<<<<<<<<<<<<<
 *     else:
 *         # assume that callable in the form f(n) returning tuple byte
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_ByteIOWrapper); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_8 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_8) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_body); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
      __Pyx_INCREF(__pyx_v_body);
      PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_body);
      __Pyx_GIVEREF(__pyx_v_body);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_generate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }
  /*else*/ {

    /* "nghttp2.pyx":295
 *         # assume that callable in the form f(n) returning tuple byte
 *         # string and flag.
 *         return body             # <<<<<<<<<<<<<<
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(__pyx_v_body);
    __pyx_r = __pyx_v_body;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":283
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("nghttp2.wrap_body", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":297
 *         return body
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                            int32_t stream_id):
 *     cdef void *stream_user_data
 */

static PyObject *__pyx_f_7nghttp2__get_stream_user_data(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id) {
  void *__pyx_v_stream_user_data;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("_get_stream_user_data", 0);

  /* "nghttp2.pyx":302
 * 
 *     stream_user_data = cnghttp2.nghttp2_session_get_stream_user_data\
 *                        (session, stream_id)             # <<<<<<<<<<<<<<
 *     if stream_user_data == NULL:
 *         return None
 */
  __pyx_v_stream_user_data = nghttp2_session_get_stream_user_data(__pyx_v_session, __pyx_v_stream_id);

  /* "nghttp2.pyx":303
 *     stream_user_data = cnghttp2.nghttp2_session_get_stream_user_data\
 *                        (session, stream_id)
 *     if stream_user_data == NULL:             # <<<<<<<<<<<<<<
 *         return None
 * 
 */
  __pyx_t_1 = ((__pyx_v_stream_user_data == NULL) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":304
 *                        (session, stream_id)
 *     if stream_user_data == NULL:
 *         return None             # <<<<<<<<<<<<<<
 * 
 *     return <object>stream_user_data
 */
    __Pyx_XDECREF(__pyx_r);
    __Pyx_INCREF(Py_None);
    __pyx_r = Py_None;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":306
 *         return None
 * 
 *     return <object>stream_user_data             # <<<<<<<<<<<<<<
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(((PyObject *)__pyx_v_stream_user_data));
  __pyx_r = ((PyObject *)__pyx_v_stream_user_data);
  goto __pyx_L0;

  /* "nghttp2.pyx":297
 *         return body
 * 
 * cdef _get_stream_user_data(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                            int32_t stream_id):
 *     cdef void *stream_user_data
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":308
 *     return <object>stream_user_data
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_nv *nva
 *     cdef size_t nvlen
 */

static size_t __pyx_f_7nghttp2__make_nva(nghttp2_nv **__pyx_v_nva_ptr, PyObject *__pyx_v_headers) {
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  size_t __pyx_r;
  __Pyx_RefNannyDeclarations
  Py_ssize_t __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  uint8_t *__pyx_t_10;
  Py_ssize_t __pyx_t_11;
  Py_ssize_t __pyx_t_12;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_nva", 0);

  /* "nghttp2.pyx":312
 *     cdef size_t nvlen
 * 
 *     nvlen = len(headers)             # <<<<<<<<<<<<<<
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):
 */
  __pyx_t_1 = PyObject_Length(__pyx_v_headers); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_nvlen = __pyx_t_1;

  /* "nghttp2.pyx":313
 * 
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)             # <<<<<<<<<<<<<<
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k
 */
  __pyx_v_nva = ((nghttp2_nv *)malloc(((sizeof(nghttp2_nv)) * __pyx_v_nvlen)));

  /* "nghttp2.pyx":314
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):             # <<<<<<<<<<<<<<
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 */
  __Pyx_INCREF(__pyx_int_0);
  __pyx_t_2 = __pyx_int_0;
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_3 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_3))) {
        if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_5 = __pyx_t_4(__pyx_t_3);
      if (unlikely(!__pyx_t_5)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_5);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_5))) || (PyList_CheckExact(__pyx_t_5))) {
      PyObject* sequence = __pyx_t_5;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_6 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_6 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      #else
      __pyx_t_6 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      #endif
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_8 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_9 = Py_TYPE(__pyx_t_8)->tp_iternext;
      index = 0; __pyx_t_6 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_6)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_6);
      index = 1; __pyx_t_7 = __pyx_t_9(__pyx_t_8); if (unlikely(!__pyx_t_7)) goto __pyx_L5_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_7);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = NULL;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      goto __pyx_L6_unpacking_done;
      __pyx_L5_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L6_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_6);
    __pyx_t_6 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_INCREF(__pyx_t_2);
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2);
    __pyx_t_2 = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "nghttp2.pyx":315
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k             # <<<<<<<<<<<<<<
 *         nva[i].namelen = len(k)
 *         nva[i].value = v
 */
    __pyx_t_10 = __Pyx_PyObject_AsUString(__pyx_v_k); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nva[__pyx_t_11]).name = __pyx_t_10;

    /* "nghttp2.pyx":316
 *     for i, (k, v) in enumerate(headers):
 *         nva[i].name = k
 *         nva[i].namelen = len(k)             # <<<<<<<<<<<<<<
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)
 */
    __pyx_t_11 = PyObject_Length(__pyx_v_k); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nva[__pyx_t_12]).namelen = __pyx_t_11;

    /* "nghttp2.pyx":317
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 *         nva[i].value = v             # <<<<<<<<<<<<<<
 *         nva[i].valuelen = len(v)
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 */
    __pyx_t_10 = __Pyx_PyObject_AsUString(__pyx_v_v); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nva[__pyx_t_12]).value = __pyx_t_10;

    /* "nghttp2.pyx":318
 *         nva[i].namelen = len(k)
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)             # <<<<<<<<<<<<<<
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 * 
 */
    __pyx_t_12 = PyObject_Length(__pyx_v_v); if (unlikely(__pyx_t_12 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nva[__pyx_t_11]).valuelen = __pyx_t_12;

    /* "nghttp2.pyx":319
 *         nva[i].value = v
 *         nva[i].valuelen = len(v)
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE             # <<<<<<<<<<<<<<
 * 
 *     nva_ptr[0] = nva
 */
    __pyx_t_11 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_11 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 319; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    (__pyx_v_nva[__pyx_t_11]).flags = NGHTTP2_NV_FLAG_NONE;

    /* "nghttp2.pyx":314
 *     nvlen = len(headers)
 *     nva = <cnghttp2.nghttp2_nv*>malloc(sizeof(cnghttp2.nghttp2_nv) * nvlen)
 *     for i, (k, v) in enumerate(headers):             # <<<<<<<<<<<<<<
 *         nva[i].name = k
 *         nva[i].namelen = len(k)
 */
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":321
 *         nva[i].flags = cnghttp2.NGHTTP2_NV_FLAG_NONE
 * 
 *     nva_ptr[0] = nva             # <<<<<<<<<<<<<<
 * 
 *     return nvlen
 */
  (__pyx_v_nva_ptr[0]) = __pyx_v_nva;

  /* "nghttp2.pyx":323
 *     nva_ptr[0] = nva
 * 
 *     return nvlen             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_v_nvlen;
  goto __pyx_L0;

  /* "nghttp2.pyx":308
 *     return <object>stream_user_data
 * 
 * cdef size_t _make_nva(cnghttp2.nghttp2_nv **nva_ptr, headers):             # <<<<<<<<<<<<<<
 *     cdef cnghttp2.nghttp2_nv *nva
 *     cdef size_t nvlen
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_WriteUnraisable("nghttp2._make_nva", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":325
 *     return nvlen
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

static int __pyx_f_7nghttp2_server_on_header(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, uint8_t __pyx_v_flags, void *__pyx_v_user_data) {
  CYTHON_UNUSED PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_header", 0);

  /* "nghttp2.pyx":331
 *                           uint8_t flags,
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":332
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_server_on_header_type_s_stream_i);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_header_type_s_stream_i);
  __Pyx_GIVEREF(__pyx_kp_s_server_on_header_type_s_stream_i);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":334
 *     logging.debug('server_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":335
 * 
 *     handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     return on_header(name, namelen, value, valuelen, flags, handler)             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_f_7nghttp2_on_header(__pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen, __pyx_v_flags, __pyx_v_handler);
  goto __pyx_L0;

  /* "nghttp2.pyx":325
 *     return nvlen
 * 
 * cdef int server_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.server_on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":337
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

static int __pyx_f_7nghttp2_client_on_header(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, uint8_t __pyx_v_flags, void *__pyx_v_user_data) {
  CYTHON_UNUSED PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_header", 0);

  /* "nghttp2.pyx":343
 *                           uint8_t flags,
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":344
 *                           void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_client_on_header_type_s_stream_i);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_header_type_s_stream_i);
  __Pyx_GIVEREF(__pyx_kp_s_client_on_header_type_s_stream_i);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":348
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 * 
 */
  switch (__pyx_v_frame->hd.type) {

    /* "nghttp2.pyx":346
 *     logging.debug('client_on_header, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":347
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;
    break;

    /* "nghttp2.pyx":348
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 * 
 */
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":349
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;
    break;
    default: break;
  }

  /* "nghttp2.pyx":351
 *         handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 * 
 *     return on_header(name, namelen, value, valuelen, flags, handler)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  if (unlikely(!__pyx_v_handler)) { __Pyx_RaiseUnboundLocalError("handler"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_r = __pyx_f_7nghttp2_on_header(__pyx_v_name, __pyx_v_namelen, __pyx_v_value, __pyx_v_valuelen, __pyx_v_flags, __pyx_v_handler);
  goto __pyx_L0;

  /* "nghttp2.pyx":337
 *     return on_header(name, namelen, value, valuelen, flags, handler)
 * 
 * cdef int client_on_header(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                           const cnghttp2.nghttp2_frame *frame,
 *                           const uint8_t *name, size_t namelen,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.client_on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":354
 * 
 * 
 * cdef int on_header(const uint8_t *name, size_t namelen,             # <<<<<<<<<<<<<<
 *                           const uint8_t *value, size_t valuelen,
 *                           uint8_t flags,
 */

static int __pyx_f_7nghttp2_on_header(uint8_t const *__pyx_v_name, size_t __pyx_v_namelen, uint8_t const *__pyx_v_value, size_t __pyx_v_valuelen, CYTHON_UNUSED uint8_t __pyx_v_flags, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_key = NULL;
  PyObject *__pyx_v_values = NULL;
  PyObject *__pyx_v_v = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  int __pyx_t_10;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_header", 0);

  /* "nghttp2.pyx":358
 *                           uint8_t flags,
 *                           object handler):
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":359
 *                           object handler):
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     key = name[:namelen]
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":361
 *         return 0
 * 
 *     key = name[:namelen]             # <<<<<<<<<<<<<<
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_name) + 0, __pyx_v_namelen - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_v_key = ((PyObject*)__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":362
 * 
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')             # <<<<<<<<<<<<<<
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 */
  __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_value) + 0, __pyx_v_valuelen - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_split); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_values = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":363
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':             # <<<<<<<<<<<<<<
 *         handler.scheme = values[0]
 *     elif key == b':method':
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_scheme, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":364
 *     values = value[:valuelen].split(b'\x00')
 *     if key == b':scheme':
 *         handler.scheme = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':method':
 *         handler.method = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_scheme_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":365
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 *     elif key == b':method':             # <<<<<<<<<<<<<<
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_method, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":366
 *         handler.scheme = values[0]
 *     elif key == b':method':
 *         handler.method = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_method_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":367
 *     elif key == b':method':
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':             # <<<<<<<<<<<<<<
 *         handler.host = values[0]
 *     elif key == b':path':
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_authority, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_5 = (__pyx_t_1 != 0);
  if (!__pyx_t_5) {
  } else {
    __pyx_t_2 = __pyx_t_5;
    goto __pyx_L5_bool_binop_done;
  }
  __pyx_t_5 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_n_b_host, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_5 != 0);
  __pyx_t_2 = __pyx_t_1;
  __pyx_L5_bool_binop_done:;
  if (__pyx_t_2) {

    /* "nghttp2.pyx":368
 *         handler.method = values[0]
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':path':
 *         handler.path = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_host, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":369
 *     elif key == b':authority' or key == b'host':
 *         handler.host = values[0]
 *     elif key == b':path':             # <<<<<<<<<<<<<<
 *         handler.path = values[0]
 *     elif key == b':status':
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_path, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":370
 *         handler.host = values[0]
 *     elif key == b':path':
 *         handler.path = values[0]             # <<<<<<<<<<<<<<
 *     elif key == b':status':
 *         handler.status = values[0]
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_path_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }

  /* "nghttp2.pyx":371
 *     elif key == b':path':
 *         handler.path = values[0]
 *     elif key == b':status':             # <<<<<<<<<<<<<<
 *         handler.status = values[0]
 * 
 */
  __pyx_t_1 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_kp_b_status, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":372
 *         handler.path = values[0]
 *     elif key == b':status':
 *         handler.status = values[0]             # <<<<<<<<<<<<<<
 * 
 *     if key == b'cookie':
 */
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_values, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_status_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "nghttp2.pyx":374
 *         handler.status = values[0]
 * 
 *     if key == b'cookie':             # <<<<<<<<<<<<<<
 *         handler.cookies.extend(values)
 *     else:
 */
  __pyx_t_2 = (__Pyx_PyBytes_Equals(__pyx_v_key, __pyx_n_b_cookie, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = (__pyx_t_2 != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":375
 * 
 *     if key == b'cookie':
 *         handler.cookies.extend(values)             # <<<<<<<<<<<<<<
 *     else:
 *         for v in values:
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_extend); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_values);
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_values);
      __Pyx_GIVEREF(__pyx_v_values);
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L7;
  }
  /*else*/ {

    /* "nghttp2.pyx":377
 *         handler.cookies.extend(values)
 *     else:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             handler.headers.append((key, v))
 * 
 */
    if (likely(PyList_CheckExact(__pyx_v_values)) || PyTuple_CheckExact(__pyx_v_values)) {
      __pyx_t_3 = __pyx_v_values; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #else
          __pyx_t_6 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          #endif
        }
      } else {
        __pyx_t_6 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_6)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_6);
      }
      __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "nghttp2.pyx":378
 *     else:
 *         for v in values:
 *             handler.headers.append((key, v))             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_v_key);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_key);
      __Pyx_GIVEREF(__pyx_v_key);
      __Pyx_INCREF(__pyx_v_v);
      PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_v);
      __Pyx_GIVEREF(__pyx_v_v);
      __pyx_t_10 = __Pyx_PyObject_Append(__pyx_t_6, __pyx_t_7); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

      /* "nghttp2.pyx":377
 *         handler.cookies.extend(values)
 *     else:
 *         for v in values:             # <<<<<<<<<<<<<<
 *             handler.headers.append((key, v))
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L7:;

  /* "nghttp2.pyx":380
 *             handler.headers.append((key, v))
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":354
 * 
 * 
 * cdef int on_header(const uint8_t *name, size_t namelen,             # <<<<<<<<<<<<<<
 *                           const uint8_t *value, size_t valuelen,
 *                           uint8_t flags,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.on_header", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_key);
  __Pyx_XDECREF(__pyx_v_values);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":382
 *     return 0
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_begin_request_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_begin_request_headers", 0);

  /* "nghttp2.pyx":385
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":387
 *     cdef http2 = <_HTTP2SessionCore>user_data
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     cnghttp2.nghttp2_session_set_stream_user_data(session, frame.hd.stream_id,
 *                                                   <void*>handler)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_make_handler); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":388
 * 
 *     handler = http2._make_handler(frame.hd.stream_id)
 *     cnghttp2.nghttp2_session_set_stream_user_data(session, frame.hd.stream_id,             # <<<<<<<<<<<<<<
 *                                                   <void*>handler)
 * 
 */
  nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id, ((void *)__pyx_v_handler));

  /* "nghttp2.pyx":391
 *                                                   <void*>handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":382
 *     return 0
 * 
 * cdef int server_on_begin_request_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                          const cnghttp2.nghttp2_frame *frame,
 *                                          void *user_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_WriteUnraisable("nghttp2.server_on_begin_request_headers", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":393
 *     return 0
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_begin_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  __Pyx_RefNannySetupContext("server_on_begin_headers", 0);

  /* "nghttp2.pyx":396
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             return server_on_begin_request_headers(session, frame, user_data)
 */
  __pyx_t_1 = ((__pyx_v_frame->hd.type == NGHTTP2_HEADERS) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":397
 *                                  void *user_data):
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             return server_on_begin_request_headers(session, frame, user_data)
 * 
 */
    __pyx_t_1 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_REQUEST) != 0);
    if (__pyx_t_1) {

      /* "nghttp2.pyx":398
 *     if frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             return server_on_begin_request_headers(session, frame, user_data)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_r = __pyx_f_7nghttp2_server_on_begin_request_headers(__pyx_v_session, __pyx_v_frame, __pyx_v_user_data);
      goto __pyx_L0;
    }
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":400
 *             return server_on_begin_request_headers(session, frame, user_data)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":393
 *     return 0
 * 
 * cdef int server_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

  /* function exit code */
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":402
 *     return 0
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_frame_recv(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_recv", 0);

  /* "nghttp2.pyx":405
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":406
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_server_on_frame_recv_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_recv_type_s_stre);
  __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_recv_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":434
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 */
  switch (__pyx_v_frame->hd.type) {

    /* "nghttp2.pyx":408
 *     logging.debug('server_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    case NGHTTP2_DATA:

    /* "nghttp2.pyx":409
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":410
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_handler = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "nghttp2.pyx":411
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((!__pyx_t_8) != 0);
      if (__pyx_t_9) {

        /* "nghttp2.pyx":412
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_request_done()
 */
        __pyx_r = 0;
        goto __pyx_L0;
      }

      /* "nghttp2.pyx":413
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_request_done()
 *             except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "nghttp2.pyx":414
 *                 return 0
 *             try:
 *                 handler.on_request_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_request_done); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (__pyx_t_7) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_try_end;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "nghttp2.pyx":415
 *             try:
 *                 handler.on_request_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);

          /* "nghttp2.pyx":416
 *                 handler.on_request_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          if (__pyx_t_13) {
            __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          } else {
            __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          }
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":417
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
            PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_15;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L8_except_return;
        }
        __pyx_L7_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L8_except_return:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L0;
        __pyx_L12_try_end:;
      }
      goto __pyx_L3;
    }
    __pyx_L3:;
    break;

    /* "nghttp2.pyx":418
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":419
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_9 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_REQUEST) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":420
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_7 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_handler = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "nghttp2.pyx":421
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_REQUEST:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             if handler.cookies:
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = ((!__pyx_t_9) != 0);
      if (__pyx_t_8) {

        /* "nghttp2.pyx":422
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 */
        __pyx_r = 0;
        goto __pyx_L0;
      }

      /* "nghttp2.pyx":423
 *             if not handler:
 *                 return 0
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_8) {

        /* "nghttp2.pyx":424
 *                 return 0
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);

        /* "nghttp2.pyx":425
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))             # <<<<<<<<<<<<<<
 *                 handler.cookies = None
 *             try:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyBytes_Join(__pyx_kp_b__7, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":424
 *                 return 0
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_16 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_3); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":426
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_headers()
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "nghttp2.pyx":427
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "nghttp2.pyx":428
 *                 handler.cookies = None
 *             try:
 *                 handler.on_headers()             # <<<<<<<<<<<<<<
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_headers); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_1 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          if (__pyx_t_1) {
            __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else {
            __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
          }
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "nghttp2.pyx":429
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_request_done()
 *             except:
 */
          __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
          if (__pyx_t_8) {

            /* "nghttp2.pyx":430
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_request_done); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            if (__pyx_t_1) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else {
              __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L18_error;}
            }
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            goto __pyx_L26;
          }
          __pyx_L26:;
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L25_try_end;
        __pyx_L18_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":431
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_request_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_1);

          /* "nghttp2.pyx":432
 *                     handler.on_request_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          if (__pyx_t_13) {
            __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          } else {
            __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          }
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":433
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_GOTREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L20_except_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_15;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L21_except_return;
        }
        __pyx_L20_except_error:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L21_except_return:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L0;
        __pyx_L25_try_end:;
      }
      goto __pyx_L15;
    }
    __pyx_L15:;
    break;

    /* "nghttp2.pyx":434
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 */
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":435
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 * 
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":436
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_stop_settings_timer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L29;
    }
    __pyx_L29:;
    break;
    default: break;
  }

  /* "nghttp2.pyx":438
 *             http2._stop_settings_timer()
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":402
 *     return 0
 * 
 * cdef int server_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":440
 *     return 0
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                    uint8_t flags,
 *                                    int32_t stream_id, const uint8_t *data,
 */

static int __pyx_f_7nghttp2_on_data_chunk_recv(nghttp2_session *__pyx_v_session, CYTHON_UNUSED uint8_t __pyx_v_flags, int32_t __pyx_v_stream_id, uint8_t const *__pyx_v_data, size_t __pyx_v_length, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_data_chunk_recv", 0);

  /* "nghttp2.pyx":444
 *                                    int32_t stream_id, const uint8_t *data,
 *                                    size_t length, void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":446
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 * 
 *     handler = _get_stream_user_data(session, stream_id)             # <<<<<<<<<<<<<<
 *     if not handler:
 *         return 0
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":447
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":448
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":450
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_data(data[:length])
 *     except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":451
 * 
 *     try:
 *         handler.on_data(data[:length])             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_data); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_data) + 0, __pyx_v_length - 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_9) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_10);
        PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
        PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_8);
        __Pyx_GIVEREF(__pyx_t_8);
        __pyx_t_8 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":452
 *     try:
 *         handler.on_data(data[:length])
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 *         return http2._rst_stream(stream_id)
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2.on_data_chunk_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_GOTREF(__pyx_t_10);

      /* "nghttp2.pyx":453
 *         handler.on_data(data[:length])
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *         return http2._rst_stream(stream_id)
 * 
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_13))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_13);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_13, function);
        }
      }
      if (__pyx_t_12) {
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_13, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_13) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = NULL;
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_11);
        __Pyx_GIVEREF(__pyx_t_11);
        __pyx_t_11 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_12, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":454
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 *         return http2._rst_stream(stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_12 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_11) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); __pyx_t_11 = NULL;
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_13, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_8); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __pyx_r = __pyx_t_14;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_except_return;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L7_except_return:;
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
    goto __pyx_L0;
    __pyx_L11_try_end:;
  }

  /* "nghttp2.pyx":456
 *         return http2._rst_stream(stream_id)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":440
 *     return 0
 * 
 * cdef int on_data_chunk_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                    uint8_t flags,
 *                                    int32_t stream_id, const uint8_t *data,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_WriteUnraisable("nghttp2.on_data_chunk_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":458
 *     return 0
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_server_on_frame_send(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_send", 0);

  /* "nghttp2.pyx":461
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":462
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_server_on_frame_send_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_send_type_s_stre);
  __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_send_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":476
 *             return 0
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 *            cnghttp2.nghttp2_session_check_server_session(session):
 */
  switch (__pyx_v_frame->hd.type) {

    /* "nghttp2.pyx":464
 *     logging.debug('server_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # For PUSH_PROMISE, send push response immediately
 *         handler = _get_stream_user_data\
 */
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":467
 *         # For PUSH_PROMISE, send push response immediately
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":468
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 * 
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":469
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 * 
 *         http2.send_response(handler)
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":471
 *             return 0
 * 
 *         http2.send_response(handler)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_send_response); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_handler);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_handler);
      __Pyx_GIVEREF(__pyx_v_handler);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    break;

    /* "nghttp2.pyx":472
 * 
 *         http2.send_response(handler)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 */
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":473
 *         http2.send_response(handler)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    __pyx_t_9 = (((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":474
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":475
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 *         http2._start_settings_timer()             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_start_settings_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    break;

    /* "nghttp2.pyx":476
 *             return 0
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 *            cnghttp2.nghttp2_session_check_server_session(session):
 */
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":477
 *         http2._start_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {
    } else {
      __pyx_t_9 = __pyx_t_8;
      goto __pyx_L6_bool_binop_done;
    }

    /* "nghttp2.pyx":478
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM) and \
 *            cnghttp2.nghttp2_session_check_server_session(session):             # <<<<<<<<<<<<<<
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 */
    __pyx_t_8 = (nghttp2_session_check_server_session(__pyx_v_session) != 0);
    __pyx_t_9 = __pyx_t_8;
    __pyx_L6_bool_binop_done:;
    if (__pyx_t_9) {

      /* "nghttp2.pyx":481
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, frame.hd.stream_id) == 0:             # <<<<<<<<<<<<<<
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
      __pyx_t_9 = ((nghttp2_session_get_stream_remote_close(__pyx_v_session, __pyx_v_frame->hd.stream_id) == 0) != 0);
      if (__pyx_t_9) {

        /* "nghttp2.pyx":482
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, frame.hd.stream_id) == 0:
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PyInt_FromLong(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_2 = NULL;
        __pyx_t_6 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
            __pyx_t_6 = 1;
          }
        }
        __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_5);
        if (__pyx_t_2) {
          PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
        }
        PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
        __Pyx_GIVEREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_7);
        __Pyx_GIVEREF(__pyx_t_7);
        __pyx_t_4 = 0;
        __pyx_t_7 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        goto __pyx_L8;
      }
      __pyx_L8:;
      goto __pyx_L5;
    }
    __pyx_L5:;
    break;
    default: break;
  }

  /* "nghttp2.pyx":458
 *     return 0
 * 
 * cdef int server_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":484
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                   const cnghttp2.nghttp2_frame *frame,
 *                                   int lib_error_code,
 */

static int __pyx_f_7nghttp2_server_on_frame_not_send(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, CYTHON_UNUSED int __pyx_v_lib_error_code, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_on_frame_not_send", 0);

  /* "nghttp2.pyx":488
 *                                   int lib_error_code,
 *                                   void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":489
 *                                   void *user_data):
 *     cdef http2 = <_HTTP2SessionCore>user_data
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_server_on_frame_not_send_type_s);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_server_on_frame_not_send_type_s);
  __Pyx_GIVEREF(__pyx_kp_s_server_on_frame_not_send_type_s);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":491
 *     logging.debug('server_on_frame_not_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # We have to remove handler here. Without this, it is not
 *         # removed until session is terminated.
 */
  __pyx_t_8 = ((__pyx_v_frame->hd.type == NGHTTP2_PUSH_PROMISE) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":495
 *         # removed until session is terminated.
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":496
 *         handler = _get_stream_user_data\
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._remove_handler(handler)
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":497
 *                   (session, frame.push_promise.promised_stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._remove_handler(handler)
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":498
 *         if not handler:
 *             return 0
 *         http2._remove_handler(handler)             # <<<<<<<<<<<<<<
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      __Pyx_INCREF(__pyx_v_handler);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_handler);
      __Pyx_GIVEREF(__pyx_v_handler);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":484
 *                 http2._rst_stream(frame.hd.stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * cdef int server_on_frame_not_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                   const cnghttp2.nghttp2_frame *frame,
 *                                   int lib_error_code,
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.server_on_frame_not_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":500
 *         http2._remove_handler(handler)
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                 int32_t stream_id,
 *                                 uint32_t error_code,
 */

static int __pyx_f_7nghttp2_on_stream_close(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id, uint32_t __pyx_v_error_code, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_stream_close", 0);

  /* "nghttp2.pyx":504
 *                                 uint32_t error_code,
 *                                 void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":505
 *                                 void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_on_stream_close_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_on_stream_close_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_on_stream_close_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":507
 *     logging.debug('on_stream_close, stream_id:%s', stream_id)
 * 
 *     handler = _get_stream_user_data(session, stream_id)             # <<<<<<<<<<<<<<
 *     if not handler:
 *         return 0
 */
  __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":508
 * 
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:             # <<<<<<<<<<<<<<
 *         return 0
 * 
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_8 = ((!__pyx_t_7) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":509
 *     handler = _get_stream_user_data(session, stream_id)
 *     if not handler:
 *         return 0             # <<<<<<<<<<<<<<
 * 
 *     try:
 */
    __pyx_r = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":511
 *         return 0
 * 
 *     try:             # <<<<<<<<<<<<<<
 *         handler.on_close(error_code)
 *     except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_11);
    /*try:*/ {

      /* "nghttp2.pyx":512
 * 
 *     try:
 *         handler.on_close(error_code)             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_6 = __Pyx_PyInt_From_uint32_t(__pyx_v_error_code); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (!__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
        __Pyx_GOTREF(__pyx_t_1);
      } else {
        __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_4);
        PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
        PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
        __Pyx_GIVEREF(__pyx_t_6);
        __pyx_t_6 = 0;
        __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      }
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
    goto __pyx_L11_try_end;
    __pyx_L4_error:;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":513
 *     try:
 *         handler.on_close(error_code)
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 * 
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2.on_stream_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_4);

      /* "nghttp2.pyx":514
 *         handler.on_close(error_code)
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 * 
 *     http2._remove_handler(handler)
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_13 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_13)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_13);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      if (__pyx_t_13) {
        __pyx_t_12 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      } else {
        __pyx_t_12 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_14) {
        __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_12); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_GOTREF(__pyx_t_6);
      } else {
        __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
        PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_12);
        __Pyx_GIVEREF(__pyx_t_12);
        __pyx_t_12 = 0;
        __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L6_except_error;}
        __Pyx_GOTREF(__pyx_t_6);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      goto __pyx_L5_exception_handled;
    }
    __pyx_L6_except_error:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    goto __pyx_L1_error;
    __pyx_L5_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_11);
    __Pyx_ExceptionReset(__pyx_t_9, __pyx_t_10, __pyx_t_11);
    __pyx_L11_try_end:;
  }

  /* "nghttp2.pyx":516
 *         sys.stderr.write(traceback.format_exc())
 * 
 *     http2._remove_handler(handler)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_1)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_1);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_1) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":518
 *     http2._remove_handler(handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":500
 *         http2._remove_handler(handler)
 * 
 * cdef int on_stream_close(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                 int32_t stream_id,
 *                                 uint32_t error_code,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.on_stream_close", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":520
 *     return 0
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               int32_t stream_id,
 *                               uint8_t *buf, size_t length,
 */

static Py_ssize_t __pyx_f_7nghttp2_data_source_read(nghttp2_session *__pyx_v_session, int32_t __pyx_v_stream_id, uint8_t *__pyx_v_buf, size_t __pyx_v_length, uint32_t *__pyx_v_data_flags, nghttp2_data_source *__pyx_v_source, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_generator = NULL;
  PyObject *__pyx_v_data = NULL;
  PyObject *__pyx_v_flag = NULL;
  Py_ssize_t __pyx_v_nread;
  Py_ssize_t __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_t_13;
  int __pyx_t_14;
  char const *__pyx_t_15;
  PyObject *__pyx_t_16 = NULL;
  PyObject *__pyx_t_17 = NULL;
  PyObject *__pyx_t_18 = NULL;
  Py_ssize_t __pyx_t_19;
  int __pyx_t_20;
  Py_ssize_t __pyx_t_21;
  uint8_t *__pyx_t_22;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_source_read", 0);

  /* "nghttp2.pyx":526
 *                               cnghttp2.nghttp2_data_source *source,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data             # <<<<<<<<<<<<<<
 *     generator = <object>source.ptr
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":527
 *                               void *user_data):
 *     cdef http2 = <_HTTP2SessionCoreBase>user_data
 *     generator = <object>source.ptr             # <<<<<<<<<<<<<<
 * 
 *     http2.enter_callback()
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_source->ptr);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_generator = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":529
 *     generator = <object>source.ptr
 * 
 *     http2.enter_callback()             # <<<<<<<<<<<<<<
 *     try:
 *         data, flag = generator(length)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_enter_callback); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":530
 * 
 *     http2.enter_callback()
 *     try:             # <<<<<<<<<<<<<<
 *         data, flag = generator(length)
 *     except:
 */
  /*try:*/ {
    {
      __Pyx_ExceptionSave(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_6);
      /*try:*/ {

        /* "nghttp2.pyx":531
 *     http2.enter_callback()
 *     try:
 *         data, flag = generator(length)             # <<<<<<<<<<<<<<
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 */
        __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_INCREF(__pyx_v_generator);
        __pyx_t_3 = __pyx_v_generator; __pyx_t_7 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (!__pyx_t_7) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_8);
          PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
          PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_2);
          __Pyx_GIVEREF(__pyx_t_2);
          __pyx_t_2 = 0;
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        }
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
          PyObject* sequence = __pyx_t_1;
          #if CYTHON_COMPILING_IN_CPYTHON
          Py_ssize_t size = Py_SIZE(sequence);
          #else
          Py_ssize_t size = PySequence_Size(sequence);
          #endif
          if (unlikely(size != 2)) {
            if (size > 2) __Pyx_RaiseTooManyValuesError(2);
            else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          }
          #if CYTHON_COMPILING_IN_CPYTHON
          if (likely(PyTuple_CheckExact(sequence))) {
            __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); 
            __pyx_t_8 = PyTuple_GET_ITEM(sequence, 1); 
          } else {
            __pyx_t_3 = PyList_GET_ITEM(sequence, 0); 
            __pyx_t_8 = PyList_GET_ITEM(sequence, 1); 
          }
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_8);
          #else
          __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_8 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_8);
          #endif
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          Py_ssize_t index = -1;
          __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __pyx_t_9 = Py_TYPE(__pyx_t_2)->tp_iternext;
          index = 0; __pyx_t_3 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_3)) goto __pyx_L14_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_3);
          index = 1; __pyx_t_8 = __pyx_t_9(__pyx_t_2); if (unlikely(!__pyx_t_8)) goto __pyx_L14_unpacking_failed;
          __Pyx_GOTREF(__pyx_t_8);
          if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __pyx_t_9 = NULL;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          goto __pyx_L15_unpacking_done;
          __pyx_L14_unpacking_failed:;
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_9 = NULL;
          if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
          {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L6_error;}
          __pyx_L15_unpacking_done:;
        }
        __pyx_v_data = __pyx_t_3;
        __pyx_t_3 = 0;
        __pyx_v_flag = __pyx_t_8;
        __pyx_t_8 = 0;
      }
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L13_try_end;
      __pyx_L6_error:;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":532
 *     try:
 *         data, flag = generator(length)
 *     except:             # <<<<<<<<<<<<<<
 *         sys.stderr.write(traceback.format_exc())
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 */
      /*except:*/ {
        __Pyx_AddTraceback("nghttp2.data_source_read", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_8, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_GOTREF(__pyx_t_3);

        /* "nghttp2.pyx":533
 *         data, flag = generator(length)
 *     except:
 *         sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 *     finally:
 */
        __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __pyx_t_11 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
          __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
          if (likely(__pyx_t_11)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
            __Pyx_INCREF(__pyx_t_11);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_12, function);
          }
        }
        if (__pyx_t_11) {
          __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        } else {
          __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
        }
        __Pyx_GOTREF(__pyx_t_10);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
        __pyx_t_12 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_12)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_12);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (!__pyx_t_12) {
          __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
          __Pyx_GOTREF(__pyx_t_2);
        } else {
          __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_11);
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
          PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
          __Pyx_GIVEREF(__pyx_t_10);
          __pyx_t_10 = 0;
          __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L8_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

        /* "nghttp2.pyx":534
 *     except:
 *         sys.stderr.write(traceback.format_exc())
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;             # <<<<<<<<<<<<<<
 *     finally:
 *         http2.leave_callback()
 */
        __pyx_r = NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        goto __pyx_L9_except_return;
      }
      __pyx_L8_except_error:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L4_error;
      __pyx_L9_except_return:;
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_ExceptionReset(__pyx_t_4, __pyx_t_5, __pyx_t_6);
      goto __pyx_L3_return;
      __pyx_L13_try_end:;
    }
  }

  /* "nghttp2.pyx":536
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
 *     finally:
 *         http2.leave_callback()             # <<<<<<<<<<<<<<
 * 
 *     if flag == DATA_DEFERRED:
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4) < 0)) __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_5, &__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_6);
      __Pyx_XGOTREF(__pyx_t_5);
      __Pyx_XGOTREF(__pyx_t_4);
      __Pyx_XGOTREF(__pyx_t_16);
      __Pyx_XGOTREF(__pyx_t_17);
      __Pyx_XGOTREF(__pyx_t_18);
      __pyx_t_13 = __pyx_lineno; __pyx_t_14 = __pyx_clineno; __pyx_t_15 = __pyx_filename;
      {
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_1)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_1);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
          }
        }
        if (__pyx_t_1) {
          __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        } else {
          __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L19_error;}
        }
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XGIVEREF(__pyx_t_6);
      __Pyx_XGIVEREF(__pyx_t_5);
      __Pyx_XGIVEREF(__pyx_t_4);
      __Pyx_ErrRestore(__pyx_t_6, __pyx_t_5, __pyx_t_4);
      __pyx_t_6 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      __pyx_lineno = __pyx_t_13; __pyx_clineno = __pyx_t_14; __pyx_filename = __pyx_t_15;
      goto __pyx_L1_error;
      __pyx_L19_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_16);
        __Pyx_XGIVEREF(__pyx_t_17);
        __Pyx_XGIVEREF(__pyx_t_18);
        __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18);
      }
      __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L3_return: {
      __pyx_t_19 = __pyx_r;
      __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_leave_callback); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_1 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
        __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_8);
        if (likely(__pyx_t_1)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
          __Pyx_INCREF(__pyx_t_1);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_8, function);
        }
      }
      if (__pyx_t_1) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_r = __pyx_t_19;
      goto __pyx_L0;
    }
    __pyx_L5:;
  }

  /* "nghttp2.pyx":538
 *         http2.leave_callback()
 * 
 *     if flag == DATA_DEFERRED:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DATA_DEFERRED); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":539
 * 
 *     if flag == DATA_DEFERRED:
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED             # <<<<<<<<<<<<<<
 * 
 *     if data:
 */
    __pyx_r = NGHTTP2_ERR_DEFERRED;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":541
 *         return cnghttp2.NGHTTP2_ERR_DEFERRED
 * 
 *     if data:             # <<<<<<<<<<<<<<
 *         nread = len(data)
 *         memcpy(buf, <uint8_t*>data, nread)
 */
  if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_data); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_20) {

    /* "nghttp2.pyx":542
 * 
 *     if data:
 *         nread = len(data)             # <<<<<<<<<<<<<<
 *         memcpy(buf, <uint8_t*>data, nread)
 *     else:
 */
    if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_21 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_v_nread = __pyx_t_21;

    /* "nghttp2.pyx":543
 *     if data:
 *         nread = len(data)
 *         memcpy(buf, <uint8_t*>data, nread)             # <<<<<<<<<<<<<<
 *     else:
 *         nread = 0
 */
    if (unlikely(!__pyx_v_data)) { __Pyx_RaiseUnboundLocalError("data"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
    __pyx_t_22 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_22) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    memcpy(__pyx_v_buf, ((uint8_t *)__pyx_t_22), __pyx_v_nread);
    goto __pyx_L21;
  }
  /*else*/ {

    /* "nghttp2.pyx":545
 *         memcpy(buf, <uint8_t*>data, nread)
 *     else:
 *         nread = 0             # <<<<<<<<<<<<<<
 * 
 *     if flag == DATA_EOF:
 */
    __pyx_v_nread = 0;
  }
  __pyx_L21:;

  /* "nghttp2.pyx":547
 *         nread = 0
 * 
 *     if flag == DATA_EOF:             # <<<<<<<<<<<<<<
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_DATA_EOF); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_3 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_8, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":548
 * 
 *     if flag == DATA_EOF:
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF             # <<<<<<<<<<<<<<
 *         if cnghttp2.nghttp2_session_check_server_session(session):
 *             # Send RST_STREAM if remote is not closed yet
 */
    (__pyx_v_data_flags[0]) = NGHTTP2_DATA_FLAG_EOF;

    /* "nghttp2.pyx":549
 *     if flag == DATA_EOF:
 *         data_flags[0] = cnghttp2.NGHTTP2_DATA_FLAG_EOF
 *         if cnghttp2.nghttp2_session_check_server_session(session):             # <<<<<<<<<<<<<<
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 */
    __pyx_t_20 = (nghttp2_session_check_server_session(__pyx_v_session) != 0);
    if (__pyx_t_20) {

      /* "nghttp2.pyx":552
 *             # Send RST_STREAM if remote is not closed yet
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, stream_id) == 0:             # <<<<<<<<<<<<<<
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:
 */
      __pyx_t_20 = ((nghttp2_session_get_stream_remote_close(__pyx_v_session, __pyx_v_stream_id) == 0) != 0);
      if (__pyx_t_20) {

        /* "nghttp2.pyx":553
 *             if cnghttp2.nghttp2_session_get_stream_remote_close(
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 *     elif flag != DATA_OK:
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 */
        __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __pyx_t_2 = PyInt_FromLong(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_7 = NULL;
        __pyx_t_21 = 0;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
          __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_8);
          if (likely(__pyx_t_7)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
            __Pyx_INCREF(__pyx_t_7);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_8, function);
            __pyx_t_21 = 1;
          }
        }
        __pyx_t_11 = PyTuple_New(2+__pyx_t_21); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_11);
        if (__pyx_t_7) {
          PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
        }
        PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_21, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_21, __pyx_t_2);
        __Pyx_GIVEREF(__pyx_t_2);
        __pyx_t_1 = 0;
        __pyx_t_2 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        goto __pyx_L24;
      }
      __pyx_L24:;
      goto __pyx_L23;
    }
    __pyx_L23:;
    goto __pyx_L22;
  }

  /* "nghttp2.pyx":554
 *                     session, stream_id) == 0:
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:             # <<<<<<<<<<<<<<
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 * 
 */
  if (unlikely(!__pyx_v_flag)) { __Pyx_RaiseUnboundLocalError("flag"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DATA_OK); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyObject_RichCompare(__pyx_v_flag, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_20 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  if (__pyx_t_20) {

    /* "nghttp2.pyx":555
 *                 http2._rst_stream(stream_id, cnghttp2.NGHTTP2_NO_ERROR)
 *     elif flag != DATA_OK:
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE             # <<<<<<<<<<<<<<
 * 
 *     return nread
 */
    __pyx_r = NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE;
    goto __pyx_L0;
  }
  __pyx_L22:;

  /* "nghttp2.pyx":557
 *         return cnghttp2.NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
 * 
 *     return nread             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = __pyx_v_nread;
  goto __pyx_L0;

  /* "nghttp2.pyx":520
 *     return 0
 * 
 * cdef ssize_t data_source_read(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               int32_t stream_id,
 *                               uint8_t *buf, size_t length,
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_WriteUnraisable("nghttp2.data_source_read", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_generator);
  __Pyx_XDECREF(__pyx_v_data);
  __Pyx_XDECREF(__pyx_v_flag);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":559
 *     return nread
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_begin_headers(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_push_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_begin_headers", 0);

  /* "nghttp2.pyx":562
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":564
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()
 */
  __pyx_t_2 = ((__pyx_v_frame->hd.type == NGHTTP2_PUSH_PROMISE) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":566
 *     if frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()             # <<<<<<<<<<<<<<
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_BaseResponseHandler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_push_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":567
 *         # Generate a temporary handler until the headers are all received
 *         push_handler = BaseResponseHandler()
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 *                                                       <void*>push_handler)
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_add_handler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_push_handler);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_push_handler);
    __Pyx_GIVEREF(__pyx_v_push_handler);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":568
 *         push_handler = BaseResponseHandler()
 *         http2._add_handler(push_handler, frame.push_promise.promised_stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>push_handler)
 * 
 */
    nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id, ((void *)__pyx_v_push_handler));
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":571
 *                                                       <void*>push_handler)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":559
 *     return nread
 * 
 * cdef int client_on_begin_headers(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                                  const cnghttp2.nghttp2_frame *frame,
 *                                  void *user_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.client_on_begin_headers", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_push_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":573
 *     return 0
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_frame_recv(nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_v_push_handler = NULL;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_frame_recv", 0);

  /* "nghttp2.pyx":576
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":577
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_client_on_frame_recv_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_frame_recv_type_s_stre);
  __Pyx_GIVEREF(__pyx_kp_s_client_on_frame_recv_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":610
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:
 */
  switch (__pyx_v_frame->hd.type) {

    /* "nghttp2.pyx":579
 *     logging.debug('client_on_frame_recv, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:             # <<<<<<<<<<<<<<
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    case NGHTTP2_DATA:

    /* "nghttp2.pyx":580
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":581
 *     if frame.hd.type == cnghttp2.NGHTTP2_DATA:
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *             if not handler:
 *                 return 0
 */
      __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_v_handler = __pyx_t_1;
      __pyx_t_1 = 0;

      /* "nghttp2.pyx":582
 *         if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             try:
 */
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_9 = ((!__pyx_t_8) != 0);
      if (__pyx_t_9) {

        /* "nghttp2.pyx":583
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_response_done()
 */
        __pyx_r = 0;
        goto __pyx_L0;
      }

      /* "nghttp2.pyx":584
 *             if not handler:
 *                 return 0
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_response_done()
 *             except:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_12);
        /*try:*/ {

          /* "nghttp2.pyx":585
 *                 return 0
 *             try:
 *                 handler.on_response_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
          __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_response_done); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __pyx_t_7 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
            __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
            if (likely(__pyx_t_7)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
              __Pyx_INCREF(__pyx_t_7);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_3, function);
            }
          }
          if (__pyx_t_7) {
            __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          } else {
            __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
          }
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        }
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        goto __pyx_L12_try_end;
        __pyx_L5_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "nghttp2.pyx":586
 *             try:
 *                 handler.on_response_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);

          /* "nghttp2.pyx":587
 *                 handler.on_response_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_14, function);
            }
          }
          if (__pyx_t_13) {
            __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          } else {
            __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          }
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_5);
            __Pyx_GIVEREF(__pyx_t_5);
            __pyx_t_5 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":588
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_14);
            PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
            PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_15;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L8_except_return;
        }
        __pyx_L7_except_error:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L1_error;
        __pyx_L8_except_return:;
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
        goto __pyx_L0;
        __pyx_L12_try_end:;
      }
      goto __pyx_L3;
    }
    __pyx_L3:;
    break;

    /* "nghttp2.pyx":589
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:             # <<<<<<<<<<<<<<
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
    case NGHTTP2_HEADERS:

    /* "nghttp2.pyx":590
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:             # <<<<<<<<<<<<<<
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 */
    __pyx_t_8 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_RESPONSE) != 0);
    if (!__pyx_t_8) {
    } else {
      __pyx_t_9 = __pyx_t_8;
      goto __pyx_L16_bool_binop_done;
    }
    __pyx_t_8 = ((__pyx_v_frame->headers.cat == NGHTTP2_HCAT_PUSH_RESPONSE) != 0);
    __pyx_t_9 = __pyx_t_8;
    __pyx_L16_bool_binop_done:;
    if (__pyx_t_9) {

      /* "nghttp2.pyx":591
 *     elif frame.hd.type == cnghttp2.NGHTTP2_HEADERS:
 *         if frame.headers.cat == cnghttp2.NGHTTP2_HCAT_RESPONSE or frame.headers.cat == cnghttp2.NGHTTP2_HCAT_PUSH_RESPONSE:
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *             if not handler:
 */
      __pyx_t_7 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_v_handler = __pyx_t_7;
      __pyx_t_7 = 0;

      /* "nghttp2.pyx":593
 *             handler = _get_stream_user_data(session, frame.hd.stream_id)
 * 
 *             if not handler:             # <<<<<<<<<<<<<<
 *                 return 0
 *             # TODO handle 1xx non-final response
 */
      __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_8 = ((!__pyx_t_9) != 0);
      if (__pyx_t_8) {

        /* "nghttp2.pyx":594
 * 
 *             if not handler:
 *                 return 0             # <<<<<<<<<<<<<<
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 */
        __pyx_r = 0;
        goto __pyx_L0;
      }

      /* "nghttp2.pyx":596
 *                 return 0
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:             # <<<<<<<<<<<<<<
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      if (__pyx_t_8) {

        /* "nghttp2.pyx":597
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_7);

        /* "nghttp2.pyx":598
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))             # <<<<<<<<<<<<<<
 *                 handler.cookies = None
 *             try:
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_cookies); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_1 = __Pyx_PyBytes_Join(__pyx_kp_b__7, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":597
 *             # TODO handle 1xx non-final response
 *             if handler.cookies:
 *                 handler.headers.append((b'cookie',             # <<<<<<<<<<<<<<
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 */
        __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_INCREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_b_cookie);
        __Pyx_GIVEREF(__pyx_n_b_cookie);
        PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_16 = __Pyx_PyObject_Append(__pyx_t_7, __pyx_t_3); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":599
 *                 handler.headers.append((b'cookie',
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None             # <<<<<<<<<<<<<<
 *             try:
 *                 handler.on_headers()
 */
        if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        goto __pyx_L19;
      }
      __pyx_L19:;

      /* "nghttp2.pyx":600
 *                                         b'; '.join(handler.cookies)))
 *                 handler.cookies = None
 *             try:             # <<<<<<<<<<<<<<
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 */
      {
        __Pyx_ExceptionSave(&__pyx_t_12, &__pyx_t_11, &__pyx_t_10);
        __Pyx_XGOTREF(__pyx_t_12);
        __Pyx_XGOTREF(__pyx_t_11);
        __Pyx_XGOTREF(__pyx_t_10);
        /*try:*/ {

          /* "nghttp2.pyx":601
 *                 handler.cookies = None
 *             try:
 *                 handler.on_headers()             # <<<<<<<<<<<<<<
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()
 */
          __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_headers); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          __Pyx_GOTREF(__pyx_t_7);
          __pyx_t_1 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
            __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
            if (likely(__pyx_t_1)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
              __Pyx_INCREF(__pyx_t_1);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_7, function);
            }
          }
          if (__pyx_t_1) {
            __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
            __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          } else {
            __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 601; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
          }
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

          /* "nghttp2.pyx":602
 *             try:
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:             # <<<<<<<<<<<<<<
 *                     handler.on_response_done()
 *             except:
 */
          __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_END_STREAM) != 0);
          if (__pyx_t_8) {

            /* "nghttp2.pyx":603
 *                 handler.on_headers()
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()             # <<<<<<<<<<<<<<
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 */
            __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_response_done); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
            __Pyx_GOTREF(__pyx_t_7);
            __pyx_t_1 = NULL;
            if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
              __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
              if (likely(__pyx_t_1)) {
                PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
                __Pyx_INCREF(__pyx_t_1);
                __Pyx_INCREF(function);
                __Pyx_DECREF_SET(__pyx_t_7, function);
              }
            }
            if (__pyx_t_1) {
              __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
              __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
            } else {
              __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L20_error;}
            }
            __Pyx_GOTREF(__pyx_t_3);
            __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
            __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
            goto __pyx_L28;
          }
          __pyx_L28:;
        }
        __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
        __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
        __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
        goto __pyx_L27_try_end;
        __pyx_L20_error:;
        __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
        __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
        __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;

        /* "nghttp2.pyx":604
 *                 if frame.hd.flags & cnghttp2.NGHTTP2_FLAG_END_STREAM:
 *                     handler.on_response_done()
 *             except:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 */
        /*except:*/ {
          __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
          if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_7, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_3);
          __Pyx_GOTREF(__pyx_t_7);
          __Pyx_GOTREF(__pyx_t_1);

          /* "nghttp2.pyx":605
 *                     handler.on_response_done()
 *             except:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
          __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
          __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_5);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __pyx_t_13 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
            __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_5);
            if (likely(__pyx_t_13)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
              __Pyx_INCREF(__pyx_t_13);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_5, function);
            }
          }
          if (__pyx_t_13) {
            __pyx_t_14 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_13); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          } else {
            __pyx_t_14 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          }
          __Pyx_GOTREF(__pyx_t_14);
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __pyx_t_5 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_5)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_5);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_5) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_14); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_GOTREF(__pyx_t_13);
            PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
            PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_14);
            __Pyx_GIVEREF(__pyx_t_14);
            __pyx_t_14 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

          /* "nghttp2.pyx":606
 *             except:
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 */
          __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_2);
          __pyx_t_13 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          __pyx_t_14 = NULL;
          if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
            __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
            if (likely(__pyx_t_14)) {
              PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
              __Pyx_INCREF(__pyx_t_14);
              __Pyx_INCREF(function);
              __Pyx_DECREF_SET(__pyx_t_2, function);
            }
          }
          if (!__pyx_t_14) {
            __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
            __Pyx_GOTREF(__pyx_t_4);
          } else {
            __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_GOTREF(__pyx_t_5);
            PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
            PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_13);
            __Pyx_GIVEREF(__pyx_t_13);
            __pyx_t_13 = 0;
            __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
            __Pyx_GOTREF(__pyx_t_4);
            __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          }
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
          __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L22_except_error;}
          __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
          __pyx_r = __pyx_t_15;
          __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
          __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
          goto __pyx_L23_except_return;
        }
        __pyx_L22_except_error:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L1_error;
        __pyx_L23_except_return:;
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_ExceptionReset(__pyx_t_12, __pyx_t_11, __pyx_t_10);
        goto __pyx_L0;
        __pyx_L27_try_end:;
      }
      goto __pyx_L15;
    }
    __pyx_L15:;
    break;

    /* "nghttp2.pyx":607
 *                 sys.stderr.write(traceback.format_exc())
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 */
    case NGHTTP2_SETTINGS:

    /* "nghttp2.pyx":608
 *                 return http2._rst_stream(frame.hd.stream_id)
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):             # <<<<<<<<<<<<<<
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 */
    __pyx_t_8 = ((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":609
 *     elif frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()             # <<<<<<<<<<<<<<
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_stop_settings_timer); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L31;
    }
    __pyx_L31:;
    break;

    /* "nghttp2.pyx":610
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK):
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:             # <<<<<<<<<<<<<<
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:
 */
    case NGHTTP2_PUSH_PROMISE:

    /* "nghttp2.pyx":611
 *             http2._stop_settings_timer()
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 *         if not handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":612
 *     elif frame.hd.type == cnghttp2.NGHTTP2_PUSH_PROMISE:
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Get the temporary push_handler which now should have all of the header data
 */
    __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_9 = ((!__pyx_t_8) != 0);
    if (__pyx_t_9) {

      /* "nghttp2.pyx":613
 *         handler = _get_stream_user_data(session, frame.hd.stream_id)
 *         if not handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":615
 *             return 0
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)             # <<<<<<<<<<<<<<
 *         if not push_handler:
 *             return 0
 */
    __pyx_t_1 = __pyx_f_7nghttp2__get_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_push_handler = __pyx_t_1;
    __pyx_t_1 = 0;

    /* "nghttp2.pyx":616
 *         # Get the temporary push_handler which now should have all of the header data
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 *         if not push_handler:             # <<<<<<<<<<<<<<
 *             return 0
 *         # Remove the temporary handler
 */
    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_push_handler); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = ((!__pyx_t_9) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":617
 *         push_handler = _get_stream_user_data(session, frame.push_promise.promised_stream_id)
 *         if not push_handler:
 *             return 0             # <<<<<<<<<<<<<<
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":619
 *             return 0
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,
 *                                                       <void*>NULL)
 */
    __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_remove_handler); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_push_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
      __Pyx_INCREF(__pyx_v_push_handler);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_push_handler);
      __Pyx_GIVEREF(__pyx_v_push_handler);
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":620
 *         # Remove the temporary handler
 *         http2._remove_handler(push_handler)
 *         cnghttp2.nghttp2_session_set_stream_user_data(session, frame.push_promise.promised_stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>NULL)
 * 
 */
    nghttp2_session_set_stream_user_data(__pyx_v_session, __pyx_v_frame->push_promise.promised_stream_id, ((void *)NULL));

    /* "nghttp2.pyx":623
 *                                                       <void*>NULL)
 * 
 *         try:             # <<<<<<<<<<<<<<
 *             handler.on_push_promise(push_handler)
 *         except:
 */
    {
      __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      /*try:*/ {

        /* "nghttp2.pyx":624
 * 
 *         try:
 *             handler.on_push_promise(push_handler)             # <<<<<<<<<<<<<<
 *         except:
 *             sys.stderr.write(traceback.format_exc())
 */
        __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_push_promise); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __pyx_t_4 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
          __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
          if (likely(__pyx_t_4)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
            __Pyx_INCREF(__pyx_t_4);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_7, function);
          }
        }
        if (!__pyx_t_4) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_push_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
          __Pyx_GOTREF(__pyx_t_1);
        } else {
          __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
          __Pyx_GOTREF(__pyx_t_3);
          PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
          __Pyx_INCREF(__pyx_v_push_handler);
          PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_push_handler);
          __Pyx_GIVEREF(__pyx_v_push_handler);
          __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L34_error;}
          __Pyx_GOTREF(__pyx_t_1);
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        }
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
      __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
      goto __pyx_L41_try_end;
      __pyx_L34_error:;
      __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":625
 *         try:
 *             handler.on_push_promise(push_handler)
 *         except:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             return http2._rst_stream(frame.hd.stream_id)
 */
      /*except:*/ {
        __Pyx_AddTraceback("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename);
        if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_7, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_GOTREF(__pyx_t_3);

        /* "nghttp2.pyx":626
 *             handler.on_push_promise(push_handler)
 *         except:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             return http2._rst_stream(frame.hd.stream_id)
 * 
 */
        __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_stderr); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
        __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __pyx_t_13 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_14))) {
          __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
          if (likely(__pyx_t_13)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
            __Pyx_INCREF(__pyx_t_13);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_14, function);
          }
        }
        if (__pyx_t_13) {
          __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        } else {
          __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        }
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        __pyx_t_14 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_14)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_14);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_14) {
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_GOTREF(__pyx_t_13);
          PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = NULL;
          PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_t_5);
          __Pyx_GIVEREF(__pyx_t_5);
          __pyx_t_5 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

        /* "nghttp2.pyx":627
 *         except:
 *             sys.stderr.write(traceback.format_exc())
 *             return http2._rst_stream(frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     return 0
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_13 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_GOTREF(__pyx_t_13);
        __pyx_t_5 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_5)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_5);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (!__pyx_t_5) {
          __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
          __Pyx_GOTREF(__pyx_t_4);
        } else {
          __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_GOTREF(__pyx_t_14);
          PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
          PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
          __Pyx_GIVEREF(__pyx_t_13);
          __pyx_t_13 = 0;
          __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
          __Pyx_GOTREF(__pyx_t_4);
          __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
        }
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L36_except_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __pyx_r = __pyx_t_15;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
        goto __pyx_L37_except_return;
      }
      __pyx_L36_except_error:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L1_error;
      __pyx_L37_except_return:;
      __Pyx_XGIVEREF(__pyx_t_10);
      __Pyx_XGIVEREF(__pyx_t_11);
      __Pyx_XGIVEREF(__pyx_t_12);
      __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      goto __pyx_L0;
      __pyx_L41_try_end:;
    }
    break;
    default: break;
  }

  /* "nghttp2.pyx":629
 *             return http2._rst_stream(frame.hd.stream_id)
 * 
 *     return 0             # <<<<<<<<<<<<<<
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,
 */
  __pyx_r = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":573
 *     return 0
 * 
 * cdef int client_on_frame_recv(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_WriteUnraisable("nghttp2.client_on_frame_recv", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XDECREF(__pyx_v_push_handler);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":631
 *     return 0
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

static int __pyx_f_7nghttp2_client_on_frame_send(CYTHON_UNUSED nghttp2_session *__pyx_v_session, nghttp2_frame const *__pyx_v_frame, void *__pyx_v_user_data) {
  PyObject *__pyx_v_http2 = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_on_frame_send", 0);

  /* "nghttp2.pyx":634
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data             # <<<<<<<<<<<<<<
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 */
  __pyx_t_1 = ((PyObject *)__pyx_v_user_data);
  __Pyx_INCREF(__pyx_t_1);
  __pyx_v_http2 = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":635
 *                               void *user_data):
 *     cdef http2 = <_HTTP2ClientSessionCore>user_data
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_frame->hd.type); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_frame->hd.stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_client_on_frame_send_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_client_on_frame_send_type_s_stre);
  __Pyx_GIVEREF(__pyx_kp_s_client_on_frame_send_type_s_stre);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":637
 *     logging.debug('client_on_frame_send, type:%s, stream_id:%s', frame.hd.type, frame.hd.stream_id)
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:             # <<<<<<<<<<<<<<
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 */
  __pyx_t_8 = ((__pyx_v_frame->hd.type == NGHTTP2_SETTINGS) != 0);
  if (__pyx_t_8) {

    /* "nghttp2.pyx":638
 * 
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:             # <<<<<<<<<<<<<<
 *             return 0
 *         http2._start_settings_timer()
 */
    __pyx_t_8 = (((__pyx_v_frame->hd.flags & NGHTTP2_FLAG_ACK) != 0) != 0);
    if (__pyx_t_8) {

      /* "nghttp2.pyx":639
 *     if frame.hd.type == cnghttp2.NGHTTP2_SETTINGS:
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0             # <<<<<<<<<<<<<<
 *         http2._start_settings_timer()
 * 
 */
      __pyx_r = 0;
      goto __pyx_L0;
    }

    /* "nghttp2.pyx":640
 *         if (frame.hd.flags & cnghttp2.NGHTTP2_FLAG_ACK) != 0:
 *             return 0
 *         http2._start_settings_timer()             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2SessionCoreBase:
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_http2, __pyx_n_s_start_settings_timer); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_7) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":631
 *     return 0
 * 
 * cdef int client_on_frame_send(cnghttp2.nghttp2_session *session,             # <<<<<<<<<<<<<<
 *                               const cnghttp2.nghttp2_frame *frame,
 *                               void *user_data):
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_WriteUnraisable("nghttp2.client_on_frame_send", __pyx_clineno, __pyx_lineno, __pyx_filename, 0);
  __pyx_r = 0;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_http2);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":650
 *     cdef inside_callback
 * 
 *     def __cinit__(self, transport, handler_class=None):             # <<<<<<<<<<<<<<
 *         self.session = NULL
 *         self.transport = transport
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_transport = 0;
  PyObject *__pyx_v_handler_class = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_transport,&__pyx_n_s_handler_class,0};
    PyObject* values[2] = {0,0};
    values[1] = ((PyObject *)Py_None);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler_class);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_transport = values[0];
    __pyx_v_handler_class = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return -1;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_transport, __pyx_v_handler_class);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_transport, PyObject *__pyx_v_handler_class) {
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":651
 * 
 *     def __cinit__(self, transport, handler_class=None):
 *         self.session = NULL             # <<<<<<<<<<<<<<
 *         self.transport = transport
 *         self.handler_class = handler_class
 */
  __pyx_v_self->session = NULL;

  /* "nghttp2.pyx":652
 *     def __cinit__(self, transport, handler_class=None):
 *         self.session = NULL
 *         self.transport = transport             # <<<<<<<<<<<<<<
 *         self.handler_class = handler_class
 *         self.handlers = set()
 */
  __Pyx_INCREF(__pyx_v_transport);
  __Pyx_GIVEREF(__pyx_v_transport);
  __Pyx_GOTREF(__pyx_v_self->transport);
  __Pyx_DECREF(__pyx_v_self->transport);
  __pyx_v_self->transport = __pyx_v_transport;

  /* "nghttp2.pyx":653
 *         self.session = NULL
 *         self.transport = transport
 *         self.handler_class = handler_class             # <<<<<<<<<<<<<<
 *         self.handlers = set()
 *         self.settings_timer = None
 */
  __Pyx_INCREF(__pyx_v_handler_class);
  __Pyx_GIVEREF(__pyx_v_handler_class);
  __Pyx_GOTREF(__pyx_v_self->handler_class);
  __Pyx_DECREF(__pyx_v_self->handler_class);
  __pyx_v_self->handler_class = __pyx_v_handler_class;

  /* "nghttp2.pyx":654
 *         self.transport = transport
 *         self.handler_class = handler_class
 *         self.handlers = set()             # <<<<<<<<<<<<<<
 *         self.settings_timer = None
 *         self.inside_callback = False
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->handlers);
  __Pyx_DECREF(__pyx_v_self->handlers);
  __pyx_v_self->handlers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":655
 *         self.handler_class = handler_class
 *         self.handlers = set()
 *         self.settings_timer = None             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = Py_None;

  /* "nghttp2.pyx":656
 *         self.handlers = set()
 *         self.settings_timer = None
 *         self.inside_callback = False             # <<<<<<<<<<<<<<
 * 
 *     def __dealloc__(self):
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_False;

  /* "nghttp2.pyx":650
 *     cdef inside_callback
 * 
 *     def __cinit__(self, transport, handler_class=None):             # <<<<<<<<<<<<<<
 *         self.session = NULL
 *         self.transport = transport
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":658
 *         self.inside_callback = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 */

/* Python wrapper */
static void __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(PyObject *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
  __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

static void __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_2__dealloc__(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__dealloc__", 0);

  /* "nghttp2.pyx":659
 * 
 *     def __dealloc__(self):
 *         cnghttp2.nghttp2_session_del(self.session)             # <<<<<<<<<<<<<<
 * 
 *     def data_received(self, data):
 */
  nghttp2_session_del(__pyx_v_self->session);

  /* "nghttp2.pyx":658
 *         self.inside_callback = False
 * 
 *     def __dealloc__(self):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
}

/* "nghttp2.pyx":661
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_received(PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_4data_received(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_data));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_4data_received(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_data) {
  Py_ssize_t __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  uint8_t const *__pyx_t_1;
  Py_ssize_t __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":664
 *         cdef ssize_t rv
 * 
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))             # <<<<<<<<<<<<<<
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 */
  __pyx_t_1 = __Pyx_PyObject_AsUString(__pyx_v_data); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_v_rv = nghttp2_session_mem_recv(__pyx_v_self->session, __pyx_t_1, __pyx_t_2);

  /* "nghttp2.pyx":665
 * 
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_3 = ((__pyx_v_rv < 0) != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":666
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 *         self.send_data()
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_mem_recv_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);

    /* "nghttp2.pyx":667
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 *         self.send_data()
 * 
 */
    __pyx_t_6 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":666
 *         rv = cnghttp2.nghttp2_session_mem_recv(self.session, data, len(data))
 *         if rv < 0:
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 *         self.send_data()
 */
    __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":668
 *             raise Exception('nghttp2_session_mem_recv failed: {}'.format\
 *                             (_strerror(rv)))
 *         self.send_data()             # <<<<<<<<<<<<<<
 * 
 *     OUTBUF_MAX = 65535
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (__pyx_t_8) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  } else {
    __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":661
 *         cnghttp2.nghttp2_session_del(self.session)
 * 
 *     def data_received(self, data):             # <<<<<<<<<<<<<<
 *         cdef ssize_t rv
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":673
 *     SETTINGS_TIMEOUT = 5.0
 * 
 *     def send_data(self):             # <<<<<<<<<<<<<<
 *         cdef ssize_t outbuflen
 *         cdef const uint8_t *outbuf
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_data (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_6send_data(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  Py_ssize_t __pyx_v_outbuflen;
  uint8_t const *__pyx_v_outbuf;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_data", 0);

  /* "nghttp2.pyx":677
 *         cdef const uint8_t *outbuf
 * 
 *         while True:             # <<<<<<<<<<<<<<
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break
 */
  while (1) {

    /* "nghttp2.pyx":678
 * 
 *         while True:
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:             # <<<<<<<<<<<<<<
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_write_buffer_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_OUTBUF_MAX); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (__pyx_t_4) {

      /* "nghttp2.pyx":679
 *         while True:
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break             # <<<<<<<<<<<<<<
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:
 */
      goto __pyx_L4_break;
    }

    /* "nghttp2.pyx":680
 *             if self.transport.get_write_buffer_size() > self.OUTBUF_MAX:
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)             # <<<<<<<<<<<<<<
 *             if outbuflen == 0:
 *                 break
 */
    __pyx_v_outbuflen = nghttp2_session_mem_send(__pyx_v_self->session, (&__pyx_v_outbuf));

    /* "nghttp2.pyx":681
 *                 break
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:             # <<<<<<<<<<<<<<
 *                 break
 *             if outbuflen < 0:
 */
    __pyx_t_4 = ((__pyx_v_outbuflen == 0) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":682
 *             outbuflen = cnghttp2.nghttp2_session_mem_send(self.session, &outbuf)
 *             if outbuflen == 0:
 *                 break             # <<<<<<<<<<<<<<
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\
 */
      goto __pyx_L4_break;
    }

    /* "nghttp2.pyx":683
 *             if outbuflen == 0:
 *                 break
 *             if outbuflen < 0:             # <<<<<<<<<<<<<<
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\
 *                                 (_strerror(outbuflen)))
 */
    __pyx_t_4 = ((__pyx_v_outbuflen < 0) != 0);
    if (__pyx_t_4) {

      /* "nghttp2.pyx":684
 *                 break
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\             # <<<<<<<<<<<<<<
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_mem_send_faild, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);

      /* "nghttp2.pyx":685
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\
 *                                 (_strerror(outbuflen)))             # <<<<<<<<<<<<<<
 *             self.transport.write(outbuf[:outbuflen])
 * 
 */
      __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_outbuflen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_6);
        PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_1);
        __Pyx_GIVEREF(__pyx_t_1);
        __pyx_t_1 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      }
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":684
 *                 break
 *             if outbuflen < 0:
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\             # <<<<<<<<<<<<<<
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])
 */
      __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_Raise(__pyx_t_3, 0, 0, 0);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }

    /* "nghttp2.pyx":686
 *                 raise Exception('nghttp2_session_mem_send faild: {}'.format\
 *                                 (_strerror(outbuflen)))
 *             self.transport.write(outbuf[:outbuflen])             # <<<<<<<<<<<<<<
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_write); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_outbuf) + 0, __pyx_v_outbuflen - 0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_3);
    } else {
      __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
      PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __pyx_L4_break:;

  /* "nghttp2.pyx":688
 *             self.transport.write(outbuf[:outbuflen])
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_write_buffer_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L9_bool_binop_done;
  }

  /* "nghttp2.pyx":689
 * 
 *         if self.transport.get_write_buffer_size() == 0 and \
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \             # <<<<<<<<<<<<<<
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 *             self.transport.close()
 */
  __pyx_t_7 = ((nghttp2_session_want_read(__pyx_v_self->session) == 0) != 0);
  if (__pyx_t_7) {
  } else {
    __pyx_t_4 = __pyx_t_7;
    goto __pyx_L9_bool_binop_done;
  }

  /* "nghttp2.pyx":690
 *         if self.transport.get_write_buffer_size() == 0 and \
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:             # <<<<<<<<<<<<<<
 *             self.transport.close()
 * 
 */
  __pyx_t_7 = ((nghttp2_session_want_write(__pyx_v_self->session) == 0) != 0);
  __pyx_t_4 = __pyx_t_7;
  __pyx_L9_bool_binop_done:;
  if (__pyx_t_4) {

    /* "nghttp2.pyx":691
 *            cnghttp2.nghttp2_session_want_read(self.session) == 0 and \
 *            cnghttp2.nghttp2_session_want_write(self.session) == 0:
 *             self.transport.close()             # <<<<<<<<<<<<<<
 * 
 *     def resume(self, stream_id):
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "nghttp2.pyx":673
 *     SETTINGS_TIMEOUT = 5.0
 * 
 *     def send_data(self):             # <<<<<<<<<<<<<<
 *         cdef ssize_t outbuflen
 *         cdef const uint8_t *outbuf
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.send_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":693
 *             self.transport.close()
 * 
 *     def resume(self, stream_id):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_stream_id));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_8resume(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":694
 * 
 *     def resume(self, stream_id):
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)             # <<<<<<<<<<<<<<
 *         if not self.inside_callback:
 *             self.send_data()
 */
  __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_stream_id); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 694; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  nghttp2_session_resume_data(__pyx_v_self->session, __pyx_t_1);

  /* "nghttp2.pyx":695
 *     def resume(self, stream_id):
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:             # <<<<<<<<<<<<<<
 *             self.send_data()
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->inside_callback); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_3 = ((!__pyx_t_2) != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":696
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 *             self.send_data()             # <<<<<<<<<<<<<<
 * 
 *     def enter_callback(self):
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    } else {
      __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":693
 *             self.transport.close()
 * 
 *     def resume(self, stream_id):             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_resume_data(self.session, stream_id)
 *         if not self.inside_callback:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":698
 *             self.send_data()
 * 
 *     def enter_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = True
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enter_callback (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_10enter_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("enter_callback", 0);

  /* "nghttp2.pyx":699
 * 
 *     def enter_callback(self):
 *         self.inside_callback = True             # <<<<<<<<<<<<<<
 * 
 *     def leave_callback(self):
 */
  __Pyx_INCREF(Py_True);
  __Pyx_GIVEREF(Py_True);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_True;

  /* "nghttp2.pyx":698
 *             self.send_data()
 * 
 *     def enter_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = True
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":701
 *         self.inside_callback = True
 * 
 *     def leave_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leave_callback (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_12leave_callback(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("leave_callback", 0);

  /* "nghttp2.pyx":702
 * 
 *     def leave_callback(self):
 *         self.inside_callback = False             # <<<<<<<<<<<<<<
 * 
 *     def _make_handler(self, stream_id):
 */
  __Pyx_INCREF(Py_False);
  __Pyx_GIVEREF(Py_False);
  __Pyx_GOTREF(__pyx_v_self->inside_callback);
  __Pyx_DECREF(__pyx_v_self->inside_callback);
  __pyx_v_self->inside_callback = Py_False;

  /* "nghttp2.pyx":701
 *         self.inside_callback = True
 * 
 *     def leave_callback(self):             # <<<<<<<<<<<<<<
 *         self.inside_callback = False
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":704
 *         self.inside_callback = False
 * 
 *     def _make_handler(self, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_make_handler (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_stream_id));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_14_make_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_make_handler", 0);

  /* "nghttp2.pyx":705
 * 
 *     def _make_handler(self, stream_id):
 *         logging.debug('_make_handler, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_make_handler_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s_make_handler_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_make_handler_stream_id_s);
  __Pyx_INCREF(__pyx_v_stream_id);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stream_id);
  __Pyx_GIVEREF(__pyx_v_stream_id);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":706
 *     def _make_handler(self, stream_id):
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)             # <<<<<<<<<<<<<<
 *         self.handlers.add(handler)
 *         return handler
 */
  __Pyx_INCREF(__pyx_v_self->handler_class);
  __pyx_t_3 = __pyx_v_self->handler_class; __pyx_t_5 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_2 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_4, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __Pyx_INCREF(__pyx_v_stream_id);
  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_4, __pyx_v_stream_id);
  __Pyx_GIVEREF(__pyx_v_stream_id);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_handler = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":707
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)             # <<<<<<<<<<<<<<
 *         return handler
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":708
 *         handler = self.handler_class(self, stream_id)
 *         self.handlers.add(handler)
 *         return handler             # <<<<<<<<<<<<<<
 * 
 *     def _remove_handler(self, handler):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_handler);
  __pyx_r = __pyx_v_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":704
 *         self.inside_callback = False
 * 
 *     def _make_handler(self, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_make_handler, stream_id:%s', stream_id)
 *         handler = self.handler_class(self, stream_id)
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._make_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":710
 *         return handler
 * 
 *     def _remove_handler(self, handler):             # <<<<<<<<<<<<<<
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_remove_handler (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_16_remove_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_remove_handler", 0);

  /* "nghttp2.pyx":711
 * 
 *     def _remove_handler(self, handler):
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)             # <<<<<<<<<<<<<<
 *         self.handlers.remove(handler)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_remove_handler_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_remove_handler_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_remove_handler_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":712
 *     def _remove_handler(self, handler):
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)             # <<<<<<<<<<<<<<
 * 
 *     def _add_handler(self, handler, stream_id):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_remove); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":710
 *         return handler
 * 
 *     def _remove_handler(self, handler):             # <<<<<<<<<<<<<<
 *         logging.debug('_remove_handler, stream_id:%s', handler.stream_id)
 *         self.handlers.remove(handler)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._remove_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":714
 *         self.handlers.remove(handler)
 * 
 *     def _add_handler(self, handler, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_handler = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_add_handler (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handler,&__pyx_n_s_stream_id,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_add_handler", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_add_handler") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_handler = values[0];
    __pyx_v_stream_id = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_add_handler", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._add_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_handler, __pyx_v_stream_id);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_18_add_handler(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_add_handler", 0);

  /* "nghttp2.pyx":715
 * 
 *     def _add_handler(self, handler, stream_id):
 *         logging.debug('_add_handler, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 *         handler.stream_id = stream_id
 *         handler.http2 = self
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_add_handler_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_kp_s_add_handler_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_add_handler_stream_id_s);
  __Pyx_INCREF(__pyx_v_stream_id);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_stream_id);
  __Pyx_GIVEREF(__pyx_v_stream_id);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":716
 *     def _add_handler(self, handler, stream_id):
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id             # <<<<<<<<<<<<<<
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":717
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 *         handler.http2 = self             # <<<<<<<<<<<<<<
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_http2, ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":718
 *         handler.stream_id = stream_id
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()             # <<<<<<<<<<<<<<
 *         handler.client_certificate = self._get_client_certificate()
 *         self.handlers.add(handler)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_remote_address); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_remote_address, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":719
 *         handler.http2 = self
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()             # <<<<<<<<<<<<<<
 *         self.handlers.add(handler)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_client_certificate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_client_certificate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":720
 *         handler.remote_address = self._get_remote_address()
 *         handler.client_certificate = self._get_client_certificate()
 *         self.handlers.add(handler)             # <<<<<<<<<<<<<<
 * 
 *     def _rst_stream(self, stream_id,
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":714
 *         self.handlers.remove(handler)
 * 
 *     def _add_handler(self, handler, stream_id):             # <<<<<<<<<<<<<<
 *         logging.debug('_add_handler, stream_id:%s', stream_id)
 *         handler.stream_id = stream_id
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._add_handler", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":722
 *         self.handlers.add(handler)
 * 
 *     def _rst_stream(self, stream_id,             # <<<<<<<<<<<<<<
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):
 *         cdef int rv
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_stream_id = 0;
  PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_rst_stream (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_stream_id,&__pyx_n_s_error_code,0};
    PyObject* values[2] = {0,0};
    values[1] = __pyx_k__8;
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_code);
          if (value) { values[1] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rst_stream") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_stream_id = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_rst_stream", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 722; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._rst_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), __pyx_v_stream_id, __pyx_v_error_code);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_20_rst_stream(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_stream_id, PyObject *__pyx_v_error_code) {
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int32_t __pyx_t_1;
  uint32_t __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_rst_stream", 0);

  /* "nghttp2.pyx":728
 *         rv = cnghttp2.nghttp2_submit_rst_stream\
 *              (self.session, cnghttp2.NGHTTP2_FLAG_NONE,
 *               stream_id, error_code)             # <<<<<<<<<<<<<<
 * 
 *         return rv
 */
  __pyx_t_1 = __Pyx_PyInt_As_int32_t(__pyx_v_stream_id); if (unlikely((__pyx_t_1 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = __Pyx_PyInt_As_uint32_t(__pyx_v_error_code); if (unlikely((__pyx_t_2 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":727
 * 
 *         rv = cnghttp2.nghttp2_submit_rst_stream\
 *              (self.session, cnghttp2.NGHTTP2_FLAG_NONE,             # <<<<<<<<<<<<<<
 *               stream_id, error_code)
 * 
 */
  __pyx_v_rv = nghttp2_submit_rst_stream(__pyx_v_self->session, NGHTTP2_FLAG_NONE, __pyx_t_1, __pyx_t_2);

  /* "nghttp2.pyx":730
 *               stream_id, error_code)
 * 
 *         return rv             # <<<<<<<<<<<<<<
 * 
 *     def _get_remote_address(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_rv); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":722
 *         self.handlers.add(handler)
 * 
 *     def _rst_stream(self, stream_id,             # <<<<<<<<<<<<<<
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):
 *         cdef int rv
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._rst_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":732
 *         return rv
 * 
 *     def _get_remote_address(self):             # <<<<<<<<<<<<<<
 *         return self.transport.get_extra_info('peername')
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_remote_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_22_get_remote_address(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_remote_address", 0);

  /* "nghttp2.pyx":733
 * 
 *     def _get_remote_address(self):
 *         return self.transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 * 
 *     def _get_client_certificate(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_r = __pyx_t_2;
  __pyx_t_2 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":732
 *         return rv
 * 
 *     def _get_remote_address(self):             # <<<<<<<<<<<<<<
 *         return self.transport.get_extra_info('peername')
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_remote_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":735
 *         return self.transport.get_extra_info('peername')
 * 
 *     def _get_client_certificate(self):             # <<<<<<<<<<<<<<
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_get_client_certificate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_24_get_client_certificate(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_get_client_certificate", 0);

  /* "nghttp2.pyx":736
 * 
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         try:
 *             return sock.getpeercert()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_sock = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":737
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')
 *         try:             # <<<<<<<<<<<<<<
 *             return sock.getpeercert()
 *         except AttributeError:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "nghttp2.pyx":738
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 *             return sock.getpeercert()             # <<<<<<<<<<<<<<
 *         except AttributeError:
 *             return None
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_getpeercert); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_r = __pyx_t_2;
      __pyx_t_2 = 0;
      goto __pyx_L7_try_return;
    }
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":739
 *         try:
 *             return sock.getpeercert()
 *         except AttributeError:             # <<<<<<<<<<<<<<
 *             return None
 * 
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_client_certificate", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_6);

      /* "nghttp2.pyx":740
 *             return sock.getpeercert()
 *         except AttributeError:
 *             return None             # <<<<<<<<<<<<<<
 * 
 *     def _start_settings_timer(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __Pyx_INCREF(Py_None);
      __pyx_r = Py_None;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":735
 *         return self.transport.get_extra_info('peername')
 * 
 *     def _get_client_certificate(self):             # <<<<<<<<<<<<<<
 *         sock = self.transport.get_extra_info('socket')
 *         try:
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._get_client_certificate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":742
 *             return None
 * 
 *     def _start_settings_timer(self):             # <<<<<<<<<<<<<<
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_start_settings_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_26_start_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_v_loop = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_start_settings_timer", 0);

  /* "nghttp2.pyx":743
 * 
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 *                                               self._settings_timeout)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_loop = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":744
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,             # <<<<<<<<<<<<<<
 *                                               self._settings_timeout)
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_loop, __pyx_n_s_call_later); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_SETTINGS_TIMEOUT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "nghttp2.pyx":745
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 *                                               self._settings_timeout)             # <<<<<<<<<<<<<<
 * 
 *     def _stop_settings_timer(self):
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_settings_timeout); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":744
 *     def _start_settings_timer(self):
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,             # <<<<<<<<<<<<<<
 *                                               self._settings_timeout)
 * 
 */
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":742
 *             return None
 * 
 *     def _start_settings_timer(self):             # <<<<<<<<<<<<<<
 *         loop = asyncio.get_event_loop()
 *         self.settings_timer = loop.call_later(self.SETTINGS_TIMEOUT,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._start_settings_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_loop);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":747
 *                                               self._settings_timeout)
 * 
 *     def _stop_settings_timer(self):             # <<<<<<<<<<<<<<
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_stop_settings_timer (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_28_stop_settings_timer(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_stop_settings_timer", 0);

  /* "nghttp2.pyx":748
 * 
 *     def _stop_settings_timer(self):
 *         if self.settings_timer:             # <<<<<<<<<<<<<<
 *             self.settings_timer.cancel()
 *             self.settings_timer = None
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_self->settings_timer); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "nghttp2.pyx":749
 *     def _stop_settings_timer(self):
 *         if self.settings_timer:
 *             self.settings_timer.cancel()             # <<<<<<<<<<<<<<
 *             self.settings_timer = None
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->settings_timer, __pyx_n_s_cancel); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":750
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 *             self.settings_timer = None             # <<<<<<<<<<<<<<
 * 
 *     def _settings_timeout(self):
 */
    __Pyx_INCREF(Py_None);
    __Pyx_GIVEREF(Py_None);
    __Pyx_GOTREF(__pyx_v_self->settings_timer);
    __Pyx_DECREF(__pyx_v_self->settings_timer);
    __pyx_v_self->settings_timer = Py_None;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":747
 *                                               self._settings_timeout)
 * 
 *     def _stop_settings_timer(self):             # <<<<<<<<<<<<<<
 *         if self.settings_timer:
 *             self.settings_timer.cancel()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._stop_settings_timer", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":752
 *             self.settings_timer = None
 * 
 *     def _settings_timeout(self):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_settings_timeout (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_30_settings_timeout(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_rv;
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_settings_timeout", 0);

  /* "nghttp2.pyx":755
 *         cdef int rv
 * 
 *         logging.debug('_settings_timeout')             # <<<<<<<<<<<<<<
 * 
 *         self.settings_timer = None
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_debug); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":757
 *         logging.debug('_settings_timeout')
 * 
 *         self.settings_timer = None             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 */
  __Pyx_INCREF(Py_None);
  __Pyx_GIVEREF(Py_None);
  __Pyx_GOTREF(__pyx_v_self->settings_timer);
  __Pyx_DECREF(__pyx_v_self->settings_timer);
  __pyx_v_self->settings_timer = Py_None;

  /* "nghttp2.pyx":760
 * 
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)             # <<<<<<<<<<<<<<
 *         try:
 *             self.send_data()
 */
  __pyx_v_rv = nghttp2_session_terminate_session(__pyx_v_self->session, NGHTTP2_SETTINGS_TIMEOUT);

  /* "nghttp2.pyx":761
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "nghttp2.pyx":762
 *              (self.session, cnghttp2.NGHTTP2_SETTINGS_TIMEOUT)
 *         try:
 *             self.send_data()             # <<<<<<<<<<<<<<
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":763
 *         try:
 *             self.send_data()
 *         except Exception as err:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._settings_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_err = __pyx_t_2;

      /* "nghttp2.pyx":764
 *             self.send_data()
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             self.transport.close()
 *             return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":765
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":766
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 *             return             # <<<<<<<<<<<<<<
 * 
 *     def _log_request(self, handler):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":752
 *             self.settings_timer = None
 * 
 *     def _settings_timeout(self):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._settings_timeout", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":768
 *             return
 * 
 *     def _log_request(self, handler):             # <<<<<<<<<<<<<<
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_log_request (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_32_log_request(CYTHON_UNUSED struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_now = NULL;
  PyObject *__pyx_v_tv = NULL;
  PyObject *__pyx_v_datestr = NULL;
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  Py_ssize_t __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_log_request", 0);

  /* "nghttp2.pyx":769
 * 
 *     def _log_request(self, handler):
 *         now = datetime.datetime.now()             # <<<<<<<<<<<<<<
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_datetime); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_datetime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_now); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_now = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":770
 *     def _log_request(self, handler):
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())             # <<<<<<<<<<<<<<
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_time); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_mktime); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_now, __pyx_n_s_timetuple); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_tv = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":771
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,             # <<<<<<<<<<<<<<
 *                                         usegmt=True)
 *         try:
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_email); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_utils); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_formatdate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeval, __pyx_v_tv) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_localtime, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":772
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)             # <<<<<<<<<<<<<<
 *         try:
 *             method = handler.method.decode('utf-8')
 */
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_usegmt, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":771
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,             # <<<<<<<<<<<<<<
 *                                         usegmt=True)
 *         try:
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_datestr = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":773
 *         datestr = email.utils.formatdate(timeval=tv, localtime=False,
 *                                         usegmt=True)
 *         try:             # <<<<<<<<<<<<<<
 *             method = handler.method.decode('utf-8')
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "nghttp2.pyx":774
 *                                         usegmt=True)
 *         try:
 *             method = handler.method.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             method = handler.method
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_method = __pyx_t_5;
      __pyx_t_5 = 0;
    }
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":775
 *         try:
 *             method = handler.method.decode('utf-8')
 *         except:             # <<<<<<<<<<<<<<
 *             method = handler.method
 *         try:
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_1);

      /* "nghttp2.pyx":776
 *             method = handler.method.decode('utf-8')
 *         except:
 *             method = handler.method             # <<<<<<<<<<<<<<
 *         try:
 *             path = handler.path.decode('utf-8')
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_method, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L4_exception_handled;
    }
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8);
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":777
 *         except:
 *             method = handler.method
 *         try:             # <<<<<<<<<<<<<<
 *             path = handler.path.decode('utf-8')
 *         except:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_7, &__pyx_t_6);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_7);
    __Pyx_XGOTREF(__pyx_t_6);
    /*try:*/ {

      /* "nghttp2.pyx":778
 *             method = handler.method
 *         try:
 *             path = handler.path.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             path = handler.path
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L13_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_v_path = __pyx_t_1;
      __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    goto __pyx_L20_try_end;
    __pyx_L13_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":779
 *         try:
 *             path = handler.path.decode('utf-8')
 *         except:             # <<<<<<<<<<<<<<
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 */
    /*except:*/ {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);

      /* "nghttp2.pyx":780
 *             path = handler.path.decode('utf-8')
 *         except:
 *             path = handler.path             # <<<<<<<<<<<<<<
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L15_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_2);
      __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L14_exception_handled;
    }
    __pyx_L15_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    goto __pyx_L1_error;
    __pyx_L14_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_7);
    __Pyx_XGIVEREF(__pyx_t_6);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_7, __pyx_t_6);
    __pyx_L20_try_end:;
  }

  /* "nghttp2.pyx":781
 *         except:
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],             # <<<<<<<<<<<<<<
 *                           datestr, method, path, handler.status,
 *                           'P' if handler.pushed else '-')
 */
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":782
 *             path = handler.path
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,             # <<<<<<<<<<<<<<
 *                           'P' if handler.pushed else '-')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_status_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "nghttp2.pyx":783
 *         logging.info('%s - - [%s] "%s %s HTTP/2" %s - %s', handler.remote_address[0],
 *                           datestr, method, path, handler.status,
 *                           'P' if handler.pushed else '-')             # <<<<<<<<<<<<<<
 * 
 *     def close(self):
 */
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_pushed); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __pyx_t_10 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  if (__pyx_t_10) {
    __Pyx_INCREF(__pyx_n_s_P);
    __pyx_t_4 = __pyx_n_s_P;
  } else {
    __Pyx_INCREF(__pyx_kp_s__14);
    __pyx_t_4 = __pyx_kp_s__14;
  }
  __pyx_t_9 = NULL;
  __pyx_t_11 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_9)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_9);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_11 = 1;
    }
  }
  __pyx_t_12 = PyTuple_New(7+__pyx_t_11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_12);
  if (__pyx_t_9) {
    PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_s_s_s_s_HTTP_2_s_s);
  PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_11, __pyx_kp_s_s_s_s_s_HTTP_2_s_s);
  __Pyx_GIVEREF(__pyx_kp_s_s_s_s_s_HTTP_2_s_s);
  PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_11, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_datestr);
  PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_11, __pyx_v_datestr);
  __Pyx_GIVEREF(__pyx_v_datestr);
  __Pyx_INCREF(__pyx_v_method);
  PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_11, __pyx_v_method);
  __Pyx_GIVEREF(__pyx_v_method);
  __Pyx_INCREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_11, __pyx_v_path);
  __Pyx_GIVEREF(__pyx_v_path);
  PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_11, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_11, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":768
 *             return
 * 
 *     def _log_request(self, handler):             # <<<<<<<<<<<<<<
 *         now = datetime.datetime.now()
 *         tv = time.mktime(now.timetuple())
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase._log_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_now);
  __Pyx_XDECREF(__pyx_v_tv);
  __Pyx_XDECREF(__pyx_v_datestr);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":785
 *                           'P' if handler.pushed else '-')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_21_HTTP2SessionCoreBase_34close(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *__pyx_v_self) {
  CYTHON_UNUSED int __pyx_v_rv;
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":787
 *     def close(self):
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 *         try:
 *             self.send_data()
 */
  __pyx_v_rv = nghttp2_session_terminate_session(__pyx_v_self->session, NGHTTP2_NO_ERROR);

  /* "nghttp2.pyx":788
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:             # <<<<<<<<<<<<<<
 *             self.send_data()
 *         except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":789
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 *         try:
 *             self.send_data()             # <<<<<<<<<<<<<<
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_send_data); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
        __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
        if (likely(__pyx_t_6)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
          __Pyx_INCREF(__pyx_t_6);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_5, function);
        }
      }
      if (__pyx_t_6) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":790
 *         try:
 *             self.send_data()
 *         except Exception as err:             # <<<<<<<<<<<<<<
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_5, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_5);
      __pyx_v_err = __pyx_t_5;

      /* "nghttp2.pyx":791
 *             self.send_data()
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *             self.transport.close()
 *             return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":792
 *         except Exception as err:
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()             # <<<<<<<<<<<<<<
 *             return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->transport, __pyx_n_s_close); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":793
 *             sys.stderr.write(traceback.format_exc())
 *             self.transport.close()
 *             return             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":785
 *                           'P' if handler.pushed else '-')
 * 
 *     def close(self):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_session_terminate_session\
 *              (self.session, cnghttp2.NGHTTP2_NO_ERROR)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCoreBase.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":796
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nghttp2_17_HTTP2SessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  nghttp2_session_callbacks *__pyx_v_callbacks;
  nghttp2_settings_entry __pyx_v_iv[2];
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":801
 *         cdef int rv
 * 
 *         super(_HTTP2SessionCore, self).__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2SessionCore)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2SessionCore)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2SessionCore)));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":803
 *         super(_HTTP2SessionCore, self).__init__(*args, **kwargs)
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_session_callbacks_new((&__pyx_v_callbacks));

  /* "nghttp2.pyx":805
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":806
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":807
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":806
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":809
 *                             (_strerror(rv)))
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 */
  nghttp2_session_callbacks_set_on_header_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_header);

  /* "nghttp2.pyx":811
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 *             callbacks, server_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 */
  nghttp2_session_callbacks_set_on_begin_headers_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_begin_headers);

  /* "nghttp2.pyx":813
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 *             callbacks, server_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 */
  nghttp2_session_callbacks_set_on_frame_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_recv);

  /* "nghttp2.pyx":815
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 *             callbacks, server_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 */
  nghttp2_session_callbacks_set_on_stream_close_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_stream_close);

  /* "nghttp2.pyx":817
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(
 */
  nghttp2_session_callbacks_set_on_frame_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_send);

  /* "nghttp2.pyx":819
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 *             callbacks, server_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, server_on_frame_not_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
 */
  nghttp2_session_callbacks_set_on_frame_not_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_server_on_frame_not_send);

  /* "nghttp2.pyx":821
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_not_send_callback(
 *             callbacks, server_on_frame_not_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_data_chunk_recv)
 * 
 */
  nghttp2_session_callbacks_set_on_data_chunk_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_data_chunk_recv);

  /* "nghttp2.pyx":824
 *             callbacks, on_data_chunk_recv)
 * 
 *         rv = cnghttp2.nghttp2_session_server_new(&self.session, callbacks,             # <<<<<<<<<<<<<<
 *                                                  <void*>self)
 * 
 */
  __pyx_v_rv = nghttp2_session_server_new((&__pyx_v_self->__pyx_base.session), __pyx_v_callbacks, ((void *)__pyx_v_self));

  /* "nghttp2.pyx":827
 *                                                  <void*>self)
 * 
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  nghttp2_session_callbacks_del(__pyx_v_callbacks);

  /* "nghttp2.pyx":829
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":830
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_server_new_faile, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":831
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 */
    __pyx_t_6 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":830
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_server_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":833
 *                             (_strerror(rv)))
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS             # <<<<<<<<<<<<<<
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;

  /* "nghttp2.pyx":834
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100             # <<<<<<<<<<<<<<
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).value = 100;

  /* "nghttp2.pyx":835
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 */
  (__pyx_v_iv[1]).settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":836
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 */
  (__pyx_v_iv[1]).value = NGHTTP2_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":840
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) / sizeof(iv[0]))             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_t_7 = (sizeof(__pyx_v_iv));
  __pyx_t_8 = (sizeof((__pyx_v_iv[0])));
  if (unlikely(__pyx_t_8 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":838
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,             # <<<<<<<<<<<<<<
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) / sizeof(iv[0]))
 */
  __pyx_v_rv = nghttp2_submit_settings(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_v_iv, (__pyx_t_7 / __pyx_t_8));

  /* "nghttp2.pyx":842
 *                                               iv, sizeof(iv) / sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":843
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":844
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *     def send_response(self, handler):
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":843
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":796
 * 
 * cdef class _HTTP2SessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":846
 *                             (_strerror(rv)))
 * 
 *     def send_response(self, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response(PyObject *__pyx_v_self, PyObject *__pyx_v_handler); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response(PyObject *__pyx_v_self, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_response (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), ((PyObject *)__pyx_v_handler));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_2send_response(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler) {
  nghttp2_data_provider __pyx_v_prd;
  nghttp2_data_provider *__pyx_v_prd_ptr;
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int __pyx_v_rv;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  int32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_response", 0);

  /* "nghttp2.pyx":853
 *         cdef int rv
 * 
 *         logging.debug('send_response, stream_id:%s', handler.stream_id)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_5 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_5 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_send_response_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_send_response_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_send_response_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 853; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":855
 *         logging.debug('send_response, stream_id:%s', handler.stream_id)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, handler.response_headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":856
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, handler.response_headers)             # <<<<<<<<<<<<<<
 * 
 *         if handler.response_body:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_headers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 856; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":858
 *         nvlen = _make_nva(&nva, handler.response_headers)
 * 
 *         if handler.response_body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_body); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 858; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_7) {

    /* "nghttp2.pyx":859
 * 
 *         if handler.response_body:
 *             prd.source.ptr = <void*>handler.response_body             # <<<<<<<<<<<<<<
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_response_body); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_v_prd.source.ptr = ((void *)__pyx_t_1);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":860
 *         if handler.response_body:
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read             # <<<<<<<<<<<<<<
 *             prd_ptr = &prd
 *         else:
 */
    __pyx_v_prd.read_callback = __pyx_f_7nghttp2_data_source_read;

    /* "nghttp2.pyx":861
 *             prd.source.ptr = <void*>handler.response_body
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd             # <<<<<<<<<<<<<<
 *         else:
 *             prd_ptr = NULL
 */
    __pyx_v_prd_ptr = (&__pyx_v_prd);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "nghttp2.pyx":863
 *             prd_ptr = &prd
 *         else:
 *             prd_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,
 */
    __pyx_v_prd_ptr = NULL;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":865
 *             prd_ptr = NULL
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,             # <<<<<<<<<<<<<<
 *                                               nva, nvlen, prd_ptr)
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":866
 * 
 *         rv = cnghttp2.nghttp2_submit_response(self.session, handler.stream_id,
 *                                               nva, nvlen, prd_ptr)             # <<<<<<<<<<<<<<
 * 
 *         free(nva)
 */
  __pyx_v_rv = nghttp2_submit_response(__pyx_v_self->__pyx_base.session, __pyx_t_8, __pyx_v_nva, __pyx_v_nvlen, __pyx_v_prd_ptr);

  /* "nghttp2.pyx":868
 *                                               nva, nvlen, prd_ptr)
 * 
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":870
 *         free(nva)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 */
  __pyx_t_7 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_7) {

    /* "nghttp2.pyx":872
 *         if rv != 0:
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_response failed: {}'.format\
 *                             (_strerror(rv)))
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":873
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_response_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":874
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         self._log_request(handler)
 */
    __pyx_t_4 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":873
 *             # TODO Ignore return value
 *             self._rst_stream(handler.stream_id)
 *             raise Exception('nghttp2_submit_response failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":876
 *                             (_strerror(rv)))
 * 
 *         self._log_request(handler)             # <<<<<<<<<<<<<<
 * 
 *     def push(self, handler, promised_handler):
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_log_request); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":846
 *                             (_strerror(rv)))
 * 
 *     def send_response(self, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":878
 *         self._log_request(handler)
 * 
 *     def push(self, handler, promised_handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nva
 *         cdef size_t nvlen
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_handler = 0;
  PyObject *__pyx_v_promised_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_handler,&__pyx_n_s_promised_handler,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_promised_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_handler = values[0];
    __pyx_v_promised_handler = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self), __pyx_v_handler, __pyx_v_promised_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self, PyObject *__pyx_v_handler, PyObject *__pyx_v_promised_handler) {
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int32_t __pyx_v_promised_stream_id;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int32_t __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);

  /* "nghttp2.pyx":883
 *         cdef int32_t promised_stream_id
 * 
 *         self.handlers.add(promised_handler)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->__pyx_base.handlers, __pyx_n_s_add); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_promised_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_promised_handler);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_promised_handler);
    __Pyx_GIVEREF(__pyx_v_promised_handler);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":885
 *         self.handlers.add(promised_handler)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, promised_handler.headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":886
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, promised_handler.headers)             # <<<<<<<<<<<<<<
 * 
 *         promised_stream_id = cnghttp2.nghttp2_submit_push_promise\
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_headers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_t_1);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":891
 *                              (self.session,
 *                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                               handler.stream_id,             # <<<<<<<<<<<<<<
 *                               nva, nvlen,
 *                               <void*>promised_handler)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":889
 * 
 *         promised_stream_id = cnghttp2.nghttp2_submit_push_promise\
 *                              (self.session,             # <<<<<<<<<<<<<<
 *                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                               handler.stream_id,
 */
  __pyx_v_promised_stream_id = nghttp2_submit_push_promise(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_t_5, __pyx_v_nva, __pyx_v_nvlen, ((void *)__pyx_v_promised_handler));

  /* "nghttp2.pyx":894
 *                               nva, nvlen,
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\
 *                             (_strerror(promised_stream_id)))
 */
  __pyx_t_6 = ((__pyx_v_promised_stream_id < 0) != 0);
  if (__pyx_t_6) {

    /* "nghttp2.pyx":895
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(promised_stream_id)))
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_push_promise_fail, __pyx_n_s_format); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":896
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\
 *                             (_strerror(promised_stream_id)))             # <<<<<<<<<<<<<<
 * 
 *         promised_handler.stream_id = promised_stream_id
 */
    __pyx_t_4 = __pyx_f_7nghttp2__strerror(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_7);
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
      PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      __pyx_t_4 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":895
 *                               <void*>promised_handler)
 *         if promised_stream_id < 0:
 *             raise Exception('nghttp2_submit_push_promise failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(promised_stream_id)))
 * 
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":898
 *                             (_strerror(promised_stream_id)))
 * 
 *         promised_handler.stream_id = promised_stream_id             # <<<<<<<<<<<<<<
 * 
 *         logging.debug('push, stream_id:%s', promised_stream_id)
 */
  __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_stream_id, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":900
 *         promised_handler.stream_id = promised_stream_id
 * 
 *         logging.debug('push, stream_id:%s', promised_stream_id)             # <<<<<<<<<<<<<<
 * 
 *         return promised_handler
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_promised_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_push_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_kp_s_push_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_push_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":902
 *         logging.debug('push, stream_id:%s', promised_stream_id)
 * 
 *         return promised_handler             # <<<<<<<<<<<<<<
 * 
 *     def connection_lost(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_promised_handler);
  __pyx_r = __pyx_v_promised_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":878
 *         self._log_request(handler)
 * 
 *     def push(self, handler, promised_handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_nv *nva
 *         cdef size_t nvlen
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":904
 *         return promised_handler
 * 
 *     def connection_lost(self):             # <<<<<<<<<<<<<<
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyObject *__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(((struct __pyx_obj_7nghttp2__HTTP2SessionCore *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_17_HTTP2SessionCore_6connection_lost(struct __pyx_obj_7nghttp2__HTTP2SessionCore *__pyx_v_self) {
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  Py_ssize_t __pyx_t_2;
  PyObject *(*__pyx_t_3)(PyObject *);
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":905
 * 
 *     def connection_lost(self):
 *         for handler in self.handlers:             # <<<<<<<<<<<<<<
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()
 */
  if (likely(PyList_CheckExact(__pyx_v_self->__pyx_base.handlers)) || PyTuple_CheckExact(__pyx_v_self->__pyx_base.handlers)) {
    __pyx_t_1 = __pyx_v_self->__pyx_base.handlers; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
    __pyx_t_3 = NULL;
  } else {
    __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_self->__pyx_base.handlers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_3)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_3(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_handler, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "nghttp2.pyx":906
 *     def connection_lost(self):
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)             # <<<<<<<<<<<<<<
 *         self.handlers = set()
 * 
 */
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_on_close); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = PyInt_FromLong(NGHTTP2_INTERNAL_ERROR); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_7 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_7)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_7);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
      }
    }
    if (!__pyx_t_7) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 906; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":905
 * 
 *     def connection_lost(self):
 *         for handler in self.handlers:             # <<<<<<<<<<<<<<
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":907
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 *         self.handlers = set()             # <<<<<<<<<<<<<<
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 */
  __pyx_t_1 = PySet_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_GOTREF(__pyx_v_self->__pyx_base.handlers);
  __Pyx_DECREF(__pyx_v_self->__pyx_base.handlers);
  __pyx_v_self->__pyx_base.handlers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":904
 *         return promised_handler
 * 
 *     def connection_lost(self):             # <<<<<<<<<<<<<<
 *         for handler in self.handlers:
 *             handler.on_close(cnghttp2.NGHTTP2_INTERNAL_ERROR)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2._HTTP2SessionCore.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":910
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

/* Python wrapper */
static int __pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_args = 0;
  PyObject *__pyx_v_kwargs = 0;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
  if (unlikely(__pyx_kwds) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 1))) return -1;
  __pyx_v_kwargs = (__pyx_kwds) ? PyDict_Copy(__pyx_kwds) : PyDict_New();
  if (unlikely(!__pyx_v_kwargs)) return -1;
  __Pyx_GOTREF(__pyx_v_kwargs);
  __Pyx_INCREF(__pyx_args);
  __pyx_v_args = __pyx_args;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_args, __pyx_v_kwargs);

  /* function exit code */
  __Pyx_XDECREF(__pyx_v_args);
  __Pyx_XDECREF(__pyx_v_kwargs);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static int __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore___cinit__(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_args, PyObject *__pyx_v_kwargs) {
  nghttp2_session_callbacks *__pyx_v_callbacks;
  nghttp2_settings_entry __pyx_v_iv[2];
  int __pyx_v_rv;
  int __pyx_r;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  size_t __pyx_t_7;
  size_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__cinit__", 0);

  /* "nghttp2.pyx":915
 *         cdef int rv
 * 
 *         super(_HTTP2ClientSessionCore, self).__init__(*args, **kwargs)             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 */
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore)));
  PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore)));
  __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore)));
  __Pyx_INCREF(((PyObject *)__pyx_v_self));
  PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self));
  __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PySequence_Tuple(__pyx_v_args); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __pyx_v_kwargs;
  __Pyx_INCREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":917
 *         super(_HTTP2ClientSessionCore, self).__init__(*args, **kwargs)
 * 
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_v_rv = nghttp2_session_callbacks_new((&__pyx_v_callbacks));

  /* "nghttp2.pyx":919
 *         rv = cnghttp2.nghttp2_session_callbacks_new(&callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":920
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":921
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL;
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":920
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_callbacks_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":923
 *                             (_strerror(rv)))
 * 
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 */
  nghttp2_session_callbacks_set_on_header_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_header);

  /* "nghttp2.pyx":925
 *         cnghttp2.nghttp2_session_callbacks_set_on_header_callback(
 *             callbacks, client_on_header)
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 */
  nghttp2_session_callbacks_set_on_begin_headers_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_begin_headers);

  /* "nghttp2.pyx":927
 *         cnghttp2.nghttp2_session_callbacks_set_on_begin_headers_callback(
 *             callbacks, client_on_begin_headers)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 */
  nghttp2_session_callbacks_set_on_frame_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_frame_recv);

  /* "nghttp2.pyx":929
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_recv_callback(
 *             callbacks, client_on_frame_recv)
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 */
  nghttp2_session_callbacks_set_on_stream_close_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_stream_close);

  /* "nghttp2.pyx":931
 *         cnghttp2.nghttp2_session_callbacks_set_on_stream_close_callback(
 *             callbacks, on_stream_close)
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(             # <<<<<<<<<<<<<<
 *             callbacks, client_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(
 */
  nghttp2_session_callbacks_set_on_frame_send_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_client_on_frame_send);

  /* "nghttp2.pyx":933
 *         cnghttp2.nghttp2_session_callbacks_set_on_frame_send_callback(
 *             callbacks, client_on_frame_send)
 *         cnghttp2.nghttp2_session_callbacks_set_on_data_chunk_recv_callback(             # <<<<<<<<<<<<<<
 *             callbacks, on_data_chunk_recv)
 * 
 */
  nghttp2_session_callbacks_set_on_data_chunk_recv_callback(__pyx_v_callbacks, __pyx_f_7nghttp2_on_data_chunk_recv);

  /* "nghttp2.pyx":936
 *             callbacks, on_data_chunk_recv)
 * 
 *         rv = cnghttp2.nghttp2_session_client_new(&self.session, callbacks,             # <<<<<<<<<<<<<<
 *                                                  <void*>self)
 * 
 */
  __pyx_v_rv = nghttp2_session_client_new((&__pyx_v_self->__pyx_base.session), __pyx_v_callbacks, ((void *)__pyx_v_self));

  /* "nghttp2.pyx":939
 *                                                  <void*>self)
 * 
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  nghttp2_session_callbacks_del(__pyx_v_callbacks);

  /* "nghttp2.pyx":941
 *         cnghttp2.nghttp2_session_callbacks_del(callbacks)
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":942
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_session_client_new_faile, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":943
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 */
    __pyx_t_6 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_6);
      __Pyx_GIVEREF(__pyx_t_6);
      __pyx_t_6 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 943; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":942
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_session_client_new failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":945
 *                             (_strerror(rv)))
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS             # <<<<<<<<<<<<<<
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;

  /* "nghttp2.pyx":946
 * 
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100             # <<<<<<<<<<<<<<
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 */
  (__pyx_v_iv[0]).value = 100;

  /* "nghttp2.pyx":947
 *         iv[0].settings_id = cnghttp2.NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 */
  (__pyx_v_iv[1]).settings_id = NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":948
 *         iv[0].value = 100
 *         iv[1].settings_id = cnghttp2.NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE             # <<<<<<<<<<<<<<
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 */
  (__pyx_v_iv[1]).value = NGHTTP2_INITIAL_WINDOW_SIZE;

  /* "nghttp2.pyx":952
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) / sizeof(iv[0]))             # <<<<<<<<<<<<<<
 * 
 *         if rv != 0:
 */
  __pyx_t_7 = (sizeof(__pyx_v_iv));
  __pyx_t_8 = (sizeof((__pyx_v_iv[0])));
  if (unlikely(__pyx_t_8 == 0)) {
    #ifdef WITH_THREAD
    PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();
    #endif
    PyErr_SetString(PyExc_ZeroDivisionError, "integer division or modulo by zero");
    #ifdef WITH_THREAD
    PyGILState_Release(__pyx_gilstate_save);
    #endif
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":950
 *         iv[1].value = cnghttp2.NGHTTP2_INITIAL_WINDOW_SIZE
 * 
 *         rv = cnghttp2.nghttp2_submit_settings(self.session,             # <<<<<<<<<<<<<<
 *                                               cnghttp2.NGHTTP2_FLAG_NONE,
 *                                               iv, sizeof(iv) / sizeof(iv[0]))
 */
  __pyx_v_rv = nghttp2_submit_settings(__pyx_v_self->__pyx_base.session, NGHTTP2_FLAG_NONE, __pyx_v_iv, (__pyx_t_7 / __pyx_t_8));

  /* "nghttp2.pyx":954
 *                                               iv, sizeof(iv) / sizeof(iv[0]))
 * 
 *         if rv != 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))
 */
  __pyx_t_5 = ((__pyx_v_rv != 0) != 0);
  if (__pyx_t_5) {

    /* "nghttp2.pyx":955
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":956
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\
 *                             (_strerror(rv)))             # <<<<<<<<<<<<<<
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):
 */
    __pyx_t_1 = __pyx_f_7nghttp2__strerror(__pyx_v_rv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_6)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_6);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_6) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
      PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_1 = 0;
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "nghttp2.pyx":955
 * 
 *         if rv != 0:
 *             raise Exception('nghttp2_submit_settings failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(rv)))
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":910
 * 
 * cdef class _HTTP2ClientSessionCore(_HTTP2SessionCoreBase):
 *     def __cinit__(self, *args, **kwargs):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_session_callbacks *callbacks
 *         cdef cnghttp2.nghttp2_settings_entry iv[2]
 */

  /* function exit code */
  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = -1;
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":958
 *                             (_strerror(rv)))
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_scheme = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_method_2,&__pyx_n_s_scheme_2,&__pyx_n_s_host,&__pyx_n_s_path_2,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_2)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scheme_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 7) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
    }
    __pyx_v_method = values[0];
    __pyx_v_scheme = values[1];
    __pyx_v_host = values[2];
    __pyx_v_path = values[3];
    __pyx_v_headers = values[4];
    __pyx_v_body = values[5];
    __pyx_v_handler = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_method, __pyx_v_scheme, __pyx_v_host, __pyx_v_path, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_2send_request(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  nghttp2_data_provider __pyx_v_prd;
  nghttp2_data_provider *__pyx_v_prd_ptr;
  nghttp2_priority_spec *__pyx_v_pri_ptr;
  nghttp2_nv *__pyx_v_nva;
  size_t __pyx_v_nvlen;
  int32_t __pyx_v_stream_id;
  PyObject *__pyx_v_custom_headers = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);
  __Pyx_INCREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":966
 *         cdef int32_t stream_id
 * 
 *         body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *         custom_headers = _encode_headers(headers)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_wrap_body); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_body); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_body);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_body);
    __Pyx_GIVEREF(__pyx_v_body);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":968
 *         body = wrap_body(body)
 * 
 *         custom_headers = _encode_headers(headers)             # <<<<<<<<<<<<<<
 *         headers = [
 *             (b':method', method.encode('utf-8')),
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_encode_headers); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_headers); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_headers);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_headers);
    __Pyx_GIVEREF(__pyx_v_headers);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_custom_headers = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":970
 *         custom_headers = _encode_headers(headers)
 *         headers = [
 *             (b':method', method.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":971
 *         headers = [
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_scheme, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":972
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':path', path.encode('utf-8'))
 *         ]
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_host, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;

  /* "nghttp2.pyx":973
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         ]
 *         headers.extend(custom_headers)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":969
 * 
 *         custom_headers = _encode_headers(headers)
 *         headers = [             # <<<<<<<<<<<<<<
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),
 */
  __pyx_t_5 = PyList_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyList_SET_ITEM(__pyx_t_5, 2, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_5, 3, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_2 = 0;
  __pyx_t_3 = 0;
  __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_5);
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":975
 *             (b':path', path.encode('utf-8'))
 *         ]
 *         headers.extend(custom_headers)             # <<<<<<<<<<<<<<
 * 
 *         nva = NULL
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_headers, __pyx_n_s_extend); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_custom_headers); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_custom_headers);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_custom_headers);
    __Pyx_GIVEREF(__pyx_v_custom_headers);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":977
 *         headers.extend(custom_headers)
 * 
 *         nva = NULL             # <<<<<<<<<<<<<<
 *         nvlen = _make_nva(&nva, headers)
 * 
 */
  __pyx_v_nva = NULL;

  /* "nghttp2.pyx":978
 * 
 *         nva = NULL
 *         nvlen = _make_nva(&nva, headers)             # <<<<<<<<<<<<<<
 * 
 *         if body:
 */
  __pyx_v_nvlen = __pyx_f_7nghttp2__make_nva((&__pyx_v_nva), __pyx_v_headers);

  /* "nghttp2.pyx":980
 *         nvlen = _make_nva(&nva, headers)
 * 
 *         if body:             # <<<<<<<<<<<<<<
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read
 */
  __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_body); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 980; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_6) {

    /* "nghttp2.pyx":981
 * 
 *         if body:
 *             prd.source.ptr = <void*>body             # <<<<<<<<<<<<<<
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd
 */
    __pyx_v_prd.source.ptr = ((void *)__pyx_v_body);

    /* "nghttp2.pyx":982
 *         if body:
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read             # <<<<<<<<<<<<<<
 *             prd_ptr = &prd
 *         else:
 */
    __pyx_v_prd.read_callback = __pyx_f_7nghttp2_data_source_read;

    /* "nghttp2.pyx":983
 *             prd.source.ptr = <void*>body
 *             prd.read_callback = data_source_read
 *             prd_ptr = &prd             # <<<<<<<<<<<<<<
 *         else:
 *             prd_ptr = NULL
 */
    __pyx_v_prd_ptr = (&__pyx_v_prd);
    goto __pyx_L3;
  }
  /*else*/ {

    /* "nghttp2.pyx":985
 *             prd_ptr = &prd
 *         else:
 *             prd_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         # TODO: Enable priorities
 */
    __pyx_v_prd_ptr = NULL;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":988
 * 
 *         # TODO: Enable priorities
 *         pri_ptr = NULL             # <<<<<<<<<<<<<<
 * 
 *         stream_id = cnghttp2.nghttp2_submit_request\
 */
  __pyx_v_pri_ptr = NULL;

  /* "nghttp2.pyx":991
 * 
 *         stream_id = cnghttp2.nghttp2_submit_request\
 *                              (self.session, pri_ptr,             # <<<<<<<<<<<<<<
 *                               nva, nvlen, prd_ptr,
 *                               <void*>handler)
 */
  __pyx_v_stream_id = nghttp2_submit_request(__pyx_v_self->__pyx_base.session, __pyx_v_pri_ptr, __pyx_v_nva, __pyx_v_nvlen, __pyx_v_prd_ptr, ((void *)__pyx_v_handler));

  /* "nghttp2.pyx":994
 *                               nva, nvlen, prd_ptr,
 *                               <void*>handler)
 *         free(nva)             # <<<<<<<<<<<<<<
 * 
 *         if stream_id < 0:
 */
  free(__pyx_v_nva);

  /* "nghttp2.pyx":996
 *         free(nva)
 * 
 *         if stream_id < 0:             # <<<<<<<<<<<<<<
 *             raise Exception('nghttp2_submit_request failed: {}'.format\
 *                             (_strerror(stream_id)))
 */
  __pyx_t_6 = ((__pyx_v_stream_id < 0) != 0);
  if (__pyx_t_6) {

    /* "nghttp2.pyx":997
 * 
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(stream_id)))
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_kp_s_nghttp2_submit_request_failed, __pyx_n_s_format); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "nghttp2.pyx":998
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\
 *                             (_strerror(stream_id)))             # <<<<<<<<<<<<<<
 * 
 *         logging.debug('request, stream_id:%s', stream_id)
 */
    __pyx_t_2 = __pyx_f_7nghttp2__strerror(__pyx_v_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (!__pyx_t_3) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_t_2);
      __Pyx_GIVEREF(__pyx_t_2);
      __pyx_t_2 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":997
 * 
 *         if stream_id < 0:
 *             raise Exception('nghttp2_submit_request failed: {}'.format\             # <<<<<<<<<<<<<<
 *                             (_strerror(stream_id)))
 * 
 */
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_Raise(__pyx_t_5, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1000
 *                             (_strerror(stream_id)))
 * 
 *         logging.debug('request, stream_id:%s', stream_id)             # <<<<<<<<<<<<<<
 * 
 *         self._add_handler(handler, stream_id)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_debug); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_request_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_kp_s_request_stream_id_s);
  __Pyx_GIVEREF(__pyx_kp_s_request_stream_id_s);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1002
 *         logging.debug('request, stream_id:%s', stream_id)
 * 
 *         self._add_handler(handler, stream_id)             # <<<<<<<<<<<<<<
 *         cnghttp2.nghttp2_session_set_stream_user_data(self.session, stream_id,
 *                                                   <void*>handler)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_handler); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_stream_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (__pyx_t_4) {
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_handler);
  PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_handler);
  __Pyx_GIVEREF(__pyx_v_handler);
  PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1002; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1003
 * 
 *         self._add_handler(handler, stream_id)
 *         cnghttp2.nghttp2_session_set_stream_user_data(self.session, stream_id,             # <<<<<<<<<<<<<<
 *                                                   <void*>handler)
 * 
 */
  nghttp2_session_set_stream_user_data(__pyx_v_self->__pyx_base.session, __pyx_v_stream_id, ((void *)__pyx_v_handler));

  /* "nghttp2.pyx":1006
 *                                                   <void*>handler)
 * 
 *         return handler             # <<<<<<<<<<<<<<
 * 
 *     def push(self, push_promise, handler):
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_handler);
  __pyx_r = __pyx_v_handler;
  goto __pyx_L0;

  /* "nghttp2.pyx":958
 *                             (_strerror(rv)))
 * 
 *     def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *         cdef cnghttp2.nghttp2_data_provider prd
 *         cdef cnghttp2.nghttp2_data_provider *prd_ptr
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_custom_headers);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1008
 *         return handler
 * 
 *     def push(self, push_promise, handler):             # <<<<<<<<<<<<<<
 *         if handler:
 *             # push_promise accepted, fill in the handler with the stored
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_push_promise = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_push_promise,&__pyx_n_s_handler,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_push_promise = values[0];
    __pyx_v_handler = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(((struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *)__pyx_v_self), __pyx_v_push_promise, __pyx_v_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_23_HTTP2ClientSessionCore_4push(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  uint32_t __pyx_t_8;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);

  /* "nghttp2.pyx":1009
 * 
 *     def push(self, push_promise, handler):
 *         if handler:             # <<<<<<<<<<<<<<
 *             # push_promise accepted, fill in the handler with the stored
 *             # headers from the push_promise
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_handler); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_1) {

    /* "nghttp2.pyx":1012
 *             # push_promise accepted, fill in the handler with the stored
 *             # headers from the push_promise
 *             handler.status = push_promise.status             # <<<<<<<<<<<<<<
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_status_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_status_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1013
 *             # headers from the push_promise
 *             handler.status = push_promise.status
 *             handler.scheme = push_promise.scheme             # <<<<<<<<<<<<<<
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_scheme_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1014
 *             handler.status = push_promise.status
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method             # <<<<<<<<<<<<<<
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_method_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_method_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1015
 *             handler.scheme = push_promise.scheme
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host             # <<<<<<<<<<<<<<
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_host); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_host, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1016
 *             handler.method = push_promise.method
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path             # <<<<<<<<<<<<<<
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_path_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_path_2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1017
 *             handler.host = push_promise.host
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies             # <<<<<<<<<<<<<<
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_cookies); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_cookies, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1018
 *             handler.path = push_promise.path
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id             # <<<<<<<<<<<<<<
 *             handler.http2 = self
 *             handler.pushed = True
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1019
 *             handler.cookies = push_promise.cookies
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self             # <<<<<<<<<<<<<<
 *             handler.pushed = True
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_http2, ((PyObject *)__pyx_v_self)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "nghttp2.pyx":1020
 *             handler.stream_id = push_promise.stream_id
 *             handler.http2 = self
 *             handler.pushed = True             # <<<<<<<<<<<<<<
 * 
 *             self._add_handler(handler, handler.stream_id)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_handler, __pyx_n_s_pushed, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1020; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "nghttp2.pyx":1022
 *             handler.pushed = True
 * 
 *             self._add_handler(handler, handler.stream_id)             # <<<<<<<<<<<<<<
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_add_handler); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_5 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (__pyx_t_5) {
      PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    }
    __Pyx_INCREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_handler);
    __Pyx_GIVEREF(__pyx_v_handler);
    PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1022; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1024
 *             self._add_handler(handler, handler.stream_id)
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,             # <<<<<<<<<<<<<<
 *                                                       <void*>handler)
 *         else:
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_handler, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_8 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1025
 * 
 *             cnghttp2.nghttp2_session_set_stream_user_data(self.session, handler.stream_id,
 *                                                       <void*>handler)             # <<<<<<<<<<<<<<
 *         else:
 *             # push_promise rejected, reset the stream
 */
    nghttp2_session_set_stream_user_data(__pyx_v_self->__pyx_base.session, __pyx_t_8, ((void *)__pyx_v_handler));
    goto __pyx_L3;
  }
  /*else*/ {

    /* "nghttp2.pyx":1028
 *         else:
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,             # <<<<<<<<<<<<<<
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_rst_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_push_promise, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":1029
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)             # <<<<<<<<<<<<<<
 * 
 * if asyncio:
 */
    __pyx_t_4 = PyInt_FromLong(NGHTTP2_NO_ERROR); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1029; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_error_code, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1028
 *         else:
 *             # push_promise rejected, reset the stream
 *             self._rst_stream(push_promise.stream_id,             # <<<<<<<<<<<<<<
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 */
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1028; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1008
 *         return handler
 * 
 *     def push(self, push_promise, handler):             # <<<<<<<<<<<<<<
 *         if handler:
 *             # push_promise accepted, fill in the handler with the stored
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSessionCore.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1087
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_http2,&__pyx_n_s_stream_id,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_http2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stream_id)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_self = values[0];
    __pyx_v_http2 = values[1];
    __pyx_v_stream_id = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_http2, __pyx_v_stream_id);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1088
 * 
 *         def __init__(self, http2, stream_id):
 *             self.headers = []             # <<<<<<<<<<<<<<
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_headers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1089
 *         def __init__(self, http2, stream_id):
 *             self.headers = []
 *             self.cookies = []             # <<<<<<<<<<<<<<
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cookies, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1091
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id             # <<<<<<<<<<<<<<
 *             self.http2 = http2
 *             # address of the client
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1092
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 *             self.http2 = http2             # <<<<<<<<<<<<<<
 *             # address of the client
 *             self.remote_address = self.http2._get_remote_address()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_v_http2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1094
 *             self.http2 = http2
 *             # address of the client
 *             self.remote_address = self.http2._get_remote_address()             # <<<<<<<<<<<<<<
 *             # certificate of the client
 *             self._client_certificate = self.http2._get_client_certificate()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_remote_address); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_remote_address, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1094; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1096
 *             self.remote_address = self.http2._get_remote_address()
 *             # certificate of the client
 *             self._client_certificate = self.http2._get_client_certificate()             # <<<<<<<<<<<<<<
 *             # :scheme header field in request
 *             self.scheme = None
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get_client_certificate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_client_certificate_2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1096; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1098
 *             self._client_certificate = self.http2._get_client_certificate()
 *             # :scheme header field in request
 *             self.scheme = None             # <<<<<<<<<<<<<<
 *             # :method header field in request
 *             self.method = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1100
 *             self.scheme = None
 *             # :method header field in request
 *             self.method = None             # <<<<<<<<<<<<<<
 *             # :authority or host header field in request
 *             self.host = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_method_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1100; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1102
 *             self.method = None
 *             # :authority or host header field in request
 *             self.host = None             # <<<<<<<<<<<<<<
 *             # :path header field in request
 *             self.path = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_host, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1104
 *             self.host = None
 *             # :path header field in request
 *             self.path = None             # <<<<<<<<<<<<<<
 *             # HTTP status
 *             self.status = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_path_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1106
 *             self.path = None
 *             # HTTP status
 *             self.status = None             # <<<<<<<<<<<<<<
 *             # True if this is a handler for pushed resource
 *             self.pushed = False
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1108
 *             self.status = None
 *             # True if this is a handler for pushed resource
 *             self.pushed = False             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pushed, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1087
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1111
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_3client_address = {"client_address", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_3client_address(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("client_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_2client_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_address", 0);

  /* "nghttp2.pyx":1112
 *         @property
 *         def client_address(self):
 *             return self.remote_address             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1111
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.client_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1115
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_5client_certificate = {"client_certificate", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_5client_certificate(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("client_certificate (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_4client_certificate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("client_certificate", 0);

  /* "nghttp2.pyx":1116
 *         @property
 *         def client_certificate(self):
 *             return self._client_certificate             # <<<<<<<<<<<<<<
 * 
 *         def on_headers(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_client_certificate_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1115
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.client_certificate", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1118
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_6on_headers[] = "Called when request HEADERS is arrived.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_7on_headers = {"on_headers", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers, METH_O, __pyx_doc_7nghttp2_18BaseRequestHandler_6on_headers};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_7on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_6on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1125
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_8on_data[] = "Called when a chunk of request body is arrived. This method\n            will be called multiple times until all data are received.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_9on_data = {"on_data", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_8on_data};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_9on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.on_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_8on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1133
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_10on_request_done[] = "Called when whole request was received\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_11on_request_done = {"on_request_done", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done, METH_O, __pyx_doc_7nghttp2_18BaseRequestHandler_10on_request_done};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_11on_request_done(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_request_done (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_10on_request_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_request_done", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1140
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_12on_close[] = "Called when stream is about to close.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_13on_close = {"on_close", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_12on_close};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_13on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_error_code,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_close") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.on_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(__pyx_self, __pyx_v_self, __pyx_v_error_code);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_12on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1147
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_14send_response[] = "Send response. The status is HTTP status code. The headers is\n            additional response headers. The :status header field is\n            appended by the library. The body is the response body. It\n            could be None if response body is empty. Or it must be\n            instance of either str, bytes, io.IOBase or callable,\n            called body generator, which takes one parameter,\n            size. The body generator generates response body. It can\n            pause generation of response so that it can wait for slow\n            backend data generation. When invoked, it should return\n            tuple, byte string and flag. The flag is either DATA_OK,\n            DATA_EOF and DATA_DEFERRED. For non-empty byte string and\n            it is not the last chunk of response, DATA_OK is returned\n            as flag.  If this is the last chunk of the response (byte\n            string is possibly None), DATA_EOF must be returned as\n            flag.  If there is no data available right now, but\n            additional data are anticipated, return tuple (None,\n            DATA_DEFERRD).  When data arrived, call resume() and\n            restart response body transmission.\n\n            Only the body generator can pause response body\n            generation; instance of io.IOBase must not block.\n\n            If instance of str is specified as body, it is encoded\n            using UTF-8.\n\n            The headers is a list of tuple of the form (name,\n            value). The name and value can be either unicode string or\n            byte string.\n\n            On error, exception will be thrown.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_15send_response = {"send_response", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_14send_response};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_15send_response(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_response (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[4] = {0,0,0,0};
    values[1] = ((PyObject *)((PyObject *)__pyx_int_200));
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_status_2);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_response") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_status = values[1];
    __pyx_v_headers = values[2];
    __pyx_v_body = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_response", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(__pyx_self, __pyx_v_self, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_14send_response(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_response", 0);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":1181
 * 
 *             '''
 *             if self.status is not None:             # <<<<<<<<<<<<<<
 *                 raise Exception('response has already been sent')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_status_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = (__pyx_t_1 != Py_None);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_3 = (__pyx_t_2 != 0);
  if (__pyx_t_3) {

    /* "nghttp2.pyx":1182
 *             '''
 *             if self.status is not None:
 *                 raise Exception('response has already been sent')             # <<<<<<<<<<<<<<
 * 
 *             if not status:
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1184
 *                 raise Exception('response has already been sent')
 * 
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_status); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1184; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_3) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1185
 * 
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_Raise(__pyx_t_1, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1187
 *                 raise Exception('status must not be empty')
 * 
 *             body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *             self._set_response_prop(status, headers, body)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_wrap_body); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_body); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_body);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_body);
    __Pyx_GIVEREF(__pyx_v_body);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1187; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1189
 *             body = wrap_body(body)
 * 
 *             self._set_response_prop(status, headers, body)             # <<<<<<<<<<<<<<
 *             self.http2.send_response(self)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_set_response_prop); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_6) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_status);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_status);
  __Pyx_GIVEREF(__pyx_v_status);
  __Pyx_INCREF(__pyx_v_headers);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_headers);
  __Pyx_GIVEREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_body);
  __Pyx_GIVEREF(__pyx_v_body);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1189; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1190
 * 
 *             self._set_response_prop(status, headers, body)
 *             self.http2.send_response(self)             # <<<<<<<<<<<<<<
 * 
 *         def push(self, path, method='GET', request_headers=None,
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_send_response); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1190; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1147
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.send_response", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1192
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_17push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_18BaseRequestHandler_16push[] = "Push a resource. The path is a path portion of request URI\n            for this\n            resource. The method is a method to access this\n            resource. The request_headers is additional request\n            headers to access this resource. The :scheme, :method,\n            :authority and :path are appended by the library. The\n            :scheme and :authority are inherited from the request (not\n            request_headers parameter).\n\n            The status is HTTP status code. The headers is additional\n            response headers. The :status header field is appended by\n            the library. The body is the response body. It has the\n            same semantics of body parameter of send_response().\n\n            The headers and request_headers are a list of tuple of the\n            form (name, value). The name and value can be either\n            unicode string or byte string.\n\n            On error, exception will be thrown.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_17push = {"push", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_17push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_18BaseRequestHandler_16push};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_17push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_request_headers = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_path_2,&__pyx_n_s_method_2,&__pyx_n_s_request_headers,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[7] = {0,0,0,0,0,0,0};
    values[2] = ((PyObject *)((PyObject*)__pyx_n_s_GET));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)__pyx_int_200));

    /* "nghttp2.pyx":1193
 * 
 *         def push(self, path, method='GET', request_headers=None,
 *                  status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Push a resource. The path is a path portion of request URI
 */
    values[5] = ((PyObject *)((PyObject *)Py_None));
    values[6] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("push", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_2);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_request_headers);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_status_2);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[6] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "push") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_path = values[1];
    __pyx_v_method = values[2];
    __pyx_v_request_headers = values[3];
    __pyx_v_status = values[4];
    __pyx_v_headers = values[5];
    __pyx_v_body = values[6];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("push", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_16push(__pyx_self, __pyx_v_self, __pyx_v_path, __pyx_v_method, __pyx_v_request_headers, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

  /* "nghttp2.pyx":1192
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_16push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_path, PyObject *__pyx_v_method, PyObject *__pyx_v_request_headers, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  PyObject *__pyx_v_promised_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("push", 0);
  __Pyx_INCREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);

  /* "nghttp2.pyx":1216
 * 
 *             '''
 *             if not status:             # <<<<<<<<<<<<<<
 *                 raise Exception('status must not be empty')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_status); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1217
 *             '''
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not method:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1219
 *                 raise Exception('status must not be empty')
 * 
 *             if not method:             # <<<<<<<<<<<<<<
 *                 raise Exception('method must not be empty')
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_method); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_1 = ((!__pyx_t_2) != 0);
  if (__pyx_t_1) {

    /* "nghttp2.pyx":1220
 * 
 *             if not method:
 *                 raise Exception('method must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not path:
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1222
 *                 raise Exception('method must not be empty')
 * 
 *             if not path:             # <<<<<<<<<<<<<<
 *                 raise Exception('path must not be empty')
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_path); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1222; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1223
 * 
 *             if not path:
 *                 raise Exception('path must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_Exception, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }

  /* "nghttp2.pyx":1225
 *                 raise Exception('path must not be empty')
 * 
 *             body = wrap_body(body)             # <<<<<<<<<<<<<<
 * 
 *             promised_handler = self.http2._make_handler(-1)
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_wrap_body); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_body); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    __Pyx_INCREF(__pyx_v_body);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_body);
    __Pyx_GIVEREF(__pyx_v_body);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1225; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF_SET(__pyx_v_body, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1227
 *             body = wrap_body(body)
 * 
 *             promised_handler = self.http2._make_handler(-1)             # <<<<<<<<<<<<<<
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_make_handler); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_v_promised_handler = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1228
 * 
 *             promised_handler = self.http2._make_handler(-1)
 *             promised_handler.pushed = True             # <<<<<<<<<<<<<<
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_pushed, Py_True) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1229
 *             promised_handler = self.http2._make_handler(-1)
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme             # <<<<<<<<<<<<<<
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_scheme_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1230
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_method, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_method_2, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":1231
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host             # <<<<<<<<<<<<<<
 *             promised_handler.path = path.encode('utf-8')
 *             promised_handler._set_response_prop(status, headers, body)
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_host); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_host, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1231; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":1232
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler._set_response_prop(status, headers, body)
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_path, __pyx_n_s_encode); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_path_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1233
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')
 *             promised_handler._set_response_prop(status, headers, body)             # <<<<<<<<<<<<<<
 * 
 *             headers = [
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_set_response_prop); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_6) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_v_status);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_v_status);
  __Pyx_GIVEREF(__pyx_v_status);
  __Pyx_INCREF(__pyx_v_headers);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_headers);
  __Pyx_GIVEREF(__pyx_v_headers);
  __Pyx_INCREF(__pyx_v_body);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_7, __pyx_v_body);
  __Pyx_GIVEREF(__pyx_v_body);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1236
 * 
 *             headers = [
 *                 (b':method', promised_handler.method),             # <<<<<<<<<<<<<<
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_method_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_kp_b_method);
  __Pyx_GIVEREF(__pyx_kp_b_method);
  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1237
 *             headers = [
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),             # <<<<<<<<<<<<<<
 *                 (b':authority', promised_handler.host),
 *                 (b':path', promised_handler.path)
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_INCREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_kp_b_scheme);
  __Pyx_GIVEREF(__pyx_kp_b_scheme);
  PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1238
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),             # <<<<<<<<<<<<<<
 *                 (b':path', promised_handler.path)
 *             ]
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_host); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_INCREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_kp_b_authority);
  __Pyx_GIVEREF(__pyx_kp_b_authority);
  PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1239
 *                 (b':scheme', promised_handler.scheme),
 *                 (b':authority', promised_handler.host),
 *                 (b':path', promised_handler.path)             # <<<<<<<<<<<<<<
 *             ]
 *             headers.extend(_encode_headers(request_headers))
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_promised_handler, __pyx_n_s_path_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_INCREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_kp_b_path);
  __Pyx_GIVEREF(__pyx_kp_b_path);
  PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1235
 *             promised_handler._set_response_prop(status, headers, body)
 * 
 *             headers = [             # <<<<<<<<<<<<<<
 *                 (b':method', promised_handler.method),
 *                 (b':scheme', promised_handler.scheme),
 */
  __pyx_t_3 = PyList_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1235; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_5);
  __Pyx_GIVEREF(__pyx_t_5);
  PyList_SET_ITEM(__pyx_t_3, 2, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  PyList_SET_ITEM(__pyx_t_3, 3, __pyx_t_8);
  __Pyx_GIVEREF(__pyx_t_8);
  __pyx_t_4 = 0;
  __pyx_t_5 = 0;
  __pyx_t_6 = 0;
  __pyx_t_8 = 0;
  __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_3);
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1241
 *                 (b':path', promised_handler.path)
 *             ]
 *             headers.extend(_encode_headers(request_headers))             # <<<<<<<<<<<<<<
 * 
 *             promised_handler.headers = headers
 */
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_headers, __pyx_n_s_extend); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_encode_headers); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_request_headers); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_request_headers);
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_v_request_headers);
    __Pyx_GIVEREF(__pyx_v_request_headers);
    __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_8))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_8);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_8, function);
    }
  }
  if (!__pyx_t_5) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
    PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_6);
    __pyx_t_6 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  }
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1243
 *             headers.extend(_encode_headers(request_headers))
 * 
 *             promised_handler.headers = headers             # <<<<<<<<<<<<<<
 * 
 *             return self.http2.push(self, promised_handler)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_promised_handler, __pyx_n_s_headers, __pyx_v_headers) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1243; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1245
 *             promised_handler.headers = headers
 * 
 *             return self.http2.push(self, promised_handler)             # <<<<<<<<<<<<<<
 * 
 *         def _set_response_prop(self, status, headers, body):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_push); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_8) {
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_INCREF(__pyx_v_self);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_7, __pyx_v_self);
  __Pyx_GIVEREF(__pyx_v_self);
  __Pyx_INCREF(__pyx_v_promised_handler);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_7, __pyx_v_promised_handler);
  __Pyx_GIVEREF(__pyx_v_promised_handler);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1245; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1192
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_promised_handler);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1247
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_19_set_response_prop = {"_set_response_prop", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_19_set_response_prop(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_status = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_set_response_prop (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_status_2,&__pyx_n_s_headers,&__pyx_n_s_body,0};
    PyObject* values[4] = {0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_status_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_set_response_prop") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 4) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
    }
    __pyx_v_self = values[0];
    __pyx_v_status = values[1];
    __pyx_v_headers = values[2];
    __pyx_v_body = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("_set_response_prop", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler._set_response_prop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(__pyx_self, __pyx_v_self, __pyx_v_status, __pyx_v_headers, __pyx_v_body);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_18_set_response_prop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_status, PyObject *__pyx_v_headers, PyObject *__pyx_v_body) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_set_response_prop", 0);
  __Pyx_INCREF(__pyx_v_headers);

  /* "nghttp2.pyx":1248
 * 
 *         def _set_response_prop(self, status, headers, body):
 *             self.status = status             # <<<<<<<<<<<<<<
 * 
 *             if headers is None:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, __pyx_v_status) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1250
 *             self.status = status
 * 
 *             if headers is None:             # <<<<<<<<<<<<<<
 *                 headers = []
 * 
 */
  __pyx_t_1 = (__pyx_v_headers == Py_None);
  __pyx_t_2 = (__pyx_t_1 != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1251
 * 
 *             if headers is None:
 *                 headers = []             # <<<<<<<<<<<<<<
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]
 */
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF_SET(__pyx_v_headers, __pyx_t_3);
    __pyx_t_3 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1253
 *                 headers = []
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]             # <<<<<<<<<<<<<<
 *             self.response_headers.extend(_encode_headers(headers))
 * 
 */
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_v_status);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_status);
  __Pyx_GIVEREF(__pyx_v_status);
  __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_encode); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_INCREF(__pyx_kp_b_status);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_b_status);
  __Pyx_GIVEREF(__pyx_kp_b_status);
  PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_3);
  __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_response_headers, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":1254
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]
 *             self.response_headers.extend(_encode_headers(headers))             # <<<<<<<<<<<<<<
 * 
 *             self.response_body = body
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_response_headers); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_extend); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_encode_headers); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_6, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_headers); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_headers);
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_v_headers);
    __Pyx_GIVEREF(__pyx_v_headers);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_4);
  } else {
    __pyx_t_8 = PyTuple_New(1+1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_8);
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    PyTuple_SET_ITEM(__pyx_t_8, 0+1, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

  /* "nghttp2.pyx":1256
 *             self.response_headers.extend(_encode_headers(headers))
 * 
 *             self.response_body = body             # <<<<<<<<<<<<<<
 * 
 *         def resume(self):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_response_body, __pyx_v_body) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1256; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1247
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler._set_response_prop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1258
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_21resume(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_18BaseRequestHandler_21resume = {"resume", (PyCFunction)__pyx_pw_7nghttp2_18BaseRequestHandler_21resume, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_18BaseRequestHandler_21resume(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_18BaseRequestHandler_20resume(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_18BaseRequestHandler_20resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":1259
 * 
 *         def resume(self):
 *             self.http2.resume(self.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     def _encode_headers(headers):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resume); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1258
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2.BaseRequestHandler.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1261
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_5_encode_headers(PyObject *__pyx_self, PyObject *__pyx_v_headers); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_5_encode_headers = {"_encode_headers", (PyCFunction)__pyx_pw_7nghttp2_5_encode_headers, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_5_encode_headers(PyObject *__pyx_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("_encode_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_4_encode_headers(__pyx_self, ((PyObject *)__pyx_v_headers));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_4_encode_headers(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_headers) {
  PyObject *__pyx_v_k = NULL;
  PyObject *__pyx_v_v = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  int __pyx_t_1;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *(*__pyx_t_11)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("_encode_headers", 0);

  /* "nghttp2.pyx":1262
 * 
 *     def _encode_headers(headers):
 *         if not headers:             # <<<<<<<<<<<<<<
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 */
  __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_headers); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1262; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_t_2 = ((!__pyx_t_1) != 0);
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1263
 *     def _encode_headers(headers):
 *         if not headers:
 *             return []             # <<<<<<<<<<<<<<
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 */
    __Pyx_XDECREF(__pyx_r);
    __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_r = __pyx_t_3;
    __pyx_t_3 = 0;
    goto __pyx_L0;
  }

  /* "nghttp2.pyx":1264
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);

  /* "nghttp2.pyx":1266
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2Session(asyncio.Protocol):
 */
  if (likely(PyList_CheckExact(__pyx_v_headers)) || PyTuple_CheckExact(__pyx_v_headers)) {
    __pyx_t_4 = __pyx_v_headers; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_headers); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_6 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_4))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_7); __pyx_t_5++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_7 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_7 = __pyx_t_6(__pyx_t_4);
      if (unlikely(!__pyx_t_7)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_7);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_7))) || (PyList_CheckExact(__pyx_t_7))) {
      PyObject* sequence = __pyx_t_7;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 2)) {
        if (size > 2) __Pyx_RaiseTooManyValuesError(2);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_8 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyTuple_GET_ITEM(sequence, 1); 
      } else {
        __pyx_t_8 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_9 = PyList_GET_ITEM(sequence, 1); 
      }
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(__pyx_t_9);
      #else
      __pyx_t_8 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __pyx_t_9 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      #endif
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    } else {
      Py_ssize_t index = -1;
      __pyx_t_10 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext;
      index = 0; __pyx_t_8 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_8)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_8);
      index = 1; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L6_unpacking_failed;
      __Pyx_GOTREF(__pyx_t_9);
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_11 = NULL;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      goto __pyx_L7_unpacking_done;
      __pyx_L6_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1266; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L7_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_8);
    __pyx_t_8 = 0;
    __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_9);
    __pyx_t_9 = 0;

    /* "nghttp2.pyx":1264
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_k); 
    if ((__pyx_t_2 != 0)) {
      __Pyx_INCREF(__pyx_v_k);
      __pyx_t_7 = __pyx_v_k;
    } else {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_k, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_7 = __pyx_t_8;
      __pyx_t_8 = 0;
    }

    /* "nghttp2.pyx":1265
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \             # <<<<<<<<<<<<<<
 *                 for k, v in headers]
 * 
 */
    __pyx_t_2 = PyBytes_Check(__pyx_v_v); 
    if ((__pyx_t_2 != 0)) {
      __Pyx_INCREF(__pyx_v_v);
      __pyx_t_8 = __pyx_v_v;
    } else {
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_v, __pyx_n_s_encode); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_8 = __pyx_t_10;
      __pyx_t_10 = 0;
    }

    /* "nghttp2.pyx":1264
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
    __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_10);
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_8);
    __Pyx_GIVEREF(__pyx_t_8);
    __pyx_t_7 = 0;
    __pyx_t_8 = 0;
    if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_10))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;

    /* "nghttp2.pyx":1266
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2Session(asyncio.Protocol):
 */
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_3;
  __pyx_t_3 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1261
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("nghttp2._encode_headers", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_k);
  __Pyx_XDECREF(__pyx_v_v);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1270
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_RequestHandlerClass = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_RequestHandlerClass,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RequestHandlerClass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_RequestHandlerClass = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session___init__(__pyx_self, __pyx_v_self, __pyx_v_RequestHandlerClass);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_RequestHandlerClass) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1271
 * 
 *         def __init__(self, RequestHandlerClass):
 *             asyncio.Protocol.__init__(self)             # <<<<<<<<<<<<<<
 *             self.RequestHandlerClass = RequestHandlerClass
 *             self.http2 = None
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1271; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1272
 *         def __init__(self, RequestHandlerClass):
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass             # <<<<<<<<<<<<<<
 *             self.http2 = None
 * 
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_RequestHandlerClass, __pyx_v_RequestHandlerClass) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1273
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 *             self.http2 = None             # <<<<<<<<<<<<<<
 * 
 *         def connection_made(self, transport):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1273; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1270
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1275
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_3connection_made = {"connection_made", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_transport = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_transport,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_made") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_transport = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(__pyx_self, __pyx_v_self, __pyx_v_transport);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_address = NULL;
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_v_e = NULL;
  PyObject *__pyx_v_ssl_ctx = NULL;
  PyObject *__pyx_v_protocol = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_t_11;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  int __pyx_t_14;
  int __pyx_t_15;
  int __pyx_t_16;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "nghttp2.pyx":1276
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_address = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1277
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *             self.transport = transport
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_connection_made_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_connection_made_address_s_port_s);
  __Pyx_GIVEREF(__pyx_kp_s_connection_made_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1279
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 *             self.transport = transport             # <<<<<<<<<<<<<<
 *             sock = self.transport.get_extra_info('socket')
 *             try:
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transport, __pyx_v_transport) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1279; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1280
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sock = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1281
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             try:             # <<<<<<<<<<<<<<
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_10);
    /*try:*/ {

      /* "nghttp2.pyx":1282
 *             sock = self.transport.get_extra_info('socket')
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 */
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      if (__pyx_t_7) {
        PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
      }
      PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_4);
      PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      __pyx_t_4 = 0;
      __pyx_t_1 = 0;
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1283
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:             # <<<<<<<<<<<<<<
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 */
    __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_OSError);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_3, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __pyx_v_e = __pyx_t_3;

      /* "nghttp2.pyx":1284
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))             # <<<<<<<<<<<<<<
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 */
      __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_info); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_v_e);
      PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_e);
      __Pyx_GIVEREF(__pyx_v_e);
      __pyx_t_12 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      __pyx_t_6 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
          __pyx_t_6 = 1;
        }
      }
      __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      if (__pyx_t_4) {
        PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      }
      __Pyx_INCREF(__pyx_kp_s_failed_to_set_tcp_nodelay_s);
      PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_kp_s_failed_to_set_tcp_nodelay_s);
      __Pyx_GIVEREF(__pyx_kp_s_failed_to_set_tcp_nodelay_s);
      PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_12);
      __Pyx_GIVEREF(__pyx_t_12);
      __pyx_t_12 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L4_exception_handled;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    goto __pyx_L1_error;
    __pyx_L4_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10);
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1285
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 */
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ssl_ctx = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":1286
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 */
  __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_v_ssl_ctx); if (unlikely(__pyx_t_14 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_14) {

    /* "nghttp2.pyx":1287
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()             # <<<<<<<<<<<<<<
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_selected_npn_protocol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_protocol = __pyx_t_5;
    __pyx_t_5 = 0;

    /* "nghttp2.pyx":1288
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)             # <<<<<<<<<<<<<<
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_1 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_3) {
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_npn_protocol_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_6, __pyx_kp_s_npn_protocol_s);
    __Pyx_GIVEREF(__pyx_kp_s_npn_protocol_s);
    __Pyx_INCREF(__pyx_v_protocol);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_6, __pyx_v_protocol);
    __Pyx_GIVEREF(__pyx_v_protocol);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":1289
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    __pyx_t_15 = (__pyx_v_protocol == Py_None);
    __pyx_t_16 = (__pyx_t_15 != 0);
    if (!__pyx_t_16) {
    } else {
      __pyx_t_14 = __pyx_t_16;
      goto __pyx_L15_bool_binop_done;
    }
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "nghttp2.pyx":1290
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:             # <<<<<<<<<<<<<<
 *                     self.transport.abort()
 *                     return
 */
    __pyx_t_5 = __Pyx_PyObject_FromString(NGHTTP2_PROTO_VERSION_ID); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1290; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_16 = (__Pyx_PyBytes_Equals(__pyx_t_2, __pyx_t_5, Py_NE)); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_14 = __pyx_t_16;
    __pyx_L15_bool_binop_done:;
    if (__pyx_t_14) {

      /* "nghttp2.pyx":1291
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()             # <<<<<<<<<<<<<<
 *                     return
 *             try:
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_abort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1292
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 *                     return             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      goto __pyx_L0;
    }
    goto __pyx_L13;
  }
  __pyx_L13:;

  /* "nghttp2.pyx":1293
 *                     self.transport.abort()
 *                     return
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8);
    __Pyx_XGOTREF(__pyx_t_10);
    __Pyx_XGOTREF(__pyx_t_9);
    __Pyx_XGOTREF(__pyx_t_8);
    /*try:*/ {

      /* "nghttp2.pyx":1295
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,             # <<<<<<<<<<<<<<
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_GOTREF(__pyx_t_5);

      /* "nghttp2.pyx":1296
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,
 *                               self.RequestHandlerClass)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_RequestHandlerClass); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_GOTREF(__pyx_t_1);

      /* "nghttp2.pyx":1295
 *             try:
 *                 self.http2 = _HTTP2SessionCore\
 *                              (self.transport,             # <<<<<<<<<<<<<<
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 */
      __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_GOTREF(__pyx_t_2);
      PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_1);
      __pyx_t_5 = 0;
      __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2SessionCore)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1295; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "nghttp2.pyx":1294
 *                     return
 *             try:
 *                 self.http2 = _HTTP2SessionCore\             # <<<<<<<<<<<<<<
 *                              (self.transport,
 *                               self.RequestHandlerClass)
 */
      if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1294; __pyx_clineno = __LINE__; goto __pyx_L17_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
    goto __pyx_L24_try_end;
    __pyx_L17_error:;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
    __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1297
 *                              (self.transport,
 *                               self.RequestHandlerClass)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()
 */
    __pyx_t_11 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_11) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_1, &__pyx_t_2, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1297; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __pyx_v_err = __pyx_t_2;

      /* "nghttp2.pyx":1298
 *                               self.RequestHandlerClass)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.abort()
 *                 return
 */
      __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_stderr); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_write); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_12) {
        __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_12); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_7))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_7, function);
        }
      }
      if (!__pyx_t_4) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_3);
      } else {
        __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
        __Pyx_GOTREF(__pyx_t_12);
        PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
        PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      }
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "nghttp2.pyx":1299
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_abort); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

      /* "nghttp2.pyx":1300
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.abort()
 *                 return             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      goto __pyx_L20_except_return;
    }
    goto __pyx_L19_except_error;
    __pyx_L19_except_error:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
    goto __pyx_L1_error;
    __pyx_L20_except_return:;
    __Pyx_XGIVEREF(__pyx_t_10);
    __Pyx_XGIVEREF(__pyx_t_9);
    __Pyx_XGIVEREF(__pyx_t_8);
    __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_9, __pyx_t_8);
    goto __pyx_L0;
    __pyx_L24_try_end:;
  }

  /* "nghttp2.pyx":1275
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_address);
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XDECREF(__pyx_v_e);
  __Pyx_XDECREF(__pyx_v_ssl_ctx);
  __Pyx_XDECREF(__pyx_v_protocol);
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1303
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_5connection_lost = {"connection_lost", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_lost") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_exc = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(__pyx_self, __pyx_v_self, __pyx_v_exc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":1304
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.connection_lost()
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1305
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.connection_lost()
 *                 self.http2 = None
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1305; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "nghttp2.pyx":1306
 *             logging.info('connection_lost')
 *             if self.http2:
 *                 self.http2.connection_lost()             # <<<<<<<<<<<<<<
 *                 self.http2 = None
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_connection_lost); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1307
 *             if self.http2:
 *                 self.http2.connection_lost()
 *                 self.http2 = None             # <<<<<<<<<<<<<<
 * 
 *         def data_received(self, data):
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1303
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1309
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_7data_received = {"data_received", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_7data_received, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "data_received") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_6data_received(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":1310
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":1311
 *         def data_received(self, data):
 *             try:
 *                 self.http2.data_received(data)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_data_received); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1311; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1312
 *             try:
 *                 self.http2.data_received(data)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1312; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1313
 *                 self.http2.data_received(data)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1313; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1314
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1315
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def resume_writing(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1309
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1317
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_13_HTTP2Session_9resume_writing = {"resume_writing", (PyCFunction)__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_13_HTTP2Session_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_13_HTTP2Session_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume_writing", 0);

  /* "nghttp2.pyx":1318
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":1319
 *         def resume_writing(self):
 *             try:
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1320
 *             try:
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2Session.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1320; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1321
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1321; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1322
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1323
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *     class HTTP2Server:
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1317
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2Session.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_11HTTP2Server___init__[] = "address is a tuple of the listening address and port (e.g.,\n            ('127.0.0.1', 8080)). RequestHandlerClass must be a subclass\n            of BaseRequestHandler class to handle a HTTP/2 stream.  The\n            ssl can be ssl.SSLContext instance. If it is not None, the\n            resulting server is SSL/TLS capable.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Server_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_11HTTP2Server___init__};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_RequestHandlerClass = 0;
  PyObject *__pyx_v_ssl = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_RequestHandlerClass,&__pyx_n_s_ssl,0};
    PyObject* values[4] = {0,0,0,0};
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_RequestHandlerClass)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ssl);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_RequestHandlerClass = values[2];
    __pyx_v_ssl = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server___init__(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_RequestHandlerClass, __pyx_v_ssl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1343
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_8__init___1session_factory = {"session_factory", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("session_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_8__init___session_factory(PyObject *__pyx_self) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_cur_scope;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("session_factory", 0);
  __pyx_outer_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "nghttp2.pyx":1344
 *             '''
 *             def session_factory():
 *                 return _HTTP2Session(RequestHandlerClass)             # <<<<<<<<<<<<<<
 * 
 *             self.loop = asyncio.get_event_loop()
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_HTTP2Session); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (unlikely(!__pyx_cur_scope->__pyx_v_RequestHandlerClass)) { __Pyx_RaiseClosureNameError("RequestHandlerClass"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_RequestHandlerClass); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_RequestHandlerClass);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1343
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__.session_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_RequestHandlerClass, PyObject *__pyx_v_ssl) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_cur_scope;
  PyObject *__pyx_v_session_factory = 0;
  PyObject *__pyx_v_coro = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(__pyx_ptype_7nghttp2___pyx_scope_struct____init__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_RequestHandlerClass = __pyx_v_RequestHandlerClass;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_RequestHandlerClass);

  /* "nghttp2.pyx":1343
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Server_8__init___1session_factory, 0, __pyx_n_s_HTTP2Server___init___locals_sess, ((PyObject*)__pyx_cur_scope), __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_session_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1346
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 *             self.loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_loop, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1348
 *             self.loop = asyncio.get_event_loop()
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\
 *                                        .decode('utf-8')])
 */
  __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_4) {

    /* "nghttp2.pyx":1349
 * 
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\             # <<<<<<<<<<<<<<
 *                                        .decode('utf-8')])
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl, __pyx_n_s_set_npn_protocols); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);

    /* "nghttp2.pyx":1350
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\
 *                                        .decode('utf-8')])             # <<<<<<<<<<<<<<
 * 
 *             coro = self.loop.create_server(session_factory,
 */
    __pyx_t_2 = __Pyx_decode_c_string(NGHTTP2_PROTO_VERSION_ID, 0, strlen(NGHTTP2_PROTO_VERSION_ID), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1349
 * 
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\             # <<<<<<<<<<<<<<
 *                                        .decode('utf-8')])
 * 
 */
    __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (!__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5);
      __Pyx_GIVEREF(__pyx_t_5);
      __pyx_t_5 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1352
 *                                        .decode('utf-8')])
 * 
 *             coro = self.loop.create_server(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_create_server); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_session_factory);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_session_factory);
  __Pyx_GIVEREF(__pyx_v_session_factory);
  __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);

  /* "nghttp2.pyx":1353
 * 
 *             coro = self.loop.create_server(session_factory,
 *                                            host=address[0], port=address[1],             # <<<<<<<<<<<<<<
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)
 */
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_host, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_5 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_5);
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_port, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1354
 *             coro = self.loop.create_server(session_factory,
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)             # <<<<<<<<<<<<<<
 *             self.server = self.loop.run_until_complete(coro)
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 */
  if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_ssl, __pyx_v_ssl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1352
 *                                        .decode('utf-8')])
 * 
 *             coro = self.loop.create_server(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_v_coro = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "nghttp2.pyx":1355
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)             # <<<<<<<<<<<<<<
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_run_until_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_coro); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_INCREF(__pyx_v_coro);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_coro);
    __Pyx_GIVEREF(__pyx_v_coro);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_server, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1356
 *                                            ssl=ssl)
 *             self.server = self.loop.run_until_complete(coro)
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *         def serve_forever(self):
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_listen_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_s_listen_address_s_port_s);
  __Pyx_GIVEREF(__pyx_kp_s_listen_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_6);
  __Pyx_GIVEREF(__pyx_t_6);
  __pyx_t_1 = 0;
  __pyx_t_6 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

  /* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("nghttp2.HTTP2Server.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session_factory);
  __Pyx_XDECREF(__pyx_v_coro);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1358
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Server_3serve_forever = {"serve_forever", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Server_3serve_forever(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("serve_forever (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Server_2serve_forever(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_t_4;
  int __pyx_t_5;
  char const *__pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("serve_forever", 0);

  /* "nghttp2.pyx":1359
 * 
 *         def serve_forever(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.loop.run_forever()
 *             finally:
 */
  /*try:*/ {

    /* "nghttp2.pyx":1360
 *         def serve_forever(self):
 *             try:
 *                 self.loop.run_forever()             # <<<<<<<<<<<<<<
 *             finally:
 *                 self.server.close()
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run_forever); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; __pyx_clineno = __LINE__; goto __pyx_L4_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }

  /* "nghttp2.pyx":1362
 *                 self.loop.run_forever()
 *             finally:
 *                 self.server.close()             # <<<<<<<<<<<<<<
 *                 self.loop.close()
 * 
 */
  /*finally:*/ {
    /*normal exit:*/{
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_server); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_3)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_3);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_3) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":1363
 *             finally:
 *                 self.server.close()
 *                 self.loop.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
      __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_3);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
        __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
        if (likely(__pyx_t_2)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
          __Pyx_INCREF(__pyx_t_2);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_3, function);
        }
      }
      if (__pyx_t_2) {
        __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      } else {
        __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      goto __pyx_L5;
    }
    /*exception exit:*/{
      __pyx_L4_error:;
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
      if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
      if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9) < 0)) __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_7);
      __Pyx_XGOTREF(__pyx_t_8);
      __Pyx_XGOTREF(__pyx_t_9);
      __Pyx_XGOTREF(__pyx_t_10);
      __Pyx_XGOTREF(__pyx_t_11);
      __Pyx_XGOTREF(__pyx_t_12);
      __pyx_t_4 = __pyx_lineno; __pyx_t_5 = __pyx_clineno; __pyx_t_6 = __pyx_filename;
      {

        /* "nghttp2.pyx":1362
 *                 self.loop.run_forever()
 *             finally:
 *                 self.server.close()             # <<<<<<<<<<<<<<
 *                 self.loop.close()
 * 
 */
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_server); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __pyx_t_3 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
          __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
          if (likely(__pyx_t_3)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
            __Pyx_INCREF(__pyx_t_3);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_2, function);
          }
        }
        if (__pyx_t_3) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

        /* "nghttp2.pyx":1363
 *             finally:
 *                 self.server.close()
 *                 self.loop.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
        __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_2);
        __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        __Pyx_GOTREF(__pyx_t_3);
        __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        __pyx_t_2 = NULL;
        if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
          __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
          if (likely(__pyx_t_2)) {
            PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
            __Pyx_INCREF(__pyx_t_2);
            __Pyx_INCREF(function);
            __Pyx_DECREF_SET(__pyx_t_3, function);
          }
        }
        if (__pyx_t_2) {
          __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
          __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
        } else {
          __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; __pyx_clineno = __LINE__; goto __pyx_L7_error;}
        }
        __Pyx_GOTREF(__pyx_t_1);
        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
        __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      }
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XGIVEREF(__pyx_t_7);
      __Pyx_XGIVEREF(__pyx_t_8);
      __Pyx_XGIVEREF(__pyx_t_9);
      __Pyx_ErrRestore(__pyx_t_7, __pyx_t_8, __pyx_t_9);
      __pyx_t_7 = 0; __pyx_t_8 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_5; __pyx_filename = __pyx_t_6;
      goto __pyx_L1_error;
      __pyx_L7_error:;
      if (PY_MAJOR_VERSION >= 3) {
        __Pyx_XGIVEREF(__pyx_t_10);
        __Pyx_XGIVEREF(__pyx_t_11);
        __Pyx_XGIVEREF(__pyx_t_12);
        __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
      }
      __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_10 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0;
      goto __pyx_L1_error;
    }
    __pyx_L5:;
  }

  /* "nghttp2.pyx":1358
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HTTP2Server.serve_forever", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1419
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_http2 = 0;
  PyObject *__pyx_v_stream_id = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_http2,&__pyx_n_s_stream_id,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)((PyObject *)Py_None));
    values[2] = ((PyObject *)((PyObject *)__pyx_int_neg_1));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_http2);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_stream_id);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_http2 = values[1];
    __pyx_v_stream_id = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler___init__(__pyx_self, __pyx_v_self, __pyx_v_http2, __pyx_v_stream_id);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_http2, PyObject *__pyx_v_stream_id) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1420
 * 
 *         def __init__(self, http2=None, stream_id=-1):
 *             self.headers = []             # <<<<<<<<<<<<<<
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_headers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1420; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1421
 *         def __init__(self, http2=None, stream_id=-1):
 *             self.headers = []
 *             self.cookies = []             # <<<<<<<<<<<<<<
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_cookies, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1421; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1423
 *             self.cookies = []
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id             # <<<<<<<<<<<<<<
 *             self.http2 = http2
 *             # address of the server
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_stream_id, __pyx_v_stream_id) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1424
 *             # Stream ID. For promised stream, it is initially -1.
 *             self.stream_id = stream_id
 *             self.http2 = http2             # <<<<<<<<<<<<<<
 *             # address of the server
 *             self.remote_address = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_v_http2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1426
 *             self.http2 = http2
 *             # address of the server
 *             self.remote_address = None             # <<<<<<<<<<<<<<
 *             # :scheme header field in request
 *             self.scheme = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_remote_address, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1428
 *             self.remote_address = None
 *             # :scheme header field in request
 *             self.scheme = None             # <<<<<<<<<<<<<<
 *             # :method header field in request
 *             self.method = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1428; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1430
 *             self.scheme = None
 *             # :method header field in request
 *             self.method = None             # <<<<<<<<<<<<<<
 *             # :authority or host header field in request
 *             self.host = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_method_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1430; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1432
 *             self.method = None
 *             # :authority or host header field in request
 *             self.host = None             # <<<<<<<<<<<<<<
 *             # :path header field in request
 *             self.path = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_host, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1432; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1434
 *             self.host = None
 *             # :path header field in request
 *             self.path = None             # <<<<<<<<<<<<<<
 *             # HTTP status
 *             self.status = None
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_path_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1434; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1436
 *             self.path = None
 *             # HTTP status
 *             self.status = None             # <<<<<<<<<<<<<<
 *             # True if this is a handler for pushed resource
 *             self.pushed = False
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_status_2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1436; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1438
 *             self.status = None
 *             # True if this is a handler for pushed resource
 *             self.pushed = False             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pushed, Py_False) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1438; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1419
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1441
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_3server_address = {"server_address", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_3server_address(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("server_address (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_2server_address(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("server_address", 0);

  /* "nghttp2.pyx":1442
 *         @property
 *         def server_address(self):
 *             return self.remote_address             # <<<<<<<<<<<<<<
 * 
 *         def on_headers(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_remote_address); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1442; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1441
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.server_address", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1444
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_4on_headers[] = "Called when response HEADERS is arrived.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_5on_headers = {"on_headers", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers, METH_O, __pyx_doc_7nghttp2_19BaseResponseHandler_4on_headers};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_5on_headers(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_4on_headers(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_headers", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1451
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_6on_data[] = "Called when a chunk of response body is arrived. This method\n            will be called multiple times until all data are received.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_7on_data = {"on_data", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_6on_data};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_7on_data(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_data") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_data", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_data", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_6on_data(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_data) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_data", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1459
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_8on_response_done[] = "Called when whole response was received\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_9on_response_done = {"on_response_done", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done, METH_O, __pyx_doc_7nghttp2_19BaseResponseHandler_8on_response_done};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_9on_response_done(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_response_done (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_8on_response_done(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_response_done", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1466
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_10on_close[] = "Called when stream is about to close.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_11on_close = {"on_close", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_10on_close};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_11on_close(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  CYTHON_UNUSED PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_error_code = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_error_code,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_error_code)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_close") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_error_code = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_close", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(__pyx_self, __pyx_v_self, __pyx_v_error_code);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_10on_close(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_error_code) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_close", 0);

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1473
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_12on_push_promise[] = "Called when a push is promised. Default behavior is to\n            cancel the push. If application overrides this method,\n            it should call either accept_push or reject_push.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_13on_push_promise = {"on_push_promise", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_12on_push_promise};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_13on_push_promise(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("on_push_promise (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("on_push_promise", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "on_push_promise") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_push_promise = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("on_push_promise", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_push_promise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(__pyx_self, __pyx_v_self, __pyx_v_push_promise);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_12on_push_promise(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("on_push_promise", 0);

  /* "nghttp2.pyx":1480
 * 
 *             '''
 *             self.reject_push(push_promise)             # <<<<<<<<<<<<<<
 * 
 *         def reject_push(self, push_promise):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_reject_push); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_push_promise); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_push_promise);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_push_promise);
    __Pyx_GIVEREF(__pyx_v_push_promise);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1473
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.on_push_promise", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1482
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_14reject_push[] = "Convenience method equivalent to calling accept_push\n            with a falsy value.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_15reject_push = {"reject_push", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_14reject_push};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_15reject_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("reject_push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("reject_push", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "reject_push") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_push_promise = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("reject_push", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.reject_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(__pyx_self, __pyx_v_self, __pyx_v_push_promise);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_14reject_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("reject_push", 0);

  /* "nghttp2.pyx":1488
 * 
 *             '''
 *             self.http2.push(push_promise, None)             # <<<<<<<<<<<<<<
 * 
 *         def accept_push(self, push_promise, handler=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_push); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_push_promise);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_push_promise);
  __Pyx_GIVEREF(__pyx_v_push_promise);
  __Pyx_INCREF(Py_None);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None);
  __Pyx_GIVEREF(Py_None);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1488; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1482
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.reject_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1490
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_19BaseResponseHandler_16accept_push[] = "Accept a push_promise and provider a handler for the\n            new stream. If a falsy value is supplied for the handler,\n            the push is rejected.\n\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_17accept_push = {"accept_push", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_19BaseResponseHandler_16accept_push};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_17accept_push(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_push_promise = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("accept_push (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_push_promise,&__pyx_n_s_handler,0};
    PyObject* values[3] = {0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_push_promise)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("accept_push", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "accept_push") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_push_promise = values[1];
    __pyx_v_handler = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("accept_push", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.accept_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(__pyx_self, __pyx_v_self, __pyx_v_push_promise, __pyx_v_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_16accept_push(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_push_promise, PyObject *__pyx_v_handler) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("accept_push", 0);

  /* "nghttp2.pyx":1497
 * 
 *             '''
 *             self.http2.push(push_promise, handler)             # <<<<<<<<<<<<<<
 * 
 *         def resume(self):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_push); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_2) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_push_promise);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_push_promise);
  __Pyx_GIVEREF(__pyx_v_push_promise);
  __Pyx_INCREF(__pyx_v_handler);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_handler);
  __Pyx_GIVEREF(__pyx_v_handler);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1497; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1490
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.accept_push", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1499
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_19resume(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19BaseResponseHandler_19resume = {"resume", (PyCFunction)__pyx_pw_7nghttp2_19BaseResponseHandler_19resume, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19BaseResponseHandler_19resume(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19BaseResponseHandler_18resume(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19BaseResponseHandler_18resume(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume", 0);

  /* "nghttp2.pyx":1500
 * 
 *         def resume(self):
 *             self.http2.resume(self.stream_id)             # <<<<<<<<<<<<<<
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_resume); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_stream_id); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1500; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1499
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("nghttp2.BaseResponseHandler.resume", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1504
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_client = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_client,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_client)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_client = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(__pyx_self, __pyx_v_self, __pyx_v_client);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_client) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);

  /* "nghttp2.pyx":1505
 * 
 *         def __init__(self, client):
 *             asyncio.Protocol.__init__(self)             # <<<<<<<<<<<<<<
 *             self.http2 = None
 *             self.pending = []
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_init); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self);
    __Pyx_GIVEREF(__pyx_v_self);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1506
 *         def __init__(self, client):
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None             # <<<<<<<<<<<<<<
 *             self.pending = []
 *             self.client = client
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1506; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1507
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 *             self.pending = []             # <<<<<<<<<<<<<<
 *             self.client = client
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pending, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1507; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1508
 *             self.http2 = None
 *             self.pending = []
 *             self.client = client             # <<<<<<<<<<<<<<
 * 
 *         def connection_made(self, transport):
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_client, __pyx_v_client) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1508; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1504
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1510
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_3connection_made = {"connection_made", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_3connection_made(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_transport = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_made (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_transport,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_transport)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_made") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_transport = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_made", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(__pyx_self, __pyx_v_self, __pyx_v_transport);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_2connection_made(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_transport) {
  PyObject *__pyx_v_address = NULL;
  PyObject *__pyx_v_sock = NULL;
  PyObject *__pyx_v_ssl_ctx = NULL;
  PyObject *__pyx_v_protocol = NULL;
  PyObject *__pyx_v_send_pending = NULL;
  PyObject *__pyx_v_method = NULL;
  PyObject *__pyx_v_scheme = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_v_headers = NULL;
  PyObject *__pyx_v_body = NULL;
  PyObject *__pyx_v_handler = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  int __pyx_t_9;
  int __pyx_t_10;
  PyObject *(*__pyx_t_11)(PyObject *);
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  PyObject *(*__pyx_t_16)(PyObject *);
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_made", 0);

  /* "nghttp2.pyx":1511
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_transport, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_address = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1512
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])             # <<<<<<<<<<<<<<
 * 
 *             self.transport = transport
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_1 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_connection_made_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_kp_s_connection_made_address_s_port_s);
  __Pyx_GIVEREF(__pyx_kp_s_connection_made_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_1 = 0;
  __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1514
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 *             self.transport = transport             # <<<<<<<<<<<<<<
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_transport, __pyx_v_transport) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1515
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_sock = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1516
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)             # <<<<<<<<<<<<<<
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_setsockopt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_IPPROTO_TCP); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_socket); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_TCP_NODELAY); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_7) {
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = NULL;
  }
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_int_1);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_int_1);
  __Pyx_GIVEREF(__pyx_int_1);
  __pyx_t_4 = 0;
  __pyx_t_1 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1517
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_extra_info); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_ssl_ctx = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1518
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:             # <<<<<<<<<<<<<<
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_ssl_ctx); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_8) {

    /* "nghttp2.pyx":1519
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()             # <<<<<<<<<<<<<<
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_sock, __pyx_n_s_selected_npn_protocol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1519; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_v_protocol = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "nghttp2.pyx":1520
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)             # <<<<<<<<<<<<<<
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 */
    __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    __pyx_t_6 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_6 = 1;
      }
    }
    __pyx_t_1 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (__pyx_t_3) {
      PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    }
    __Pyx_INCREF(__pyx_kp_s_npn_protocol_s);
    PyTuple_SET_ITEM(__pyx_t_1, 0+__pyx_t_6, __pyx_kp_s_npn_protocol_s);
    __Pyx_GIVEREF(__pyx_kp_s_npn_protocol_s);
    __Pyx_INCREF(__pyx_v_protocol);
    PyTuple_SET_ITEM(__pyx_t_1, 1+__pyx_t_6, __pyx_v_protocol);
    __Pyx_GIVEREF(__pyx_v_protocol);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1520; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1521
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
    __pyx_t_9 = (__pyx_v_protocol == Py_None);
    __pyx_t_10 = (__pyx_t_9 != 0);
    if (!__pyx_t_10) {
    } else {
      __pyx_t_8 = __pyx_t_10;
      goto __pyx_L5_bool_binop_done;
    }
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_protocol, __pyx_n_s_encode); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":1522
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:             # <<<<<<<<<<<<<<
 *                     self.transport.abort()
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_FromString(NGHTTP2_PROTO_VERSION_ID); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1522; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_10 = (__Pyx_PyBytes_Equals(__pyx_t_5, __pyx_t_2, Py_NE)); if (unlikely(__pyx_t_10 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = __pyx_t_10;
    __pyx_L5_bool_binop_done:;
    if (__pyx_t_8) {

      /* "nghttp2.pyx":1523
 *                 if protocol is None or protocol.encode('utf-8') != \
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()             # <<<<<<<<<<<<<<
 * 
 *             self.http2 = _HTTP2ClientSessionCore(self.transport)
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abort); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_1, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1523; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      goto __pyx_L4;
    }
    __pyx_L4:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1525
 *                     self.transport.abort()
 * 
 *             self.http2 = _HTTP2ClientSessionCore(self.transport)             # <<<<<<<<<<<<<<
 * 
 * 	    # Clear pending requests
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7nghttp2__HTTP2ClientSessionCore)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1525; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1528
 * 
 * 	    # Clear pending requests
 *             send_pending = self.pending             # <<<<<<<<<<<<<<
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pending); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1528; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_v_send_pending = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "nghttp2.pyx":1529
 * 	    # Clear pending requests
 *             send_pending = self.pending
 *             self.pending = []             # <<<<<<<<<<<<<<
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
  __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pending, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1529; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1530
 *             send_pending = self.pending
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:             # <<<<<<<<<<<<<<
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 */
  if (likely(PyList_CheckExact(__pyx_v_send_pending)) || PyTuple_CheckExact(__pyx_v_send_pending)) {
    __pyx_t_2 = __pyx_v_send_pending; __Pyx_INCREF(__pyx_t_2); __pyx_t_6 = 0;
    __pyx_t_11 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_v_send_pending); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  for (;;) {
    if (likely(!__pyx_t_11)) {
      if (likely(PyList_CheckExact(__pyx_t_2))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #else
        __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        #endif
      }
    } else {
      __pyx_t_1 = __pyx_t_11(__pyx_t_2);
      if (unlikely(!__pyx_t_1)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_1);
    }
    if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) {
      PyObject* sequence = __pyx_t_1;
      #if CYTHON_COMPILING_IN_CPYTHON
      Py_ssize_t size = Py_SIZE(sequence);
      #else
      Py_ssize_t size = PySequence_Size(sequence);
      #endif
      if (unlikely(size != 7)) {
        if (size > 7) __Pyx_RaiseTooManyValuesError(7);
        else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      }
      #if CYTHON_COMPILING_IN_CPYTHON
      if (likely(PyTuple_CheckExact(sequence))) {
        __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyTuple_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyTuple_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyTuple_GET_ITEM(sequence, 4); 
        __pyx_t_13 = PyTuple_GET_ITEM(sequence, 5); 
        __pyx_t_14 = PyTuple_GET_ITEM(sequence, 6); 
      } else {
        __pyx_t_5 = PyList_GET_ITEM(sequence, 0); 
        __pyx_t_3 = PyList_GET_ITEM(sequence, 1); 
        __pyx_t_4 = PyList_GET_ITEM(sequence, 2); 
        __pyx_t_7 = PyList_GET_ITEM(sequence, 3); 
        __pyx_t_12 = PyList_GET_ITEM(sequence, 4); 
        __pyx_t_13 = PyList_GET_ITEM(sequence, 5); 
        __pyx_t_14 = PyList_GET_ITEM(sequence, 6); 
      }
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(__pyx_t_14);
      #else
      {
        Py_ssize_t i;
        PyObject** temps[7] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_4,&__pyx_t_7,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
        for (i=0; i < 7; i++) {
          PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
          __Pyx_GOTREF(item);
          *(temps[i]) = item;
        }
      }
      #endif
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    } else {
      Py_ssize_t index = -1;
      PyObject** temps[7] = {&__pyx_t_5,&__pyx_t_3,&__pyx_t_4,&__pyx_t_7,&__pyx_t_12,&__pyx_t_13,&__pyx_t_14};
      __pyx_t_15 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_16 = Py_TYPE(__pyx_t_15)->tp_iternext;
      for (index=0; index < 7; index++) {
        PyObject* item = __pyx_t_16(__pyx_t_15); if (unlikely(!item)) goto __pyx_L9_unpacking_failed;
        __Pyx_GOTREF(item);
        *(temps[index]) = item;
      }
      if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_15), 7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_t_16 = NULL;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      goto __pyx_L10_unpacking_done;
      __pyx_L9_unpacking_failed:;
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_16 = NULL;
      if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1530; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __pyx_L10_unpacking_done:;
    }
    __Pyx_XDECREF_SET(__pyx_v_method, __pyx_t_5);
    __pyx_t_5 = 0;
    __Pyx_XDECREF_SET(__pyx_v_scheme, __pyx_t_3);
    __pyx_t_3 = 0;
    __Pyx_XDECREF_SET(__pyx_v_host, __pyx_t_4);
    __pyx_t_4 = 0;
    __Pyx_XDECREF_SET(__pyx_v_path, __pyx_t_7);
    __pyx_t_7 = 0;
    __Pyx_XDECREF_SET(__pyx_v_headers, __pyx_t_12);
    __pyx_t_12 = 0;
    __Pyx_XDECREF_SET(__pyx_v_body, __pyx_t_13);
    __pyx_t_13 = 0;
    __Pyx_XDECREF_SET(__pyx_v_handler, __pyx_t_14);
    __pyx_t_14 = 0;

    /* "nghttp2.pyx":1531
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_send_request); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_14 = PyDict_New(); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_14);
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_method_2, __pyx_v_method) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_host, __pyx_v_host) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_path_2, __pyx_v_path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "nghttp2.pyx":1532
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 *             self.http2.send_data()
 * 
 */
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_headers, __pyx_v_headers) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_body, __pyx_v_body) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (PyDict_SetItem(__pyx_t_14, __pyx_n_s_handler, __pyx_v_handler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

    /* "nghttp2.pyx":1531
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()
 */
    __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1531; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;

    /* "nghttp2.pyx":1530
 *             send_pending = self.pending
 *             self.pending = []
 *             for method,scheme,host,path,headers,body,handler in send_pending:             # <<<<<<<<<<<<<<
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 */
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1533
 *                 self.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                   headers=headers, body=body, handler=handler)
 *             self.http2.send_data()             # <<<<<<<<<<<<<<
 * 
 *         def connection_lost(self, exc):
 */
  __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_13);
  __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_send_data); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_14);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __pyx_t_13 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
    __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_14);
    if (likely(__pyx_t_13)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
      __Pyx_INCREF(__pyx_t_13);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_14, function);
    }
  }
  if (__pyx_t_13) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1533; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":1510
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_made", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_address);
  __Pyx_XDECREF(__pyx_v_sock);
  __Pyx_XDECREF(__pyx_v_ssl_ctx);
  __Pyx_XDECREF(__pyx_v_protocol);
  __Pyx_XDECREF(__pyx_v_send_pending);
  __Pyx_XDECREF(__pyx_v_method);
  __Pyx_XDECREF(__pyx_v_scheme);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_headers);
  __Pyx_XDECREF(__pyx_v_body);
  __Pyx_XDECREF(__pyx_v_handler);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1535
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_5connection_lost = {"connection_lost", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_5connection_lost(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  CYTHON_UNUSED PyObject *__pyx_v_exc = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("connection_lost (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_exc,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_exc)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "connection_lost") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_exc = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("connection_lost", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(__pyx_self, __pyx_v_self, __pyx_v_exc);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_4connection_lost(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_exc) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  int __pyx_t_3;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("connection_lost", 0);

  /* "nghttp2.pyx":1536
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2 = None
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__40, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1537
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2 = None
 *             self.client.close()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1537; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_3) {

    /* "nghttp2.pyx":1538
 *             logging.info('connection_lost')
 *             if self.http2:
 *                 self.http2 = None             # <<<<<<<<<<<<<<
 *             self.client.close()
 * 
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_http2, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1538; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1539
 *             if self.http2:
 *                 self.http2 = None
 *             self.client.close()             # <<<<<<<<<<<<<<
 * 
 *         def data_received(self, data):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_client); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1539; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1535
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.connection_lost", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1541
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_7data_received = {"data_received", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_7data_received(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_data = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("data_received (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "data_received") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_self = values[0];
    __pyx_v_data = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("data_received", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(__pyx_self, __pyx_v_self, __pyx_v_data);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_6data_received(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data) {
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("data_received", 0);

  /* "nghttp2.pyx":1542
 * 
 *         def data_received(self, data):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.data_received(data)
 *             except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":1543
 *         def data_received(self, data):
 *             try:
 *                 self.http2.data_received(data)             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_data_received); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (!__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_v_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
      } else {
        __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL;
        __Pyx_INCREF(__pyx_v_data);
        PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_v_data);
        __Pyx_GIVEREF(__pyx_v_data);
        __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1543; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      }
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1544
 *             try:
 *                 self.http2.data_received(data)
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_8) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1544; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1545
 *                 self.http2.data_received(data)
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_5);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1545; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_5);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1546
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1546; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "nghttp2.pyx":1547
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def resume_writing(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1541
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.data_received", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1549
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_9resume_writing = {"resume_writing", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_9resume_writing(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("resume_writing (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_8resume_writing(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("resume_writing", 0);

  /* "nghttp2.pyx":1550
 * 
 *         def resume_writing(self):
 *             try:             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":1551
 *         def resume_writing(self):
 *             try:
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_send_data); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __pyx_t_5 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_5)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_5);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
        }
      }
      if (__pyx_t_5) {
        __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      } else {
        __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1551; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "nghttp2.pyx":1552
 *             try:
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_7 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_7) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_6, &__pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1552; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __pyx_v_err = __pyx_t_6;

      /* "nghttp2.pyx":1553
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_stderr); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_write); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
      __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __pyx_t_11 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_11)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_11);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (__pyx_t_11) {
        __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_11); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      } else {
        __pyx_t_10 = __Pyx_PyObject_CallNoArg(__pyx_t_12); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_10);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_9))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_9);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_9, function);
        }
      }
      if (!__pyx_t_12) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_10); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
        __Pyx_GOTREF(__pyx_t_8);
      } else {
        __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = NULL;
        PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_10);
        __Pyx_GIVEREF(__pyx_t_10);
        __pyx_t_10 = 0;
        __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1553; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_8);
        __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      }
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1554
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_close); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __pyx_t_9 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_11))) {
        __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_11);
        if (likely(__pyx_t_9)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
          __Pyx_INCREF(__pyx_t_9);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_11, function);
        }
      }
      if (__pyx_t_9) {
        __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_11, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      } else {
        __pyx_t_8 = __Pyx_PyObject_CallNoArg(__pyx_t_11); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1554; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_8);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;

      /* "nghttp2.pyx":1555
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1549
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.resume_writing", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1557
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_11send_request = {"send_request", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_11send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_scheme = 0;
  PyObject *__pyx_v_host = 0;
  PyObject *__pyx_v_path = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_method_2,&__pyx_n_s_scheme_2,&__pyx_n_s_host,&__pyx_n_s_path_2,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_scheme_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_host)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_path_2)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  7:
        if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 8) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
      values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
      values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
      values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
    }
    __pyx_v_self = values[0];
    __pyx_v_method = values[1];
    __pyx_v_scheme = values[2];
    __pyx_v_host = values[3];
    __pyx_v_path = values[4];
    __pyx_v_headers = values[5];
    __pyx_v_body = values[6];
    __pyx_v_handler = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 1, 8, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(__pyx_self, __pyx_v_self, __pyx_v_method, __pyx_v_scheme, __pyx_v_host, __pyx_v_path, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_10send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_scheme, PyObject *__pyx_v_host, PyObject *__pyx_v_path, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  CYTHON_UNUSED PyObject *__pyx_v_err = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  PyObject *__pyx_t_14 = NULL;
  PyObject *__pyx_t_15 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);

  /* "nghttp2.pyx":1558
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):
 *             try:             # <<<<<<<<<<<<<<
 * 		# Waiting until connection established
 *                 if not self.http2:
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_1);
    __Pyx_XGOTREF(__pyx_t_2);
    __Pyx_XGOTREF(__pyx_t_3);
    /*try:*/ {

      /* "nghttp2.pyx":1560
 *             try:
 * 		# Waiting until connection established
 *                 if not self.http2:             # <<<<<<<<<<<<<<
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])
 *                     return
 */
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1560; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __pyx_t_6 = ((!__pyx_t_5) != 0);
      if (__pyx_t_6) {

        /* "nghttp2.pyx":1561
 * 		# Waiting until connection established
 *                 if not self.http2:
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])             # <<<<<<<<<<<<<<
 *                     return
 * 
 */
        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pending); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_4);
        __pyx_t_7 = PyList_New(7); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_GOTREF(__pyx_t_7);
        __Pyx_INCREF(__pyx_v_method);
        PyList_SET_ITEM(__pyx_t_7, 0, __pyx_v_method);
        __Pyx_GIVEREF(__pyx_v_method);
        __Pyx_INCREF(__pyx_v_scheme);
        PyList_SET_ITEM(__pyx_t_7, 1, __pyx_v_scheme);
        __Pyx_GIVEREF(__pyx_v_scheme);
        __Pyx_INCREF(__pyx_v_host);
        PyList_SET_ITEM(__pyx_t_7, 2, __pyx_v_host);
        __Pyx_GIVEREF(__pyx_v_host);
        __Pyx_INCREF(__pyx_v_path);
        PyList_SET_ITEM(__pyx_t_7, 3, __pyx_v_path);
        __Pyx_GIVEREF(__pyx_v_path);
        __Pyx_INCREF(__pyx_v_headers);
        PyList_SET_ITEM(__pyx_t_7, 4, __pyx_v_headers);
        __Pyx_GIVEREF(__pyx_v_headers);
        __Pyx_INCREF(__pyx_v_body);
        PyList_SET_ITEM(__pyx_t_7, 5, __pyx_v_body);
        __Pyx_GIVEREF(__pyx_v_body);
        __Pyx_INCREF(__pyx_v_handler);
        PyList_SET_ITEM(__pyx_t_7, 6, __pyx_v_handler);
        __Pyx_GIVEREF(__pyx_v_handler);
        __pyx_t_8 = __Pyx_PyObject_Append(__pyx_t_4, __pyx_t_7); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1561; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

        /* "nghttp2.pyx":1562
 *                 if not self.http2:
 *                     self.pending.append([method, scheme, host, path, headers, body, handler])
 *                     return             # <<<<<<<<<<<<<<
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
        __Pyx_XDECREF(__pyx_r);
        __pyx_r = Py_None; __Pyx_INCREF(Py_None);
        goto __pyx_L7_try_return;
      }

      /* "nghttp2.pyx":1564
 *                     return
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_send_request); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_method_2, __pyx_v_method) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_host, __pyx_v_host) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_path_2, __pyx_v_path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}

      /* "nghttp2.pyx":1565
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                         headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 *                 self.http2.send_data()
 *             except Exception as err:
 */
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_headers, __pyx_v_headers) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_body, __pyx_v_body) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_handler, __pyx_v_handler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}

      /* "nghttp2.pyx":1564
 *                     return
 * 
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 */
      __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1564; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

      /* "nghttp2.pyx":1566
 *                 self.http2.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()             # <<<<<<<<<<<<<<
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 */
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_7);
      __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_send_data); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_4, function);
        }
      }
      if (__pyx_t_7) {
        __pyx_t_9 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      } else {
        __pyx_t_9 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1566; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    }
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    goto __pyx_L10_try_end;
    __pyx_L3_error:;
    __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1567
 *                                         headers=headers, body=body, handler=handler)
 *                 self.http2.send_data()
 *             except Exception as err:             # <<<<<<<<<<<<<<
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 */
    __pyx_t_10 = PyErr_ExceptionMatches(__pyx_builtin_Exception);
    if (__pyx_t_10) {
      __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_9, &__pyx_t_4, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1567; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_9);
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_4);
      __pyx_v_err = __pyx_t_4;

      /* "nghttp2.pyx":1568
 *                 self.http2.send_data()
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())             # <<<<<<<<<<<<<<
 *                 self.transport.close()
 *                 return
 */
      __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_stderr); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_write); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
      __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_traceback); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_format_exc); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_15);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __pyx_t_14 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_15))) {
        __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_15);
        if (likely(__pyx_t_14)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
          __Pyx_INCREF(__pyx_t_14);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_15, function);
        }
      }
      if (__pyx_t_14) {
        __pyx_t_13 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_14); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      } else {
        __pyx_t_13 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_13);
      __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
      __pyx_t_15 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_12))) {
        __pyx_t_15 = PyMethod_GET_SELF(__pyx_t_12);
        if (likely(__pyx_t_15)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
          __Pyx_INCREF(__pyx_t_15);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_12, function);
        }
      }
      if (!__pyx_t_15) {
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
        __Pyx_GOTREF(__pyx_t_11);
      } else {
        __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_14);
        PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = NULL;
        PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_13);
        __Pyx_GIVEREF(__pyx_t_13);
        __pyx_t_13 = 0;
        __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_14, NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1568; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_GOTREF(__pyx_t_11);
        __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      }
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "nghttp2.pyx":1569
 *             except Exception as err:
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()             # <<<<<<<<<<<<<<
 *                 return
 * 
 */
      __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_transport); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_12);
      __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_close); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      __pyx_t_12 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_14))) {
        __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_14);
        if (likely(__pyx_t_12)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_14);
          __Pyx_INCREF(__pyx_t_12);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_14, function);
        }
      }
      if (__pyx_t_12) {
        __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_14, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
        __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
      } else {
        __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_14); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1569; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
      }
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;

      /* "nghttp2.pyx":1570
 *                 sys.stderr.write(traceback.format_exc())
 *                 self.transport.close()
 *                 return             # <<<<<<<<<<<<<<
 * 
 *         def close(self):
 */
      __Pyx_XDECREF(__pyx_r);
      __pyx_r = Py_None; __Pyx_INCREF(Py_None);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      goto __pyx_L6_except_return;
    }
    goto __pyx_L5_except_error;
    __pyx_L5_except_error:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L1_error;
    __pyx_L7_try_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L6_except_return:;
    __Pyx_XGIVEREF(__pyx_t_1);
    __Pyx_XGIVEREF(__pyx_t_2);
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
    goto __pyx_L0;
    __pyx_L10_try_end:;
  }

  /* "nghttp2.pyx":1557
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_XDECREF(__pyx_t_14);
  __Pyx_XDECREF(__pyx_t_15);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_err);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1572
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_19_HTTP2ClientSession_13close = {"close", (PyCFunction)__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_19_HTTP2ClientSession_13close(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_19_HTTP2ClientSession_12close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_t_2;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":1573
 * 
 *         def close(self):
 *             if self.http2:             # <<<<<<<<<<<<<<
 *                 self.http2.close()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1573; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_2) {

    /* "nghttp2.pyx":1574
 *         def close(self):
 *             if self.http2:
 *                 self.http2.close()             # <<<<<<<<<<<<<<
 * 
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_http2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_close); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_3)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_3);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
      }
    }
    if (__pyx_t_3) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1574; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1572
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2._HTTP2ClientSession.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_7nghttp2_11HTTP2Client___init__[] = "address is a tuple of the connect address and port (e.g.,\n            ('127.0.0.1', 8080)). The ssl can be ssl.SSLContext instance.\n            If it is not None, the resulting client is SSL/TLS capable.\n            ";
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_1__init__ = {"__init__", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_1__init__, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7nghttp2_11HTTP2Client___init__};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_address = 0;
  PyObject *__pyx_v_loop = 0;
  PyObject *__pyx_v_ssl = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__init__ (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_address,&__pyx_n_s_loop,&__pyx_n_s_ssl,0};
    PyObject* values[4] = {0,0,0,0};
    values[2] = ((PyObject *)((PyObject *)Py_None));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_address)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_loop);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ssl);
          if (value) { values[3] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_address = values[1];
    __pyx_v_loop = values[2];
    __pyx_v_ssl = values[3];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client___init__(__pyx_self, __pyx_v_self, __pyx_v_address, __pyx_v_loop, __pyx_v_ssl);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1593
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_8__init___1session_factory = {"session_factory", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory, METH_NOARGS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_8__init___1session_factory(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("session_factory (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(__pyx_self);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_8__init___session_factory(PyObject *__pyx_self) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_cur_scope;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_outer_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("session_factory", 0);
  __pyx_outer_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "nghttp2.pyx":1594
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():
 *                 return self.session             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  __Pyx_XDECREF(__pyx_r);
  if (unlikely(!__pyx_cur_scope->__pyx_v_self)) { __Pyx_RaiseClosureNameError("self"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1593
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__.session_factory", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_address, PyObject *__pyx_v_loop, PyObject *__pyx_v_ssl) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_cur_scope;
  PyObject *__pyx_v_session_factory = 0;
  PyObject *__pyx_v_coro = NULL;
  CYTHON_UNUSED PyObject *__pyx_v__ = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  int __pyx_t_7;
  PyObject *(*__pyx_t_8)(PyObject *);
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("__init__", 0);
  __pyx_cur_scope = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(__pyx_ptype_7nghttp2___pyx_scope_struct_1___init__, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_self = __pyx_v_self;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);

  /* "nghttp2.pyx":1591
 *             '''
 * 
 *             self.address = address             # <<<<<<<<<<<<<<
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address, __pyx_v_address) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1591; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1592
 * 
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)             # <<<<<<<<<<<<<<
 *             def session_factory():
 *                 return self.session
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_HTTP2ClientSession); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_cur_scope->__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_cur_scope->__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_cur_scope->__pyx_v_self);
    __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_self);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_session, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1592; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1593
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Client_8__init___1session_factory, 0, __pyx_n_s_HTTP2Client___init___locals_sess, ((PyObject*)__pyx_cur_scope), __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_session_factory = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1596
 *                 return self.session
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\
 *                                        .decode('utf-8')])
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1596; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1597
 * 
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\             # <<<<<<<<<<<<<<
 *                                        .decode('utf-8')])
 * 
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_ssl, __pyx_n_s_set_npn_protocols); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1598
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\
 *                                        .decode('utf-8')])             # <<<<<<<<<<<<<<
 * 
 *             self.loop = loop
 */
    __pyx_t_4 = __Pyx_decode_c_string(NGHTTP2_PROTO_VERSION_ID, 0, strlen(NGHTTP2_PROTO_VERSION_ID), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);

    /* "nghttp2.pyx":1597
 * 
 *             if ssl:
 *                 ssl.set_npn_protocols([cnghttp2.NGHTTP2_PROTO_VERSION_ID\             # <<<<<<<<<<<<<<
 *                                        .decode('utf-8')])
 * 
 */
    __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_2, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_GOTREF(__pyx_t_1);
    } else {
      __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_6);
      PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL;
      PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_3);
      __Pyx_GIVEREF(__pyx_t_3);
      __pyx_t_3 = 0;
      __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1597; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    }
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1600
 *                                        .decode('utf-8')])
 * 
 *             self.loop = loop             # <<<<<<<<<<<<<<
 *             if not self.loop:
 *                 self.loop = asyncio.get_event_loop()
 */
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop, __pyx_v_loop) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1601
 * 
 *             self.loop = loop
 *             if not self.loop:             # <<<<<<<<<<<<<<
 *                 self.loop = asyncio.get_event_loop()
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1601; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_7 = ((!__pyx_t_5) != 0);
  if (__pyx_t_7) {

    /* "nghttp2.pyx":1602
 *             self.loop = loop
 *             if not self.loop:
 *                 self.loop = asyncio.get_event_loop()             # <<<<<<<<<<<<<<
 * 
 *             coro = self.loop.create_connection(session_factory,
 */
    __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get_event_loop); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_6))) {
      __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6);
      if (likely(__pyx_t_2)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
        __Pyx_INCREF(__pyx_t_2);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_6, function);
      }
    }
    if (__pyx_t_2) {
      __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    } else {
      __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "nghttp2.pyx":1604
 *                 self.loop = asyncio.get_event_loop()
 * 
 *             coro = self.loop.create_connection(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_create_connection); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_session_factory);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_session_factory);
  __Pyx_GIVEREF(__pyx_v_session_factory);
  __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);

  /* "nghttp2.pyx":1605
 * 
 *             coro = self.loop.create_connection(session_factory,
 *                                            host=address[0], port=address[1],             # <<<<<<<<<<<<<<
 *                                            ssl=ssl)
 * 
 */
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_address, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_host, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_address, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1605; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_port, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1606
 *             coro = self.loop.create_connection(session_factory,
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)             # <<<<<<<<<<<<<<
 * 
 *             if ssl:
 */
  if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_ssl, __pyx_v_ssl) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1604
 *                 self.loop = asyncio.get_event_loop()
 * 
 *             coro = self.loop.create_connection(session_factory,             # <<<<<<<<<<<<<<
 *                                            host=address[0], port=address[1],
 *                                            ssl=ssl)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_coro = __pyx_t_3;
  __pyx_t_3 = 0;

  /* "nghttp2.pyx":1608
 *                                            ssl=ssl)
 * 
 *             if ssl:             # <<<<<<<<<<<<<<
 *                 self.scheme = 'https'
 *             else:
 */
  __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_v_ssl); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1608; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (__pyx_t_7) {

    /* "nghttp2.pyx":1609
 * 
 *             if ssl:
 *                 self.scheme = 'https'             # <<<<<<<<<<<<<<
 *             else:
 *                 self.scheme = 'http'
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_scheme_2, __pyx_n_s_https) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1609; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    goto __pyx_L5;
  }
  /*else*/ {

    /* "nghttp2.pyx":1611
 *                 self.scheme = 'https'
 *             else:
 *                 self.scheme = 'http'             # <<<<<<<<<<<<<<
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)
 */
    if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_scheme_2, __pyx_n_s_http) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1611; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  /* "nghttp2.pyx":1613
 *                 self.scheme = 'http'
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)             # <<<<<<<<<<<<<<
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])
 * 
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_run_until_complete); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_coro); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_coro);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_coro);
    __Pyx_GIVEREF(__pyx_v_coro);
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
    PyObject* sequence = __pyx_t_3;
    #if CYTHON_COMPILING_IN_CPYTHON
    Py_ssize_t size = Py_SIZE(sequence);
    #else
    Py_ssize_t size = PySequence_Size(sequence);
    #endif
    if (unlikely(size != 2)) {
      if (size > 2) __Pyx_RaiseTooManyValuesError(2);
      else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
    #if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyTuple_CheckExact(sequence))) {
      __pyx_t_1 = PyTuple_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyTuple_GET_ITEM(sequence, 1); 
    } else {
      __pyx_t_1 = PyList_GET_ITEM(sequence, 0); 
      __pyx_t_6 = PyList_GET_ITEM(sequence, 1); 
    }
    __Pyx_INCREF(__pyx_t_1);
    __Pyx_INCREF(__pyx_t_6);
    #else
    __pyx_t_1 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_6);
    #endif
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  } else {
    Py_ssize_t index = -1;
    __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_8 = Py_TYPE(__pyx_t_2)->tp_iternext;
    index = 0; __pyx_t_1 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_1);
    index = 1; __pyx_t_6 = __pyx_t_8(__pyx_t_2); if (unlikely(!__pyx_t_6)) goto __pyx_L6_unpacking_failed;
    __Pyx_GOTREF(__pyx_t_6);
    if (__Pyx_IternextUnpackEndCheck(__pyx_t_8(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_t_8 = NULL;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    goto __pyx_L7_unpacking_done;
    __pyx_L6_unpacking_failed:;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_8 = NULL;
    if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __pyx_L7_unpacking_done:;
  }
  if (__Pyx_PyObject_SetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_transport, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1613; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v__ = __pyx_t_6;
  __pyx_t_6 = 0;

  /* "nghttp2.pyx":1614
 * 
 *             self.transport,_ = self.loop.run_until_complete(coro)
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])             # <<<<<<<<<<<<<<
 * 
 *         @property
 */
  __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_6, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_2 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_6);
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_6, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_9 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
      __pyx_t_9 = 1;
    }
  }
  __pyx_t_10 = PyTuple_New(3+__pyx_t_9); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_10);
  if (__pyx_t_6) {
    PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_INCREF(__pyx_kp_s_connect_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_kp_s_connect_address_s_port_s);
  __Pyx_GIVEREF(__pyx_kp_s_connect_address_s_port_s);
  PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_9, __pyx_t_4);
  __Pyx_GIVEREF(__pyx_t_4);
  __pyx_t_2 = 0;
  __pyx_t_4 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1614; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_session_factory);
  __Pyx_XDECREF(__pyx_v_coro);
  __Pyx_XDECREF(__pyx_v__);
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1617
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_3io_loop(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_3io_loop = {"io_loop", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_3io_loop, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_3io_loop(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("io_loop (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_2io_loop(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_2io_loop(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("io_loop", 0);

  /* "nghttp2.pyx":1618
 *         @property
 *         def io_loop(self):
 *             return self.loop             # <<<<<<<<<<<<<<
 * 
 *         def close(self):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_loop); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1618; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "nghttp2.pyx":1617
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.io_loop", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1620
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_5close(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_5close = {"close", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_5close, METH_O, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_5close(PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("close (wrapper)", 0);
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_4close(__pyx_self, ((PyObject *)__pyx_v_self));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_4close(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("close", 0);

  /* "nghttp2.pyx":1621
 * 
 *         def close(self):
 *             self.session.close()             # <<<<<<<<<<<<<<
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_close); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1621; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":1620
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.close", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "nghttp2.pyx":1623
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */

/* Python wrapper */
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_7send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_7nghttp2_11HTTP2Client_7send_request = {"send_request", (PyCFunction)__pyx_pw_7nghttp2_11HTTP2Client_7send_request, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_7nghttp2_11HTTP2Client_7send_request(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_self = 0;
  PyObject *__pyx_v_method = 0;
  PyObject *__pyx_v_url = 0;
  PyObject *__pyx_v_headers = 0;
  PyObject *__pyx_v_body = 0;
  PyObject *__pyx_v_handler = 0;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("send_request (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_method_2,&__pyx_n_s_url,&__pyx_n_s_headers,&__pyx_n_s_body,&__pyx_n_s_handler,0};
    PyObject* values[6] = {0,0,0,0,0,0};
    values[1] = ((PyObject *)((PyObject*)__pyx_n_s_GET));
    values[2] = ((PyObject *)((PyObject*)__pyx_kp_s__42));
    values[3] = ((PyObject *)((PyObject *)Py_None));
    values[4] = ((PyObject *)((PyObject *)Py_None));
    values[5] = ((PyObject *)((PyObject *)Py_None));
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_method_2);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_url);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_headers);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_body);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_handler);
          if (value) { values[5] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "send_request") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_self = values[0];
    __pyx_v_method = values[1];
    __pyx_v_url = values[2];
    __pyx_v_headers = values[3];
    __pyx_v_body = values[4];
    __pyx_v_handler = values[5];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("send_request", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
  __pyx_L3_error:;
  __Pyx_AddTraceback("nghttp2.HTTP2Client.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_7nghttp2_11HTTP2Client_6send_request(__pyx_self, __pyx_v_self, __pyx_v_method, __pyx_v_url, __pyx_v_headers, __pyx_v_body, __pyx_v_handler);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_7nghttp2_11HTTP2Client_6send_request(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_method, PyObject *__pyx_v_url, PyObject *__pyx_v_headers, PyObject *__pyx_v_body, PyObject *__pyx_v_handler) {
  PyObject *__pyx_v_scheme = NULL;
  PyObject *__pyx_v_host = NULL;
  PyObject *__pyx_v_path = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannySetupContext("send_request", 0);
  __Pyx_INCREF(__pyx_v_url);

  /* "nghttp2.pyx":1624
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 *             url = urlparse(url)             # <<<<<<<<<<<<<<
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_urlparse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_url); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_url);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_url);
    __Pyx_GIVEREF(__pyx_v_url);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1624; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF_SET(__pyx_v_url, __pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1625
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme             # <<<<<<<<<<<<<<
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_scheme_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1625; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  }
  __pyx_v_scheme = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1626
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])             # <<<<<<<<<<<<<<
 *             path = url.path
 *             if url.params:
 */
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_netloc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  if (__pyx_t_5) {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_netloc); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_1 = __pyx_t_2;
    __pyx_t_2 = 0;
  } else {
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyNumber_Add(__pyx_t_4, __pyx_kp_s__43); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_address); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_4, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1626; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_1 = __pyx_t_4;
    __pyx_t_4 = 0;
  }
  __pyx_v_host = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1627
 *             scheme = url.scheme if url.scheme else self.scheme
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path             # <<<<<<<<<<<<<<
 *             if url.params:
 *                 path += ';'+url.params
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_path_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1627; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_path = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":1628
 *             host = url.netloc if url.netloc else self.address[0]+':'+str(self.address[1])
 *             path = url.path
 *             if url.params:             # <<<<<<<<<<<<<<
 *                 path += ';'+url.params
 *             if url.query:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1628; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1629
 *             path = url.path
 *             if url.params:
 *                 path += ';'+url.params             # <<<<<<<<<<<<<<
 *             if url.query:
 *                 path += '?'+url.query
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_params); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_s__44, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1629; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "nghttp2.pyx":1630
 *             if url.params:
 *                 path += ';'+url.params
 *             if url.query:             # <<<<<<<<<<<<<<
 *                 path += '?'+url.query
 *             if url.fragment:
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1630; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1631
 *                 path += ';'+url.params
 *             if url.query:
 *                 path += '?'+url.query             # <<<<<<<<<<<<<<
 *             if url.fragment:
 *                 path += '#'+url.fragment
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_query); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_s__45, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "nghttp2.pyx":1632
 *             if url.query:
 *                 path += '?'+url.query
 *             if url.fragment:             # <<<<<<<<<<<<<<
 *                 path += '#'+url.fragment
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_fragment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1632; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (__pyx_t_5) {

    /* "nghttp2.pyx":1633
 *                 path += '?'+url.query
 *             if url.fragment:
 *                 path += '#'+url.fragment             # <<<<<<<<<<<<<<
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\
 */
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_fragment); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = PyNumber_Add(__pyx_kp_s__46, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_path, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_DECREF_SET(__pyx_v_path, __pyx_t_1);
    __pyx_t_1 = 0;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "nghttp2.pyx":1635
 *                 path += '#'+url.fragment
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                       headers=headers, body=body, handler=handler)
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_session); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_send_request); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_method_2, __pyx_v_method) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_scheme_2, __pyx_v_scheme) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_host, __pyx_v_host) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_path_2, __pyx_v_path) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1636
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\
 *                                       headers=headers, body=body, handler=handler)             # <<<<<<<<<<<<<<
 */
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_headers, __pyx_v_headers) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_body, __pyx_v_body) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_handler, __pyx_v_handler) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1635
 *                 path += '#'+url.fragment
 * 
 *             self.session.send_request(method=method, scheme=scheme, host=host, path=path,\             # <<<<<<<<<<<<<<
 *                                       headers=headers, body=body, handler=handler)
 */
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1635; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

  /* "nghttp2.pyx":1623
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */

  /* function exit code */
  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("nghttp2.HTTP2Client.send_request", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_scheme);
  __Pyx_XDECREF(__pyx_v_host);
  __Pyx_XDECREF(__pyx_v_path);
  __Pyx_XDECREF(__pyx_v_url);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_tp_new_7nghttp2_HDDeflater(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_10HDDeflater_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7nghttp2_HDDeflater(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7nghttp2_10HDDeflater_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7nghttp2_HDDeflater[] = {
  {"deflate", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_5deflate, METH_O, __pyx_doc_7nghttp2_10HDDeflater_4deflate},
  {"change_table_size", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_7change_table_size, METH_O, __pyx_doc_7nghttp2_10HDDeflater_6change_table_size},
  {"get_hd_table", (PyCFunction)__pyx_pw_7nghttp2_10HDDeflater_9get_hd_table, METH_NOARGS, __pyx_doc_7nghttp2_10HDDeflater_8get_hd_table},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2_HDDeflater = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.HDDeflater", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2_HDDeflater), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2_HDDeflater, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Performs header compression. The constructor takes\n    |hd_table_bufsize_max| parameter, which limits the usage of header\n    table in the given amount of bytes. This is necessary because the\n    header compressor and decompressor share the same amount of\n    header table and the decompressor decides that number. The\n    compressor may not want to use all header table size because of\n    limited memory availability. In that case, the\n    |hd_table_bufsize_max| can be used to cap the upper limit of table\n    size whatever the header table size is chosen by the decompressor.\n    The default value of |hd_table_bufsize_max| is 4096 bytes.\n\n    The following example shows how to compress request header sets:\n\n        import binascii, nghttp2\n\n        deflater = nghttp2.HDDeflater()\n        res = deflater.deflate([(b'foo', b'bar'),\n                              (b'baz', b'buz')])\n        print(binascii.b2a_hex(res))\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2_HDDeflater, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2_HDDeflater, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2_HDInflater(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_10HDInflater_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7nghttp2_HDInflater(PyObject *o) {
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7nghttp2_10HDInflater_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  (*Py_TYPE(o)->tp_free)(o);
}

static PyMethodDef __pyx_methods_7nghttp2_HDInflater[] = {
  {"inflate", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_5inflate, METH_O, __pyx_doc_7nghttp2_10HDInflater_4inflate},
  {"change_table_size", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_7change_table_size, METH_O, __pyx_doc_7nghttp2_10HDInflater_6change_table_size},
  {"get_hd_table", (PyCFunction)__pyx_pw_7nghttp2_10HDInflater_9get_hd_table, METH_NOARGS, __pyx_doc_7nghttp2_10HDInflater_8get_hd_table},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2_HDInflater = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.HDInflater", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2_HDInflater), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2_HDInflater, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  "Performs header decompression.\n\n    The following example shows how to compress request header sets:\n\n        data = b'0082c5ad82bd0f000362617a0362757a'\n        inflater = nghttp2.HDInflater()\n        hdrs = inflater.inflate(data)\n        print(hdrs)\n\n    ", /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2_HDInflater, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2_HDInflater, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p;
  PyObject *o;
  if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
    o = (*t->tp_alloc)(t, 0);
  } else {
    o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
  }
  if (unlikely(!o)) return 0;
  p = ((struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o);
  p->transport = Py_None; Py_INCREF(Py_None);
  p->handler_class = Py_None; Py_INCREF(Py_None);
  p->handlers = Py_None; Py_INCREF(Py_None);
  p->settings_timer = Py_None; Py_INCREF(Py_None);
  p->inside_callback = Py_None; Py_INCREF(Py_None);
  if (unlikely(__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase(PyObject *o) {
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  #if PY_VERSION_HEX >= 0x030400a1
  if (unlikely(Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
    if (PyObject_CallFinalizerFromDealloc(o)) return;
  }
  #endif
  PyObject_GC_UnTrack(o);
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++Py_REFCNT(o);
    __pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_3__dealloc__(o);
    --Py_REFCNT(o);
    PyErr_Restore(etype, eval, etb);
  }
  Py_CLEAR(p->transport);
  Py_CLEAR(p->handler_class);
  Py_CLEAR(p->handlers);
  Py_CLEAR(p->settings_timer);
  Py_CLEAR(p->inside_callback);
  (*Py_TYPE(o)->tp_free)(o);
}

static int __pyx_tp_traverse_7nghttp2__HTTP2SessionCoreBase(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  if (p->transport) {
    e = (*v)(p->transport, a); if (e) return e;
  }
  if (p->handler_class) {
    e = (*v)(p->handler_class, a); if (e) return e;
  }
  if (p->handlers) {
    e = (*v)(p->handlers, a); if (e) return e;
  }
  if (p->settings_timer) {
    e = (*v)(p->settings_timer, a); if (e) return e;
  }
  if (p->inside_callback) {
    e = (*v)(p->inside_callback, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *p = (struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase *)o;
  tmp = ((PyObject*)p->transport);
  p->transport = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->handler_class);
  p->handler_class = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->handlers);
  p->handlers = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->settings_timer);
  p->settings_timer = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  tmp = ((PyObject*)p->inside_callback);
  p->inside_callback = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2SessionCoreBase[] = {
  {"data_received", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_5data_received, METH_O, 0},
  {"send_data", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_7send_data, METH_NOARGS, 0},
  {"resume", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_9resume, METH_O, 0},
  {"enter_callback", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_11enter_callback, METH_NOARGS, 0},
  {"leave_callback", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_13leave_callback, METH_NOARGS, 0},
  {"_make_handler", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_15_make_handler, METH_O, 0},
  {"_remove_handler", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_17_remove_handler, METH_O, 0},
  {"_add_handler", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_19_add_handler, METH_VARARGS|METH_KEYWORDS, 0},
  {"_rst_stream", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_21_rst_stream, METH_VARARGS|METH_KEYWORDS, 0},
  {"_get_remote_address", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_23_get_remote_address, METH_NOARGS, 0},
  {"_get_client_certificate", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_25_get_client_certificate, METH_NOARGS, 0},
  {"_start_settings_timer", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_27_start_settings_timer, METH_NOARGS, 0},
  {"_stop_settings_timer", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_29_stop_settings_timer, METH_NOARGS, 0},
  {"_settings_timeout", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_31_settings_timeout, METH_NOARGS, 0},
  {"_log_request", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_33_log_request, METH_O, 0},
  {"close", (PyCFunction)__pyx_pw_7nghttp2_21_HTTP2SessionCoreBase_35close, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2SessionCoreBase = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2SessionCoreBase", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2SessionCoreBase), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2SessionCoreBase, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2__HTTP2SessionCoreBase, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2SessionCore(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(t, a, k);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_17_HTTP2SessionCore_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2SessionCore[] = {
  {"send_response", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_3send_response, METH_O, 0},
  {"push", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_5push, METH_VARARGS|METH_KEYWORDS, 0},
  {"connection_lost", (PyCFunction)__pyx_pw_7nghttp2_17_HTTP2SessionCore_7connection_lost, METH_NOARGS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2SessionCore = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2SessionCore", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2SessionCore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2SessionCore, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2__HTTP2SessionCore, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyObject *__pyx_tp_new_7nghttp2__HTTP2ClientSessionCore(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = __pyx_tp_new_7nghttp2__HTTP2SessionCoreBase(t, a, k);
  if (unlikely(!o)) return 0;
  if (unlikely(__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_1__cinit__(o, a, k) < 0)) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static PyMethodDef __pyx_methods_7nghttp2__HTTP2ClientSessionCore[] = {
  {"send_request", (PyCFunction)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_3send_request, METH_VARARGS|METH_KEYWORDS, 0},
  {"push", (PyCFunction)__pyx_pw_7nghttp2_23_HTTP2ClientSessionCore_5push, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyTypeObject __pyx_type_7nghttp2__HTTP2ClientSessionCore = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2._HTTP2ClientSessionCore", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2__HTTP2ClientSessionCore), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2__HTTP2SessionCoreBase, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7nghttp2__HTTP2SessionCoreBase, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2__HTTP2SessionCoreBase, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_7nghttp2__HTTP2ClientSessionCore, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2__HTTP2ClientSessionCore, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *__pyx_freelist_7nghttp2___pyx_scope_struct____init__[8];
static int __pyx_freecount_7nghttp2___pyx_scope_struct____init__ = 0;

static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct____init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7nghttp2___pyx_scope_struct____init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__)))) {
    o = (PyObject*)__pyx_freelist_7nghttp2___pyx_scope_struct____init__[--__pyx_freecount_7nghttp2___pyx_scope_struct____init__];
    memset(o, 0, sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7nghttp2___pyx_scope_struct____init__(PyObject *o) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_RequestHandlerClass);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7nghttp2___pyx_scope_struct____init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__)))) {
    __pyx_freelist_7nghttp2___pyx_scope_struct____init__[__pyx_freecount_7nghttp2___pyx_scope_struct____init__++] = ((struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7nghttp2___pyx_scope_struct____init__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  if (p->__pyx_v_RequestHandlerClass) {
    e = (*v)(p->__pyx_v_RequestHandlerClass, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2___pyx_scope_struct____init__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct____init__ *)o;
  tmp = ((PyObject*)p->__pyx_v_RequestHandlerClass);
  p->__pyx_v_RequestHandlerClass = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7nghttp2___pyx_scope_struct____init__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.__pyx_scope_struct____init__", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct____init__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2___pyx_scope_struct____init__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7nghttp2___pyx_scope_struct____init__, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2___pyx_scope_struct____init__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2___pyx_scope_struct____init__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *__pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[8];
static int __pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ = 0;

static PyObject *__pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) {
  PyObject *o;
  if (CYTHON_COMPILING_IN_CPYTHON && likely((__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__)))) {
    o = (PyObject*)__pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[--__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__];
    memset(o, 0, sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__));
    (void) PyObject_INIT(o, t);
    PyObject_GC_Track(o);
  } else {
    o = (*t->tp_alloc)(t, 0);
    if (unlikely(!o)) return 0;
  }
  return o;
}

static void __pyx_tp_dealloc_7nghttp2___pyx_scope_struct_1___init__(PyObject *o) {
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  PyObject_GC_UnTrack(o);
  Py_CLEAR(p->__pyx_v_self);
  if (CYTHON_COMPILING_IN_CPYTHON && ((__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__ < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__)))) {
    __pyx_freelist_7nghttp2___pyx_scope_struct_1___init__[__pyx_freecount_7nghttp2___pyx_scope_struct_1___init__++] = ((struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o);
  } else {
    (*Py_TYPE(o)->tp_free)(o);
  }
}

static int __pyx_tp_traverse_7nghttp2___pyx_scope_struct_1___init__(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  if (p->__pyx_v_self) {
    e = (*v)(p->__pyx_v_self, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_7nghttp2___pyx_scope_struct_1___init__(PyObject *o) {
  PyObject* tmp;
  struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__ *)o;
  tmp = ((PyObject*)p->__pyx_v_self);
  p->__pyx_v_self = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(tmp);
  return 0;
}

static PyTypeObject __pyx_type_7nghttp2___pyx_scope_struct_1___init__ = {
  PyVarObject_HEAD_INIT(0, 0)
  "nghttp2.__pyx_scope_struct_1___init__", /*tp_name*/
  sizeof(struct __pyx_obj_7nghttp2___pyx_scope_struct_1___init__), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_7nghttp2___pyx_scope_struct_1___init__, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  #if PY_MAJOR_VERSION < 3
  0, /*tp_compare*/
  #else
  0, /*reserved*/
  #endif
  0, /*tp_repr*/
  0, /*tp_as_number*/
  0, /*tp_as_sequence*/
  0, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  0, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  0, /*tp_doc*/
  __pyx_tp_traverse_7nghttp2___pyx_scope_struct_1___init__, /*tp_traverse*/
  __pyx_tp_clear_7nghttp2___pyx_scope_struct_1___init__, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  0, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_7nghttp2___pyx_scope_struct_1___init__, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
  0, /*tp_del*/
  0, /*tp_version_tag*/
  #if PY_VERSION_HEX >= 0x030400a1
  0, /*tp_finalize*/
  #endif
};

static PyMethodDef __pyx_methods[] = {
  {0, 0, 0, 0}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef __pyx_moduledef = {
  #if PY_VERSION_HEX < 0x03020000
    { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
  #else
    PyModuleDef_HEAD_INIT,
  #endif
    "nghttp2",
    0, /* m_doc */
    -1, /* m_size */
    __pyx_methods /* m_methods */,
    NULL, /* m_reload */
    NULL, /* m_traverse */
    NULL, /* m_clear */
    NULL /* m_free */
};
#endif

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler, __pyx_k_BaseRequestHandler, sizeof(__pyx_k_BaseRequestHandler), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler___init, __pyx_k_BaseRequestHandler___init, sizeof(__pyx_k_BaseRequestHandler___init), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler__set_response, __pyx_k_BaseRequestHandler__set_response, sizeof(__pyx_k_BaseRequestHandler__set_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_client_addres, __pyx_k_BaseRequestHandler_client_addres, sizeof(__pyx_k_BaseRequestHandler_client_addres), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_client_certif, __pyx_k_BaseRequestHandler_client_certif, sizeof(__pyx_k_BaseRequestHandler_client_certif), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_close, __pyx_k_BaseRequestHandler_on_close, sizeof(__pyx_k_BaseRequestHandler_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_data, __pyx_k_BaseRequestHandler_on_data, sizeof(__pyx_k_BaseRequestHandler_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_headers, __pyx_k_BaseRequestHandler_on_headers, sizeof(__pyx_k_BaseRequestHandler_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_on_request_do, __pyx_k_BaseRequestHandler_on_request_do, sizeof(__pyx_k_BaseRequestHandler_on_request_do), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_push, __pyx_k_BaseRequestHandler_push, sizeof(__pyx_k_BaseRequestHandler_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_resume, __pyx_k_BaseRequestHandler_resume, sizeof(__pyx_k_BaseRequestHandler_resume), 0, 0, 1, 1},
  {&__pyx_n_s_BaseRequestHandler_send_response, __pyx_k_BaseRequestHandler_send_response, sizeof(__pyx_k_BaseRequestHandler_send_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler, __pyx_k_BaseResponseHandler, sizeof(__pyx_k_BaseResponseHandler), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler___init, __pyx_k_BaseResponseHandler___init, sizeof(__pyx_k_BaseResponseHandler___init), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_accept_push, __pyx_k_BaseResponseHandler_accept_push, sizeof(__pyx_k_BaseResponseHandler_accept_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_close, __pyx_k_BaseResponseHandler_on_close, sizeof(__pyx_k_BaseResponseHandler_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_data, __pyx_k_BaseResponseHandler_on_data, sizeof(__pyx_k_BaseResponseHandler_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_headers, __pyx_k_BaseResponseHandler_on_headers, sizeof(__pyx_k_BaseResponseHandler_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_push_prom, __pyx_k_BaseResponseHandler_on_push_prom, sizeof(__pyx_k_BaseResponseHandler_on_push_prom), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_on_response, __pyx_k_BaseResponseHandler_on_response, sizeof(__pyx_k_BaseResponseHandler_on_response), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_reject_push, __pyx_k_BaseResponseHandler_reject_push, sizeof(__pyx_k_BaseResponseHandler_reject_push), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_resume, __pyx_k_BaseResponseHandler_resume, sizeof(__pyx_k_BaseResponseHandler_resume), 0, 0, 1, 1},
  {&__pyx_n_s_BaseResponseHandler_server_addre, __pyx_k_BaseResponseHandler_server_addre, sizeof(__pyx_k_BaseResponseHandler_server_addre), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper, __pyx_k_ByteIOWrapper, sizeof(__pyx_k_ByteIOWrapper), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper___init, __pyx_k_ByteIOWrapper___init, sizeof(__pyx_k_ByteIOWrapper___init), 0, 0, 1, 1},
  {&__pyx_n_s_ByteIOWrapper_generate, __pyx_k_ByteIOWrapper_generate, sizeof(__pyx_k_ByteIOWrapper_generate), 0, 0, 1, 1},
  {&__pyx_n_s_BytesIO, __pyx_k_BytesIO, sizeof(__pyx_k_BytesIO), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_DEFERRED, __pyx_k_DATA_DEFERRED, sizeof(__pyx_k_DATA_DEFERRED), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_EOF, __pyx_k_DATA_EOF, sizeof(__pyx_k_DATA_EOF), 0, 0, 1, 1},
  {&__pyx_n_s_DATA_OK, __pyx_k_DATA_OK, sizeof(__pyx_k_DATA_OK), 0, 0, 1, 1},
  {&__pyx_n_s_DEFAULT_HEADER_TABLE_SIZE, __pyx_k_DEFAULT_HEADER_TABLE_SIZE, sizeof(__pyx_k_DEFAULT_HEADER_TABLE_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE, __pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE, sizeof(__pyx_k_DEFLATE_MAX_HEADER_TABLE_SIZE), 0, 0, 1, 1},
  {&__pyx_n_s_Exception, __pyx_k_Exception, sizeof(__pyx_k_Exception), 0, 0, 1, 1},
  {&__pyx_n_s_GET, __pyx_k_GET, sizeof(__pyx_k_GET), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry, __pyx_k_HDTableEntry, sizeof(__pyx_k_HDTableEntry), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry___init, __pyx_k_HDTableEntry___init, sizeof(__pyx_k_HDTableEntry___init), 0, 0, 1, 1},
  {&__pyx_n_s_HDTableEntry_space, __pyx_k_HDTableEntry_space, sizeof(__pyx_k_HDTableEntry_space), 0, 0, 1, 1},
  {&__pyx_n_s_HD_ENTRY_OVERHEAD, __pyx_k_HD_ENTRY_OVERHEAD, sizeof(__pyx_k_HD_ENTRY_OVERHEAD), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client, __pyx_k_HTTP2Client, sizeof(__pyx_k_HTTP2Client), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession, __pyx_k_HTTP2ClientSession, sizeof(__pyx_k_HTTP2ClientSession), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession___init, __pyx_k_HTTP2ClientSession___init, sizeof(__pyx_k_HTTP2ClientSession___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_close, __pyx_k_HTTP2ClientSession_close, sizeof(__pyx_k_HTTP2ClientSession_close), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_connection_l, __pyx_k_HTTP2ClientSession_connection_l, sizeof(__pyx_k_HTTP2ClientSession_connection_l), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_connection_m, __pyx_k_HTTP2ClientSession_connection_m, sizeof(__pyx_k_HTTP2ClientSession_connection_m), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_data_receive, __pyx_k_HTTP2ClientSession_data_receive, sizeof(__pyx_k_HTTP2ClientSession_data_receive), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_resume_writi, __pyx_k_HTTP2ClientSession_resume_writi, sizeof(__pyx_k_HTTP2ClientSession_resume_writi), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2ClientSession_send_request, __pyx_k_HTTP2ClientSession_send_request, sizeof(__pyx_k_HTTP2ClientSession_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client___init, __pyx_k_HTTP2Client___init, sizeof(__pyx_k_HTTP2Client___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client___init___locals_sess, __pyx_k_HTTP2Client___init___locals_sess, sizeof(__pyx_k_HTTP2Client___init___locals_sess), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_close, __pyx_k_HTTP2Client_close, sizeof(__pyx_k_HTTP2Client_close), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_io_loop, __pyx_k_HTTP2Client_io_loop, sizeof(__pyx_k_HTTP2Client_io_loop), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Client_send_request, __pyx_k_HTTP2Client_send_request, sizeof(__pyx_k_HTTP2Client_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server, __pyx_k_HTTP2Server, sizeof(__pyx_k_HTTP2Server), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server___init, __pyx_k_HTTP2Server___init, sizeof(__pyx_k_HTTP2Server___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server___init___locals_sess, __pyx_k_HTTP2Server___init___locals_sess, sizeof(__pyx_k_HTTP2Server___init___locals_sess), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Server_serve_forever, __pyx_k_HTTP2Server_serve_forever, sizeof(__pyx_k_HTTP2Server_serve_forever), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session, __pyx_k_HTTP2Session, sizeof(__pyx_k_HTTP2Session), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session___init, __pyx_k_HTTP2Session___init, sizeof(__pyx_k_HTTP2Session___init), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_connection_lost, __pyx_k_HTTP2Session_connection_lost, sizeof(__pyx_k_HTTP2Session_connection_lost), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_connection_made, __pyx_k_HTTP2Session_connection_made, sizeof(__pyx_k_HTTP2Session_connection_made), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_data_received, __pyx_k_HTTP2Session_data_received, sizeof(__pyx_k_HTTP2Session_data_received), 0, 0, 1, 1},
  {&__pyx_n_s_HTTP2Session_resume_writing, __pyx_k_HTTP2Session_resume_writing, sizeof(__pyx_k_HTTP2Session_resume_writing), 0, 0, 1, 1},
  {&__pyx_kp_s_HTTP_2_client_This_class_builds, __pyx_k_HTTP_2_client_This_class_builds, sizeof(__pyx_k_HTTP_2_client_This_class_builds), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_request_stream_handler_ba, __pyx_k_HTTP_2_request_stream_handler_ba, sizeof(__pyx_k_HTTP_2_request_stream_handler_ba), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_response_stream_handler_b, __pyx_k_HTTP_2_response_stream_handler_b, sizeof(__pyx_k_HTTP_2_response_stream_handler_b), 0, 0, 1, 0},
  {&__pyx_kp_s_HTTP_2_server_This_class_builds, __pyx_k_HTTP_2_server_This_class_builds, sizeof(__pyx_k_HTTP_2_server_This_class_builds), 0, 0, 1, 0},
  {&__pyx_n_s_IOBase, __pyx_k_IOBase, sizeof(__pyx_k_IOBase), 0, 0, 1, 1},
  {&__pyx_n_s_IPPROTO_TCP, __pyx_k_IPPROTO_TCP, sizeof(__pyx_k_IPPROTO_TCP), 0, 0, 1, 1},
  {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
  {&__pyx_n_s_OSError, __pyx_k_OSError, sizeof(__pyx_k_OSError), 0, 0, 1, 1},
  {&__pyx_n_s_OUTBUF_MAX, __pyx_k_OUTBUF_MAX, sizeof(__pyx_k_OUTBUF_MAX), 0, 0, 1, 1},
  {&__pyx_n_s_P, __pyx_k_P, sizeof(__pyx_k_P), 0, 0, 1, 1},
  {&__pyx_n_s_Protocol, __pyx_k_Protocol, sizeof(__pyx_k_Protocol), 0, 0, 1, 1},
  {&__pyx_n_s_RequestHandlerClass, __pyx_k_RequestHandlerClass, sizeof(__pyx_k_RequestHandlerClass), 0, 0, 1, 1},
  {&__pyx_n_s_SETTINGS_TIMEOUT, __pyx_k_SETTINGS_TIMEOUT, sizeof(__pyx_k_SETTINGS_TIMEOUT), 0, 0, 1, 1},
  {&__pyx_n_s_TCP_NODELAY, __pyx_k_TCP_NODELAY, sizeof(__pyx_k_TCP_NODELAY), 0, 0, 1, 1},
  {&__pyx_n_s__136, __pyx_k__136, sizeof(__pyx_k__136), 0, 0, 1, 1},
  {&__pyx_kp_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 0},
  {&__pyx_kp_s__42, __pyx_k__42, sizeof(__pyx_k__42), 0, 0, 1, 0},
  {&__pyx_kp_s__43, __pyx_k__43, sizeof(__pyx_k__43), 0, 0, 1, 0},
  {&__pyx_kp_s__44, __pyx_k__44, sizeof(__pyx_k__44), 0, 0, 1, 0},
  {&__pyx_kp_s__45, __pyx_k__45, sizeof(__pyx_k__45), 0, 0, 1, 0},
  {&__pyx_kp_s__46, __pyx_k__46, sizeof(__pyx_k__46), 0, 0, 1, 0},
  {&__pyx_kp_b__5, __pyx_k__5, sizeof(__pyx_k__5), 0, 0, 0, 0},
  {&__pyx_kp_b__7, __pyx_k__7, sizeof(__pyx_k__7), 0, 0, 0, 0},
  {&__pyx_n_s_abort, __pyx_k_abort, sizeof(__pyx_k_abort), 0, 0, 1, 1},
  {&__pyx_n_s_accept_push, __pyx_k_accept_push, sizeof(__pyx_k_accept_push), 0, 0, 1, 1},
  {&__pyx_n_s_add, __pyx_k_add, sizeof(__pyx_k_add), 0, 0, 1, 1},
  {&__pyx_n_s_add_handler, __pyx_k_add_handler, sizeof(__pyx_k_add_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_add_handler_stream_id_s, __pyx_k_add_handler_stream_id_s, sizeof(__pyx_k_add_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_address, __pyx_k_address, sizeof(__pyx_k_address), 0, 0, 1, 1},
  {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
  {&__pyx_n_s_asyncio, __pyx_k_asyncio, sizeof(__pyx_k_asyncio), 0, 0, 1, 1},
  {&__pyx_kp_b_authority, __pyx_k_authority, sizeof(__pyx_k_authority), 0, 0, 0, 0},
  {&__pyx_n_s_b, __pyx_k_b, sizeof(__pyx_k_b), 0, 0, 1, 1},
  {&__pyx_n_s_body, __pyx_k_body, sizeof(__pyx_k_body), 0, 0, 1, 1},
  {&__pyx_n_s_call_later, __pyx_k_call_later, sizeof(__pyx_k_call_later), 0, 0, 1, 1},
  {&__pyx_n_s_cancel, __pyx_k_cancel, sizeof(__pyx_k_cancel), 0, 0, 1, 1},
  {&__pyx_n_s_client, __pyx_k_client, sizeof(__pyx_k_client), 0, 0, 1, 1},
  {&__pyx_n_s_client_address, __pyx_k_client_address, sizeof(__pyx_k_client_address), 0, 0, 1, 1},
  {&__pyx_n_s_client_certificate, __pyx_k_client_certificate, sizeof(__pyx_k_client_certificate), 0, 0, 1, 1},
  {&__pyx_n_s_client_certificate_2, __pyx_k_client_certificate_2, sizeof(__pyx_k_client_certificate_2), 0, 0, 1, 1},
  {&__pyx_kp_s_client_on_frame_recv_type_s_stre, __pyx_k_client_on_frame_recv_type_s_stre, sizeof(__pyx_k_client_on_frame_recv_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_client_on_frame_send_type_s_stre, __pyx_k_client_on_frame_send_type_s_stre, sizeof(__pyx_k_client_on_frame_send_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_client_on_header_type_s_stream_i, __pyx_k_client_on_header_type_s_stream_i, sizeof(__pyx_k_client_on_header_type_s_stream_i), 0, 0, 1, 0},
  {&__pyx_n_s_close, __pyx_k_close, sizeof(__pyx_k_close), 0, 0, 1, 1},
  {&__pyx_kp_s_connect_address_s_port_s, __pyx_k_connect_address_s_port_s, sizeof(__pyx_k_connect_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_s_connection_lost, __pyx_k_connection_lost, sizeof(__pyx_k_connection_lost), 0, 0, 1, 1},
  {&__pyx_n_s_connection_made, __pyx_k_connection_made, sizeof(__pyx_k_connection_made), 0, 0, 1, 1},
  {&__pyx_kp_s_connection_made_address_s_port_s, __pyx_k_connection_made_address_s_port_s, sizeof(__pyx_k_connection_made_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_b_cookie, __pyx_k_cookie, sizeof(__pyx_k_cookie), 0, 0, 0, 1},
  {&__pyx_n_s_cookies, __pyx_k_cookies, sizeof(__pyx_k_cookies), 0, 0, 1, 1},
  {&__pyx_n_s_coro, __pyx_k_coro, sizeof(__pyx_k_coro), 0, 0, 1, 1},
  {&__pyx_n_s_create_connection, __pyx_k_create_connection, sizeof(__pyx_k_create_connection), 0, 0, 1, 1},
  {&__pyx_n_s_create_server, __pyx_k_create_server, sizeof(__pyx_k_create_server), 0, 0, 1, 1},
  {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
  {&__pyx_n_s_data_received, __pyx_k_data_received, sizeof(__pyx_k_data_received), 0, 0, 1, 1},
  {&__pyx_n_s_datetime, __pyx_k_datetime, sizeof(__pyx_k_datetime), 0, 0, 1, 1},
  {&__pyx_n_s_debug, __pyx_k_debug, sizeof(__pyx_k_debug), 0, 0, 1, 1},
  {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
  {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1},
  {&__pyx_n_s_e, __pyx_k_e, sizeof(__pyx_k_e), 0, 0, 1, 1},
  {&__pyx_n_s_email, __pyx_k_email, sizeof(__pyx_k_email), 0, 0, 1, 1},
  {&__pyx_n_s_email_utils, __pyx_k_email_utils, sizeof(__pyx_k_email_utils), 0, 0, 1, 1},
  {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
  {&__pyx_n_s_encode_headers, __pyx_k_encode_headers, sizeof(__pyx_k_encode_headers), 0, 0, 1, 1},
  {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1},
  {&__pyx_n_s_enter_callback, __pyx_k_enter_callback, sizeof(__pyx_k_enter_callback), 0, 0, 1, 1},
  {&__pyx_n_s_entry, __pyx_k_entry, sizeof(__pyx_k_entry), 0, 0, 1, 1},
  {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
  {&__pyx_n_s_err, __pyx_k_err, sizeof(__pyx_k_err), 0, 0, 1, 1},
  {&__pyx_n_s_error_code, __pyx_k_error_code, sizeof(__pyx_k_error_code), 0, 0, 1, 1},
  {&__pyx_n_s_exc, __pyx_k_exc, sizeof(__pyx_k_exc), 0, 0, 1, 1},
  {&__pyx_n_s_extend, __pyx_k_extend, sizeof(__pyx_k_extend), 0, 0, 1, 1},
  {&__pyx_kp_s_failed_to_set_tcp_nodelay_s, __pyx_k_failed_to_set_tcp_nodelay_s, sizeof(__pyx_k_failed_to_set_tcp_nodelay_s), 0, 0, 1, 0},
  {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1},
  {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
  {&__pyx_n_s_format_exc, __pyx_k_format_exc, sizeof(__pyx_k_format_exc), 0, 0, 1, 1},
  {&__pyx_n_s_formatdate, __pyx_k_formatdate, sizeof(__pyx_k_formatdate), 0, 0, 1, 1},
  {&__pyx_n_s_fragment, __pyx_k_fragment, sizeof(__pyx_k_fragment), 0, 0, 1, 1},
  {&__pyx_n_s_generate, __pyx_k_generate, sizeof(__pyx_k_generate), 0, 0, 1, 1},
  {&__pyx_n_s_get_client_certificate, __pyx_k_get_client_certificate, sizeof(__pyx_k_get_client_certificate), 0, 0, 1, 1},
  {&__pyx_n_s_get_event_loop, __pyx_k_get_event_loop, sizeof(__pyx_k_get_event_loop), 0, 0, 1, 1},
  {&__pyx_n_s_get_extra_info, __pyx_k_get_extra_info, sizeof(__pyx_k_get_extra_info), 0, 0, 1, 1},
  {&__pyx_n_s_get_remote_address, __pyx_k_get_remote_address, sizeof(__pyx_k_get_remote_address), 0, 0, 1, 1},
  {&__pyx_n_s_get_write_buffer_size, __pyx_k_get_write_buffer_size, sizeof(__pyx_k_get_write_buffer_size), 0, 0, 1, 1},
  {&__pyx_n_s_getpeercert, __pyx_k_getpeercert, sizeof(__pyx_k_getpeercert), 0, 0, 1, 1},
  {&__pyx_n_s_handler, __pyx_k_handler, sizeof(__pyx_k_handler), 0, 0, 1, 1},
  {&__pyx_n_s_handler_class, __pyx_k_handler_class, sizeof(__pyx_k_handler_class), 0, 0, 1, 1},
  {&__pyx_n_s_hd_table_bufsize_max, __pyx_k_hd_table_bufsize_max, sizeof(__pyx_k_hd_table_bufsize_max), 0, 0, 1, 1},
  {&__pyx_n_s_hdtable, __pyx_k_hdtable, sizeof(__pyx_k_hdtable), 0, 0, 1, 1},
  {&__pyx_n_s_headers, __pyx_k_headers, sizeof(__pyx_k_headers), 0, 0, 1, 1},
  {&__pyx_n_b_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 0, 1},
  {&__pyx_n_s_host, __pyx_k_host, sizeof(__pyx_k_host), 0, 0, 1, 1},
  {&__pyx_n_s_http, __pyx_k_http, sizeof(__pyx_k_http), 0, 0, 1, 1},
  {&__pyx_n_s_http2, __pyx_k_http2, sizeof(__pyx_k_http2), 0, 0, 1, 1},
  {&__pyx_n_s_https, __pyx_k_https, sizeof(__pyx_k_https), 0, 0, 1, 1},
  {&__pyx_n_s_idx, __pyx_k_idx, sizeof(__pyx_k_idx), 0, 0, 1, 1},
  {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
  {&__pyx_n_s_info, __pyx_k_info, sizeof(__pyx_k_info), 0, 0, 1, 1},
  {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1},
  {&__pyx_n_s_io, __pyx_k_io, sizeof(__pyx_k_io), 0, 0, 1, 1},
  {&__pyx_n_s_io_loop, __pyx_k_io_loop, sizeof(__pyx_k_io_loop), 0, 0, 1, 1},
  {&__pyx_n_s_join, __pyx_k_join, sizeof(__pyx_k_join), 0, 0, 1, 1},
  {&__pyx_n_s_k, __pyx_k_k, sizeof(__pyx_k_k), 0, 0, 1, 1},
  {&__pyx_n_s_leave_callback, __pyx_k_leave_callback, sizeof(__pyx_k_leave_callback), 0, 0, 1, 1},
  {&__pyx_kp_s_listen_address_s_port_s, __pyx_k_listen_address_s_port_s, sizeof(__pyx_k_listen_address_s_port_s), 0, 0, 1, 0},
  {&__pyx_n_s_localtime, __pyx_k_localtime, sizeof(__pyx_k_localtime), 0, 0, 1, 1},
  {&__pyx_n_s_log_request, __pyx_k_log_request, sizeof(__pyx_k_log_request), 0, 0, 1, 1},
  {&__pyx_n_s_logging, __pyx_k_logging, sizeof(__pyx_k_logging), 0, 0, 1, 1},
  {&__pyx_n_s_loop, __pyx_k_loop, sizeof(__pyx_k_loop), 0, 0, 1, 1},
  {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
  {&__pyx_n_s_make_handler, __pyx_k_make_handler, sizeof(__pyx_k_make_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_make_handler_stream_id_s, __pyx_k_make_handler_stream_id_s, sizeof(__pyx_k_make_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1},
  {&__pyx_kp_b_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 0, 0},
  {&__pyx_n_s_method_2, __pyx_k_method_2, sizeof(__pyx_k_method_2), 0, 0, 1, 1},
  {&__pyx_kp_s_method_must_not_be_empty, __pyx_k_method_must_not_be_empty, sizeof(__pyx_k_method_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_mktime, __pyx_k_mktime, sizeof(__pyx_k_mktime), 0, 0, 1, 1},
  {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1},
  {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
  {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
  {&__pyx_n_s_namelen, __pyx_k_namelen, sizeof(__pyx_k_namelen), 0, 0, 1, 1},
  {&__pyx_n_s_netloc, __pyx_k_netloc, sizeof(__pyx_k_netloc), 0, 0, 1, 1},
  {&__pyx_n_s_nghttp2, __pyx_k_nghttp2, sizeof(__pyx_k_nghttp2), 0, 0, 1, 1},
  {&__pyx_kp_s_nghttp2_session_callbacks_new_fa, __pyx_k_nghttp2_session_callbacks_new_fa, sizeof(__pyx_k_nghttp2_session_callbacks_new_fa), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_client_new_faile, __pyx_k_nghttp2_session_client_new_faile, sizeof(__pyx_k_nghttp2_session_client_new_faile), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_mem_recv_failed, __pyx_k_nghttp2_session_mem_recv_failed, sizeof(__pyx_k_nghttp2_session_mem_recv_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_mem_send_faild, __pyx_k_nghttp2_session_mem_send_faild, sizeof(__pyx_k_nghttp2_session_mem_send_faild), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_session_server_new_faile, __pyx_k_nghttp2_session_server_new_faile, sizeof(__pyx_k_nghttp2_session_server_new_faile), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_push_promise_fail, __pyx_k_nghttp2_submit_push_promise_fail, sizeof(__pyx_k_nghttp2_submit_push_promise_fail), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_request_failed, __pyx_k_nghttp2_submit_request_failed, sizeof(__pyx_k_nghttp2_submit_request_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_response_failed, __pyx_k_nghttp2_submit_response_failed, sizeof(__pyx_k_nghttp2_submit_response_failed), 0, 0, 1, 0},
  {&__pyx_kp_s_nghttp2_submit_settings_failed, __pyx_k_nghttp2_submit_settings_failed, sizeof(__pyx_k_nghttp2_submit_settings_failed), 0, 0, 1, 0},
  {&__pyx_n_s_now, __pyx_k_now, sizeof(__pyx_k_now), 0, 0, 1, 1},
  {&__pyx_kp_s_npn_protocol_s, __pyx_k_npn_protocol_s, sizeof(__pyx_k_npn_protocol_s), 0, 0, 1, 0},
  {&__pyx_n_s_on_close, __pyx_k_on_close, sizeof(__pyx_k_on_close), 0, 0, 1, 1},
  {&__pyx_n_s_on_data, __pyx_k_on_data, sizeof(__pyx_k_on_data), 0, 0, 1, 1},
  {&__pyx_n_s_on_headers, __pyx_k_on_headers, sizeof(__pyx_k_on_headers), 0, 0, 1, 1},
  {&__pyx_n_s_on_push_promise, __pyx_k_on_push_promise, sizeof(__pyx_k_on_push_promise), 0, 0, 1, 1},
  {&__pyx_n_s_on_request_done, __pyx_k_on_request_done, sizeof(__pyx_k_on_request_done), 0, 0, 1, 1},
  {&__pyx_n_s_on_response_done, __pyx_k_on_response_done, sizeof(__pyx_k_on_response_done), 0, 0, 1, 1},
  {&__pyx_kp_s_on_stream_close_stream_id_s, __pyx_k_on_stream_close_stream_id_s, sizeof(__pyx_k_on_stream_close_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_params, __pyx_k_params, sizeof(__pyx_k_params), 0, 0, 1, 1},
  {&__pyx_kp_b_path, __pyx_k_path, sizeof(__pyx_k_path), 0, 0, 0, 0},
  {&__pyx_n_s_path_2, __pyx_k_path_2, sizeof(__pyx_k_path_2), 0, 0, 1, 1},
  {&__pyx_kp_s_path_must_not_be_empty, __pyx_k_path_must_not_be_empty, sizeof(__pyx_k_path_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_peername, __pyx_k_peername, sizeof(__pyx_k_peername), 0, 0, 1, 1},
  {&__pyx_n_s_pending, __pyx_k_pending, sizeof(__pyx_k_pending), 0, 0, 1, 1},
  {&__pyx_n_s_port, __pyx_k_port, sizeof(__pyx_k_port), 0, 0, 1, 1},
  {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1},
  {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1},
  {&__pyx_n_s_print_hd_table, __pyx_k_print_hd_table, sizeof(__pyx_k_print_hd_table), 0, 0, 1, 1},
  {&__pyx_n_s_promised_handler, __pyx_k_promised_handler, sizeof(__pyx_k_promised_handler), 0, 0, 1, 1},
  {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1},
  {&__pyx_n_s_protocol, __pyx_k_protocol, sizeof(__pyx_k_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_push, __pyx_k_push, sizeof(__pyx_k_push), 0, 0, 1, 1},
  {&__pyx_n_s_push_promise, __pyx_k_push_promise, sizeof(__pyx_k_push_promise), 0, 0, 1, 1},
  {&__pyx_kp_s_push_stream_id_s, __pyx_k_push_stream_id_s, sizeof(__pyx_k_push_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_pushed, __pyx_k_pushed, sizeof(__pyx_k_pushed), 0, 0, 1, 1},
  {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1},
  {&__pyx_n_s_query, __pyx_k_query, sizeof(__pyx_k_query), 0, 0, 1, 1},
  {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
  {&__pyx_n_s_read1, __pyx_k_read1, sizeof(__pyx_k_read1), 0, 0, 1, 1},
  {&__pyx_n_s_reject_push, __pyx_k_reject_push, sizeof(__pyx_k_reject_push), 0, 0, 1, 1},
  {&__pyx_n_s_remote_address, __pyx_k_remote_address, sizeof(__pyx_k_remote_address), 0, 0, 1, 1},
  {&__pyx_n_s_remove, __pyx_k_remove, sizeof(__pyx_k_remove), 0, 0, 1, 1},
  {&__pyx_n_s_remove_handler, __pyx_k_remove_handler, sizeof(__pyx_k_remove_handler), 0, 0, 1, 1},
  {&__pyx_kp_s_remove_handler_stream_id_s, __pyx_k_remove_handler_stream_id_s, sizeof(__pyx_k_remove_handler_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_request_headers, __pyx_k_request_headers, sizeof(__pyx_k_request_headers), 0, 0, 1, 1},
  {&__pyx_kp_s_request_stream_id_s, __pyx_k_request_stream_id_s, sizeof(__pyx_k_request_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_response_body, __pyx_k_response_body, sizeof(__pyx_k_response_body), 0, 0, 1, 1},
  {&__pyx_kp_s_response_has_already_been_sent, __pyx_k_response_has_already_been_sent, sizeof(__pyx_k_response_has_already_been_sent), 0, 0, 1, 0},
  {&__pyx_n_s_response_headers, __pyx_k_response_headers, sizeof(__pyx_k_response_headers), 0, 0, 1, 1},
  {&__pyx_n_s_resume, __pyx_k_resume, sizeof(__pyx_k_resume), 0, 0, 1, 1},
  {&__pyx_n_s_resume_writing, __pyx_k_resume_writing, sizeof(__pyx_k_resume_writing), 0, 0, 1, 1},
  {&__pyx_n_s_rst_stream, __pyx_k_rst_stream, sizeof(__pyx_k_rst_stream), 0, 0, 1, 1},
  {&__pyx_n_s_run_forever, __pyx_k_run_forever, sizeof(__pyx_k_run_forever), 0, 0, 1, 1},
  {&__pyx_n_s_run_until_complete, __pyx_k_run_until_complete, sizeof(__pyx_k_run_until_complete), 0, 0, 1, 1},
  {&__pyx_kp_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 0},
  {&__pyx_kp_s_s_s_s_s_HTTP_2_s_s, __pyx_k_s_s_s_s_HTTP_2_s_s, sizeof(__pyx_k_s_s_s_s_HTTP_2_s_s), 0, 0, 1, 0},
  {&__pyx_kp_b_scheme, __pyx_k_scheme, sizeof(__pyx_k_scheme), 0, 0, 0, 0},
  {&__pyx_n_s_scheme_2, __pyx_k_scheme_2, sizeof(__pyx_k_scheme_2), 0, 0, 1, 1},
  {&__pyx_n_s_selected_npn_protocol, __pyx_k_selected_npn_protocol, sizeof(__pyx_k_selected_npn_protocol), 0, 0, 1, 1},
  {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1},
  {&__pyx_n_s_send_data, __pyx_k_send_data, sizeof(__pyx_k_send_data), 0, 0, 1, 1},
  {&__pyx_n_s_send_pending, __pyx_k_send_pending, sizeof(__pyx_k_send_pending), 0, 0, 1, 1},
  {&__pyx_n_s_send_request, __pyx_k_send_request, sizeof(__pyx_k_send_request), 0, 0, 1, 1},
  {&__pyx_n_s_send_response, __pyx_k_send_response, sizeof(__pyx_k_send_response), 0, 0, 1, 1},
  {&__pyx_kp_s_send_response_stream_id_s, __pyx_k_send_response_stream_id_s, sizeof(__pyx_k_send_response_stream_id_s), 0, 0, 1, 0},
  {&__pyx_n_s_serve_forever, __pyx_k_serve_forever, sizeof(__pyx_k_serve_forever), 0, 0, 1, 1},
  {&__pyx_n_s_server, __pyx_k_server, sizeof(__pyx_k_server), 0, 0, 1, 1},
  {&__pyx_n_s_server_address, __pyx_k_server_address, sizeof(__pyx_k_server_address), 0, 0, 1, 1},
  {&__pyx_kp_s_server_on_frame_not_send_type_s, __pyx_k_server_on_frame_not_send_type_s, sizeof(__pyx_k_server_on_frame_not_send_type_s), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_frame_recv_type_s_stre, __pyx_k_server_on_frame_recv_type_s_stre, sizeof(__pyx_k_server_on_frame_recv_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_frame_send_type_s_stre, __pyx_k_server_on_frame_send_type_s_stre, sizeof(__pyx_k_server_on_frame_send_type_s_stre), 0, 0, 1, 0},
  {&__pyx_kp_s_server_on_header_type_s_stream_i, __pyx_k_server_on_header_type_s_stream_i, sizeof(__pyx_k_server_on_header_type_s_stream_i), 0, 0, 1, 0},
  {&__pyx_n_s_session, __pyx_k_session, sizeof(__pyx_k_session), 0, 0, 1, 1},
  {&__pyx_n_s_session_factory, __pyx_k_session_factory, sizeof(__pyx_k_session_factory), 0, 0, 1, 1},
  {&__pyx_n_s_set_npn_protocols, __pyx_k_set_npn_protocols, sizeof(__pyx_k_set_npn_protocols), 0, 0, 1, 1},
  {&__pyx_n_s_set_response_prop, __pyx_k_set_response_prop, sizeof(__pyx_k_set_response_prop), 0, 0, 1, 1},
  {&__pyx_n_s_setsockopt, __pyx_k_setsockopt, sizeof(__pyx_k_setsockopt), 0, 0, 1, 1},
  {&__pyx_n_s_settings_timeout, __pyx_k_settings_timeout, sizeof(__pyx_k_settings_timeout), 0, 0, 1, 1},
  {&__pyx_n_s_sock, __pyx_k_sock, sizeof(__pyx_k_sock), 0, 0, 1, 1},
  {&__pyx_n_s_socket, __pyx_k_socket, sizeof(__pyx_k_socket), 0, 0, 1, 1},
  {&__pyx_n_s_space, __pyx_k_space, sizeof(__pyx_k_space), 0, 0, 1, 1},
  {&__pyx_n_s_split, __pyx_k_split, sizeof(__pyx_k_split), 0, 0, 1, 1},
  {&__pyx_n_s_ssl, __pyx_k_ssl, sizeof(__pyx_k_ssl), 0, 0, 1, 1},
  {&__pyx_n_s_ssl_ctx, __pyx_k_ssl_ctx, sizeof(__pyx_k_ssl_ctx), 0, 0, 1, 1},
  {&__pyx_n_s_sslcontext, __pyx_k_sslcontext, sizeof(__pyx_k_sslcontext), 0, 0, 1, 1},
  {&__pyx_n_s_start_settings_timer, __pyx_k_start_settings_timer, sizeof(__pyx_k_start_settings_timer), 0, 0, 1, 1},
  {&__pyx_kp_b_status, __pyx_k_status, sizeof(__pyx_k_status), 0, 0, 0, 0},
  {&__pyx_n_s_status_2, __pyx_k_status_2, sizeof(__pyx_k_status_2), 0, 0, 1, 1},
  {&__pyx_kp_s_status_must_not_be_empty, __pyx_k_status_must_not_be_empty, sizeof(__pyx_k_status_must_not_be_empty), 0, 0, 1, 0},
  {&__pyx_n_s_stderr, __pyx_k_stderr, sizeof(__pyx_k_stderr), 0, 0, 1, 1},
  {&__pyx_n_s_stop_settings_timer, __pyx_k_stop_settings_timer, sizeof(__pyx_k_stop_settings_timer), 0, 0, 1, 1},
  {&__pyx_n_s_stream_id, __pyx_k_stream_id, sizeof(__pyx_k_stream_id), 0, 0, 1, 1},
  {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1},
  {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
  {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
  {&__pyx_n_s_time, __pyx_k_time, sizeof(__pyx_k_time), 0, 0, 1, 1},
  {&__pyx_n_s_timetuple, __pyx_k_timetuple, sizeof(__pyx_k_timetuple), 0, 0, 1, 1},
  {&__pyx_n_s_timeval, __pyx_k_timeval, sizeof(__pyx_k_timeval), 0, 0, 1, 1},
  {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1},
  {&__pyx_n_s_transport, __pyx_k_transport, sizeof(__pyx_k_transport), 0, 0, 1, 1},
  {&__pyx_n_s_url, __pyx_k_url, sizeof(__pyx_k_url), 0, 0, 1, 1},
  {&__pyx_n_s_urllib_parse, __pyx_k_urllib_parse, sizeof(__pyx_k_urllib_parse), 0, 0, 1, 1},
  {&__pyx_n_s_urlparse, __pyx_k_urlparse, sizeof(__pyx_k_urlparse), 0, 0, 1, 1},
  {&__pyx_n_s_usegmt, __pyx_k_usegmt, sizeof(__pyx_k_usegmt), 0, 0, 1, 1},
  {&__pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_k_usr_src_ports_nghttp2_nghttp2_1, sizeof(__pyx_k_usr_src_ports_nghttp2_nghttp2_1), 0, 0, 1, 0},
  {&__pyx_kp_s_utf_8, __pyx_k_utf_8, sizeof(__pyx_k_utf_8), 0, 0, 1, 0},
  {&__pyx_n_s_utils, __pyx_k_utils, sizeof(__pyx_k_utils), 0, 0, 1, 1},
  {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1},
  {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1},
  {&__pyx_n_s_valuelen, __pyx_k_valuelen, sizeof(__pyx_k_valuelen), 0, 0, 1, 1},
  {&__pyx_n_s_wrap_body, __pyx_k_wrap_body, sizeof(__pyx_k_wrap_body), 0, 0, 1, 1},
  {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1},
  {0, 0, 0, 0, 0, 0, 0}
};
static int __Pyx_InitCachedBuiltins(void) {
  __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_Exception = __Pyx_GetBuiltinName(__pyx_n_s_Exception); if (!__pyx_builtin_Exception) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_builtin_OSError = __Pyx_GetBuiltinName(__pyx_n_s_OSError); if (!__pyx_builtin_OSError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

static int __Pyx_InitCachedConstants(void) {
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);

  /* "nghttp2.pyx":251
 *         print('[{}] (s={}) {}: {}'\
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),             # <<<<<<<<<<<<<<
 *                       entry.value.decode('utf-8')))
 * 
 */
  __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__2);
  __Pyx_GIVEREF(__pyx_tuple__2);

  /* "nghttp2.pyx":252
 *               .format(idx, entry.space(),
 *                       entry.name.decode('utf-8'),
 *                       entry.value.decode('utf-8')))             # <<<<<<<<<<<<<<
 * 
 * try:
 */
  __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__3);
  __Pyx_GIVEREF(__pyx_tuple__3);

  /* "nghttp2.pyx":287
 *         return body
 *     elif isinstance(body, str):
 *         return _ByteIOWrapper(io.BytesIO(body.encode('utf-8'))).generate             # <<<<<<<<<<<<<<
 *     elif isinstance(body, bytes):
 *         return _ByteIOWrapper(io.BytesIO(body)).generate
 */
  __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__4);
  __Pyx_GIVEREF(__pyx_tuple__4);

  /* "nghttp2.pyx":362
 * 
 *     key = name[:namelen]
 *     values = value[:valuelen].split(b'\x00')             # <<<<<<<<<<<<<<
 *     if key == b':scheme':
 *         handler.scheme = values[0]
 */
  __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_b__5); if (unlikely(!__pyx_tuple__6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__6);
  __Pyx_GIVEREF(__pyx_tuple__6);

  /* "nghttp2.pyx":733
 * 
 *     def _get_remote_address(self):
 *         return self.transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 * 
 *     def _get_client_certificate(self):
 */
  __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_peername); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__9);
  __Pyx_GIVEREF(__pyx_tuple__9);

  /* "nghttp2.pyx":736
 * 
 *     def _get_client_certificate(self):
 *         sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *         try:
 *             return sock.getpeercert()
 */
  __pyx_tuple__10 = PyTuple_Pack(1, __pyx_n_s_socket); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__10);
  __Pyx_GIVEREF(__pyx_tuple__10);

  /* "nghttp2.pyx":755
 *         cdef int rv
 * 
 *         logging.debug('_settings_timeout')             # <<<<<<<<<<<<<<
 * 
 *         self.settings_timer = None
 */
  __pyx_tuple__11 = PyTuple_Pack(1, __pyx_n_s_settings_timeout); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__11);
  __Pyx_GIVEREF(__pyx_tuple__11);

  /* "nghttp2.pyx":774
 *                                         usegmt=True)
 *         try:
 *             method = handler.method.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             method = handler.method
 */
  __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__12);
  __Pyx_GIVEREF(__pyx_tuple__12);

  /* "nghttp2.pyx":778
 *             method = handler.method
 *         try:
 *             path = handler.path.decode('utf-8')             # <<<<<<<<<<<<<<
 *         except:
 *             path = handler.path
 */
  __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__13);
  __Pyx_GIVEREF(__pyx_tuple__13);

  /* "nghttp2.pyx":970
 *         custom_headers = _encode_headers(headers)
 *         headers = [
 *             (b':method', method.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 */
  __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__15);
  __Pyx_GIVEREF(__pyx_tuple__15);

  /* "nghttp2.pyx":971
 *         headers = [
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))
 */
  __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 971; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__16);
  __Pyx_GIVEREF(__pyx_tuple__16);

  /* "nghttp2.pyx":972
 *             (b':method', method.encode('utf-8')),
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),             # <<<<<<<<<<<<<<
 *             (b':path', path.encode('utf-8'))
 *         ]
 */
  __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__17);
  __Pyx_GIVEREF(__pyx_tuple__17);

  /* "nghttp2.pyx":973
 *             (b':scheme', scheme.encode('utf-8')),
 *             (b':authority', host.encode('utf-8')),
 *             (b':path', path.encode('utf-8'))             # <<<<<<<<<<<<<<
 *         ]
 *         headers.extend(custom_headers)
 */
  __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__18);
  __Pyx_GIVEREF(__pyx_tuple__18);

  /* "nghttp2.pyx":1182
 *             '''
 *             if self.status is not None:
 *                 raise Exception('response has already been sent')             # <<<<<<<<<<<<<<
 * 
 *             if not status:
 */
  __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_response_has_already_been_sent); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__19);
  __Pyx_GIVEREF(__pyx_tuple__19);

  /* "nghttp2.pyx":1185
 * 
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
  __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_status_must_not_be_empty); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__20);
  __Pyx_GIVEREF(__pyx_tuple__20);

  /* "nghttp2.pyx":1217
 *             '''
 *             if not status:
 *                 raise Exception('status must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not method:
 */
  __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_status_must_not_be_empty); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__21);
  __Pyx_GIVEREF(__pyx_tuple__21);

  /* "nghttp2.pyx":1220
 * 
 *             if not method:
 *                 raise Exception('method must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             if not path:
 */
  __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_method_must_not_be_empty); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__22);
  __Pyx_GIVEREF(__pyx_tuple__22);

  /* "nghttp2.pyx":1223
 * 
 *             if not path:
 *                 raise Exception('path must not be empty')             # <<<<<<<<<<<<<<
 * 
 *             body = wrap_body(body)
 */
  __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_path_must_not_be_empty); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1223; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__23);
  __Pyx_GIVEREF(__pyx_tuple__23);

  /* "nghttp2.pyx":1227
 *             body = wrap_body(body)
 * 
 *             promised_handler = self.http2._make_handler(-1)             # <<<<<<<<<<<<<<
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 */
  __pyx_tuple__24 = PyTuple_Pack(1, __pyx_int_neg_1); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1227; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__24);
  __Pyx_GIVEREF(__pyx_tuple__24);

  /* "nghttp2.pyx":1230
 *             promised_handler.pushed = True
 *             promised_handler.scheme = self.scheme
 *             promised_handler.method = method.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')
 */
  __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1230; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__25);
  __Pyx_GIVEREF(__pyx_tuple__25);

  /* "nghttp2.pyx":1232
 *             promised_handler.method = method.encode('utf-8')
 *             promised_handler.host = self.host
 *             promised_handler.path = path.encode('utf-8')             # <<<<<<<<<<<<<<
 *             promised_handler._set_response_prop(status, headers, body)
 * 
 */
  __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__26);
  __Pyx_GIVEREF(__pyx_tuple__26);

  /* "nghttp2.pyx":1253
 *                 headers = []
 * 
 *             self.response_headers = [(b':status', str(status).encode('utf-8'))]             # <<<<<<<<<<<<<<
 *             self.response_headers.extend(_encode_headers(headers))
 * 
 */
  __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__27);
  __Pyx_GIVEREF(__pyx_tuple__27);

  /* "nghttp2.pyx":1264
 *         if not headers:
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),             # <<<<<<<<<<<<<<
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \
 *                 for k, v in headers]
 */
  __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__28);
  __Pyx_GIVEREF(__pyx_tuple__28);

  /* "nghttp2.pyx":1265
 *             return []
 *         return [(k if isinstance(k, bytes) else k.encode('utf-8'),
 *                  v if isinstance(v, bytes) else v.encode('utf-8')) \             # <<<<<<<<<<<<<<
 *                 for k, v in headers]
 * 
 */
  __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__29);
  __Pyx_GIVEREF(__pyx_tuple__29);

  /* "nghttp2.pyx":1276
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_peername); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1276; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__30);
  __Pyx_GIVEREF(__pyx_tuple__30);

  /* "nghttp2.pyx":1280
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             try:
 *                 sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 */
  __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_socket); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__31);
  __Pyx_GIVEREF(__pyx_tuple__31);

  /* "nghttp2.pyx":1285
 *             except OSError as e:
 *                 logging.info('failed to set tcp-nodelay: %s', str(e))
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 */
  __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_sslcontext); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__32);
  __Pyx_GIVEREF(__pyx_tuple__32);

  /* "nghttp2.pyx":1289
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
  __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__33);
  __Pyx_GIVEREF(__pyx_tuple__33);

  /* "nghttp2.pyx":1304
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.connection_lost()
 */
  __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_connection_lost); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1304; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__34);
  __Pyx_GIVEREF(__pyx_tuple__34);

  /* "nghttp2.pyx":1343
 * 
 *             '''
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return _HTTP2Session(RequestHandlerClass)
 * 
 */
  __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_session_factory, 1343, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1511
 * 
 *         def connection_made(self, transport):
 *             address = transport.get_extra_info('peername')             # <<<<<<<<<<<<<<
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 * 
 */
  __pyx_tuple__36 = PyTuple_Pack(1, __pyx_n_s_peername); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1511; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__36);
  __Pyx_GIVEREF(__pyx_tuple__36);

  /* "nghttp2.pyx":1515
 * 
 *             self.transport = transport
 *             sock = self.transport.get_extra_info('socket')             # <<<<<<<<<<<<<<
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')
 */
  __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_socket); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1515; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__37);
  __Pyx_GIVEREF(__pyx_tuple__37);

  /* "nghttp2.pyx":1517
 *             sock = self.transport.get_extra_info('socket')
 *             sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
 *             ssl_ctx = self.transport.get_extra_info('sslcontext')             # <<<<<<<<<<<<<<
 *             if ssl_ctx:
 *                 protocol = sock.selected_npn_protocol()
 */
  __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_sslcontext); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1517; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__38);
  __Pyx_GIVEREF(__pyx_tuple__38);

  /* "nghttp2.pyx":1521
 *                 protocol = sock.selected_npn_protocol()
 *                 logging.info('npn, protocol:%s', protocol)
 *                 if protocol is None or protocol.encode('utf-8') != \             # <<<<<<<<<<<<<<
 *                    cnghttp2.NGHTTP2_PROTO_VERSION_ID:
 *                     self.transport.abort()
 */
  __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_utf_8); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1521; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__39);
  __Pyx_GIVEREF(__pyx_tuple__39);

  /* "nghttp2.pyx":1536
 * 
 *         def connection_lost(self, exc):
 *             logging.info('connection_lost')             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2 = None
 */
  __pyx_tuple__40 = PyTuple_Pack(1, __pyx_n_s_connection_lost); if (unlikely(!__pyx_tuple__40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1536; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__40);
  __Pyx_GIVEREF(__pyx_tuple__40);

  /* "nghttp2.pyx":1593
 *             self.address = address
 *             self.session = _HTTP2ClientSession(self)
 *             def session_factory():             # <<<<<<<<<<<<<<
 *                 return self.session
 * 
 */
  __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_session_factory, 1593, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */
  __pyx_tuple__47 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_name, __pyx_n_s_namelen, __pyx_n_s_value, __pyx_n_s_valuelen); if (unlikely(!__pyx_tuple__47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__47);
  __Pyx_GIVEREF(__pyx_tuple__47);
  __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(5, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 38, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */
  __pyx_tuple__49 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__49);
  __Pyx_GIVEREF(__pyx_tuple__49);
  __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_space, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */
  __pyx_tuple__51 = PyTuple_Pack(3, __pyx_n_s_hdtable, __pyx_n_s_idx, __pyx_n_s_entry); if (unlikely(!__pyx_tuple__51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__51);
  __Pyx_GIVEREF(__pyx_tuple__51);
  __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_print_hd_table, 238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":274
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */
  __pyx_tuple__53 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_b); if (unlikely(!__pyx_tuple__53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__53);
  __Pyx_GIVEREF(__pyx_tuple__53);
  __pyx_codeobj__54 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 274, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":277
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */
  __pyx_tuple__55 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_n, __pyx_n_s_data); if (unlikely(!__pyx_tuple__55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__55);
  __Pyx_GIVEREF(__pyx_tuple__55);
  __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_generate, 277, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":283
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */
  __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_body); if (unlikely(!__pyx_tuple__57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__57);
  __Pyx_GIVEREF(__pyx_tuple__57);
  __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_wrap_body, 283, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1087
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
  __pyx_tuple__59 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_http2, __pyx_n_s_stream_id); if (unlikely(!__pyx_tuple__59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__59);
  __Pyx_GIVEREF(__pyx_tuple__59);
  __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1087, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1111
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
  __pyx_tuple__61 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__61);
  __Pyx_GIVEREF(__pyx_tuple__61);
  __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_client_address, 1111, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1115
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */
  __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__63);
  __Pyx_GIVEREF(__pyx_tuple__63);
  __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_client_certificate, 1115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1118
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */
  __pyx_tuple__65 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__65);
  __Pyx_GIVEREF(__pyx_tuple__65);
  __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_headers, 1118, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1125
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */
  __pyx_tuple__67 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__67);
  __Pyx_GIVEREF(__pyx_tuple__67);
  __pyx_codeobj__68 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_data, 1125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1133
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */
  __pyx_tuple__69 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__69);
  __Pyx_GIVEREF(__pyx_tuple__69);
  __pyx_codeobj__70 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_request_done, 1133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1140
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
  __pyx_tuple__71 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_error_code); if (unlikely(!__pyx_tuple__71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__71);
  __Pyx_GIVEREF(__pyx_tuple__71);
  __pyx_codeobj__72 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_close, 1140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1147
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */
  __pyx_tuple__73 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body); if (unlikely(!__pyx_tuple__73)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__73);
  __Pyx_GIVEREF(__pyx_tuple__73);
  __pyx_codeobj__74 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__73, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_send_response, 1147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__75 = PyTuple_Pack(3, ((PyObject *)__pyx_int_200), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__75)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__75);
  __Pyx_GIVEREF(__pyx_tuple__75);

  /* "nghttp2.pyx":1192
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */
  __pyx_tuple__76 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_path_2, __pyx_n_s_method_2, __pyx_n_s_request_headers, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_promised_handler); if (unlikely(!__pyx_tuple__76)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__76);
  __Pyx_GIVEREF(__pyx_tuple__76);
  __pyx_codeobj__77 = (PyObject*)__Pyx_PyCode_New(7, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__76, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_push, 1192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__77)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__78 = PyTuple_Pack(5, ((PyObject*)__pyx_n_s_GET), ((PyObject *)Py_None), ((PyObject *)__pyx_int_200), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__78)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__78);
  __Pyx_GIVEREF(__pyx_tuple__78);

  /* "nghttp2.pyx":1247
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */
  __pyx_tuple__79 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_status_2, __pyx_n_s_headers, __pyx_n_s_body); if (unlikely(!__pyx_tuple__79)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__79);
  __Pyx_GIVEREF(__pyx_tuple__79);
  __pyx_codeobj__80 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__79, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_set_response_prop, 1247, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__80)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1258
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
  __pyx_tuple__81 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__81)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__81);
  __Pyx_GIVEREF(__pyx_tuple__81);
  __pyx_codeobj__82 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__81, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_resume, 1258, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__82)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1261
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */
  __pyx_tuple__83 = PyTuple_Pack(3, __pyx_n_s_headers, __pyx_n_s_k, __pyx_n_s_v); if (unlikely(!__pyx_tuple__83)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__83);
  __Pyx_GIVEREF(__pyx_tuple__83);
  __pyx_codeobj__84 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__83, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_encode_headers, 1261, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__84)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1270
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */
  __pyx_tuple__85 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_RequestHandlerClass); if (unlikely(!__pyx_tuple__85)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__85);
  __Pyx_GIVEREF(__pyx_tuple__85);
  __pyx_codeobj__86 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__85, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__86)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1275
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
  __pyx_tuple__87 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_transport, __pyx_n_s_address, __pyx_n_s_sock, __pyx_n_s_e, __pyx_n_s_ssl_ctx, __pyx_n_s_protocol, __pyx_n_s_err); if (unlikely(!__pyx_tuple__87)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__87);
  __Pyx_GIVEREF(__pyx_tuple__87);
  __pyx_codeobj__88 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__87, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_connection_made, 1275, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1303
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
  __pyx_tuple__89 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__89);
  __Pyx_GIVEREF(__pyx_tuple__89);
  __pyx_codeobj__90 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__89, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_connection_lost, 1303, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__90)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1309
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
  __pyx_tuple__91 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_err); if (unlikely(!__pyx_tuple__91)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__91);
  __Pyx_GIVEREF(__pyx_tuple__91);
  __pyx_codeobj__92 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__91, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_data_received, 1309, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1317
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
  __pyx_tuple__93 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__93);
  __Pyx_GIVEREF(__pyx_tuple__93);
  __pyx_codeobj__94 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__93, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_resume_writing, 1317, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
  __pyx_tuple__95 = PyTuple_Pack(7, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_RequestHandlerClass, __pyx_n_s_ssl, __pyx_n_s_session_factory, __pyx_n_s_session_factory, __pyx_n_s_coro); if (unlikely(!__pyx_tuple__95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__95);
  __Pyx_GIVEREF(__pyx_tuple__95);
  __pyx_codeobj__96 = (PyObject*)__Pyx_PyCode_New(4, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__95, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1334, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__97 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__97);
  __Pyx_GIVEREF(__pyx_tuple__97);

  /* "nghttp2.pyx":1358
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */
  __pyx_tuple__98 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__98);
  __Pyx_GIVEREF(__pyx_tuple__98);
  __pyx_codeobj__99 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_serve_forever, 1358, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1419
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
  __pyx_tuple__100 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_http2, __pyx_n_s_stream_id); if (unlikely(!__pyx_tuple__100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__100);
  __Pyx_GIVEREF(__pyx_tuple__100);
  __pyx_codeobj__101 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1419, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__102 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)__pyx_int_neg_1)); if (unlikely(!__pyx_tuple__102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__102);
  __Pyx_GIVEREF(__pyx_tuple__102);

  /* "nghttp2.pyx":1441
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
  __pyx_tuple__103 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__103);
  __Pyx_GIVEREF(__pyx_tuple__103);
  __pyx_codeobj__104 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__103, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_server_address, 1441, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1444
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */
  __pyx_tuple__105 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__105);
  __Pyx_GIVEREF(__pyx_tuple__105);
  __pyx_codeobj__106 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__105, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_headers, 1444, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1451
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */
  __pyx_tuple__107 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data); if (unlikely(!__pyx_tuple__107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__107);
  __Pyx_GIVEREF(__pyx_tuple__107);
  __pyx_codeobj__108 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__107, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_data, 1451, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__108)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1459
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */
  __pyx_tuple__109 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__109)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__109);
  __Pyx_GIVEREF(__pyx_tuple__109);
  __pyx_codeobj__110 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__109, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_response_done, 1459, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__110)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1466
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
  __pyx_tuple__111 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_error_code); if (unlikely(!__pyx_tuple__111)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__111);
  __Pyx_GIVEREF(__pyx_tuple__111);
  __pyx_codeobj__112 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__111, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_close, 1466, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__112)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1473
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */
  __pyx_tuple__113 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_push_promise); if (unlikely(!__pyx_tuple__113)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__113);
  __Pyx_GIVEREF(__pyx_tuple__113);
  __pyx_codeobj__114 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__113, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_on_push_promise, 1473, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__114)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1482
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */
  __pyx_tuple__115 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_push_promise); if (unlikely(!__pyx_tuple__115)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__115);
  __Pyx_GIVEREF(__pyx_tuple__115);
  __pyx_codeobj__116 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__115, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_reject_push, 1482, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__116)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1490
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */
  __pyx_tuple__117 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_push_promise, __pyx_n_s_handler); if (unlikely(!__pyx_tuple__117)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__117);
  __Pyx_GIVEREF(__pyx_tuple__117);
  __pyx_codeobj__118 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__117, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_accept_push, 1490, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__118)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__119 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__119)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__119);
  __Pyx_GIVEREF(__pyx_tuple__119);

  /* "nghttp2.pyx":1499
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
  __pyx_tuple__120 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__120)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__120);
  __Pyx_GIVEREF(__pyx_tuple__120);
  __pyx_codeobj__121 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__120, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_resume, 1499, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__121)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1504
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */
  __pyx_tuple__122 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_client); if (unlikely(!__pyx_tuple__122)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__122);
  __Pyx_GIVEREF(__pyx_tuple__122);
  __pyx_codeobj__123 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__122, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1504, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__123)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1510
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
  __pyx_tuple__124 = PyTuple_Pack(14, __pyx_n_s_self, __pyx_n_s_transport, __pyx_n_s_address, __pyx_n_s_sock, __pyx_n_s_ssl_ctx, __pyx_n_s_protocol, __pyx_n_s_send_pending, __pyx_n_s_method_2, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler); if (unlikely(!__pyx_tuple__124)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__124);
  __Pyx_GIVEREF(__pyx_tuple__124);
  __pyx_codeobj__125 = (PyObject*)__Pyx_PyCode_New(2, 0, 14, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__124, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_connection_made, 1510, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__125)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1535
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
  __pyx_tuple__126 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_exc); if (unlikely(!__pyx_tuple__126)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__126);
  __Pyx_GIVEREF(__pyx_tuple__126);
  __pyx_codeobj__127 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__126, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_connection_lost, 1535, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__127)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1541
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
  __pyx_tuple__128 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_data, __pyx_n_s_err); if (unlikely(!__pyx_tuple__128)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__128);
  __Pyx_GIVEREF(__pyx_tuple__128);
  __pyx_codeobj__129 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__128, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_data_received, 1541, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__129)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1549
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
  __pyx_tuple__130 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_err); if (unlikely(!__pyx_tuple__130)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__130);
  __Pyx_GIVEREF(__pyx_tuple__130);
  __pyx_codeobj__131 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__130, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_resume_writing, 1549, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__131)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1557
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */
  __pyx_tuple__132 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_method_2, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler, __pyx_n_s_err); if (unlikely(!__pyx_tuple__132)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__132);
  __Pyx_GIVEREF(__pyx_tuple__132);
  __pyx_codeobj__133 = (PyObject*)__Pyx_PyCode_New(8, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__132, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_send_request, 1557, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__133)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1572
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */
  __pyx_tuple__134 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__134)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__134);
  __Pyx_GIVEREF(__pyx_tuple__134);
  __pyx_codeobj__135 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__134, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_close, 1572, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__135)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
  __pyx_tuple__137 = PyTuple_Pack(8, __pyx_n_s_self, __pyx_n_s_address, __pyx_n_s_loop, __pyx_n_s_ssl, __pyx_n_s_session_factory, __pyx_n_s_session_factory, __pyx_n_s_coro, __pyx_n_s__136); if (unlikely(!__pyx_tuple__137)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__137);
  __Pyx_GIVEREF(__pyx_tuple__137);
  __pyx_codeobj__138 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__137, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_init, 1584, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__138)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__139 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__139)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__139);
  __Pyx_GIVEREF(__pyx_tuple__139);

  /* "nghttp2.pyx":1617
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */
  __pyx_tuple__140 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__140)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__140);
  __Pyx_GIVEREF(__pyx_tuple__140);
  __pyx_codeobj__141 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__140, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_io_loop, 1617, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__141)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1620
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */
  __pyx_tuple__142 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__142)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__142);
  __Pyx_GIVEREF(__pyx_tuple__142);
  __pyx_codeobj__143 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__142, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_close, 1620, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__143)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":1623
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */
  __pyx_tuple__144 = PyTuple_Pack(9, __pyx_n_s_self, __pyx_n_s_method_2, __pyx_n_s_url, __pyx_n_s_headers, __pyx_n_s_body, __pyx_n_s_handler, __pyx_n_s_scheme_2, __pyx_n_s_host, __pyx_n_s_path_2); if (unlikely(!__pyx_tuple__144)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__144);
  __Pyx_GIVEREF(__pyx_tuple__144);
  __pyx_codeobj__145 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__144, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_usr_src_ports_nghttp2_nghttp2_1, __pyx_n_s_send_request, 1623, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__145)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_tuple__146 = PyTuple_Pack(5, ((PyObject*)__pyx_n_s_GET), ((PyObject*)__pyx_kp_s__42), ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__146)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_tuple__146);
  __Pyx_GIVEREF(__pyx_tuple__146);
  __Pyx_RefNannyFinishContext();
  return 0;
  __pyx_L1_error:;
  __Pyx_RefNannyFinishContext();
  return -1;
}

static int __Pyx_InitGlobals(void) {
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  __pyx_float_5_0 = PyFloat_FromDouble(5.0); if (unlikely(!__pyx_float_5_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_32 = PyInt_FromLong(32); if (unlikely(!__pyx_int_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_200 = PyInt_FromLong(200); if (unlikely(!__pyx_int_200)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_4096 = PyInt_FromLong(4096); if (unlikely(!__pyx_int_4096)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_65535 = PyInt_FromLong(65535L); if (unlikely(!__pyx_int_65535)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  return 0;
  __pyx_L1_error:;
  return -1;
}

#if PY_MAJOR_VERSION < 3
PyMODINIT_FUNC initnghttp2(void); /*proto*/
PyMODINIT_FUNC initnghttp2(void)
#else
PyMODINIT_FUNC PyInit_nghttp2(void); /*proto*/
PyMODINIT_FUNC PyInit_nghttp2(void)
#endif
{
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  int __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_lineno = 0;
  const char *__pyx_filename = NULL;
  int __pyx_clineno = 0;
  __Pyx_RefNannyDeclarations
  #if CYTHON_REFNANNY
  __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
  if (!__Pyx_RefNanny) {
      PyErr_Clear();
      __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
      if (!__Pyx_RefNanny)
          Py_FatalError("failed to import 'refnanny' module");
  }
  #endif
  __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_nghttp2(void)", 0);
  if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #ifdef __Pyx_CyFunction_USED
  if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_FusedFunction_USED
  if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  #ifdef __Pyx_Generator_USED
  if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  /*--- Library function declarations ---*/
  /*--- Threads initialization code ---*/
  #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
  #ifdef WITH_THREAD /* Python build with threading support? */
  PyEval_InitThreads();
  #endif
  #endif
  /*--- Module creation code ---*/
  #if PY_MAJOR_VERSION < 3
  __pyx_m = Py_InitModule4("nghttp2", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
  #else
  __pyx_m = PyModule_Create(&__pyx_moduledef);
  #endif
  if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  Py_INCREF(__pyx_d);
  __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if CYTHON_COMPILING_IN_PYPY
  Py_INCREF(__pyx_b);
  #endif
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  /*--- Initialize various global constants etc. ---*/
  if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
  if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  #endif
  if (__pyx_module_is_main_nghttp2) {
    if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
  }
  #if PY_MAJOR_VERSION >= 3
  {
    PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    if (!PyDict_GetItemString(modules, "nghttp2")) {
      if (unlikely(PyDict_SetItemString(modules, "nghttp2", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    }
  }
  #endif
  /*--- Builtin init code ---*/
  if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Constants init code ---*/
  if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  /*--- Global init code ---*/
  /*--- Variable export code ---*/
  /*--- Function export code ---*/
  /*--- Type init code ---*/
  if (PyType_Ready(&__pyx_type_7nghttp2_HDDeflater) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2_HDDeflater.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "HDDeflater", (PyObject *)&__pyx_type_7nghttp2_HDDeflater) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7nghttp2_HDDeflater = &__pyx_type_7nghttp2_HDDeflater;
  if (PyType_Ready(&__pyx_type_7nghttp2_HDInflater) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2_HDInflater.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "HDInflater", (PyObject *)&__pyx_type_7nghttp2_HDInflater) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7nghttp2_HDInflater = &__pyx_type_7nghttp2_HDInflater;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2SessionCoreBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2__HTTP2SessionCoreBase.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_HTTP2SessionCoreBase", (PyObject *)&__pyx_type_7nghttp2__HTTP2SessionCoreBase) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7nghttp2__HTTP2SessionCoreBase = &__pyx_type_7nghttp2__HTTP2SessionCoreBase;
  __pyx_type_7nghttp2__HTTP2SessionCore.tp_base = __pyx_ptype_7nghttp2__HTTP2SessionCoreBase;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2SessionCore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2__HTTP2SessionCore.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_HTTP2SessionCore", (PyObject *)&__pyx_type_7nghttp2__HTTP2SessionCore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7nghttp2__HTTP2SessionCore = &__pyx_type_7nghttp2__HTTP2SessionCore;
  __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_base = __pyx_ptype_7nghttp2__HTTP2SessionCoreBase;
  if (PyType_Ready(&__pyx_type_7nghttp2__HTTP2ClientSessionCore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2__HTTP2ClientSessionCore.tp_print = 0;
  if (PyObject_SetAttrString(__pyx_m, "_HTTP2ClientSessionCore", (PyObject *)&__pyx_type_7nghttp2__HTTP2ClientSessionCore) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_ptype_7nghttp2__HTTP2ClientSessionCore = &__pyx_type_7nghttp2__HTTP2ClientSessionCore;
  if (PyType_Ready(&__pyx_type_7nghttp2___pyx_scope_struct____init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2___pyx_scope_struct____init__.tp_print = 0;
  __pyx_ptype_7nghttp2___pyx_scope_struct____init__ = &__pyx_type_7nghttp2___pyx_scope_struct____init__;
  if (PyType_Ready(&__pyx_type_7nghttp2___pyx_scope_struct_1___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __pyx_type_7nghttp2___pyx_scope_struct_1___init__.tp_print = 0;
  __pyx_ptype_7nghttp2___pyx_scope_struct_1___init__ = &__pyx_type_7nghttp2___pyx_scope_struct_1___init__;
  /*--- Type import code ---*/
  /*--- Variable import code ---*/
  /*--- Function import code ---*/
  /*--- Execution code ---*/

  /* "nghttp2.pyx":28
 * from libc.string cimport memcpy, memset
 * from libc.stdint cimport uint8_t, uint16_t, uint32_t, int32_t
 * import logging             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __pyx_t_1 = __Pyx_Import(__pyx_n_s_logging, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_logging, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":31
 * 
 * 
 * DEFAULT_HEADER_TABLE_SIZE = cnghttp2.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE             # <<<<<<<<<<<<<<
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096
 * 
 */
  __pyx_t_1 = __Pyx_PyInt_FromSize_t(NGHTTP2_DEFAULT_HEADER_TABLE_SIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFAULT_HEADER_TABLE_SIZE, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":32
 * 
 * DEFAULT_HEADER_TABLE_SIZE = cnghttp2.NGHTTP2_DEFAULT_HEADER_TABLE_SIZE
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096             # <<<<<<<<<<<<<<
 * 
 * HD_ENTRY_OVERHEAD = 32
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE, __pyx_int_4096) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":34
 * DEFLATE_MAX_HEADER_TABLE_SIZE = 4096
 * 
 * HD_ENTRY_OVERHEAD = 32             # <<<<<<<<<<<<<<
 * 
 * class HDTableEntry:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HD_ENTRY_OVERHEAD, __pyx_int_32) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":36
 * HD_ENTRY_OVERHEAD = 32
 * 
 * class HDTableEntry:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 */
  __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HDTableEntry, __pyx_n_s_HDTableEntry, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);

  /* "nghttp2.pyx":38
 * class HDTableEntry:
 * 
 *     def __init__(self, name, namelen, value, valuelen):             # <<<<<<<<<<<<<<
 *         self.name = name
 *         self.namelen = namelen
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_12HDTableEntry_1__init__, 0, __pyx_n_s_HDTableEntry___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__48)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":44
 *         self.valuelen = valuelen
 * 
 *     def space(self):             # <<<<<<<<<<<<<<
 *         return self.namelen + self.valuelen + HD_ENTRY_OVERHEAD
 * 
 */
  __pyx_t_2 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_12HDTableEntry_3space, 0, __pyx_n_s_HDTableEntry_space, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__50)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyObject_SetItem(__pyx_t_1, __pyx_n_s_space, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

  /* "nghttp2.pyx":36
 * HD_ENTRY_OVERHEAD = 32
 * 
 * class HDTableEntry:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, name, namelen, value, valuelen):
 */
  __pyx_t_2 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HDTableEntry, __pyx_empty_tuple, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_2);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_HDTableEntry, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":75
 *     cdef cnghttp2.nghttp2_hd_deflater *_deflater
 * 
 *     def __cinit__(self, hd_table_bufsize_max = DEFLATE_MAX_HEADER_TABLE_SIZE):             # <<<<<<<<<<<<<<
 *         rv = cnghttp2.nghttp2_hd_deflate_new(&self._deflater,
 *                                              hd_table_bufsize_max)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_DEFLATE_MAX_HEADER_TABLE_SIZE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_k_ = __pyx_t_1;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_t_1 = 0;

  /* "nghttp2.pyx":238
 *     return cnghttp2.nghttp2_strerror(liberror_code).decode('utf-8')
 * 
 * def print_hd_table(hdtable):             # <<<<<<<<<<<<<<
 *     '''Convenient function to print |hdtable| to the standard output. This
 *     function does not work if header name/value cannot be decoded using
 */
  __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_1print_hd_table, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_print_hd_table, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":254
 *                       entry.value.decode('utf-8')))
 * 
 * try:             # <<<<<<<<<<<<<<
 *     import socket
 *     import io
 */
  {
    __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
    __Pyx_XGOTREF(__pyx_t_3);
    __Pyx_XGOTREF(__pyx_t_4);
    __Pyx_XGOTREF(__pyx_t_5);
    /*try:*/ {

      /* "nghttp2.pyx":255
 * 
 * try:
 *     import socket             # <<<<<<<<<<<<<<
 *     import io
 *     import asyncio
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_socket, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_socket, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":256
 * try:
 *     import socket
 *     import io             # <<<<<<<<<<<<<<
 *     import asyncio
 *     import traceback
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_io, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_io, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":257
 *     import socket
 *     import io
 *     import asyncio             # <<<<<<<<<<<<<<
 *     import traceback
 *     import sys
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_asyncio, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":258
 *     import io
 *     import asyncio
 *     import traceback             # <<<<<<<<<<<<<<
 *     import sys
 *     import email.utils
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_traceback, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":259
 *     import asyncio
 *     import traceback
 *     import sys             # <<<<<<<<<<<<<<
 *     import email.utils
 *     import datetime
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":260
 *     import traceback
 *     import sys
 *     import email.utils             # <<<<<<<<<<<<<<
 *     import datetime
 *     import time
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_email_utils, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_email, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":261
 *     import sys
 *     import email.utils
 *     import datetime             # <<<<<<<<<<<<<<
 *     import time
 *     from urllib.parse import urlparse
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_datetime, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_datetime, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":262
 *     import email.utils
 *     import datetime
 *     import time             # <<<<<<<<<<<<<<
 *     from urllib.parse import urlparse
 * except ImportError:
 */
      __pyx_t_1 = __Pyx_Import(__pyx_n_s_time, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_time, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

      /* "nghttp2.pyx":263
 *     import datetime
 *     import time
 *     from urllib.parse import urlparse             # <<<<<<<<<<<<<<
 * except ImportError:
 *     asyncio = None
 */
      __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_INCREF(__pyx_n_s_urlparse);
      PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_urlparse);
      __Pyx_GIVEREF(__pyx_n_s_urlparse);
      __pyx_t_2 = __Pyx_Import(__pyx_n_s_urllib_parse, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_urlparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_GOTREF(__pyx_t_1);
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_urlparse, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L2_error;}
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    }
    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
    goto __pyx_L9_try_end;
    __pyx_L2_error:;
    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "nghttp2.pyx":264
 *     import time
 *     from urllib.parse import urlparse
 * except ImportError:             # <<<<<<<<<<<<<<
 *     asyncio = None
 * 
 */
    __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_ImportError);
    if (__pyx_t_6) {
      __Pyx_AddTraceback("nghttp2", __pyx_clineno, __pyx_lineno, __pyx_filename);
      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GOTREF(__pyx_t_7);

      /* "nghttp2.pyx":265
 *     from urllib.parse import urlparse
 * except ImportError:
 *     asyncio = None             # <<<<<<<<<<<<<<
 * 
 * # body generator flags
 */
      if (PyDict_SetItem(__pyx_d, __pyx_n_s_asyncio, Py_None) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L4_except_error;}
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      goto __pyx_L3_exception_handled;
    }
    goto __pyx_L4_except_error;
    __pyx_L4_except_error:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    goto __pyx_L1_error;
    __pyx_L3_exception_handled:;
    __Pyx_XGIVEREF(__pyx_t_3);
    __Pyx_XGIVEREF(__pyx_t_4);
    __Pyx_XGIVEREF(__pyx_t_5);
    __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
    __pyx_L9_try_end:;
  }

  /* "nghttp2.pyx":268
 * 
 * # body generator flags
 * DATA_OK = 0             # <<<<<<<<<<<<<<
 * DATA_EOF = 1
 * DATA_DEFERRED = 2
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_OK, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":269
 * # body generator flags
 * DATA_OK = 0
 * DATA_EOF = 1             # <<<<<<<<<<<<<<
 * DATA_DEFERRED = 2
 * 
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_EOF, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":270
 * DATA_OK = 0
 * DATA_EOF = 1
 * DATA_DEFERRED = 2             # <<<<<<<<<<<<<<
 * 
 * class _ByteIOWrapper:
 */
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_DATA_DEFERRED, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

  /* "nghttp2.pyx":272
 * DATA_DEFERRED = 2
 * 
 * class _ByteIOWrapper:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, b):
 */
  __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_ByteIOWrapper, __pyx_n_s_ByteIOWrapper, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);

  /* "nghttp2.pyx":274
 * class _ByteIOWrapper:
 * 
 *     def __init__(self, b):             # <<<<<<<<<<<<<<
 *         self.b = b
 * 
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_14_ByteIOWrapper_1__init__, 0, __pyx_n_s_ByteIOWrapper___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__54)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":277
 *         self.b = b
 * 
 *     def generate(self, n):             # <<<<<<<<<<<<<<
 *         data = self.b.read1(n)
 *         if not data:
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_14_ByteIOWrapper_3generate, 0, __pyx_n_s_ByteIOWrapper_generate, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__56)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_generate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "nghttp2.pyx":272
 * DATA_DEFERRED = 2
 * 
 * class _ByteIOWrapper:             # <<<<<<<<<<<<<<
 * 
 *     def __init__(self, b):
 */
  __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_ByteIOWrapper, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_1);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_ByteIOWrapper, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":283
 *         return data, DATA_OK
 * 
 * def wrap_body(body):             # <<<<<<<<<<<<<<
 *     if body is None:
 *         return body
 */
  __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_3wrap_body, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_wrap_body, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /* "nghttp2.pyx":670
 *         self.send_data()
 * 
 *     OUTBUF_MAX = 65535             # <<<<<<<<<<<<<<
 *     SETTINGS_TIMEOUT = 5.0
 * 
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCoreBase->tp_dict, __pyx_n_s_OUTBUF_MAX, __pyx_int_65535) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_7nghttp2__HTTP2SessionCoreBase);

  /* "nghttp2.pyx":671
 * 
 *     OUTBUF_MAX = 65535
 *     SETTINGS_TIMEOUT = 5.0             # <<<<<<<<<<<<<<
 * 
 *     def send_data(self):
 */
  if (PyDict_SetItem((PyObject *)__pyx_ptype_7nghttp2__HTTP2SessionCoreBase->tp_dict, __pyx_n_s_SETTINGS_TIMEOUT, __pyx_float_5_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  PyType_Modified(__pyx_ptype_7nghttp2__HTTP2SessionCoreBase);

  /* "nghttp2.pyx":723
 * 
 *     def _rst_stream(self, stream_id,
 *                    error_code=cnghttp2.NGHTTP2_INTERNAL_ERROR):             # <<<<<<<<<<<<<<
 *         cdef int rv
 * 
 */
  __pyx_t_7 = PyInt_FromLong(NGHTTP2_INTERNAL_ERROR); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 723; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_k__8 = __pyx_t_7;
  __Pyx_GIVEREF(__pyx_t_7);
  __pyx_t_7 = 0;

  /* "nghttp2.pyx":1031
 *                               error_code=cnghttp2.NGHTTP2_NO_ERROR)
 * 
 * if asyncio:             # <<<<<<<<<<<<<<
 * 
 *     class BaseRequestHandler:
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1031; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  if (__pyx_t_8) {

    /* "nghttp2.pyx":1033
 * if asyncio:
 * 
 *     class BaseRequestHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 request (stream) handler base class.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BaseRequestHandler, __pyx_n_s_BaseRequestHandler, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_request_stream_handler_ba); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1087
 *         """
 * 
 *         def __init__(self, http2, stream_id):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_1__init__, 0, __pyx_n_s_BaseRequestHandler___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__60)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1111
 * 
 *         @property
 *         def client_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_3client_address, 0, __pyx_n_s_BaseRequestHandler_client_addres, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1110
 *             self.pushed = False
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def client_address(self):
 *             return self.remote_address
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_client_address, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1115
 * 
 *         @property
 *         def client_certificate(self):             # <<<<<<<<<<<<<<
 *             return self._client_certificate
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_5client_certificate, 0, __pyx_n_s_BaseRequestHandler_client_certif, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1114
 *             return self.remote_address
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def client_certificate(self):
 *             return self._client_certificate
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_client_certificate, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1118
 *             return self._client_certificate
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when request HEADERS is arrived.
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_7on_headers, 0, __pyx_n_s_BaseRequestHandler_on_headers, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__66)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_headers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1125
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of request body is arrived. This method
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_9on_data, 0, __pyx_n_s_BaseRequestHandler_on_data, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__68)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1125; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1133
 *             pass
 * 
 *         def on_request_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole request was received
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_11on_request_done, 0, __pyx_n_s_BaseRequestHandler_on_request_do, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__70)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_request_done, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1140
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_13on_close, 0, __pyx_n_s_BaseRequestHandler_on_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__72)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_close, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1147
 *             pass
 * 
 *         def send_response(self, status=200, headers=None, body=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Send response. The status is HTTP status code. The headers is
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_15send_response, 0, __pyx_n_s_BaseRequestHandler_send_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__74)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__75);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_send_response, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1147; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1192
 *             self.http2.send_response(self)
 * 
 *         def push(self, path, method='GET', request_headers=None,             # <<<<<<<<<<<<<<
 *                  status=200, headers=None, body=None):
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_17push, 0, __pyx_n_s_BaseRequestHandler_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__77)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__78);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_push, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1192; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1247
 *             return self.http2.push(self, promised_handler)
 * 
 *         def _set_response_prop(self, status, headers, body):             # <<<<<<<<<<<<<<
 *             self.status = status
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_19_set_response_prop, 0, __pyx_n_s_BaseRequestHandler__set_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__80)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_set_response_prop, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1258
 *             self.response_body = body
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_18BaseRequestHandler_21resume, 0, __pyx_n_s_BaseRequestHandler_resume, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__82)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_resume, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1033
 * if asyncio:
 * 
 *     class BaseRequestHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 request (stream) handler base class.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BaseRequestHandler, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseRequestHandler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1261
 *             self.http2.resume(self.stream_id)
 * 
 *     def _encode_headers(headers):             # <<<<<<<<<<<<<<
 *         if not headers:
 *             return []
 */
    __pyx_t_7 = PyCFunction_NewEx(&__pyx_mdef_7nghttp2_5_encode_headers, NULL, __pyx_n_s_nghttp2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_headers, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1261; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1268
 *                 for k, v in headers]
 * 
 *     class _HTTP2Session(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, RequestHandlerClass):
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_HTTP2Session, __pyx_n_s_HTTP2Session, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1270
 *     class _HTTP2Session(asyncio.Protocol):
 * 
 *         def __init__(self, RequestHandlerClass):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.RequestHandlerClass = RequestHandlerClass
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_13_HTTP2Session_1__init__, 0, __pyx_n_s_HTTP2Session___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__86)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1275
 *             self.http2 = None
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_13_HTTP2Session_3connection_made, 0, __pyx_n_s_HTTP2Session_connection_made, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__88)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_connection_made, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1303
 * 
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_13_HTTP2Session_5connection_lost, 0, __pyx_n_s_HTTP2Session_connection_lost, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__90)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_connection_lost, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1303; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1309
 *                 self.http2 = None
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_13_HTTP2Session_7data_received, 0, __pyx_n_s_HTTP2Session_data_received, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__92)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_data_received, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1317
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_13_HTTP2Session_9resume_writing, 0, __pyx_n_s_HTTP2Session_resume_writing, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__94)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_resume_writing, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1317; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1268
 *                 for k, v in headers]
 * 
 *     class _HTTP2Session(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, RequestHandlerClass):
 */
    __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_HTTP2Session, __pyx_t_7, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Session, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1268; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1325
 *                 return
 * 
 *     class HTTP2Server:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 server.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HTTP2Server, __pyx_n_s_HTTP2Server, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_server_This_class_builds); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1334
 * 
 *         '''
 *         def __init__(self, address, RequestHandlerClass, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the listening address and port (e.g.,
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Server_1__init__, 0, __pyx_n_s_HTTP2Server___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__96)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__97);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1358
 *             logging.info('listen, address:%s, port:%s', address[0], address[1])
 * 
 *         def serve_forever(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.loop.run_forever()
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Server_3serve_forever, 0, __pyx_n_s_HTTP2Server_serve_forever, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__99)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_serve_forever, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1325
 *                 return
 * 
 *     class HTTP2Server:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 server.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HTTP2Server, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Server, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1325; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1367
 * 
 * 
 *     class BaseResponseHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 response (stream) handler base class.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_BaseResponseHandler, __pyx_n_s_BaseResponseHandler, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_response_stream_handler_b); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1419
 *         """
 * 
 *         def __init__(self, http2=None, stream_id=-1):             # <<<<<<<<<<<<<<
 *             self.headers = []
 *             self.cookies = []
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_1__init__, 0, __pyx_n_s_BaseResponseHandler___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__101)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__102);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1419; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1441
 * 
 *         @property
 *         def server_address(self):             # <<<<<<<<<<<<<<
 *             return self.remote_address
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_3server_address, 0, __pyx_n_s_BaseResponseHandler_server_addre, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__104)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1440
 *             self.pushed = False
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def server_address(self):
 *             return self.remote_address
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1440; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_server_address, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1441; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1444
 *             return self.remote_address
 * 
 *         def on_headers(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when response HEADERS is arrived.
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_5on_headers, 0, __pyx_n_s_BaseResponseHandler_on_headers, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__106)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_headers, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1444; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1451
 *             pass
 * 
 *         def on_data(self, data):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a chunk of response body is arrived. This method
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_7on_data, 0, __pyx_n_s_BaseResponseHandler_on_data, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__108)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_data, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1459
 *             pass
 * 
 *         def on_response_done(self):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when whole response was received
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_9on_response_done, 0, __pyx_n_s_BaseResponseHandler_on_response, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__110)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_response_done, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1466
 *             pass
 * 
 *         def on_close(self, error_code):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when stream is about to close.
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_11on_close, 0, __pyx_n_s_BaseResponseHandler_on_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__112)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_close, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1466; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1473
 *             pass
 * 
 *         def on_push_promise(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Called when a push is promised. Default behavior is to
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_13on_push_promise, 0, __pyx_n_s_BaseResponseHandler_on_push_prom, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__114)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_on_push_promise, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1473; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1482
 *             self.reject_push(push_promise)
 * 
 *         def reject_push(self, push_promise):             # <<<<<<<<<<<<<<
 * 
 *             '''Convenience method equivalent to calling accept_push
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_15reject_push, 0, __pyx_n_s_BaseResponseHandler_reject_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__116)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_reject_push, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1482; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1490
 *             self.http2.push(push_promise, None)
 * 
 *         def accept_push(self, push_promise, handler=None):             # <<<<<<<<<<<<<<
 * 
 *             '''Accept a push_promise and provider a handler for the
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_17accept_push, 0, __pyx_n_s_BaseResponseHandler_accept_push, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__118)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__119);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_accept_push, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1490; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1499
 *             self.http2.push(push_promise, handler)
 * 
 *         def resume(self):             # <<<<<<<<<<<<<<
 *             self.http2.resume(self.stream_id)
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19BaseResponseHandler_19resume, 0, __pyx_n_s_BaseResponseHandler_resume, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__121)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_resume, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1499; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1367
 * 
 * 
 *     class BaseResponseHandler:             # <<<<<<<<<<<<<<
 * 
 *         """HTTP/2 response (stream) handler base class.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_BaseResponseHandler, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_BaseResponseHandler, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1502
 *             self.http2.resume(self.stream_id)
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, client):
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_asyncio); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_Protocol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);
    PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_7, __pyx_n_s_HTTP2ClientSession, __pyx_n_s_HTTP2ClientSession, (PyObject *) NULL, __pyx_n_s_nghttp2, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);

    /* "nghttp2.pyx":1504
 *     class _HTTP2ClientSession(asyncio.Protocol):
 * 
 *         def __init__(self, client):             # <<<<<<<<<<<<<<
 *             asyncio.Protocol.__init__(self)
 *             self.http2 = None
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_1__init__, 0, __pyx_n_s_HTTP2ClientSession___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__123)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_init, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1510
 *             self.client = client
 * 
 *         def connection_made(self, transport):             # <<<<<<<<<<<<<<
 *             address = transport.get_extra_info('peername')
 *             logging.info('connection_made, address:%s, port:%s', address[0], address[1])
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_3connection_made, 0, __pyx_n_s_HTTP2ClientSession_connection_m, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__125)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_connection_made, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1510; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1535
 *             self.http2.send_data()
 * 
 *         def connection_lost(self, exc):             # <<<<<<<<<<<<<<
 *             logging.info('connection_lost')
 *             if self.http2:
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_5connection_lost, 0, __pyx_n_s_HTTP2ClientSession_connection_l, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__127)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_connection_lost, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1535; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1541
 *             self.client.close()
 * 
 *         def data_received(self, data):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.data_received(data)
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_7data_received, 0, __pyx_n_s_HTTP2ClientSession_data_receive, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__129)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_data_received, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1541; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1549
 *                 return
 * 
 *         def resume_writing(self):             # <<<<<<<<<<<<<<
 *             try:
 *                 self.http2.send_data()
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_9resume_writing, 0, __pyx_n_s_HTTP2ClientSession_resume_writi, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__131)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_resume_writing, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1549; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1557
 *                 return
 * 
 *         def send_request(self, method, scheme, host, path, headers, body, handler):             # <<<<<<<<<<<<<<
 *             try:
 * 		# Waiting until connection established
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_11send_request, 0, __pyx_n_s_HTTP2ClientSession_send_request, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__133)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_send_request, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1557; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1572
 *                 return
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             if self.http2:
 *                 self.http2.close()
 */
    __pyx_t_9 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_19_HTTP2ClientSession_13close, 0, __pyx_n_s_HTTP2ClientSession_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__135)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyObject_SetItem(__pyx_t_2, __pyx_n_s_close, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1572; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;

    /* "nghttp2.pyx":1502
 *             self.http2.resume(self.stream_id)
 * 
 *     class _HTTP2ClientSession(asyncio.Protocol):             # <<<<<<<<<<<<<<
 * 
 *         def __init__(self, client):
 */
    __pyx_t_9 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_HTTP2ClientSession, __pyx_t_7, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2ClientSession, __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1502; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "nghttp2.pyx":1577
 * 
 * 
 *     class HTTP2Client:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 client.
 */
    __pyx_t_7 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_HTTP2Client, __pyx_n_s_HTTP2Client, (PyObject *) NULL, __pyx_n_s_nghttp2, __pyx_kp_s_HTTP_2_client_This_class_builds); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_7);

    /* "nghttp2.pyx":1584
 * 
 *         '''
 *         def __init__(self, address, loop=None, ssl=None):             # <<<<<<<<<<<<<<
 * 
 *             '''address is a tuple of the connect address and port (e.g.,
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Client_1__init__, 0, __pyx_n_s_HTTP2Client___init, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__138)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__139);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_init, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1584; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1617
 * 
 *         @property
 *         def io_loop(self):             # <<<<<<<<<<<<<<
 *             return self.loop
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Client_3io_loop, 0, __pyx_n_s_HTTP2Client_io_loop, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__141)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);

    /* "nghttp2.pyx":1616
 *             logging.info('connect, address:%s, port:%s', self.address[0], self.address[1])
 * 
 *         @property             # <<<<<<<<<<<<<<
 *         def io_loop(self):
 *             return self.loop
 */
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_1);
    __pyx_t_1 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1616; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_io_loop, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1617; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1620
 *             return self.loop
 * 
 *         def close(self):             # <<<<<<<<<<<<<<
 *             self.session.close()
 * 
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Client_5close, 0, __pyx_n_s_HTTP2Client_close, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__143)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_close, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1620; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1623
 *             self.session.close()
 * 
 *         def send_request(self, method='GET', url='/', headers=None, body=None, handler=None):             # <<<<<<<<<<<<<<
 *             url = urlparse(url)
 *             scheme = url.scheme if url.scheme else self.scheme
 */
    __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_7nghttp2_11HTTP2Client_7send_request, 0, __pyx_n_s_HTTP2Client_send_request, NULL, __pyx_n_s_nghttp2, __pyx_d, ((PyObject *)__pyx_codeobj__145)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_1, __pyx_tuple__146);
    if (PyObject_SetItem(__pyx_t_7, __pyx_n_s_send_request, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1623; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

    /* "nghttp2.pyx":1577
 * 
 * 
 *     class HTTP2Client:             # <<<<<<<<<<<<<<
 * 
 *         '''HTTP/2 client.
 */
    __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_HTTP2Client, __pyx_empty_tuple, __pyx_t_7, NULL, 0, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_GOTREF(__pyx_t_1);
    if (PyDict_SetItem(__pyx_d, __pyx_n_s_HTTP2Client, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1577; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    goto __pyx_L12;
  }
  __pyx_L12:;

  /* "nghttp2.pyx":1
 * # nghttp2 - HTTP/2 C Library             # <<<<<<<<<<<<<<
 * 
 * # Copyright (c) 2013 Tatsuhiro Tsujikawa
 */
  __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_GOTREF(__pyx_t_7);
  if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

  /*--- Wrapped vars code ---*/

  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  if (__pyx_m) {
    if (__pyx_d) {
      __Pyx_AddTraceback("init nghttp2", __pyx_clineno, __pyx_lineno, __pyx_filename);
    }
    Py_DECREF(__pyx_m); __pyx_m = 0;
  } else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_ImportError, "init nghttp2");
  }
  __pyx_L0:;
  __Pyx_RefNannyFinishContext();
  #if PY_MAJOR_VERSION < 3
  return;
  #else
  return __pyx_m;
  #endif
}

/* --- Runtime support code --- */
#if CYTHON_REFNANNY
static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
    PyObject *m = NULL, *p = NULL;
    void *r = NULL;
    m = PyImport_ImportModule((char *)modname);
    if (!m) goto end;
    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
    if (!p) goto end;
    r = PyLong_AsVoidPtr(p);
end:
    Py_XDECREF(p);
    Py_XDECREF(m);
    return (__Pyx_RefNannyAPIStruct *)r;
}
#endif

static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
    PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
    if (unlikely(!result)) {
        PyErr_Format(PyExc_NameError,
#if PY_MAJOR_VERSION >= 3
            "name '%U' is not defined", name);
#else
            "name '%.200s' is not defined", PyString_AS_STRING(name));
#endif
    }
    return result;
}

static void __Pyx_RaiseArgtupleInvalid(
    const char* func_name,
    int exact,
    Py_ssize_t num_min,
    Py_ssize_t num_max,
    Py_ssize_t num_found)
{
    Py_ssize_t num_expected;
    const char *more_or_less;
    if (num_found < num_min) {
        num_expected = num_min;
        more_or_less = "at least";
    } else {
        num_expected = num_max;
        more_or_less = "at most";
    }
    if (exact) {
        more_or_less = "exactly";
    }
    PyErr_Format(PyExc_TypeError,
                 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
                 func_name, more_or_less, num_expected,
                 (num_expected == 1) ? "" : "s", num_found);
}

static void __Pyx_RaiseDoubleKeywordsError(
    const char* func_name,
    PyObject* kw_name)
{
    PyErr_Format(PyExc_TypeError,
        #if PY_MAJOR_VERSION >= 3
        "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
        #else
        "%s() got multiple values for keyword argument '%s'", func_name,
        PyString_AsString(kw_name));
        #endif
}

static int __Pyx_ParseOptionalKeywords(
    PyObject *kwds,
    PyObject **argnames[],
    PyObject *kwds2,
    PyObject *values[],
    Py_ssize_t num_pos_args,
    const char* function_name)
{
    PyObject *key = 0, *value = 0;
    Py_ssize_t pos = 0;
    PyObject*** name;
    PyObject*** first_kw_arg = argnames + num_pos_args;
    while (PyDict_Next(kwds, &pos, &key, &value)) {
        name = first_kw_arg;
        while (*name && (**name != key)) name++;
        if (*name) {
            values[name-argnames] = value;
            continue;
        }
        name = first_kw_arg;
        #if PY_MAJOR_VERSION < 3
        if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
            while (*name) {
                if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
                        && _PyString_Eq(**name, key)) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    if ((**argname == key) || (
                            (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
                             && _PyString_Eq(**argname, key))) {
                        goto arg_passed_twice;
                    }
                    argname++;
                }
            }
        } else
        #endif
        if (likely(PyUnicode_Check(key))) {
            while (*name) {
                int cmp = (**name == key) ? 0 :
                #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                    (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
                #endif
                    PyUnicode_Compare(**name, key);
                if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                if (cmp == 0) {
                    values[name-argnames] = value;
                    break;
                }
                name++;
            }
            if (*name) continue;
            else {
                PyObject*** argname = argnames;
                while (argname != first_kw_arg) {
                    int cmp = (**argname == key) ? 0 :
                    #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
                        (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
                    #endif
                        PyUnicode_Compare(**argname, key);
                    if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
                    if (cmp == 0) goto arg_passed_twice;
                    argname++;
                }
            }
        } else
            goto invalid_keyword_type;
        if (kwds2) {
            if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
        } else {
            goto invalid_keyword;
        }
    }
    return 0;
arg_passed_twice:
    __Pyx_RaiseDoubleKeywordsError(function_name, key);
    goto bad;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    goto bad;
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
bad:
    return -1;
}

static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
    PyObject *result;
#if CYTHON_COMPILING_IN_CPYTHON
    result = PyDict_GetItem(__pyx_d, name);
    if (likely(result)) {
        Py_INCREF(result);
    } else {
#else
    result = PyObject_GetItem(__pyx_d, name);
    if (!result) {
        PyErr_Clear();
#endif
        result = __Pyx_GetBuiltinName(name);
    }
    return result;
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyObject *result;
    ternaryfunc call = func->ob_type->tp_call;
    if (unlikely(!call))
        return PyObject_Call(func, arg, kw);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = (*call)(func, arg, kw);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->curexc_type;
    tmp_value = tstate->curexc_value;
    tmp_tb = tstate->curexc_traceback;
    tstate->curexc_type = type;
    tstate->curexc_value = value;
    tstate->curexc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_Restore(type, value, tb);
#endif
}
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->curexc_type;
    *value = tstate->curexc_value;
    *tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(type, value, tb);
#endif
}

#if PY_MAJOR_VERSION < 3
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
                        CYTHON_UNUSED PyObject *cause) {
    Py_XINCREF(type);
    if (!value || value == Py_None)
        value = NULL;
    else
        Py_INCREF(value);
    if (!tb || tb == Py_None)
        tb = NULL;
    else {
        Py_INCREF(tb);
        if (!PyTraceBack_Check(tb)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: arg 3 must be a traceback or None");
            goto raise_error;
        }
    }
    if (PyType_Check(type)) {
#if CYTHON_COMPILING_IN_PYPY
        if (!value) {
            Py_INCREF(Py_None);
            value = Py_None;
        }
#endif
        PyErr_NormalizeException(&type, &value, &tb);
    } else {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        value = type;
        type = (PyObject*) Py_TYPE(type);
        Py_INCREF(type);
        if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
            PyErr_SetString(PyExc_TypeError,
                "raise: exception class must be a subclass of BaseException");
            goto raise_error;
        }
    }
    __Pyx_ErrRestore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}
#else
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
    PyObject* owned_instance = NULL;
    if (tb == Py_None) {
        tb = 0;
    } else if (tb && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto bad;
    }
    if (value == Py_None)
        value = 0;
    if (PyExceptionInstance_Check(type)) {
        if (value) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto bad;
        }
        value = type;
        type = (PyObject*) Py_TYPE(value);
    } else if (PyExceptionClass_Check(type)) {
        PyObject *instance_class = NULL;
        if (value && PyExceptionInstance_Check(value)) {
            instance_class = (PyObject*) Py_TYPE(value);
            if (instance_class != type) {
                if (PyObject_IsSubclass(instance_class, type)) {
                    type = instance_class;
                } else {
                    instance_class = NULL;
                }
            }
        }
        if (!instance_class) {
            PyObject *args;
            if (!value)
                args = PyTuple_New(0);
            else if (PyTuple_Check(value)) {
                Py_INCREF(value);
                args = value;
            } else
                args = PyTuple_Pack(1, value);
            if (!args)
                goto bad;
            owned_instance = PyObject_Call(type, args, NULL);
            Py_DECREF(args);
            if (!owned_instance)
                goto bad;
            value = owned_instance;
            if (!PyExceptionInstance_Check(value)) {
                PyErr_Format(PyExc_TypeError,
                             "calling %R should have returned an instance of "
                             "BaseException, not %R",
                             type, Py_TYPE(value));
                goto bad;
            }
        }
    } else {
        PyErr_SetString(PyExc_TypeError,
            "raise: exception class must be a subclass of BaseException");
        goto bad;
    }
#if PY_VERSION_HEX >= 0x03030000
    if (cause) {
#else
    if (cause && cause != Py_None) {
#endif
        PyObject *fixed_cause;
        if (cause == Py_None) {
            fixed_cause = NULL;
        } else if (PyExceptionClass_Check(cause)) {
            fixed_cause = PyObject_CallObject(cause, NULL);
            if (fixed_cause == NULL)
                goto bad;
        } else if (PyExceptionInstance_Check(cause)) {
            fixed_cause = cause;
            Py_INCREF(fixed_cause);
        } else {
            PyErr_SetString(PyExc_TypeError,
                            "exception causes must derive from "
                            "BaseException");
            goto bad;
        }
        PyException_SetCause(value, fixed_cause);
    }
    PyErr_SetObject(type, value);
    if (tb) {
#if CYTHON_COMPILING_IN_PYPY
        PyObject *tmp_type, *tmp_value, *tmp_tb;
        PyErr_Fetch(tmp_type, tmp_value, tmp_tb);
        Py_INCREF(tb);
        PyErr_Restore(tmp_type, tmp_value, tb);
        Py_XDECREF(tmp_tb);
#else
        PyThreadState *tstate = PyThreadState_GET();
        PyObject* tmp_tb = tstate->curexc_traceback;
        if (tb != tmp_tb) {
            Py_INCREF(tb);
            tstate->curexc_traceback = tb;
            Py_XDECREF(tmp_tb);
        }
#endif
    }
bad:
    Py_XDECREF(owned_instance);
    return;
}
#endif

static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
    PyErr_Format(PyExc_ValueError,
                 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
}

static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
    PyErr_Format(PyExc_ValueError,
                 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
                 index, (index == 1) ? "" : "s");
}

static CYTHON_INLINE int __Pyx_IterFinish(void) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    PyObject* exc_type = tstate->curexc_type;
    if (unlikely(exc_type)) {
        if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) {
            PyObject *exc_value, *exc_tb;
            exc_value = tstate->curexc_value;
            exc_tb = tstate->curexc_traceback;
            tstate->curexc_type = 0;
            tstate->curexc_value = 0;
            tstate->curexc_traceback = 0;
            Py_DECREF(exc_type);
            Py_XDECREF(exc_value);
            Py_XDECREF(exc_tb);
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#else
    if (unlikely(PyErr_Occurred())) {
        if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
            PyErr_Clear();
            return 0;
        } else {
            return -1;
        }
    }
    return 0;
#endif
}

static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
    if (unlikely(retval)) {
        Py_DECREF(retval);
        __Pyx_RaiseTooManyValuesError(expected);
        return -1;
    } else {
        return __Pyx_IterFinish();
    }
    return 0;
}

static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *local_type, *local_value, *local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    local_type = tstate->curexc_type;
    local_value = tstate->curexc_value;
    local_tb = tstate->curexc_traceback;
    tstate->curexc_type = 0;
    tstate->curexc_value = 0;
    tstate->curexc_traceback = 0;
#else
    PyErr_Fetch(&local_type, &local_value, &local_tb);
#endif
    PyErr_NormalizeException(&local_type, &local_value, &local_tb);
#if CYTHON_COMPILING_IN_CPYTHON
    if (unlikely(tstate->curexc_type))
#else
    if (unlikely(PyErr_Occurred()))
#endif
        goto bad;
    #if PY_MAJOR_VERSION >= 3
    if (local_tb) {
        if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
            goto bad;
    }
    #endif
    Py_XINCREF(local_tb);
    Py_XINCREF(local_type);
    Py_XINCREF(local_value);
    *type = local_type;
    *value = local_value;
    *tb = local_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = local_type;
    tstate->exc_value = local_value;
    tstate->exc_traceback = local_tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(local_type, local_value, local_tb);
#endif
    return 0;
bad:
    *type = 0;
    *value = 0;
    *tb = 0;
    Py_XDECREF(local_type);
    Py_XDECREF(local_value);
    Py_XDECREF(local_tb);
    return -1;
}

static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) {
    PyObject *tmp_type, *tmp_value, *tmp_tb;
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = *type;
    tstate->exc_value = *value;
    tstate->exc_traceback = *tb;
#else
    PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb);
    PyErr_SetExcInfo(*type, *value, *tb);
#endif
    *type = tmp_type;
    *value = tmp_value;
    *tb = tmp_tb;
}

static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyThreadState *tstate = PyThreadState_GET();
    *type = tstate->exc_type;
    *value = tstate->exc_value;
    *tb = tstate->exc_traceback;
    Py_XINCREF(*type);
    Py_XINCREF(*value);
    Py_XINCREF(*tb);
#else
    PyErr_GetExcInfo(type, value, tb);
#endif
}
static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject *tmp_type, *tmp_value, *tmp_tb;
    PyThreadState *tstate = PyThreadState_GET();
    tmp_type = tstate->exc_type;
    tmp_value = tstate->exc_value;
    tmp_tb = tstate->exc_traceback;
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    Py_XDECREF(tmp_type);
    Py_XDECREF(tmp_value);
    Py_XDECREF(tmp_tb);
#else
    PyErr_SetExcInfo(type, value, tb);
#endif
}

static CYTHON_INLINE int __Pyx_CheckKeywordStrings(
    PyObject *kwdict,
    const char* function_name,
    int kw_allowed)
{
    PyObject* key = 0;
    Py_ssize_t pos = 0;
#if CYTHON_COMPILING_IN_PYPY
    if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0))
        goto invalid_keyword;
    return 1;
#else
    while (PyDict_Next(kwdict, &pos, &key, 0)) {
        #if PY_MAJOR_VERSION < 3
        if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key)))
        #endif
            if (unlikely(!PyUnicode_Check(key)))
                goto invalid_keyword_type;
    }
    if ((!kw_allowed) && unlikely(key))
        goto invalid_keyword;
    return 1;
invalid_keyword_type:
    PyErr_Format(PyExc_TypeError,
        "%.200s() keywords must be strings", function_name);
    return 0;
#endif
invalid_keyword:
    PyErr_Format(PyExc_TypeError,
    #if PY_MAJOR_VERSION < 3
        "%.200s() got an unexpected keyword argument '%.200s'",
        function_name, PyString_AsString(key));
    #else
        "%s() got an unexpected keyword argument '%U'",
        function_name, key);
    #endif
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_decode_c_string(
         const char* cstring, Py_ssize_t start, Py_ssize_t stop,
         const char* encoding, const char* errors,
         PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)) {
    Py_ssize_t length;
    if (unlikely((start < 0) | (stop < 0))) {
        length = strlen(cstring);
        if (start < 0) {
            start += length;
            if (start < 0)
                start = 0;
        }
        if (stop < 0)
            stop += length;
    }
    length = stop - start;
    if (unlikely(length <= 0))
        return PyUnicode_FromUnicode(NULL, 0);
    cstring += start;
    if (decode_func) {
        return decode_func(cstring, length, errors);
    } else {
        return PyUnicode_Decode(cstring, length, encoding, errors);
    }
}

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
    PyObject *self, *result;
    PyCFunction cfunc;
    cfunc = PyCFunction_GET_FUNCTION(func);
    self = PyCFunction_GET_SELF(func);
    if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
        return NULL;
    result = cfunc(self, arg);
    Py_LeaveRecursiveCall();
    if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
        PyErr_SetString(
            PyExc_SystemError,
            "NULL result without error in PyObject_Call");
    }
    return result;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject *result;
    PyObject *args = PyTuple_New(1);
    if (unlikely(!args)) return NULL;
    Py_INCREF(arg);
    PyTuple_SET_ITEM(args, 0, arg);
    result = __Pyx_PyObject_Call(func, args, NULL);
    Py_DECREF(args);
    return result;
}
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
            return __Pyx_PyObject_CallMethO(func, arg);
        }
    }
    return __Pyx__PyObject_CallOneArg(func, arg);
}
#else
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
    PyObject* args = PyTuple_Pack(1, arg);
    return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL;
}
#endif

#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
#ifdef __Pyx_CyFunction_USED
    if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
#else
    if (likely(PyCFunction_Check(func))) {
#endif
        if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
            return __Pyx_PyObject_CallMethO(func, NULL);
        }
    }
    return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
}
#endif

static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno,
                                  CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename,
                                  int full_traceback) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    __Pyx_ErrFetch(&old_exc, &old_val, &old_tb);
    if (full_traceback) {
        Py_XINCREF(old_exc);
        Py_XINCREF(old_val);
        Py_XINCREF(old_tb);
        __Pyx_ErrRestore(old_exc, old_val, old_tb);
        PyErr_PrintEx(1);
    }
    #if PY_MAJOR_VERSION < 3
    ctx = PyString_FromString(name);
    #else
    ctx = PyUnicode_FromString(name);
    #endif
    __Pyx_ErrRestore(old_exc, old_val, old_tb);
    if (!ctx) {
        PyErr_WriteUnraisable(Py_None);
    } else {
        PyErr_WriteUnraisable(ctx);
        Py_DECREF(ctx);
    }
}

static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) {
    PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname);
}

static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
#if CYTHON_COMPILING_IN_PYPY
    return PyObject_RichCompareBool(s1, s2, equals);
#else
    if (s1 == s2) {
        return (equals == Py_EQ);
    } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
        const char *ps1, *ps2;
        Py_ssize_t length = PyBytes_GET_SIZE(s1);
        if (length != PyBytes_GET_SIZE(s2))
            return (equals == Py_NE);
        ps1 = PyBytes_AS_STRING(s1);
        ps2 = PyBytes_AS_STRING(s2);
        if (ps1[0] != ps2[0]) {
            return (equals == Py_NE);
        } else if (length == 1) {
            return (equals == Py_EQ);
        } else {
            int result = memcmp(ps1, ps2, (size_t)length);
            return (equals == Py_EQ) ? (result == 0) : (result != 0);
        }
    } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
        return (equals == Py_NE);
    } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
        return (equals == Py_NE);
    } else {
        int result;
        PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
        if (!py_result)
            return -1;
        result = __Pyx_PyObject_IsTrue(py_result);
        Py_DECREF(py_result);
        return result;
    }
#endif
}

static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
    PyObject *r;
    if (!j) return NULL;
    r = PyObject_GetItem(o, j);
    Py_DECREF(j);
    return r;
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
        PyObject *r = PyList_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
    if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
        PyObject *r = PyTuple_GET_ITEM(o, i);
        Py_INCREF(r);
        return r;
    }
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
#else
    return PySequence_GetItem(o, i);
#endif
}
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck) {
#if CYTHON_COMPILING_IN_CPYTHON
    if (is_list || PyList_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
        if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
            PyObject *r = PyList_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    }
    else if (PyTuple_CheckExact(o)) {
        Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
        if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
            PyObject *r = PyTuple_GET_ITEM(o, n);
            Py_INCREF(r);
            return r;
        }
    } else {
        PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
        if (likely(m && m->sq_item)) {
            if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
                Py_ssize_t l = m->sq_length(o);
                if (likely(l >= 0)) {
                    i += l;
                } else {
                    if (PyErr_ExceptionMatches(PyExc_OverflowError))
                        PyErr_Clear();
                    else
                        return NULL;
                }
            }
            return m->sq_item(o, i);
        }
    }
#else
    if (is_list || PySequence_Check(o)) {
        return PySequence_GetItem(o, i);
    }
#endif
    return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}

static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
    PyObject *method, *result = NULL;
    method = __Pyx_PyObject_GetAttrStr(obj, method_name);
    if (unlikely(!method)) goto bad;
#if CYTHON_COMPILING_IN_CPYTHON
    if (likely(PyMethod_Check(method))) {
        PyObject *self = PyMethod_GET_SELF(method);
        if (likely(self)) {
            PyObject *args;
            PyObject *function = PyMethod_GET_FUNCTION(method);
            args = PyTuple_New(2);
            if (unlikely(!args)) goto bad;
            Py_INCREF(self);
            PyTuple_SET_ITEM(args, 0, self);
            Py_INCREF(arg);
            PyTuple_SET_ITEM(args, 1, arg);
            Py_INCREF(function);
            Py_DECREF(method); method = NULL;
            result = __Pyx_PyObject_Call(function, args, NULL);
            Py_DECREF(args);
            Py_DECREF(function);
            return result;
        }
    }
#endif
    result = __Pyx_PyObject_CallOneArg(method, arg);
bad:
    Py_XDECREF(method);
    return result;
}

static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
    if (likely(PyList_CheckExact(L))) {
        if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
    } else {
        PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
        if (unlikely(!retval))
            return -1;
        Py_DECREF(retval);
    }
    return 0;
}

#if !CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyBytes_Join(PyObject* sep, PyObject* values) {
    return PyObject_CallMethodObjArgs(sep, __pyx_n_s_join, values, NULL);
}
#endif

static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
}

static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
    PyObject* fake_module;
    PyTypeObject* cached_type = NULL;
    fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
    if (!fake_module) return NULL;
    Py_INCREF(fake_module);
    cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
    if (cached_type) {
        if (!PyType_Check((PyObject*)cached_type)) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s is not a type object",
                type->tp_name);
            goto bad;
        }
        if (cached_type->tp_basicsize != type->tp_basicsize) {
            PyErr_Format(PyExc_TypeError,
                "Shared Cython type %.200s has the wrong size, try recompiling",
                type->tp_name);
            goto bad;
        }
    } else {
        if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
        PyErr_Clear();
        if (PyType_Ready(type) < 0) goto bad;
        if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
            goto bad;
        Py_INCREF(type);
        cached_type = type;
    }
done:
    Py_DECREF(fake_module);
    return cached_type;
bad:
    Py_XDECREF(cached_type);
    cached_type = NULL;
    goto done;
}

static PyObject *
__Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
{
    if (unlikely(op->func_doc == NULL)) {
        if (op->func.m_ml->ml_doc) {
#if PY_MAJOR_VERSION >= 3
            op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
#else
            op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
#endif
            if (unlikely(op->func_doc == NULL))
                return NULL;
        } else {
            Py_INCREF(Py_None);
            return Py_None;
        }
    }
    Py_INCREF(op->func_doc);
    return op->func_doc;
}
static int
__Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp = op->func_doc;
    if (value == NULL) {
        value = Py_None;
    }
    Py_INCREF(value);
    op->func_doc = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_name == NULL)) {
#if PY_MAJOR_VERSION >= 3
        op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
#else
        op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
#endif
        if (unlikely(op->func_name == NULL))
            return NULL;
    }
    Py_INCREF(op->func_name);
    return op->func_name;
}
static int
__Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__name__ must be set to a string object");
        return -1;
    }
    tmp = op->func_name;
    Py_INCREF(value);
    op->func_name = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_qualname);
    return op->func_qualname;
}
static int
__Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
#if PY_MAJOR_VERSION >= 3
    if (unlikely(value == NULL || !PyUnicode_Check(value))) {
#else
    if (unlikely(value == NULL || !PyString_Check(value))) {
#endif
        PyErr_SetString(PyExc_TypeError,
                        "__qualname__ must be set to a string object");
        return -1;
    }
    tmp = op->func_qualname;
    Py_INCREF(value);
    op->func_qualname = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
{
    PyObject *self;
    self = m->func_closure;
    if (self == NULL)
        self = Py_None;
    Py_INCREF(self);
    return self;
}
static PyObject *
__Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
{
    if (unlikely(op->func_dict == NULL)) {
        op->func_dict = PyDict_New();
        if (unlikely(op->func_dict == NULL))
            return NULL;
    }
    Py_INCREF(op->func_dict);
    return op->func_dict;
}
static int
__Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
{
    PyObject *tmp;
    if (unlikely(value == NULL)) {
        PyErr_SetString(PyExc_TypeError,
               "function's dictionary may not be deleted");
        return -1;
    }
    if (unlikely(!PyDict_Check(value))) {
        PyErr_SetString(PyExc_TypeError,
               "setting function's dictionary to a non-dict");
        return -1;
    }
    tmp = op->func_dict;
    Py_INCREF(value);
    op->func_dict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
{
    Py_INCREF(op->func_globals);
    return op->func_globals;
}
static PyObject *
__Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
{
    Py_INCREF(Py_None);
    return Py_None;
}
static PyObject *
__Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
{
    PyObject* result = (op->func_code) ? op->func_code : Py_None;
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
    PyObject *res = op->defaults_getter((PyObject *) op);
    if (unlikely(!res))
        return -1;
    op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
    Py_INCREF(op->defaults_tuple);
    op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
    Py_INCREF(op->defaults_kwdict);
    Py_DECREF(res);
    return 0;
}
static int
__Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyTuple_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__defaults__ must be set to a tuple object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_tuple;
    op->defaults_tuple = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_tuple;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_tuple;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value) {
        value = Py_None;
    } else if (value != Py_None && !PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__kwdefaults__ must be set to a dict object");
        return -1;
    }
    Py_INCREF(value);
    tmp = op->defaults_kwdict;
    op->defaults_kwdict = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
    PyObject* result = op->defaults_kwdict;
    if (unlikely(!result)) {
        if (op->defaults_getter) {
            if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
            result = op->defaults_kwdict;
        } else {
            result = Py_None;
        }
    }
    Py_INCREF(result);
    return result;
}
static int
__Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
    PyObject* tmp;
    if (!value || value == Py_None) {
        value = NULL;
    } else if (!PyDict_Check(value)) {
        PyErr_SetString(PyExc_TypeError,
                        "__annotations__ must be set to a dict object");
        return -1;
    }
    Py_XINCREF(value);
    tmp = op->func_annotations;
    op->func_annotations = value;
    Py_XDECREF(tmp);
    return 0;
}
static PyObject *
__Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
    PyObject* result = op->func_annotations;
    if (unlikely(!result)) {
        result = PyDict_New();
        if (unlikely(!result)) return NULL;
        op->func_annotations = result;
    }
    Py_INCREF(result);
    return result;
}
static PyGetSetDef __pyx_CyFunction_getsets[] = {
    {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "__doc__",  (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
    {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
    {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
    {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
    {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
    {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
    {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
    {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
    {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
    {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
    {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
    {0, 0, 0, 0, 0}
};
static PyMemberDef __pyx_CyFunction_members[] = {
    {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
    {0, 0, 0,  0, 0}
};
static PyObject *
__Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromString(m->func.m_ml->ml_name);
#else
    return PyString_FromString(m->func.m_ml->ml_name);
#endif
}
static PyMethodDef __pyx_CyFunction_methods[] = {
    {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
    {0, 0, 0, 0}
};
#if PY_VERSION_HEX < 0x030500A0
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
#else
#define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
#endif
static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
                                      PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
    __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
    if (op == NULL)
        return NULL;
    op->flags = flags;
    __Pyx_CyFunction_weakreflist(op) = NULL;
    op->func.m_ml = ml;
    op->func.m_self = (PyObject *) op;
    Py_XINCREF(closure);
    op->func_closure = closure;
    Py_XINCREF(module);
    op->func.m_module = module;
    op->func_dict = NULL;
    op->func_name = NULL;
    Py_INCREF(qualname);
    op->func_qualname = qualname;
    op->func_doc = NULL;
    op->func_classobj = NULL;
    op->func_globals = globals;
    Py_INCREF(op->func_globals);
    Py_XINCREF(code);
    op->func_code = code;
    op->defaults_pyobjects = 0;
    op->defaults = NULL;
    op->defaults_tuple = NULL;
    op->defaults_kwdict = NULL;
    op->defaults_getter = NULL;
    op->func_annotations = NULL;
    PyObject_GC_Track(op);
    return (PyObject *) op;
}
static int
__Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
{
    Py_CLEAR(m->func_closure);
    Py_CLEAR(m->func.m_module);
    Py_CLEAR(m->func_dict);
    Py_CLEAR(m->func_name);
    Py_CLEAR(m->func_qualname);
    Py_CLEAR(m->func_doc);
    Py_CLEAR(m->func_globals);
    Py_CLEAR(m->func_code);
    Py_CLEAR(m->func_classobj);
    Py_CLEAR(m->defaults_tuple);
    Py_CLEAR(m->defaults_kwdict);
    Py_CLEAR(m->func_annotations);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_XDECREF(pydefaults[i]);
        PyMem_Free(m->defaults);
        m->defaults = NULL;
    }
    return 0;
}
static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
{
    PyObject_GC_UnTrack(m);
    if (__Pyx_CyFunction_weakreflist(m) != NULL)
        PyObject_ClearWeakRefs((PyObject *) m);
    __Pyx_CyFunction_clear(m);
    PyObject_GC_Del(m);
}
static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
{
    Py_VISIT(m->func_closure);
    Py_VISIT(m->func.m_module);
    Py_VISIT(m->func_dict);
    Py_VISIT(m->func_name);
    Py_VISIT(m->func_qualname);
    Py_VISIT(m->func_doc);
    Py_VISIT(m->func_globals);
    Py_VISIT(m->func_code);
    Py_VISIT(m->func_classobj);
    Py_VISIT(m->defaults_tuple);
    Py_VISIT(m->defaults_kwdict);
    if (m->defaults) {
        PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
        int i;
        for (i = 0; i < m->defaults_pyobjects; i++)
            Py_VISIT(pydefaults[i]);
    }
    return 0;
}
static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
{
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
        Py_INCREF(func);
        return func;
    }
    if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
        if (type == NULL)
            type = (PyObject *)(Py_TYPE(obj));
        return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
    }
    if (obj == Py_None)
        obj = NULL;
    return __Pyx_PyMethod_New(func, obj, type);
}
static PyObject*
__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
{
#if PY_MAJOR_VERSION >= 3
    return PyUnicode_FromFormat("<cyfunction %U at %p>",
                                op->func_qualname, (void *)op);
#else
    return PyString_FromFormat("<cyfunction %s at %p>",
                               PyString_AsString(op->func_qualname), (void *)op);
#endif
}
#if CYTHON_COMPILING_IN_PYPY
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
    PyCFunctionObject* f = (PyCFunctionObject*)func;
    PyCFunction meth = PyCFunction_GET_FUNCTION(func);
    PyObject *self = PyCFunction_GET_SELF(func);
    Py_ssize_t size;
    switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) {
    case METH_VARARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0)
            return (*meth)(self, arg);
        break;
    case METH_VARARGS | METH_KEYWORDS:
        return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
    case METH_NOARGS:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 0)
                return (*meth)(self, NULL);
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    case METH_O:
        if (likely(kw == NULL) || PyDict_Size(kw) == 0) {
            size = PyTuple_GET_SIZE(arg);
            if (size == 1)
                return (*meth)(self, PyTuple_GET_ITEM(arg, 0));
            PyErr_Format(PyExc_TypeError,
                "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
                f->m_ml->ml_name, size);
            return NULL;
        }
        break;
    default:
        PyErr_SetString(PyExc_SystemError, "Bad call flags in "
                        "__Pyx_CyFunction_Call. METH_OLDARGS is no "
                        "longer supported!");
        return NULL;
    }
    PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
                 f->m_ml->ml_name);
    return NULL;
}
#else
static PyObject * __Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
	return PyCFunction_Call(func, arg, kw);
}
#endif
static PyTypeObject __pyx_CyFunctionType_type = {
    PyVarObject_HEAD_INIT(0, 0)
    "cython_function_or_method",
    sizeof(__pyx_CyFunctionObject),
    0,
    (destructor) __Pyx_CyFunction_dealloc,
    0,
    0,
    0,
#if PY_MAJOR_VERSION < 3
    0,
#else
    0,
#endif
    (reprfunc) __Pyx_CyFunction_repr,
    0,
    0,
    0,
    0,
    __Pyx_CyFunction_Call,
    0,
    0,
    0,
    0,
    Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
    0,
    (traverseproc) __Pyx_CyFunction_traverse,
    (inquiry) __Pyx_CyFunction_clear,
    0,
#if PY_VERSION_HEX < 0x030500A0
    offsetof(__pyx_CyFunctionObject, func_weakreflist),
#else
    offsetof(PyCFunctionObject, m_weakreflist),
#endif
    0,
    0,
    __pyx_CyFunction_methods,
    __pyx_CyFunction_members,
    __pyx_CyFunction_getsets,
    0,
    0,
    __Pyx_CyFunction_descr_get,
    0,
    offsetof(__pyx_CyFunctionObject, func_dict),
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
#if PY_VERSION_HEX >= 0x030400a1
    0,
#endif
};
static int __Pyx_CyFunction_init(void) {
#if !CYTHON_COMPILING_IN_PYPY
    __pyx_CyFunctionType_type.tp_call = PyCFunction_Call;
#endif
    __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
    if (__pyx_CyFunctionType == NULL) {
        return -1;
    }
    return 0;
}
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults = PyMem_Malloc(size);
    if (!m->defaults)
        return PyErr_NoMemory();
    memset(m->defaults, 0, size);
    m->defaults_pyobjects = pyobjects;
    return m->defaults;
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_tuple = tuple;
    Py_INCREF(tuple);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->defaults_kwdict = dict;
    Py_INCREF(dict);
}
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
    __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
    m->func_annotations = dict;
    Py_INCREF(dict);
}

static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) {
    Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases);
    for (i=0; i < nbases; i++) {
        PyTypeObject *tmptype;
        PyObject *tmp = PyTuple_GET_ITEM(bases, i);
        tmptype = Py_TYPE(tmp);
#if PY_MAJOR_VERSION < 3
        if (tmptype == &PyClass_Type)
            continue;
#endif
        if (!metaclass) {
            metaclass = tmptype;
            continue;
        }
        if (PyType_IsSubtype(metaclass, tmptype))
            continue;
        if (PyType_IsSubtype(tmptype, metaclass)) {
            metaclass = tmptype;
            continue;
        }
        PyErr_SetString(PyExc_TypeError,
                        "metaclass conflict: "
                        "the metaclass of a derived class "
                        "must be a (non-strict) subclass "
                        "of the metaclasses of all its bases");
        return NULL;
    }
    if (!metaclass) {
#if PY_MAJOR_VERSION < 3
        metaclass = &PyClass_Type;
#else
        metaclass = &PyType_Type;
#endif
    }
    Py_INCREF((PyObject*) metaclass);
    return (PyObject*) metaclass;
}

static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name,
                                           PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) {
    PyObject *ns;
    if (metaclass) {
        PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare);
        if (prep) {
            PyObject *pargs = PyTuple_Pack(2, name, bases);
            if (unlikely(!pargs)) {
                Py_DECREF(prep);
                return NULL;
            }
            ns = PyObject_Call(prep, pargs, mkw);
            Py_DECREF(prep);
            Py_DECREF(pargs);
        } else {
            if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError)))
                return NULL;
            PyErr_Clear();
            ns = PyDict_New();
        }
    } else {
        ns = PyDict_New();
    }
    if (unlikely(!ns))
        return NULL;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad;
    if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad;
    if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad;
    return ns;
bad:
    Py_DECREF(ns);
    return NULL;
}
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases,
                                      PyObject *dict, PyObject *mkw,
                                      int calculate_metaclass, int allow_py2_metaclass) {
    PyObject *result, *margs;
    PyObject *owned_metaclass = NULL;
    if (allow_py2_metaclass) {
        owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass);
        if (owned_metaclass) {
            metaclass = owned_metaclass;
        } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) {
            PyErr_Clear();
        } else {
            return NULL;
        }
    }
    if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) {
        metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases);
        Py_XDECREF(owned_metaclass);
        if (unlikely(!metaclass))
            return NULL;
        owned_metaclass = metaclass;
    }
    margs = PyTuple_Pack(3, name, bases, dict);
    if (unlikely(!margs)) {
        result = NULL;
    } else {
        result = PyObject_Call(metaclass, margs, mkw);
        Py_DECREF(margs);
    }
    Py_XDECREF(owned_metaclass);
    return result;
}

static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
    PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
    if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
        PyErr_Format(PyExc_ImportError,
        #if PY_MAJOR_VERSION < 3
            "cannot import name %.230s", PyString_AS_STRING(name));
        #else
            "cannot import name %S", name);
        #endif
    }
    return value;
}

static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
    int start = 0, mid = 0, end = count - 1;
    if (end >= 0 && code_line > entries[end].code_line) {
        return count;
    }
    while (start < end) {
        mid = (start + end) / 2;
        if (code_line < entries[mid].code_line) {
            end = mid;
        } else if (code_line > entries[mid].code_line) {
             start = mid + 1;
        } else {
            return mid;
        }
    }
    if (code_line <= entries[mid].code_line) {
        return mid;
    } else {
        return mid + 1;
    }
}
static PyCodeObject *__pyx_find_code_object(int code_line) {
    PyCodeObject* code_object;
    int pos;
    if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
        return NULL;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
        return NULL;
    }
    code_object = __pyx_code_cache.entries[pos].code_object;
    Py_INCREF(code_object);
    return code_object;
}
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
    int pos, i;
    __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
    if (unlikely(!code_line)) {
        return;
    }
    if (unlikely(!entries)) {
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
        if (likely(entries)) {
            __pyx_code_cache.entries = entries;
            __pyx_code_cache.max_count = 64;
            __pyx_code_cache.count = 1;
            entries[0].code_line = code_line;
            entries[0].code_object = code_object;
            Py_INCREF(code_object);
        }
        return;
    }
    pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
    if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
        PyCodeObject* tmp = entries[pos].code_object;
        entries[pos].code_object = code_object;
        Py_DECREF(tmp);
        return;
    }
    if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
        int new_max = __pyx_code_cache.max_count + 64;
        entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
            __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
        if (unlikely(!entries)) {
            return;
        }
        __pyx_code_cache.entries = entries;
        __pyx_code_cache.max_count = new_max;
    }
    for (i=__pyx_code_cache.count; i>pos; i--) {
        entries[i] = entries[i-1];
    }
    entries[pos].code_line = code_line;
    entries[pos].code_object = code_object;
    __pyx_code_cache.count++;
    Py_INCREF(code_object);
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"
static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
            const char *funcname, int c_line,
            int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    #if PY_MAJOR_VERSION < 3
    py_srcfile = PyString_FromString(filename);
    #else
    py_srcfile = PyUnicode_FromString(filename);
    #endif
    if (!py_srcfile) goto bad;
    if (c_line) {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #else
        py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
        #endif
    }
    else {
        #if PY_MAJOR_VERSION < 3
        py_funcname = PyString_FromString(funcname);
        #else
        py_funcname = PyUnicode_FromString(funcname);
        #endif
    }
    if (!py_funcname) goto bad;
    py_code = __Pyx_PyCode_New(
        0,
        0,
        0,
        0,
        0,
        __pyx_empty_bytes, /*PyObject *code,*/
        __pyx_empty_tuple, /*PyObject *consts,*/
        __pyx_empty_tuple, /*PyObject *names,*/
        __pyx_empty_tuple, /*PyObject *varnames,*/
        __pyx_empty_tuple, /*PyObject *freevars,*/
        __pyx_empty_tuple, /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        py_line,
        __pyx_empty_bytes  /*PyObject *lnotab*/
    );
    Py_DECREF(py_srcfile);
    Py_DECREF(py_funcname);
    return py_code;
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    return NULL;
}
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename) {
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    py_code = __pyx_find_code_object(c_line ? c_line : py_line);
    if (!py_code) {
        py_code = __Pyx_CreateCodeObjectForTraceback(
            funcname, c_line, py_line, filename);
        if (!py_code) goto bad;
        __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
    }
    py_frame = PyFrame_New(
        PyThreadState_GET(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        __pyx_d,      /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = py_line;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    #if PY_VERSION_HEX < 0x03030000
    PyObject *py_import;
    py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
    if (!py_import)
        goto bad;
    #endif
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    {
        #if PY_MAJOR_VERSION >= 3
        if (level == -1) {
            if (strchr(__Pyx_MODULE_NAME, '.')) {
                #if PY_VERSION_HEX < 0x03030000
                PyObject *py_level = PyInt_FromLong(1);
                if (!py_level)
                    goto bad;
                module = PyObject_CallFunctionObjArgs(py_import,
                    name, global_dict, empty_dict, list, py_level, NULL);
                Py_DECREF(py_level);
                #else
                module = PyImport_ImportModuleLevelObject(
                    name, global_dict, empty_dict, list, 1);
                #endif
                if (!module) {
                    if (!PyErr_ExceptionMatches(PyExc_ImportError))
                        goto bad;
                    PyErr_Clear();
                }
            }
            level = 0;
        }
        #endif
        if (!module) {
            #if PY_VERSION_HEX < 0x03030000
            PyObject *py_level = PyInt_FromLong(level);
            if (!py_level)
                goto bad;
            module = PyObject_CallFunctionObjArgs(py_import,
                name, global_dict, empty_dict, list, py_level, NULL);
            Py_DECREF(py_level);
            #else
            module = PyImport_ImportModuleLevelObject(
                name, global_dict, empty_dict, list, level);
            #endif
        }
    }
bad:
    #if PY_VERSION_HEX < 0x03030000
    Py_XDECREF(py_import);
    #endif
    Py_XDECREF(empty_list);
    Py_XDECREF(empty_dict);
    return module;
}

#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)       \
    {                                                                     \
        func_type value = func_value;                                     \
        if (sizeof(target_type) < sizeof(func_type)) {                    \
            if (unlikely(value != (func_type) (target_type) value)) {     \
                func_type zero = 0;                                       \
                if (is_unsigned && unlikely(value < zero))                \
                    goto raise_neg_overflow;                              \
                else                                                      \
                    goto raise_overflow;                                  \
            }                                                             \
        }                                                                 \
        return (target_type) value;                                       \
    }

#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
 #endif
#endif

static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
    const size_t neg_one = (size_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(size_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (size_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(size_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(size_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(size_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x))
            } else if (sizeof(size_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            size_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (size_t) -1;
        }
    } else {
        size_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (size_t) -1;
        val = __Pyx_PyInt_As_size_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to size_t");
    return (size_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to size_t");
    return (size_t) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint16_t(uint16_t value) {
    const uint16_t neg_one = (uint16_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint16_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint16_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uint16_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uint16_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint16_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint16_t),
                                     little, !is_unsigned);
    }
}

#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static PyObject *__Pyx_GetStdout(void) {
    PyObject *f = PySys_GetObject((char *)"stdout");
    if (!f) {
        PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
    }
    return f;
}
static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) {
    int i;
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) {
        PyObject* v;
        if (PyFile_SoftSpace(f, 1)) {
            if (PyFile_WriteString(" ", f) < 0)
                goto error;
        }
        v = PyTuple_GET_ITEM(arg_tuple, i);
        if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
            goto error;
        if (PyString_Check(v)) {
            char *s = PyString_AsString(v);
            Py_ssize_t len = PyString_Size(v);
            if (len > 0) {
                switch (s[len-1]) {
                    case ' ': break;
                    case '\f': case '\r': case '\n': case '\t': case '\v':
                        PyFile_SoftSpace(f, 0);
                        break;
                    default:  break;
                }
            }
        }
    }
    if (newline) {
        if (PyFile_WriteString("\n", f) < 0)
            goto error;
        PyFile_SoftSpace(f, 0);
    }
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
}
#else
static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) {
    PyObject* kwargs = 0;
    PyObject* result = 0;
    PyObject* end_string;
    if (unlikely(!__pyx_print)) {
        __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print);
        if (!__pyx_print)
            return -1;
    }
    if (stream) {
        kwargs = PyDict_New();
        if (unlikely(!kwargs))
            return -1;
        if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0))
            goto bad;
        if (!newline) {
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                goto bad;
            if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                goto bad;
            }
            Py_DECREF(end_string);
        }
    } else if (!newline) {
        if (unlikely(!__pyx_print_kwargs)) {
            __pyx_print_kwargs = PyDict_New();
            if (unlikely(!__pyx_print_kwargs))
                return -1;
            end_string = PyUnicode_FromStringAndSize(" ", 1);
            if (unlikely(!end_string))
                return -1;
            if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) {
                Py_DECREF(end_string);
                return -1;
            }
            Py_DECREF(end_string);
        }
        kwargs = __pyx_print_kwargs;
    }
    result = PyObject_Call(__pyx_print, arg_tuple, kwargs);
    if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs))
        Py_DECREF(kwargs);
    if (!result)
        return -1;
    Py_DECREF(result);
    return 0;
bad:
    if (kwargs != __pyx_print_kwargs)
        Py_XDECREF(kwargs);
    return -1;
}
#endif

#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3
static int __Pyx_PrintOne(PyObject* f, PyObject *o) {
    if (!f) {
        if (!(f = __Pyx_GetStdout()))
            return -1;
    }
    Py_INCREF(f);
    if (PyFile_SoftSpace(f, 0)) {
        if (PyFile_WriteString(" ", f) < 0)
            goto error;
    }
    if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0)
        goto error;
    if (PyFile_WriteString("\n", f) < 0)
        goto error;
    Py_DECREF(f);
    return 0;
error:
    Py_DECREF(f);
    return -1;
    /* the line below is just to avoid C compiler
     * warnings about unused functions */
    return __Pyx_Print(f, NULL, 0);
}
#else
static int __Pyx_PrintOne(PyObject* stream, PyObject *o) {
    int res;
    PyObject* arg_tuple = PyTuple_Pack(1, o);
    if (unlikely(!arg_tuple))
        return -1;
    res = __Pyx_Print(stream, arg_tuple, 1);
    Py_DECREF(arg_tuple);
    return res;
}
#endif

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) {
    const uint8_t neg_one = (uint8_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint8_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uint8_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uint8_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint8_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint8_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) {
    const int32_t neg_one = (int32_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int32_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int32_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int32_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(long) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(long) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(long) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(long) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(long),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x))
            } else if (sizeof(int) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int) -1;
        }
    } else {
        int val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int) -1;
        val = __Pyx_PyInt_As_int(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int");
    return (int) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int");
    return (int) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(uint32_t) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(uint32_t) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(uint32_t) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(uint32_t),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) {
    const int32_t neg_one = (int32_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(int32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (int32_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(int32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(int32_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(int32_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(int32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, long, PyLong_AsLong(x))
            } else if (sizeof(int32_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(int32_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            int32_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (int32_t) -1;
        }
    } else {
        int32_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (int32_t) -1;
        val = __Pyx_PyInt_As_int32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to int32_t");
    return (int32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to int32_t");
    return (int32_t) -1;
}

static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) {
    const uint32_t neg_one = (uint32_t) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(uint32_t) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (uint32_t) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(uint32_t) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(uint32_t,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(uint32_t) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, long, PyLong_AsLong(x))
            } else if (sizeof(uint32_t) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(uint32_t, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            uint32_t val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (uint32_t) -1;
        }
    } else {
        uint32_t val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (uint32_t) -1;
        val = __Pyx_PyInt_As_uint32_t(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to uint32_t");
    return (uint32_t) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to uint32_t");
    return (uint32_t) -1;
}

static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
    const int neg_one = (int) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
    if (is_unsigned) {
        if (sizeof(int) < sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(unsigned long)) {
            return PyLong_FromUnsignedLong((unsigned long) value);
        } else if (sizeof(int) <= sizeof(unsigned long long)) {
            return PyLong_FromUnsignedLongLong((unsigned long long) value);
        }
    } else {
        if (sizeof(int) <= sizeof(long)) {
            return PyInt_FromLong((long) value);
        } else if (sizeof(int) <= sizeof(long long)) {
            return PyLong_FromLongLong((long long) value);
        }
    }
    {
        int one = 1; int little = (int)*(unsigned char *)&one;
        unsigned char *bytes = (unsigned char *)&value;
        return _PyLong_FromByteArray(bytes, sizeof(int),
                                     little, !is_unsigned);
    }
}

static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
    const long neg_one = (long) -1, const_zero = 0;
    const int is_unsigned = neg_one > const_zero;
#if PY_MAJOR_VERSION < 3
    if (likely(PyInt_Check(x))) {
        if (sizeof(long) < sizeof(long)) {
            __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
        } else {
            long val = PyInt_AS_LONG(x);
            if (is_unsigned && unlikely(val < 0)) {
                goto raise_neg_overflow;
            }
            return (long) val;
        }
    } else
#endif
    if (likely(PyLong_Check(x))) {
        if (is_unsigned) {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (unlikely(Py_SIZE(x) < 0)) {
                goto raise_neg_overflow;
            }
            if (sizeof(long) <= sizeof(unsigned long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x))
            } else if (sizeof(long) <= sizeof(unsigned long long)) {
                __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x))
            }
        } else {
#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
 #if CYTHON_USE_PYLONG_INTERNALS
            switch (Py_SIZE(x)) {
                case  0: return 0;
                case  1: __PYX_VERIFY_RETURN_INT(long,  digit, +(((PyLongObject*)x)->ob_digit[0]));
                case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]);
            }
 #endif
#endif
            if (sizeof(long) <= sizeof(long)) {
                __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x))
            } else if (sizeof(long) <= sizeof(long long)) {
                __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x))
            }
        }
        {
#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
            PyErr_SetString(PyExc_RuntimeError,
                            "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
#else
            long val;
            PyObject *v = __Pyx_PyNumber_Int(x);
 #if PY_MAJOR_VERSION < 3
            if (likely(v) && !PyLong_Check(v)) {
                PyObject *tmp = v;
                v = PyNumber_Long(tmp);
                Py_DECREF(tmp);
            }
 #endif
            if (likely(v)) {
                int one = 1; int is_little = (int)*(unsigned char *)&one;
                unsigned char *bytes = (unsigned char *)&val;
                int ret = _PyLong_AsByteArray((PyLongObject *)v,
                                              bytes, sizeof(val),
                                              is_little, !is_unsigned);
                Py_DECREF(v);
                if (likely(!ret))
                    return val;
            }
#endif
            return (long) -1;
        }
    } else {
        long val;
        PyObject *tmp = __Pyx_PyNumber_Int(x);
        if (!tmp) return (long) -1;
        val = __Pyx_PyInt_As_long(tmp);
        Py_DECREF(tmp);
        return val;
    }
raise_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "value too large to convert to long");
    return (long) -1;
raise_neg_overflow:
    PyErr_SetString(PyExc_OverflowError,
        "can't convert negative value to long");
    return (long) -1;
}

static int __Pyx_check_binary_version(void) {
    char ctversion[4], rtversion[4];
    PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
    PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
    if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
        char message[200];
        PyOS_snprintf(message, sizeof(message),
                      "compiletime version %s of module '%.100s' "
                      "does not match runtime version %s",
                      ctversion, __Pyx_MODULE_NAME, rtversion);
        return PyErr_WarnEx(NULL, message, 1);
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        #if PY_MAJOR_VERSION < 3
        if (t->is_unicode) {
            *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
        } else if (t->intern) {
            *t->p = PyString_InternFromString(t->s);
        } else {
            *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        }
        #else
        if (t->is_unicode | t->is_str) {
            if (t->intern) {
                *t->p = PyUnicode_InternFromString(t->s);
            } else if (t->encoding) {
                *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
            } else {
                *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
            }
        } else {
            *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
        }
        #endif
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
    return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
}
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
    Py_ssize_t ignore;
    return __Pyx_PyObject_AsStringAndSize(o, &ignore);
}
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
    if (
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
            __Pyx_sys_getdefaultencoding_not_ascii &&
#endif
            PyUnicode_Check(o)) {
#if PY_VERSION_HEX < 0x03030000
        char* defenc_c;
        PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
        if (!defenc) return NULL;
        defenc_c = PyBytes_AS_STRING(defenc);
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        {
            char* end = defenc_c + PyBytes_GET_SIZE(defenc);
            char* c;
            for (c = defenc_c; c < end; c++) {
                if ((unsigned char) (*c) >= 128) {
                    PyUnicode_AsASCIIString(o);
                    return NULL;
                }
            }
        }
#endif
        *length = PyBytes_GET_SIZE(defenc);
        return defenc_c;
#else
        if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
        if (PyUnicode_IS_ASCII(o)) {
            *length = PyUnicode_GET_LENGTH(o);
            return PyUnicode_AsUTF8(o);
        } else {
            PyUnicode_AsASCIIString(o);
            return NULL;
        }
#else
        return PyUnicode_AsUTF8AndSize(o, length);
#endif
#endif
    } else
#endif
#if !CYTHON_COMPILING_IN_PYPY
    if (PyByteArray_Check(o)) {
        *length = PyByteArray_GET_SIZE(o);
        return PyByteArray_AS_STRING(o);
    } else
#endif
    {
        char* result;
        int r = PyBytes_AsStringAndSize(o, &result, length);
        if (unlikely(r < 0)) {
            return NULL;
        } else {
            return result;
        }
    }
}
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
   int is_true = x == Py_True;
   if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
   else return PyObject_IsTrue(x);
}
static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) {
  PyNumberMethods *m;
  const char *name = NULL;
  PyObject *res = NULL;
#if PY_MAJOR_VERSION < 3
  if (PyInt_Check(x) || PyLong_Check(x))
#else
  if (PyLong_Check(x))
#endif
    return Py_INCREF(x), x;
  m = Py_TYPE(x)->tp_as_number;
#if PY_MAJOR_VERSION < 3
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Int(x);
  }
  else if (m && m->nb_long) {
    name = "long";
    res = PyNumber_Long(x);
  }
#else
  if (m && m->nb_int) {
    name = "int";
    res = PyNumber_Long(x);
  }
#endif
  if (res) {
#if PY_MAJOR_VERSION < 3
    if (!PyInt_Check(res) && !PyLong_Check(res)) {
#else
    if (!PyLong_Check(res)) {
#endif
      PyErr_Format(PyExc_TypeError,
                   "__%.4s__ returned non-%.4s (type %.200s)",
                   name, name, Py_TYPE(res)->tp_name);
      Py_DECREF(res);
      return NULL;
    }
  }
  else if (!PyErr_Occurred()) {
    PyErr_SetString(PyExc_TypeError,
                    "an integer is required");
  }
  return res;
}
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
  Py_ssize_t ival;
  PyObject *x;
#if PY_MAJOR_VERSION < 3
  if (likely(PyInt_CheckExact(b)))
      return PyInt_AS_LONG(b);
#endif
  if (likely(PyLong_CheckExact(b))) {
    #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
     #if CYTHON_USE_PYLONG_INTERNALS
       switch (Py_SIZE(b)) {
       case -1: return -(sdigit)((PyLongObject*)b)->ob_digit[0];
       case  0: return 0;
       case  1: return ((PyLongObject*)b)->ob_digit[0];
       }
     #endif
    #endif
    return PyLong_AsSsize_t(b);
  }
  x = PyNumber_Index(b);
  if (!x) return -1;
  ival = PyInt_AsSsize_t(x);
  Py_DECREF(x);
  return ival;
}
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
    return PyInt_FromSize_t(ival);
}


#endif /* Py_PYTHON_H */
