X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_misc.h;h=e8d900b5813848c48b95b57566c164dd8e7e689f;hp=1a74c34d8262b88c5543289707627d586214c9eb;hb=5aa3a33fde0e9e59a7363d40cf4b446364f0623a;hpb=03f11ce599fa5a89148d588caf6ccec7f939e9d4 diff --git a/php_http_misc.h b/php_http_misc.h index 1a74c34..e8d900b 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) @@ -136,6 +139,11 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i /* ZEND */ +#ifdef PHP_DEBUG +# undef HASH_OF +# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))) +#endif + static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv) { if (!zo) { @@ -163,7 +171,7 @@ static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t n { zend_ini_entry *ini_entry; - if (ini_entry == zend_hash_str_find_ptr(EG(ini_directives), name_str, name_len)) { + if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives), name_str, name_len))) { if (orig && ini_entry->modified) { *val_str = ini_entry->orig_value->val; *val_len = ini_entry->orig_value->len; @@ -176,11 +184,8 @@ static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t n return FAILURE; } -#define RETVAL_STR_COPY(zs) ZVAL_STR_COPY(return_value, zs) -#define RETURN_STR_COPY(zs) do { \ - ZVAL_STR_COPY(return_value, zs); \ - return; \ -} +#define Z_ISUSER(zv) (Z_TYPE(zv) <= 10) +#define Z_ISUSER_P(zvp) Z_ISUSER(*(zvp)) /* return object(values) */ #define ZVAL_OBJECT(z, o, addref) \ @@ -222,7 +227,7 @@ static inline void *php_http_arrkey_stringify(php_http_arrkey_t *arrkey, zend_ha } if (key) { - memcpy(&arrkey, key, sizeof(*key)); + memcpy(arrkey, key, sizeof(*key)); } if ((arrkey->stringified = !arrkey->key)) { arrkey->key = zend_long_to_str(arrkey->h);