Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7310 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25480 invoked by uid 1010); 24 Jan 2004 13:37:50 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25453 invoked from network); 24 Jan 2004 13:37:50 -0000 Received: from unknown (HELO gw.kuantic.com) (192.70.34.228) by pb1.pair.com with SMTP; 24 Jan 2004 13:37:50 -0000 Received: from gw.kuantic.com (server.kuantic.com [127.0.0.1]) by gw.kuantic.com (8.12.10/8.12.10) with ESMTP id i0ODbnq5019219 for ; Sat, 24 Jan 2004 14:37:49 +0100 Received: (from root@localhost) by gw.kuantic.com (8.12.10/8.12.10/Submit) id i0ODbnrZ019215; Sat, 24 Jan 2004 14:37:49 +0100 Date: Sat, 24 Jan 2004 14:37:49 +0100 Message-ID: <200401241337.i0ODbnrZ019215@gw.kuantic.com> To: internals@lists.php.net Subject: Bug in conditional compilation in ext/curl/interface.c, PHP5.0.0B3 From: root@gw.kuantic.com (root) Hi there. I was wondering why I was not able to get cURL use Digest Authentification. The reason is the following: In ext/curl/interface.c, there is (lines 834-836) : ---- #ifdef CURLOPT_HTTPAUTH /* only in curl 7.10.6 */ case CURLOPT_HTTPAUTH: #endif ---- However, CURLOPT_HTTAUTH can't be tested that way since it's inside a enum. See curl.h, line 314 (in curl.h from curl-7.11.0 for instance): ---- typedef enum { CINIT(NOTHING, LONG, 0), /********* the first one is unused ************/ ---- ... etc .. until you have : ---- /* Set this to a bitmask value to enable the particular authentications methods you like. Use this in combination with CURLOPT_USERPWD. Note that setting multiple bits may cause extra network round-trips. */ CINIT(HTTPAUTH, LONG, 107), ---- So, if ever one wants to keep conditional compilation for this option, one can use this ugly mess instead :-) : --- #define CURL_HAS_HTTPAUTH #if LIBCURL_VERSION_MAJOR <= 7 #if LIBCURL_VERSION_MAJOR < 7 #undef CURL_HAS_HTTPAUTH #else #if LIBCURL_VERSION_MINOR < 10 #undef CURL_HAS_HTTPAUTH #else #if LIBCURL_VERSION_MINOR == 10 #if LIBCURL_VERSION_PATCH < 6 #undef CURL_HAS_HTTPAUTH #endif // LIBCURL_VERSION_PATCH < 6 #endif // LIBCURL_VERSION_MINOR == 10 #endif // LIBCURL_VERSION_MINOR < 10 #endif // LIBCURL_VERSION_MAJOR < 7 #endif // LIBCURL_VERSION_MAJOR <= 7 --- and then use, in interface.c, lines 834-836: ---- #ifdef CURLOPT_HAS_HTTPAUTH /* only in curl 7.10.6 */ case CURLOPT_HTTPAUTH: #endif ---- However won't it be simpler to suppose that, with PHP5, cURL must be at least 7.11.0 and drop all that tests? Now, to end that matter, I would have spared hours if, still in interface.c, I would have found, starting line 1089: --- default: php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option"); RETURN_FALSE; --- Cheers, Bernard