X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_misc.h;h=69076e71fbc2201b114ec3ecf8309231e100e7de;hp=54e1ac5d8d48e39be9ae28aab581b71eef7da805;hb=8191c55421fb6ecc86185608a8b0510da1525e1e;hpb=d5de4f9eae86ae1dab0f8a906bf9543710ae124d diff --git a/php_http_misc.h b/php_http_misc.h index 54e1ac5..69076e7 100644 --- a/php_http_misc.h +++ b/php_http_misc.h @@ -21,24 +21,15 @@ /* CR LF */ #define PHP_HTTP_CRLF "\r\n" -/* default cache control */ -#define PHP_HTTP_DEFAULT_CACHECONTROL "private, must-revalidate, max-age=0" - /* max URL length */ #define PHP_HTTP_URL_MAXLEN 4096 -/* max request method length */ -#define PHP_HTTP_REQUEST_METHOD_MAXLEN 31 - /* def URL arg separator */ #define PHP_HTTP_URL_ARGSEP "&" /* send buffer size */ #define PHP_HTTP_SENDBUF_SIZE 40960 -/* CURL buffer size */ -#define PHP_HTTP_CURLBUF_SIZE 16384 - /* SLEEP */ #define PHP_HTTP_DIFFSEC (0.001) @@ -104,25 +95,6 @@ static inline const char *php_http_locate_str(const char *h, size_t h_len, const return NULL; } -static inline const char *php_http_locate_body(const char *message) -{ - const char *body = NULL, *msg = message; - - while (*msg) { - if (*msg == '\n') { - if (*(msg+1) == '\n') { - body = msg + 2; - break; - } else if (*(msg+1) == '\r' && *(msg+2) == '\n') { - body = msg + 3; - break; - } - } - ++msg; - } - return body; -} - static inline const char *php_http_locate_eol(const char *line, int *eol_len) { const char *eol = strpbrk(line, "\r\n"); @@ -137,7 +109,7 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i { const char *eol; - for (eol = bin; eol - bin <= len; ++eol) { + for (eol = bin; eol - bin < len; ++eol) { if (*eol == '\r' || *eol == '\n') { if (eol_len) { *eol_len = ((eol[0] == '\r' && eol[1] == '\n') ? 2 : 1); @@ -326,6 +298,7 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c INIT_NS_CLASS_ENTRY(ce, #ns, #classname, php_ ##name## _method_entry); \ php_ ##name## _class_entry = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \ php_ ##name## _class_entry->ce_flags |= flags; \ + php_http_register_class(php_ ##name## _get_class_entry); \ } #define PHP_HTTP_REGISTER_INTERFACE(ns, ifacename, name, flags) \ @@ -335,6 +308,7 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c INIT_NS_CLASS_ENTRY(ce, #ns, #ifacename, php_ ##name## _method_entry); \ php_ ##name## _class_entry = zend_register_internal_interface(&ce TSRMLS_CC); \ php_ ##name## _class_entry->ce_flags |= flags; \ + php_http_register_class(php_ ##name## _get_class_entry); \ } #define PHP_HTTP_REGISTER_EXCEPTION(classname, cename, parent) \ @@ -346,61 +320,8 @@ static inline STATUS php_http_ini_entry(const char *name_str, size_t name_len, c cename = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC); \ } -#define ACC_PROP_PRIVATE(ce, flags) ((flags & ZEND_ACC_PRIVATE) && (EG(scope) && ce == EG(scope)) -#define ACC_PROP_PROTECTED(ce, flags) ((flags & ZEND_ACC_PROTECTED) && (zend_check_protected(ce, EG(scope)))) -#define ACC_PROP_PUBLIC(flags) (flags & ZEND_ACC_PUBLIC) -#define ACC_PROP(ce, flags) (ACC_PROP_PUBLIC(flags) || ACC_PROP_PRIVATE(ce, flags) || ACC_PROP_PROTECTED(ce, flags)) - -#ifdef PHP_HTTP_HAVE_CURL -# define PHP_HTTP_DECLARE_ARG_PASS_INFO() \ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); \ - \ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_3, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); \ - \ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); \ - \ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_5, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); - -#else -# define PHP_HTTP_DECLARE_ARG_PASS_INFO() \ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); \ -\ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_3, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); \ -\ - ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_4, 0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(0) \ - ZEND_ARG_PASS_INFO(1) \ - ZEND_END_ARG_INFO(); -#endif /* PHP_HTTP_HAVE_CURL */ - /* ARRAYS */ +PHP_HTTP_API unsigned php_http_array_list(HashTable *ht TSRMLS_DC, unsigned argc, ...); typedef struct php_http_array_hashkey { char *str; @@ -456,13 +377,7 @@ int php_http_array_apply_merge_func(void *pDest TSRMLS_DC, int num_args, va_list typedef size_t (*php_http_pass_callback_t)(void *cb_arg, const char *str, size_t len); typedef size_t (*php_http_pass_php_http_buffer_callback_t)(void *cb_arg, php_http_buffer_t *str); - -typedef struct php_http_pass_callback_arg { - size_t (*cb_zts)(void *cb_arg, const char *str, size_t len TSRMLS_DC); - void *cb_arg; -} php_http_pass_callback_arg_t; - -PHP_HTTP_API size_t php_http_pass_wrapper(php_http_pass_callback_arg_t *cb_arg, const char *str, size_t len); +typedef size_t (*php_http_pass_format_callback_t)(void *cb_arg, const char *fmt, ...); typedef struct php_http_pass_fcall_arg { zval *fcz;