X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=9055e6616e4d1f2f40e8f49aa028ab52a42d1aa9;hp=53198e1b53e4799d843a716acb9e04664df51149;hb=3ba84fa5b16b08a82d054d06d6db5201a7195dd8;hpb=a5765d1d51e444d9165c591a59d5b4c5bf9294b2 diff --git a/php_http_api.h b/php_http_api.h index 53198e1..9055e66 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -19,9 +19,13 @@ #define PHP_HTTP_API_H #ifdef PHP_WIN32 -#define PHP_HTTP_API __declspec(dllexport) +# define PHP_HTTP_API __declspec(dllexport) #else -#define PHP_HTTP_API +# define PHP_HTTP_API +#endif + +#ifndef ZEND_ENGINE_2 +# include "php_http_build_query.h" #endif /* make functions that return SUCCESS|FAILURE more obvious */ @@ -42,14 +46,20 @@ typedef enum { } http_send_mode; /* }}} */ +/* CR LF */ +#define HTTP_CRLF "\r\n" + /* max URI length */ #define HTTP_URI_MAXLEN 2048 /* buffer size */ #define HTTP_BUF_SIZE 2097152 +/* server vars shorthand */ +#define HTTP_SERVER_VARS Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]) + /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL /* CURL buffer size */ #define HTTP_CURLBUF_BODYSIZE 16384 @@ -108,7 +118,7 @@ PHP_HTTP_API int _http_modified_match(const char *entry, const time_t t TSRMLS_D PHP_HTTP_API int _http_etag_match(const char *entry, const char *etag TSRMLS_DC); #define http_send_last_modified(t) _http_send_last_modified((t) TSRMLS_CC) -PHP_HTTP_API STATUS _http_send_last_modified(const int t TSRMLS_DC); +PHP_HTTP_API STATUS _http_send_last_modified(const time_t t TSRMLS_DC); #define http_send_etag(e, l) _http_send_etag((e), (l) TSRMLS_CC) PHP_HTTP_API STATUS _http_send_etag(const char *etag, const int etag_len TSRMLS_DC); @@ -143,10 +153,16 @@ PHP_HTTP_API STATUS _http_send_file(const zval *zfile TSRMLS_DC); PHP_HTTP_API STATUS _http_chunked_decode(const char *encoded, const size_t encoded_len, char **decoded, size_t *decoded_len TSRMLS_DC); #define http_split_response(r, h, b) _http_split_response((r), (h), (b) TSRMLS_CC) -PHP_HTTP_API void _http_split_response(const zval *zresponse, zval *zheaders, zval *zbody TSRMLS_DC); +PHP_HTTP_API STATUS _http_split_response(const zval *zresponse, zval *zheaders, zval *zbody TSRMLS_DC); + +#define http_parse_headers(h, l, a) _http_parse_headers((h), (l), (a) TSRMLS_CC) +PHP_HTTP_API STATUS _http_parse_headers(char *header, int header_len, zval *array TSRMLS_DC); + +#define http_get_request_headers(h) _http_get_request_headers((h) TSRMLS_CC) +PHP_HTTP_API void _http_get_request_headers(zval *array TSRMLS_DC); /* {{{ HAVE_CURL */ -#if defined(HAVE_CURL) && HAVE_CURL +#ifdef HTTP_HAVE_CURL #define http_get(u, o, i, d, l) _http_get((u), (o), (i), (d), (l) TSRMLS_CC) PHP_HTTP_API STATUS _http_get(const char *URL, HashTable *options, HashTable *info, char **data, size_t *data_len TSRMLS_DC); @@ -167,7 +183,7 @@ PHP_HTTP_API STATUS _http_post_array(const char *URL, HashTable *postarray, Hash PHP_HTTP_API STATUS _http_auth_credentials(char **user, char **pass TSRMLS_DC); #define http_auth_header(t, r) _http_auth_header((t), (r) TSRMLS_CC) -PHP_HTTP_API void _http_auth_header(const char *type, const char *realm TSRMLS_DC); +PHP_HTTP_API STATUS _http_auth_header(const char *type, const char *realm TSRMLS_DC); /* }}} */ @@ -181,3 +197,4 @@ PHP_HTTP_API void _http_auth_header(const char *type, const char *realm TSRMLS_D * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ +