+#ifdef ZEND_ENGINE_2
+# define HE_THROW E_THROW TSRMLS_CC
+# define HE_NOTICE (HTTP_G->only_exceptions ? E_THROW : E_NOTICE) TSRMLS_CC
+# define HE_WARNING (HTTP_G->only_exceptions ? E_THROW : E_WARNING) TSRMLS_CC
+# define HE_ERROR (HTTP_G->only_exceptions ? E_THROW : E_ERROR) TSRMLS_CC
+#else
+# define HE_THROW E_WARNING TSRMLS_CC
+# define HE_NOTICE E_NOTICE TSRMLS_CC
+# define HE_WARNING E_WARNING TSRMLS_CC
+# define HE_ERROR E_ERROR TSRMLS_CC
+#endif
+
+#define HTTP_E_RUNTIME 1L
+#define HTTP_E_INVALID_PARAM 2L
+#define HTTP_E_HEADER 3L
+#define HTTP_E_MALFORMED_HEADERS 4L
+#define HTTP_E_REQUEST_METHOD 5L
+#define HTTP_E_MESSAGE_TYPE 6L
+#define HTTP_E_ENCODING 7L
+#define HTTP_E_REQUEST 8L
+#define HTTP_E_REQUEST_POOL 9L
+#define HTTP_E_SOCKET 10L
+#define HTTP_E_RESPONSE 11L
+#define HTTP_E_URL 12L
+#define HTTP_E_QUERYSTRING 13L
+
+#ifdef ZEND_ENGINE_2
+# define HTTP_BEGIN_ARGS_EX(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 0, ret_ref, req_args)
+# define HTTP_BEGIN_ARGS_AR(class, method, ret_ref, req_args) static ZEND_BEGIN_ARG_INFO_EX(args_for_ ##class## _ ##method , 1, ret_ref, req_args)
+# define HTTP_END_ARGS }
+# define HTTP_EMPTY_ARGS_EX(class, method, ret_ref) HTTP_BEGIN_ARGS_EX(class, method, ret_ref, 0) HTTP_END_ARGS
+# define HTTP_ARGS(class, method) args_for_ ##class## _ ##method
+# define HTTP_ARG_VAL(name, pass_ref) ZEND_ARG_INFO(pass_ref, name)
+# define HTTP_ARG_OBJ(class, name, allow_null) ZEND_ARG_OBJ_INFO(0, name, class, allow_null)
+#endif
+
+#ifdef ZEND_ENGINE_2
+# define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL, 0, 0}
+#else
+# define EMPTY_FUNCTION_ENTRY {NULL, NULL, NULL}
+#endif
+
+#ifdef HTTP_HAVE_CURL
+# ifdef ZEND_ENGINE_2
+# define HTTP_DECLARE_ARG_PASS_INFO() \
+ static \
+ ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
+ ZEND_ARG_PASS_INFO(0) \
+ ZEND_ARG_PASS_INFO(1) \
+ ZEND_END_ARG_INFO(); \
+ \
+ static \
+ 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(); \
+ \
+ static \
+ 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(); \
+ \
+ static \
+ 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 HTTP_DECLARE_ARG_PASS_INFO() \
+ static unsigned char http_arg_pass_ref_2[] = {2, BYREF_NONE, BYREF_FORCE}; \
+ static unsigned char http_arg_pass_ref_3[] = {3, BYREF_NONE, BYREF_NONE, BYREF_FORCE}; \
+ static unsigned char http_arg_pass_ref_4[] = {4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE}; \
+ static unsigned char http_arg_pass_ref_5[] = {5, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE};
+# endif /* ZEND_ENGINE_2 */
+#else
+# ifdef ZEND_ENGINE_2
+# define HTTP_DECLARE_ARG_PASS_INFO() \
+ static \
+ ZEND_BEGIN_ARG_INFO(http_arg_pass_ref_2, 0) \
+ ZEND_ARG_PASS_INFO(0) \
+ ZEND_ARG_PASS_INFO(1) \
+ ZEND_END_ARG_INFO(); \
+\
+ static \
+ 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();
+# else
+# define HTTP_DECLARE_ARG_PASS_INFO() \
+ static unsigned char http_arg_pass_ref_2[] = {2, BYREF_NONE, BYREF_FORCE}; \
+ static unsigned char http_arg_pass_ref_4[] = {4, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE};
+# endif /* ZEND_ENGINE_2 */
+#endif /* HTTP_HAVE_CURL */
+