fix logic error in HttpMessage::setResponseStatus
[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-2010, 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, http_zsep(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 zval_ptr_dtor(&copy); \
50 continue; \
51 }
52 #define HTTP_CURL_OPT_LONG(OPTION, ldiff) \
53 { \
54 char *K = #OPTION; \
55 HTTP_CURL_OPT_LONG_EX(K+lenof("CURLOPT_KEY")+ldiff, OPTION); \
56 }
57 #define HTTP_CURL_OPT_LONG_EX(keyname, optname) \
58 if (!strcasecmp(key.str, keyname)) { \
59 zval *copy = http_zsep(IS_LONG, *param); \
60 HTTP_CURL_OPT(optname, Z_LVAL_P(copy)); \
61 zval_ptr_dtor(&copy); \
62 continue; \
63 }
64
65 /*
66 * Local variables:
67 * tab-width: 4
68 * c-basic-offset: 4
69 * End:
70 * vim600: noet sw=4 ts=4 fdm=marker
71 * vim<600: noet sw=4 ts=4
72 */