Skip to content

Commit

Permalink
Update version for Swoole 4.5.8 (#3852)
Browse files Browse the repository at this point in the history
  • Loading branch information
huanghantao authored Nov 20, 2020
1 parent ca218a5 commit f761af9
Show file tree
Hide file tree
Showing 5 changed files with 120 additions and 44 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PROJECT(libswoole)

ENABLE_LANGUAGE(ASM)
SET(SWOOLE_VERSION 4.5.7)
SET(SWOOLE_VERSION 4.5.8)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g")
Expand Down
4 changes: 2 additions & 2 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,13 @@ if test "$PHP_SWOOLE" != "no"; then
src/os/base.cc \
src/os/file.cc \
src/os/msg_queue.cc \
src/os/pipe.cc \
src/os/process_pool.cc \
src/os/sendfile.cc \
src/os/signal.cc \
src/os/timer.cc \
src/os/wait.cc \
src/os/pipe.cc \
src/os/unix_socket.cc \
src/os/wait.cc \
src/protocol/base.cc \
src/protocol/base64.cc \
src/protocol/dtls.cc \
Expand Down
102 changes: 80 additions & 22 deletions ext-src/php_swoole_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Generated by build-library.php, Please DO NOT modify!
*/

/* $Id: 460ca02687340e5dfdad78882e694d2e5bd215ec */
/* $Id: 70607d48d9a44275402ebada4824f354e023f7ad */

static const char* swoole_library_source_constants =
"\n"
Expand Down Expand Up @@ -3454,6 +3454,8 @@ static const char* swoole_library_source_core_curl_handler =
"\n"
" private $headers = [];\n"
"\n"
" private $headerMap = [];\n"
"\n"
" private $transfer;\n"
"\n"
" private $errCode = 0;\n"
Expand All @@ -3464,6 +3466,8 @@ static const char* swoole_library_source_core_curl_handler =
"\n"
" private $closed = false;\n"
"\n"
" private $cookieJar = '';\n"
"\n"
" public function __construct(string $url = '')\n"
" {\n"
" if ($url) {\n"
Expand Down Expand Up @@ -3649,6 +3653,28 @@ static const char* swoole_library_source_core_curl_handler =
" $this->errMsg = $msg ? $msg : curl_strerror($code);\n"
" }\n"
"\n"
" private function hasHeader(string $headerName): bool\n"
" {\n"
" return isset($this->headerMap[strtolower($headerName)]);\n"
" }\n"
"\n"
" private function setHeader(string $headerName, string $value): void\n"
" {\n"
" $lowerCaseHeaderName = strtolower($headerName);\n"
"\n"
" if (isset($this->headerMap[$lowerCaseHeaderName])) {\n"
" unset($this->headers[$this->headerMap[$lowerCaseHeaderName]]);\n"
" }\n"
"\n"
" if ($value !== '') {\n"
" $this->headers[$headerName] = $value;\n"
" $this->headerMap[$lowerCaseHeaderName] = $headerName;\n"
" } else {\n"
" // remove empty headers (keep same with raw cURL)\n"
" unset($this->headerMap[$lowerCaseHeaderName]);\n"
" }\n"
" }\n"
"\n"
" /**\n"
" * @param mixed $value\n"
" * @throws Swoole\\Curl\\Exception\n"
Expand Down Expand Up @@ -3699,7 +3725,7 @@ static const char* swoole_library_source_core_curl_handler =
" break;\n"
" }\n"
" }\n"
" $this->headers['Accept-Encoding'] = $value;\n"
" $this->setHeader('Accept-Encoding', $value);\n"
" break;\n"
" case CURLOPT_PROXYTYPE:\n"
" if ($value !== CURLPROXY_HTTP and $value !== CURLPROXY_SOCKS5) {\n"
Expand Down Expand Up @@ -3751,9 +3777,9 @@ static const char* swoole_library_source_core_curl_handler =
" case CURLOPT_SSLVERSION:\n"
" case CURLOPT_NOSIGNAL:\n"
" case CURLOPT_FRESH_CONNECT:\n"
" /*\n"
" * From PHP 5.1.3, this option has no effect: the raw output will always be returned when CURLOPT_RETURNTRANSFER is used.\n"
" */\n"
" /*\n"
" * From PHP 5.1.3, this option has no effect: the raw output will always be returned when CURLOPT_RETURNTRANSFER is used.\n"
" */\n"
" case CURLOPT_BINARYTRANSFER: /* TODO */\n"
" case CURLOPT_DNS_USE_GLOBAL_CACHE:\n"
" case CURLOPT_DNS_CACHE_TIMEOUT:\n"
Expand All @@ -3762,6 +3788,10 @@ static const char* swoole_library_source_core_curl_handler =
" case CURLOPT_BUFFERSIZE:\n"
" case CURLOPT_SSLCERTTYPE:\n"
" case CURLOPT_SSLKEYTYPE:\n"
" case CURLOPT_NOPROXY:\n"
" case CURLOPT_CERTINFO:\n"
" case CURLOPT_HEADEROPT:\n"
" case CURLOPT_PROXYHEADER:\n"
" break;\n"
" /*\n"
" * SSL\n"
Expand All @@ -3783,6 +3813,11 @@ static const char* swoole_library_source_core_curl_handler =
" case CURLOPT_CAPATH:\n"
" $this->clientOptions[Constant::OPTION_SSL_CAPATH] = $value;\n"
" break;\n"
" case CURLOPT_KEYPASSWD:\n"
" case CURLOPT_SSLCERTPASSWD:\n"
" case CURLOPT_SSLKEYPASSWD:\n"
" $this->clientOptions[Constant::OPTION_SSL_PASSPHRASE] = $value;\n"
" break;\n"
" /*\n"
" * Http POST\n"
" */\n"
Expand Down Expand Up @@ -3816,14 +3851,11 @@ static const char* swoole_library_source_core_curl_handler =
" $header = explode(':', $header, 2);\n"
" $headerName = $header[0];\n"
" $headerValue = trim($header[1] ?? '');\n"
" if (strlen($headerValue) === 0) {\n"
" continue;\n"
" }\n"
" $this->headers[$headerName] = $headerValue;\n"
" $this->setHeader($headerName, $headerValue);\n"
" }\n"
" break;\n"
" case CURLOPT_REFERER:\n"
" $this->headers['Referer'] = $value;\n"
" $this->setHeader('Referer', $value);\n"
" break;\n"
" case CURLINFO_HEADER_OUT:\n"
" $this->withHeaderOut = boolval($value);\n"
Expand All @@ -3832,7 +3864,7 @@ static const char* swoole_library_source_core_curl_handler =
" $this->withFileTime = boolval($value);\n"
" break;\n"
" case CURLOPT_USERAGENT:\n"
" $this->headers['User-Agent'] = $value;\n"
" $this->setHeader('User-Agent', $value);\n"
" break;\n"
" case CURLOPT_CUSTOMREQUEST:\n"
" $this->method = (string) $value;\n"
Expand Down Expand Up @@ -3860,7 +3892,15 @@ static const char* swoole_library_source_core_curl_handler =
" * Http Cookie\n"
" */\n"
" case CURLOPT_COOKIE:\n"
" $this->headers['Cookie'] = $value;\n"
" $this->setHeader('Cookie', $value);\n"
" break;\n"
" case CURLOPT_COOKIEJAR:\n"
" $this->cookieJar = (string) $value;\n"
" break;\n"
" case CURLOPT_COOKIEFILE:\n"
" if (is_file((string) $value)) {\n"
" $this->setHeader('Cookie', file_get_contents($value));\n"
" }\n"
" break;\n"
" case CURLOPT_CONNECTTIMEOUT:\n"
" $this->clientOptions[Constant::OPTION_CONNECT_TIMEOUT] = $value;\n"
Expand Down Expand Up @@ -3899,7 +3939,7 @@ static const char* swoole_library_source_core_curl_handler =
" }\n"
" break;\n"
" case CURLOPT_USERPWD:\n"
" $this->headers['Authorization'] = 'Basic ' . base64_encode($value);\n"
" $this->setHeader('Cookie', 'Basic ' . base64_encode($value));\n"
" break;\n"
" case CURLOPT_FOLLOWLOCATION:\n"
" $this->followLocation = $value;\n"
Expand Down Expand Up @@ -4022,8 +4062,8 @@ static const char* swoole_library_source_core_curl_handler =
" // POST data\n"
" if ($this->postData) {\n"
" if (is_string($this->postData)) {\n"
" if (empty($this->headers['Content-Type'])) {\n"
" $this->headers['Content-Type'] = 'application/x-www-form-urlencoded';\n"
" if (!$this->hasHeader('content-type')) {\n"
" $this->setHeader('Content-Type', 'application/x-www-form-urlencoded');\n"
" }\n"
" } elseif (is_array($this->postData)) {\n"
" foreach ($this->postData as $k => $v) {\n"
Expand All @@ -4042,12 +4082,6 @@ static const char* swoole_library_source_core_curl_handler =
" // Notice: setHeaders must be placed last, because headers may be changed by other parts\n"
" // As much as possible to ensure that Host is the first header.\n"
" // See: http://tools.ietf.org/html/rfc7230#section-5.4\n"
" foreach ($this->headers as $headerName => $headerValue) {\n"
" if ($headerValue === '') {\n"
" // remove empty headers (keep same with raw cURL)\n"
" unset($this->headers[$headerName]);\n"
" }\n"
" }\n"
" $client->setHeaders($this->headers);\n"
" /**\n"
" * Execute.\n"
Expand Down Expand Up @@ -4076,7 +4110,7 @@ static const char* swoole_library_source_core_curl_handler =
" $this->method = 'GET';\n"
" }\n"
" if ($this->autoReferer) {\n"
" $this->headers['Referer'] = $this->info['url'];\n"
" $this->setHeader('Referer', $this->info['url']);\n"
" }\n"
" $this->setUrl($redirectUrl, false);\n"
" $this->setUrlInfo($redirectParsedUrl);\n"
Expand Down Expand Up @@ -4150,6 +4184,30 @@ static const char* swoole_library_source_core_curl_handler =
" }\n"
" }\n"
"\n"
" if ($this->cookieJar && $this->cookieJar !== '') {\n"
" if ($this->cookieJar === '-') {\n"
" foreach ((array) $client->set_cookie_headers as $cookie) {\n"
" echo $cookie . PHP_EOL;\n"
" }\n"
" } else {\n"
" $cookies = '';\n"
" foreach ((array) $client->set_cookie_headers as $cookie) {\n"
" $cookies .= \"{$cookie};\";\n"
" }\n"
" file_put_contents($this->cookieJar, $cookies);\n"
" }\n"
" }\n"
"\n"
" if ($this->writeFunction) {\n"
" if (!is_callable($this->writeFunction)) {\n"
" trigger_error('curl_exec(): Could not call the CURLOPT_WRITEFUNCTION', E_USER_WARNING);\n"
" $this->setError(CURLE_WRITE_ERROR, 'Failure writing output to destination');\n"
" return false;\n"
" }\n"
" call_user_func($this->writeFunction, $this, $transfer);\n"
" return true;\n"
" }\n"
"\n"
" if ($this->returnTransfer) {\n"
" return $this->transfer = $transfer;\n"
" }\n"
Expand Down
6 changes: 3 additions & 3 deletions include/swoole_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

#define SWOOLE_MAJOR_VERSION 4
#define SWOOLE_MINOR_VERSION 5
#define SWOOLE_RELEASE_VERSION 7
#define SWOOLE_RELEASE_VERSION 8
#define SWOOLE_EXTRA_VERSION ""
#define SWOOLE_VERSION "4.5.7"
#define SWOOLE_VERSION_ID 40507
#define SWOOLE_VERSION "4.5.8"
#define SWOOLE_VERSION_ID 40508
#define SWOOLE_API_VERSION_ID 0x202011a

#define SWOOLE_BUG_REPORT \
Expand Down
Loading

0 comments on commit f761af9

Please sign in to comment.