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