* Fixed bug in HttpRequestPool where a negative timeout was passed to select()
[m6w6/ext-http] / php_http_request_int.h
1 /*
2 +--------------------------------------------------------------------+
3 | PECL :: http |
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2006, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
11 */
12
13 /* $Id$ */
14
15 #if defined(ZTS) && defined(HTTP_HAVE_SSL)
16 # ifdef PHP_WIN32
17 # define HTTP_NEED_OPENSSL_TSL
18 # include <openssl/crypto.h>
19 # else /* !PHP_WIN32 */
20 # if defined(HTTP_HAVE_OPENSSL)
21 # if defined(HAVE_OPENSSL_CRYPTO_H)
22 # define HTTP_NEED_OPENSSL_TSL
23 # include <openssl/crypto.h>
24 # else
25 # warning \
26 "libcurl was compiled with OpenSSL support, but configure could not find " \
27 "openssl/crypto.h; thus no SSL crypto locking callbacks will be set, which may " \
28 "cause random crashes on SSL requests"
29 # endif
30 # elif defined(HTTP_HAVE_GNUTLS)
31 # if defined(HAVE_GCRYPT_H)
32 # define HTTP_NEED_GNUTLS_TSL
33 # include <gcrypt.h>
34 # else
35 # warning \
36 "libcurl was compiled with GnuTLS support, but configure could not find " \
37 "gcrypt.h; thus no SSL crypto locking callbacks will be set, which may " \
38 "cause random crashes on SSL requests"
39 # endif
40 # else
41 # warning \
42 "libcurl was compiled with SSL support, but configure could not determine which" \
43 "library was used; thus no SSL crypto locking callbacks will be set, which may " \
44 "cause random crashes on SSL requests"
45 # endif /* HTTP_HAVE_OPENSSL || HTTP_HAVE_GNUTLS */
46 # endif /* PHP_WIN32 */
47 #endif /* ZTS && HTTP_HAVE_SSL */
48
49 #ifndef HAVE_CURL_EASY_STRERROR
50 # define curl_easy_strerror(dummy) "unknown error"
51 #endif
52
53 #define HTTP_CURL_OPT(OPTION, p) HTTP_CURL_OPT_EX(request->ch, OPTION, (p))
54 #define HTTP_CURL_OPT_EX(ch, OPTION, p) curl_easy_setopt((ch), OPTION, (p))
55
56 #define HTTP_CURL_OPT_STRING(OPTION, ldiff, obdc) \
57 { \
58 char *K = #OPTION; \
59 HTTP_CURL_OPT_STRING_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION, obdc); \
60 }
61 #define HTTP_CURL_OPT_STRING_EX(keyname, optname, obdc) \
62 if (!strcasecmp(key, keyname)) { \
63 zval *copy = http_request_option_cache_ex(request, keyname, strlen(keyname)+1, 0, zval_copy(IS_STRING, *param)); \
64 if (obdc) { \
65 HTTP_CHECK_OPEN_BASEDIR(Z_STRVAL_P(copy), return FAILURE); \
66 } \
67 HTTP_CURL_OPT(optname, Z_STRVAL_P(copy)); \
68 key = NULL; \
69 continue; \
70 }
71 #define HTTP_CURL_OPT_LONG(OPTION, ldiff) \
72 { \
73 char *K = #OPTION; \
74 HTTP_CURL_OPT_LONG_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION); \
75 }
76 #define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
77 if (!strcasecmp(key, keyname)) { \
78 zval *copy = zval_copy(IS_LONG, *param); \
79 HTTP_CURL_OPT(optname, Z_LVAL_P(copy)); \
80 key = NULL; \
81 zval_free(&copy); \
82 continue; \
83 }
84
85 /*
86 * Local variables:
87 * tab-width: 4
88 * c-basic-offset: 4
89 * End:
90 * vim600: noet sw=4 ts=4 fdm=marker
91 * vim<600: noet sw=4 ts=4
92 */