/* 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)
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");
{
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);
/* ZEND */
+#if PHP_VERSION_ID < 50400
+# define object_properties_init(o, ce) zend_hash_copy(((zend_object *) o)->properties, &(ce->default_properties), (copy_ctor_func_t) zval_add_ref, NULL, sizeof(zval*))
+# define PHP_HTTP_ZEND_LITERAL_DC
+# define PHP_HTTP_ZEND_LITERAL_CC
+# define PHP_HTTP_ZEND_LITERAL_CCN
+# define ZVAL_COPY_VALUE(zv, arr) do { \
+ (zv)->value = (arr)->value; \
+ Z_TYPE_P(zv) = Z_TYPE_P(arr); \
+ } while (0)
+#else
+# define PHP_HTTP_ZEND_LITERAL_DC , const zend_literal *literal_key
+# define PHP_HTTP_ZEND_LITERAL_CC , (literal_key)
+# define PHP_HTTP_ZEND_LITERAL_CCN , NULL
+#endif
+
#define INIT_PZVAL_ARRAY(zv, ht) \
{ \
INIT_PZVAL((zv)); \
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) \
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) \
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;
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;