rename info tests
[m6w6/ext-http] / php_http_env.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2014, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 #ifndef PHP_HTTP_ENV_H
14 #define PHP_HTTP_ENV_H
15
16 #include "php_http_message_body.h"
17 #include "php_http_version.h"
18
19 struct php_http_env_globals {
20 zval *server_var;
21 char *etag_mode;
22
23 struct {
24 HashTable *headers;
25 php_http_message_body_t *body;
26 } request;
27 };
28
29 typedef enum php_http_content_encoding {
30 PHP_HTTP_CONTENT_ENCODING_NONE,
31 PHP_HTTP_CONTENT_ENCODING_GZIP
32 } php_http_content_encoding_t;
33
34 typedef enum php_http_range_status {
35 PHP_HTTP_RANGE_NO,
36 PHP_HTTP_RANGE_OK,
37 PHP_HTTP_RANGE_ERR
38 } php_http_range_status_t;
39
40 PHP_HTTP_API php_http_range_status_t php_http_env_get_request_ranges(HashTable *ranges, size_t entity_length, php_http_message_t *request TSRMLS_DC);
41 PHP_HTTP_API void php_http_env_get_request_headers(HashTable *headers TSRMLS_DC);
42 PHP_HTTP_API char *php_http_env_get_request_header(const char *name_str, size_t name_len, size_t *len, php_http_message_t *request TSRMLS_DC);
43 PHP_HTTP_API int php_http_env_got_request_header(const char *name_str, size_t name_len, php_http_message_t *request TSRMLS_DC);
44 PHP_HTTP_API php_http_message_body_t *php_http_env_get_request_body(TSRMLS_D);
45 PHP_HTTP_API const char *php_http_env_get_request_method(php_http_message_t *request TSRMLS_DC);
46
47 typedef enum php_http_content_disposition {
48 PHP_HTTP_CONTENT_DISPOSITION_NONE,
49 PHP_HTTP_CONTENT_DISPOSITION_INLINE,
50 PHP_HTTP_CONTENT_DISPOSITION_ATTACHMENT
51 } php_http_content_disposition_t;
52
53 typedef enum php_http_cache_status {
54 PHP_HTTP_CACHE_NO,
55 PHP_HTTP_CACHE_HIT,
56 PHP_HTTP_CACHE_MISS
57 } php_http_cache_status_t;
58
59 PHP_HTTP_API long php_http_env_get_response_code(TSRMLS_D);
60 PHP_HTTP_API const char *php_http_env_get_response_status_for_code(unsigned code);
61 PHP_HTTP_API STATUS php_http_env_get_response_headers(HashTable *headers_ht TSRMLS_DC);
62 PHP_HTTP_API char *php_http_env_get_response_header(const char *name_str, size_t name_len TSRMLS_DC);
63 PHP_HTTP_API STATUS php_http_env_set_response_code(long http_code TSRMLS_DC);
64 PHP_HTTP_API STATUS php_http_env_set_response_protocol_version(php_http_version_t *v TSRMLS_DC);
65 PHP_HTTP_API STATUS php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace TSRMLS_DC);
66 PHP_HTTP_API STATUS php_http_env_set_response_header_value(long http_code, const char *name_str, size_t name_len, zval *value, zend_bool replace TSRMLS_DC);
67 PHP_HTTP_API STATUS php_http_env_set_response_header_format(long http_code, zend_bool replace TSRMLS_DC, const char *fmt, ...);
68 PHP_HTTP_API STATUS php_http_env_set_response_header_va(long http_code, zend_bool replace, const char *fmt, va_list argv TSRMLS_DC);
69
70 PHP_HTTP_API zval *php_http_env_get_server_var(const char *key_str, size_t key_len, zend_bool check TSRMLS_DC);
71 #define php_http_env_got_server_var(v) (NULL != php_http_env_get_server_var((v), strlen(v), 1 TSRMLS_CC))
72 PHP_HTTP_API zval *php_http_env_get_superglobal(const char *key, size_t key_len TSRMLS_DC);
73
74 PHP_HTTP_API zend_class_entry *php_http_env_class_entry;
75 PHP_MINIT_FUNCTION(http_env);
76 PHP_RINIT_FUNCTION(http_env);
77 PHP_RSHUTDOWN_FUNCTION(http_env);
78
79 #endif
80
81 /*
82 * Local variables:
83 * tab-width: 4
84 * c-basic-offset: 4
85 * End:
86 * vim600: noet sw=4 ts=4 fdm=marker
87 * vim<600: noet sw=4 ts=4
88 */
89