-ZEND_EXTERN_MODULE_GLOBALS(http)
-
-#if LIBCURL_VERSION_NUM < 0x070c00
-# define curl_easy_strerror(code) HTTP_G(request).curl.error
-#endif
-
-#define HTTP_CURL_INFO(I) HTTP_CURL_INFO_EX(I, I)
-#define HTTP_CURL_INFO_EX(I, X) \
- switch (CURLINFO_ ##I & ~CURLINFO_MASK) \
- { \
- case CURLINFO_STRING: \
- { \
- char *c; \
- if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &c)) { \
- add_assoc_string(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), c ? c : "", 1); \
- } \
- } \
- break; \
-\
- case CURLINFO_DOUBLE: \
- { \
- double d; \
- if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &d)) { \
- add_assoc_double(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), d); \
- } \
- } \
- break; \
-\
- case CURLINFO_LONG: \
- { \
- long l; \
- if (CURLE_OK == curl_easy_getinfo(ch, CURLINFO_ ##I, &l)) { \
- add_assoc_long(&array, pretty_key(http_curl_copystr(#X), sizeof(#X)-1, 0, 0), l); \
- } \
- } \
- break; \
- }
-
-#define HTTP_CURL_OPT(OPTION, p) curl_easy_setopt(ch, CURLOPT_##OPTION, (p))
-#define HTTP_CURL_OPT_STRING(keyname) HTTP_CURL_OPT_STRING_EX(keyname, keyname)
-#define HTTP_CURL_OPT_SSL_STRING(keyname) HTTP_CURL_OPT_STRING_EX(keyname, SSL##keyname)
-#define HTTP_CURL_OPT_SSL_STRING_(keyname) HTTP_CURL_OPT_STRING_EX(keyname, SSL_##keyname)
-#define HTTP_CURL_OPT_STRING_EX(keyname, optname) \
- if (!strcasecmp(key, #keyname)) { \
- convert_to_string_ex(param); \
- HTTP_CURL_OPT(optname, http_curl_copystr(Z_STRVAL_PP(param))); \
- key = NULL; \
- continue; \
- }
-#define HTTP_CURL_OPT_LONG(keyname) HTTP_OPT_SSL_LONG_EX(keyname, keyname)
-#define HTTP_CURL_OPT_SSL_LONG(keyname) HTTP_CURL_OPT_LONG_EX(keyname, SSL##keyname)
-#define HTTP_CURL_OPT_SSL_LONG_(keyname) HTTP_CURL_OPT_LONG_EX(keyname, SSL_##keyname)
-#define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
- if (!strcasecmp(key, #keyname)) { \
- convert_to_long_ex(param); \
- HTTP_CURL_OPT(optname, Z_LVAL_PP(param)); \
- key = NULL; \
- continue; \
- }
-
-
-static const char *const http_request_methods[HTTP_MAX_REQUEST_METHOD + 1];
-#define http_curl_copystr(s) _http_curl_copystr((s) TSRMLS_CC)
-static inline char *_http_curl_copystr(const char *str TSRMLS_DC);
-#define http_curl_getopt(o, k, t) _http_curl_getopt_ex((o), (k), sizeof(k), (t) TSRMLS_CC)
-#define http_curl_getopt_ex(o, k, l, t) _http_curl_getopt_ex((o), (k), (l), (t) TSRMLS_CC)
-static inline zval *_http_curl_getopt_ex(HashTable *options, char *key, size_t keylen, int type TSRMLS_DC);
-static size_t http_curl_write_callback(char *, size_t, size_t, void *);
-static size_t http_curl_read_callback(void *, size_t, size_t, void *);
-static int http_curl_progress_callback(void *, double, double, double, double);
-static int http_curl_debug_callback(CURL *, curl_infotype, char *, size_t, void *);