forked from swoole/swoole-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswoole_http.h
95 lines (75 loc) · 2.83 KB
/
swoole_http.h
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
+----------------------------------------------------------------------+
| Swoole |
+----------------------------------------------------------------------+
| Copyright (c) 2012-2015 The Swoole Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the Apache license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.apache.org/licenses/LICENSE-2.0.html |
| If you did not receive a copy of the Apache2.0 license and are unable|
| to obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Tianfeng Han <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifndef SWOOLE_HTTP_H_
#define SWOOLE_HTTP_H_
#include "thirdparty/php_http_parser.h"
#include "thirdparty/multipart_parser.h"
typedef struct
{
enum php_http_method method;
int version;
char *path;
uint32_t path_len;
const char *ext;
uint32_t ext_len;
uint8_t post_form_urlencoded;
char *post_content;
uint32_t post_length;
} http_request;
typedef struct
{
enum php_http_method method;
int version;
int status;
swString *cookie;
} http_response;
typedef struct
{
int fd;
uint32_t end :1;
uint32_t send_header :1;
uint32_t chunk :1;
uint32_t keepalive :1;
uint32_t gzip_enable :1;
uint32_t gzip_level :4;
uint32_t request_read :1;
uint32_t current_header_name_allocated :1;
uint32_t content_sender_initialized :1;
http_request request;
http_response response;
zval *zresponse;
zval *zrequest;
php_http_parser parser;
multipart_parser *mt_parser;
char *current_header_name;
size_t current_header_name_len;
swString *current_input_name;
} swoole_http_client;
int swoole_websocket_onMessage(swEventData *req);
int swoole_websocket_onHandshake(swoole_http_client *client);
void swoole_websocket_onOpen(swoole_http_client *client);
int swoole_websocket_isset_onMessage(void);
void swoole_http_request_free(swoole_http_client *client TSRMLS_DC);
extern zend_class_entry swoole_http_server_ce;
extern zend_class_entry *swoole_http_server_class_entry_ptr;
extern zend_class_entry swoole_http_response_ce;
extern zend_class_entry *swoole_http_response_class_entry_ptr;
extern zend_class_entry swoole_http_request_ce;
extern zend_class_entry *swoole_http_request_class_entry_ptr;
extern swString *swoole_http_buffer;
#endif /* SWOOLE_HTTP_H_ */