- release 1.6.0b1
[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 # 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 #define HTTP_CURL_OPT(OPTION, p) curl_easy_setopt((request->ch), OPTION, (p))
50
51 #define HTTP_CURL_OPT_STRING(OPTION, ldiff, obdc) \
52 { \
53 char *K = #OPTION; \
54 HTTP_CURL_OPT_STRING_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION, obdc); \
55 }
56 #define HTTP_CURL_OPT_STRING_EX(keyname, optname, obdc) \
57 if (!strcasecmp(key.str, keyname)) { \
58 zval *copy = http_request_option_cache_ex(request, keyname, strlen(keyname)+1, 0, zval_copy(IS_STRING, *param)); \
59 if (obdc) { \
60 HTTP_CHECK_OPEN_BASEDIR(Z_STRVAL_P(copy), return FAILURE); \
61 } \
62 HTTP_CURL_OPT(optname, Z_STRVAL_P(copy)); \
63 continue; \
64 }
65 #define HTTP_CURL_OPT_LONG(OPTION, ldiff) \
66 { \
67 char *K = #OPTION; \
68 HTTP_CURL_OPT_LONG_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION); \
69 }
70 #define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
71 if (!strcasecmp(key.str, keyname)) { \
72 zval *copy = zval_copy(IS_LONG, *param); \
73 HTTP_CURL_OPT(optname, Z_LVAL_P(copy)); \
74 zval_free(&copy); \
75 continue; \
76 }
77
78 /*
79 * Local variables:
80 * tab-width: 4
81 * c-basic-offset: 4
82 * End:
83 * vim600: noet sw=4 ts=4 fdm=marker
84 * vim<600: noet sw=4 ts=4
85 */