separate php_http_env_response and implement content encoding
[m6w6/ext-http] / php_http_env_response.h
1 #ifndef PHP_HTTP_ENV_RESPONSE_H
2 #define PHP_HTTP_ENV_RESPONSE_H
3
4 typedef struct php_http_env_response {
5 php_http_buffer_t *buffer;
6 zval *options;
7
8 struct {
9 size_t chunk;
10 double delay;
11 } throttle;
12
13 struct {
14 php_http_range_status_t status;
15 HashTable values;
16 char boundary[32];
17 } range;
18
19 struct {
20 size_t length;
21 char *type;
22 char *encoding;
23
24 php_http_encoding_stream_t *encoder;
25 } content;
26
27 zend_bool done;
28
29 #ifdef ZTS
30 void ***ts;
31 #endif
32 } php_http_env_response_t;
33
34 PHP_HTTP_API php_http_env_response_t *php_http_env_response_init(php_http_env_response_t *r, zval *options TSRMLS_DC);
35 PHP_HTTP_API STATUS php_Http_env_response_send(php_http_env_response_t *r);
36 PHP_HTTP_API void php_http_env_response_dtor(php_http_env_response_t *r);
37 PHP_HTTP_API void php_http_env_response_free(php_http_env_response_t **r);
38
39 PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_etag(zval *options, const char *header_str, size_t header_len TSRMLS_DC);
40 PHP_HTTP_API php_http_cache_status_t php_http_env_is_response_cached_by_last_modified(zval *options, const char *header_str, size_t header_len TSRMLS_DC);
41
42 extern zend_class_entry *php_http_env_response_class_entry;
43 extern zend_function_entry php_http_env_response_method_entry[];
44
45 PHP_METHOD(HttpEnvResponse, __construct);
46 PHP_METHOD(HttpEnvResponse, setContentType);
47 PHP_METHOD(HttpEnvResponse, setContentDisposition);
48 PHP_METHOD(HttpEnvResponse, setContentEncoding);
49 PHP_METHOD(HttpEnvResponse, setCacheControl);
50 PHP_METHOD(HttpEnvResponse, setLastModified);
51 PHP_METHOD(HttpEnvResponse, isCachedByLastModified);
52 PHP_METHOD(HttpEnvResponse, setEtag);
53 PHP_METHOD(HttpEnvResponse, isCachedByEtag);
54 PHP_METHOD(HttpEnvResponse, setThrottleRate);
55 PHP_METHOD(HttpEnvResponse, send);
56
57
58 PHP_MINIT_FUNCTION(http_env_response);
59
60 #endif