2 +--------------------------------------------------------------------+
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 +--------------------------------------------------------------------+
13 #ifndef PHP_HTTP_ENV_H
14 #define PHP_HTTP_ENV_H
16 #include "php_http_message_body.h"
17 #include "php_http_version.h"
19 struct php_http_env_globals
{
25 php_http_message_body_t
*body
;
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
;
34 typedef enum php_http_range_status
{
38 } php_http_range_status_t
;
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
);
41 PHP_HTTP_API
void php_http_env_get_request_headers(HashTable
*headers
);
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
);
43 PHP_HTTP_API zend_bool
php_http_env_got_request_header(const char *name_str
, size_t name_len
, php_http_message_t
*request
);
44 PHP_HTTP_API php_http_message_body_t
*php_http_env_get_request_body(void);
45 PHP_HTTP_API
const char *php_http_env_get_request_method(php_http_message_t
*request
);
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
;
53 typedef enum php_http_cache_status
{
57 } php_http_cache_status_t
;
59 PHP_HTTP_API
long php_http_env_get_response_code(void);
60 PHP_HTTP_API
const char *php_http_env_get_response_status_for_code(unsigned code
);
61 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_get_response_headers(HashTable
*headers_ht
);
62 PHP_HTTP_API
char *php_http_env_get_response_header(const char *name_str
, size_t name_len
);
63 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_code(long http_code
);
64 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_protocol_version(php_http_version_t
*v
);
65 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_header(long http_code
, const char *header_str
, size_t header_len
, zend_bool replace
);
66 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_header_value(long http_code
, const char *name_str
, size_t name_len
, zval
*value
, zend_bool replace
);
67 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_header_format(long http_code
, zend_bool replace
, const char *fmt
, ...);
68 PHP_HTTP_API ZEND_RESULT_CODE
php_http_env_set_response_header_va(long http_code
, zend_bool replace
, const char *fmt
, va_list argv
);
70 PHP_HTTP_API zval
*php_http_env_get_server_var(const char *key_str
, size_t key_len
, zend_bool check
);
71 PHP_HTTP_API zval
*php_http_env_get_superglobal(const char *key
, size_t key_len
);
73 static inline zend_bool
php_http_env_got_server_var(const char *v
)
75 return NULL
!= php_http_env_get_server_var(v
, strlen(v
), 1);
79 PHP_HTTP_API zend_class_entry
*php_http_env_get_class_entry(void);
80 PHP_MINIT_FUNCTION(http_env
);
81 PHP_RSHUTDOWN_FUNCTION(http_env
);
90 * vim600: noet sw=4 ts=4 fdm=marker
91 * vim<600: noet sw=4 ts=4