Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
_cparser.pxd159 linesDownload Raw Back to aiohttp
1from libc.stdint cimport int32_t, uint8_t, uint16_t, uint64_t
2
3
4cdef extern from "llhttp.h":
5
6    struct llhttp__internal_s:
7        int32_t _index
8        void* _span_pos0
9        void* _span_cb0
10        int32_t error
11        const char* reason
12        const char* error_pos
13        void* data
14        void* _current
15        uint64_t content_length
16        uint8_t type
17        uint8_t method
18        uint8_t http_major
19        uint8_t http_minor
20        uint8_t header_state
21        uint8_t lenient_flags
22        uint8_t upgrade
23        uint8_t finish
24        uint16_t flags
25        uint16_t status_code
26        void* settings
27
28    ctypedef llhttp__internal_s llhttp__internal_t
29    ctypedef llhttp__internal_t llhttp_t
30
31    ctypedef int (*llhttp_data_cb)(llhttp_t*, const char *at, size_t length) except -1
32    ctypedef int (*llhttp_cb)(llhttp_t*) except -1
33
34    struct llhttp_settings_s:
35        llhttp_cb      on_message_begin
36        llhttp_data_cb on_url
37        llhttp_data_cb on_status
38        llhttp_data_cb on_header_field
39        llhttp_data_cb on_header_value
40        llhttp_cb      on_headers_complete
41        llhttp_data_cb on_body
42        llhttp_cb      on_message_complete
43        llhttp_cb      on_chunk_header
44        llhttp_cb      on_chunk_complete
45
46        llhttp_cb      on_url_complete
47        llhttp_cb      on_status_complete
48        llhttp_cb      on_header_field_complete
49        llhttp_cb      on_header_value_complete
50
51    ctypedef llhttp_settings_s llhttp_settings_t
52
53    enum llhttp_errno:
54        HPE_OK,
55        HPE_INTERNAL,
56        HPE_STRICT,
57        HPE_LF_EXPECTED,
58        HPE_UNEXPECTED_CONTENT_LENGTH,
59        HPE_CLOSED_CONNECTION,
60        HPE_INVALID_METHOD,
61        HPE_INVALID_URL,
62        HPE_INVALID_CONSTANT,
63        HPE_INVALID_VERSION,
64        HPE_INVALID_HEADER_TOKEN,
65        HPE_INVALID_CONTENT_LENGTH,
66        HPE_INVALID_CHUNK_SIZE,
67        HPE_INVALID_STATUS,
68        HPE_INVALID_EOF_STATE,
69        HPE_INVALID_TRANSFER_ENCODING,
70        HPE_CB_MESSAGE_BEGIN,
71        HPE_CB_HEADERS_COMPLETE,
72        HPE_CB_MESSAGE_COMPLETE,
73        HPE_CB_CHUNK_HEADER,
74        HPE_CB_CHUNK_COMPLETE,
75        HPE_PAUSED,
76        HPE_PAUSED_UPGRADE,
77        HPE_USER
78
79    ctypedef llhttp_errno llhttp_errno_t
80
81    enum llhttp_flags:
82        F_CHUNKED,
83        F_CONTENT_LENGTH
84
85    enum llhttp_type:
86        HTTP_REQUEST,
87        HTTP_RESPONSE,
88        HTTP_BOTH
89
90    enum llhttp_method:
91        HTTP_DELETE,
92        HTTP_GET,
93        HTTP_HEAD,
94        HTTP_POST,
95        HTTP_PUT,
96        HTTP_CONNECT,
97        HTTP_OPTIONS,
98        HTTP_TRACE,
99        HTTP_COPY,
100        HTTP_LOCK,
101        HTTP_MKCOL,
102        HTTP_MOVE,
103        HTTP_PROPFIND,
104        HTTP_PROPPATCH,
105        HTTP_SEARCH,
106        HTTP_UNLOCK,
107        HTTP_BIND,
108        HTTP_REBIND,
109        HTTP_UNBIND,
110        HTTP_ACL,
111        HTTP_REPORT,
112        HTTP_MKACTIVITY,
113        HTTP_CHECKOUT,
114        HTTP_MERGE,
115        HTTP_MSEARCH,
116        HTTP_NOTIFY,
117        HTTP_SUBSCRIBE,
118        HTTP_UNSUBSCRIBE,
119        HTTP_PATCH,
120        HTTP_PURGE,
121        HTTP_MKCALENDAR,
122        HTTP_LINK,
123        HTTP_UNLINK,
124        HTTP_SOURCE,
125        HTTP_PRI,
126        HTTP_DESCRIBE,
127        HTTP_ANNOUNCE,
128        HTTP_SETUP,
129        HTTP_PLAY,
130        HTTP_PAUSE,
131        HTTP_TEARDOWN,
132        HTTP_GET_PARAMETER,
133        HTTP_SET_PARAMETER,
134        HTTP_REDIRECT,
135        HTTP_RECORD,
136        HTTP_FLUSH
137
138    ctypedef llhttp_method llhttp_method_t;
139
140    void llhttp_settings_init(llhttp_settings_t* settings)
141    void llhttp_init(llhttp_t* parser, llhttp_type type,
142                 const llhttp_settings_t* settings)
143
144    llhttp_errno_t llhttp_execute(llhttp_t* parser, const char* data, size_t len)
145
146    int llhttp_should_keep_alive(const llhttp_t* parser)
147
148    void llhttp_resume_after_upgrade(llhttp_t* parser)
149
150    llhttp_errno_t llhttp_get_errno(const llhttp_t* parser)
151    const char* llhttp_get_error_reason(const llhttp_t* parser)
152    const char* llhttp_get_error_pos(const llhttp_t* parser)
153
154    const char* llhttp_method_name(llhttp_method_t method)
155
156    void llhttp_set_lenient_headers(llhttp_t* parser, int enabled)
157    void llhttp_set_lenient_optional_cr_before_lf(llhttp_t* parser, int enabled)
158    void llhttp_set_lenient_spaces_after_chunk_size(llhttp_t* parser, int enabled)
159 
codekingpro/portable-devtools · Team Ai