- AC found the header if HTTP_HAVE_[OPENSSL|GNUTLS] is defined
[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-2007, 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 # define HTTP_NEED_OPENSSL_TSL
22 # include <openssl/crypto.h>
23 # elif defined(HTTP_HAVE_GNUTLS)
24 # define HTTP_NEED_GNUTLS_TSL
25 # include <gcrypt.h>
26 # else
27 # warning \
28 "libcurl was compiled with SSL support, but configure could not determine which" \
29 "library was used; thus no SSL crypto locking callbacks will be set, which may " \
30 "cause random crashes on SSL requests"
31 # endif /* HTTP_HAVE_OPENSSL || HTTP_HAVE_GNUTLS */
32 # endif /* PHP_WIN32 */
33 #endif /* ZTS && HTTP_HAVE_SSL */
34
35 #define HTTP_CURL_OPT(OPTION, p) curl_easy_setopt((request->ch), OPTION, (p))
36
37 #define HTTP_CURL_OPT_STRING(OPTION, ldiff, obdc) \
38 { \
39 char *K = #OPTION; \
40 HTTP_CURL_OPT_STRING_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION, obdc); \
41 }
42 #define HTTP_CURL_OPT_STRING_EX(keyname, optname, obdc) \
43 if (!strcasecmp(key.str, keyname)) { \
44 zval *copy = http_request_option_cache_ex(request, keyname, strlen(keyname)+1, 0, zval_copy(IS_STRING, *param)); \
45 if (obdc) { \
46 HTTP_CHECK_OPEN_BASEDIR(Z_STRVAL_P(copy), return FAILURE); \
47 } \
48 HTTP_CURL_OPT(optname, Z_STRVAL_P(copy)); \
49 continue; \
50 }
51 #define HTTP_CURL_OPT_LONG(OPTION, ldiff) \
52 { \
53 char *K = #OPTION; \
54 HTTP_CURL_OPT_LONG_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION); \
55 }
56 #define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
57 if (!strcasecmp(key.str, keyname)) { \
58 zval *copy = zval_copy(IS_LONG, *param); \
59 HTTP_CURL_OPT(optname, Z_LVAL_P(copy)); \
60 zval_free(&copy); \
61 continue; \
62 }
63
64 /*
65 * Local variables:
66 * tab-width: 4
67 * c-basic-offset: 4
68 * End:
69 * vim600: noet sw=4 ts=4 fdm=marker
70 * vim<600: noet sw=4 ts=4
71 */