Repository navigation
Expand file tree
/
Copy pathclient.h
More file actions
64 lines (50 loc) · 1.71 KB
/
Copy pathclient.h
File metadata and controls
64 lines (50 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef CLIENT_H
#define CLIENT_H
#include "meinheld.h"
#include "request.h"
typedef struct _client {
int fd;
char *remote_addr;
int remote_port;
uint8_t keep_alive;
request *req;
request_queue *request_queue;
int body_length;
uint8_t body_readed;
void *body;
int bad_request_code;
request_body_type body_type;
char upgrade; // new protocol
uint8_t complete;
http_parser *http; // http req parser
PyObject *environ; // wsgi environ
int status_code; // response status code
PyObject *http_status; // response status line(PyString)
PyObject *headers; // http response headers
uint8_t header_done; // header write status
PyObject *response; // wsgi response object
PyObject *response_iter; // wsgi response object (iter)
uint8_t chunked_response; // use Transfer-Encoding: chunked
uint8_t content_length_set; // content_length_set flag
int content_length; // content_length
int write_bytes; // send body length
void *bucket; //write_data
uint8_t response_closed; //response closed flag
uint8_t use_cork; // use TCP_CORK
} client_t;
typedef struct {
PyObject_HEAD
client_t *client;
PyGreenlet *greenlet;
PyObject *args; //greenlet.switch value
PyObject *kwargs; //greenlet.switch value
uint8_t suspended;
uint8_t resumed;
} ClientObject;
extern PyTypeObject ClientObjectType;
PyObject* ClientObject_New(client_t* client);
void setup_client(void);
int CheckClientObject(PyObject *obj);
void ClientObject_list_fill(void);
void ClientObject_list_clear(void);
#endif