Curl Transfer Closed With Bytes Remaining to Read
217 votes
0 answers
php - Guzzle - roll error eighteen: transfer closed with outstanding read data remaining
I'm trying to solve a problem with my telephone call to external API. With Postman everything is working fine. When I'm trying to use Guzzle, this fault appears.
I already tried using HTTP version i.0, but it just cuts my response and I'm not receiving proper JSON. There is too no Content-Length header in response.
Whatever advice is appreciated.
Code:
private const TIMEOUT = xc; private const CONNECT_TIMEOUT = 90; private const SSL_VERIFY = faux; // ... private function getDefaultHeaders(): assortment { $headers = [ 'accept' => '*/*', 'Content-Type' => 'awarding/json', 'Take-Encoding' => 'gzip, debunk', 'Connectedness' => 'go on-alive', ]; if ($this->authorizationProvider->isAuthorizationEnabled()) { $headers['Authorization'] = $this->authorizationProvider->getAuthorizationHeader(); } return $headers; } // ... $response = $this->client->request( Asking::METHOD_POST, $uri, [ 'body' => json_encode($trunk), 'headers' => $this->getHeaders(), 'timeout' => self::TIMEOUT, 'connect_timeout' => self::CONNECT_TIMEOUT, 'verify' => self::SSL_VERIFY, ] ); Exception:
GuzzleHttp\Exception\RequestException {#494 -asking: GuzzleHttp\Psr7\Asking {#488 -method: "Go" -requestTarget: null -uri: GuzzleHttp\Psr7\Uri {#484 -scheme: "https" -userInfo: "" -host: "arch.30.com" -port: cipher -path: "/api/1/xxx/123456/xxx" -query: "" -fragment: "" } -headers: assortment:6 [ "User-Amanuensis" => assortment:1 [ 0 => "GuzzleHttp/6.5.1 coil/vii.52.1 PHP/7.two.34" ] "Host" => array:ane [ 0 => "arch.xxx.com" ] "accept" => array:i [ 0 => "awarding/json" ] "Content-Type" => array:ane [ 0 => "application/json" ] "accept-encoding" => array:1 [ 0 => "gzip, debunk" ] "Await" => assortment:ane [ 0 => "100-keep" ] ] -headerNames: array:half dozen [ "user-agent" => "User-Agent" "host" => "Host" "accept" => "accept" "content-type" => "Content-Type" "have-encoding" => "accept-encoding" "expect" => "Expect" ] -protocol: "i.ane" -stream: GuzzleHttp\Psr7\Stream {#487 -stream: stream resource @329 wrapper_type: "PHP" stream_type: "TEMP" way: "westward+b" unread_bytes: 0 seekable: true uri: "php://temp" options: [] } -size: 0 -seekable: true -readable: true -writable: true -uri: "php://temp" -customMetadata: [] } } -response: GuzzleHttp\Psr7\Response {#495 -reasonPhrase: "OK" -statusCode: 200 -headers: assortment:twenty [ "Content-Type" => array:ane [ 0 => "application/json" ] "Admission-Control-Permit-Origin" => array:1 [ 0 => "*" ] "Access-Command-Allow-Headers" => array:1 [ 0 => "DNT,10-CustomHeader,Proceed-Alive,User-Agent,X-Requested-With,If-Modified-Since,Enshroud-Control,Content-Type,Content-Range,Range,soapaction,dnt,x-customheader,keep-live,user-amanuensis,x-requested-with,if-modified-since,cache-control,content-type,content-range,range,10-NewRelic-ID,x-newrelic-id" ] "Access-Control-Permit-Methods" => assortment:1 [ 0 => "Become, Mail, OPTIONS" ] "Access-Command-Betrayal-Headers" => assortment:i [ 0 => "*" ] "Access-Control-Max-Age" => assortment:1 [ 0 => "1728000" ] "Ten-Frame-Options" => array:1 [ 0 => "SAMEORIGIN" ] "Ten-Content-Type-Options" => array:1 [ 0 => "nosniff" ] "X-XSS-Protection" => assortment:1 [ 0 => "1; mode=cake" ] "X-UA-Compatible" => array:ane [ 0 => "IE=edge,chrome=1" ] "Accept-Ranges" => array:1 [ 0 => "bytes" ] "Vary" => array:1 [ 0 => "Accept-Encoding" ] "Expires" => array:1 [ 0 => "Fri, 05 November 2021 14:23:24 GMT" ] "Cache-Control" => array:1 [ 0 => "max-age=0, no-cache, no-store" ] "Pragma" => array:1 [ 0 => "no-cache" ] "Date" => assortment:i [ 0 => "Fri, 05 Nov 2021 fourteen:23:24 GMT" ] "Transfer-Encoding" => array:1 [ 0 => "chunked" ] "Connection" => array:ii [ 0 => "keep-alive" 1 => "Transfer-Encoding" ] "Server-Timing" => array:3 [ 0 => "cdn-cache; desc=MISS" 1 => "edge; dur=23" 2 => "origin; dur=10997" ] "ten-encoded-content-encoding" => array:1 [ 0 => "gzip" ] ] -headerNames: array:20 [ "content-type" => "Content-Blazon" "admission-control-allow-origin" => "Admission-Control-Allow-Origin" "access-control-allow-headers" => "Admission-Control-Let-Headers" "access-control-allow-methods" => "Access-Control-Allow-Methods" "access-control-expose-headers" => "Access-Control-Expose-Headers" "access-command-max-age" => "Admission-Control-Max-Age" "ten-frame-options" => "X-Frame-Options" "x-content-type-options" => "10-Content-Type-Options" "x-xss-protection" => "X-XSS-Protection" "x-ua-compatible" => "10-UA-Compatible" "accept-ranges" => "Accept-Ranges" "vary" => "Vary" "expires" => "Expires" "cache-control" => "Cache-Control" "pragma" => "Pragma" "date" => "Date" "transfer-encoding" => "Transfer-Encoding" "connection" => "Connectedness" "server-timing" => "Server-Timing" "x-encoded-content-encoding" => "x-encoded-content-encoding" ] -protocol: "1.1" -stream: GuzzleHttp\Psr7\Stream {#493 -stream: stream resources @331 wrapper_type: "PHP" stream_type: "TEMP" mode: "due west+b" unread_bytes: 0 seekable: true uri: "php://temp" options: [] } -size: zip -seekable: true -readable: truthful -writable: truthful -uri: "php://temp" -customMetadata: [] } } -handlerContext: array:xxx [ "errno" => xviii "error" => "transfer closed with outstanding read data remaining" "appconnect_time" => 0.042203 "url" => "https://arch.30.com/api/one/30/123456/xxx" "content_type" => "application/json" "http_code" => 200 "header_size" => 1040 "request_size" => 237 "filetime" => -one "ssl_verify_result" => 0 "redirect_count" => 0 "total_time" => 11.115178 "namelookup_time" => 0.012257 "connect_time" => 0.020937 "pretransfer_time" => 0.042225 "size_upload" => 0.0 "size_download" => 52470.0 "speed_download" => 4720.0 "speed_upload" => 0.0 "download_content_length" => -i.0 "upload_content_length" => -1.0 "starttransfer_time" => eleven.101096 "redirect_time" => 0.0 "redirect_url" => "" "primary_ip" => "2.1.2.1" "certinfo" => [] "primary_port" => 443 "local_ip" => "192.168.200.181" "local_port" => 33130 "curl_version" => "7.52.1" ] #bulletin: "cURL error eighteen: transfer closed with outstanding read information remaining (run into https://curl.haxx.se/libcurl/c/libcurl-errors.html)" #lawmaking: 200 #file: "/var/world wide web/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php" #line: 201 trace: { /var/www/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:201 {} /var/www/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:155 {} /var/www/api/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:105 {} /var/www/api/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php:43 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:28 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php:51 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php:37 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/Middleware.php:29 {} /var/www/api/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php:70 {} /var/www/api/vendor/guzzlehttp/guzzle/src/Middleware.php:59 {} /var/www/api/vendor/guzzlehttp/guzzle/src/HandlerStack.php:71 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/Client.php:361 {} /var/world wide web/api/vendor/guzzlehttp/guzzle/src/Client.php:163 {} /var/www/api/vendor/guzzlehttp/guzzle/src/Client.php:183 {} /var/www/api/src/RestConnectorService.php:126 { Api\RestConnectorService->sendGetRequest(string $uri): ResponseInterface … › 'connect_timeout' => self::CONNECT_TIMEOUT, › 'verify' => cocky::SSL_VERIFY, › ] arguments: { $method: "Become" $uri: "https://curvation.xxx.com/api/1/xxx/123456/30?" $options: array:5 [ …5] } }el/HttpKernel.php:68 {} /var/www/api/vendor/symfony/http-kernel/Kernel.php:201 {} /var/www/api/public/index.php:25 {} } }
Undefined asked
Source
Share
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Inquire your question and get a quick answer for free.
Like questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to information technology. With your assist, nosotros will brand our community stronger.
About the technologies asked in this question
PHP
PHP (from the English Hypertext Preprocessor - hypertext preprocessor) is a scripting programming language for developing web applications. Supported by nearly hosting providers, it is one of the most popular tools for creating dynamic websites. The PHP scripting language has gained wide popularity due to its processing speed, simplicity, cross-platform, functionality and distribution of source codes under its own license.
https://www.php.net/
Symfony
Symfony compares favorably with other PHP frameworks in terms of reliability and maturity. This framework appeared a long fourth dimension ago, in 2005, that is, it has existed much longer than most of the other tools we are considering. It is popular for its spider web standards compliance and PHP blueprint patterns.
https://symfony.com/
HTML
HTML (English language "hyper text markup language" - hypertext markup language) is a special markup language that is used to create sites on the Internet. Browsers sympathise html perfectly and can translate it in an understandable way. In full general, any page on the site is html-lawmaking, which the browser translates into a user-friendly form. By the way, the code of whatsoever page is available to anybody.
https://world wide web.w3.org/html/
Welcome to programmierfrage.com
programmierfrage.com is a question and answer site for professional web developers, programming enthusiasts and website builders. Site created and operated past the community. Together with you, we create a free library of detailed answers to any question on programming, spider web development, website cosmos and website administration.
Get answers to specific questions
Ask about the real problem you are facing. Draw in detail what y'all are doing and what yous want to achieve.
Assistance Others Solve Their Problems
Our goal is to create a stiff community in which everyone will support each other. If you lot find a question and know the reply to it, assistance others with your knowledge.
Source: https://programmierfrage.com/items/guzzle-curl-error-18-transfer-closed-with-outstanding-read-data-remaining
0 Response to "Curl Transfer Closed With Bytes Remaining to Read"
Post a Comment