X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_misc.h;h=15daa96eb2f6d34a26c0dad3ebcd011a67eb1412;hp=3bd77d8b931046006373445f7344476a7bd2a1b9;hb=refs%2Fheads%2Fv2.4.x;hpb=b47a52f0a3db907095882f8ed9015a1bfc76537e diff --git a/php_http_misc.h b/php_http_misc.h index 3bd77d8..15daa96 100644 --- a/php_http_misc.h +++ b/php_http_misc.h @@ -27,6 +27,9 @@ /* send buffer size */ #define PHP_HTTP_SENDBUF_SIZE 40960 +/* allowed characters of header field names */ +#define PHP_HTTP_HEADER_NAME_CHARS "!#$%&'*+-.^_`|~1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + /* SLEEP */ #define PHP_HTTP_DIFFSEC (0.001) @@ -41,10 +44,10 @@ PHP_HTTP_API void php_http_sleep(double s); /* STRING UTILITIES */ -#ifndef STR_SET -# define STR_SET(STR, SET) \ +#ifndef PTR_SET +# define PTR_SET(STR, SET) \ { \ - STR_FREE(STR); \ + PTR_FREE(STR); \ STR = SET; \ } #endif @@ -151,6 +154,13 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i # define PHP_HTTP_ZEND_LITERAL_CCN , NULL #endif +#if PHP_VERSION_ID < 50500 +typedef enum { + SUCCESS = 0, + FAILURE = -1 +} ZEND_RESULT_CODE; +#endif + #if PHP_VERSION_ID < 50700 # define z_is_true zend_is_true #else @@ -197,7 +207,7 @@ static inline zval *php_http_zsep(zend_bool add_ref, int type, zval *z) } } -static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, const char **value_str, size_t *value_len, zend_bool orig TSRMLS_DC) +static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t name_len, const char **value_str, size_t *value_len, zend_bool orig TSRMLS_DC) { zend_ini_entry *ini_entry; @@ -291,7 +301,7 @@ static inline void php_http_array_hashkey_stringify(php_http_array_hashkey_t *ke static inline void php_http_array_hashkey_stringfree(php_http_array_hashkey_t *key) { if (key->type != HASH_KEY_IS_STRING || key->dup) { - STR_FREE(key->str); + PTR_FREE(key->str); } }