com php-src: curl_exec: remove bad check for CURL E_PARTIAL_FILE: ext/curl/interface.c
| From: | Nikita Popov | Date: | Mon, 11 Mar 2019 08:56:25 +0000 |
| Subject: | com php-src: curl_exec: remove bad check for CURL E_PARTIAL_FILE: ext/curl/interface.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105061@lists.php.net to get a copy of this message | ||
Commit: d9d253fa6bf8e89a48a3e4ce6a669c705564e254
Author: Daniel Stenberg <daniel@haxx.se> Thu, 7 Mar 2019 00:06:00 +0100
Committer: Nikita Popov <nikita.ppv@gmail.com> Mon, 11 Mar 2019 09:56:25 +0100
Parents: 4a12fb4abad611f2a4705f83842b3e833e0e100d
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d9d253fa6bf8e89a48a3e4ce6a669c705564e254
Log:
curl_exec: remove bad check for CURLE_PARTIAL_FILE
This check introduced in 2004 is wrong and removed. A HEAD request with
curl does *not* cause this error code - only if you make a regular GET
request but tell curl to send a HEAD using CURLOPT_CUSTOMREQUEST and
then you've asked for it.
You do a proper HEAD request with curl by setting the CURLOPT_NOBODY
option to 1L.
This was the case in 2004. This is still the case in 2019. This is also
documented in libcurl documentation.
This check hides the possibly serious error when this error code is
genuinely and correctly returned by curl because the transfer was
truncated and ended up partial.
As can be seen, I objected to this change already in the original bug:
https://bugs.php.net/bug.php?id=27341
Changed paths:
M ext/curl/interface.c
Diff:
diff --git a/ext/curl/interface.c b/ext/curl/interface.c
index b142445..bbdcdbf 100644
--- a/ext/curl/interface.c
+++ b/ext/curl/interface.c
@@ -3113,8 +3113,8 @@ PHP_FUNCTION(curl_exec)
error = curl_easy_perform(ch->cp);
SAVE_CURL_ERROR(ch, error);
- /* CURLE_PARTIAL_FILE is returned by HEAD requests */
- if (error != CURLE_OK && error != CURLE_PARTIAL_FILE) {
+
+ if (error != CURLE_OK) {
smart_str_free(&ch->handlers->write->buf);
RETURN_FALSE;
}