{"action":"created","issue":{"url":"https://api.github.com/repos/guzzle/guzzle/issues/1848","repository_url":"https://api.github.com/repos/guzzle/guzzle","labels_url":"https://api.github.com/repos/guzzle/guzzle/issues/1848/labels{/name}","comments_url":"https://api.github.com/repos/guzzle/guzzle/issues/1848/comments","events_url":"https://api.github.com/repos/guzzle/guzzle/issues/1848/events","html_url":"https://github.com/guzzle/guzzle/issues/1848","id":232237294,"number":1848,"title":"Error 'cURL error 52: Empty reply from server.' when sending large file.","user":{"login":"pmxjason","id":7057525,"avatar_url":"https://avatars2.githubusercontent.com/u/7057525?v=4","gravatar_id":"","url":"https://api.github.com/users/pmxjason","html_url":"https://github.com/pmxjason","followers_url":"https://api.github.com/users/pmxjason/followers","following_url":"https://api.github.com/users/pmxjason/following{/other_user}","gists_url":"https://api.github.com/users/pmxjason/gists{/gist_id}","starred_url":"https://api.github.com/users/pmxjason/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pmxjason/subscriptions","organizations_url":"https://api.github.com/users/pmxjason/orgs","repos_url":"https://api.github.com/users/pmxjason/repos","events_url":"https://api.github.com/users/pmxjason/events{/privacy}","received_events_url":"https://api.github.com/users/pmxjason/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-30T12:32:24Z","updated_at":"2018-05-30T16:12:21Z","closed_at":null,"author_association":"NONE","body":"Hello,\r\n\r\nI was hoping someone could shed some light on an error which I am receiving. This is my code:\r\n\r\n    $client = new \\GuzzleHttp\\Client();\r\n    $response = $client->post(\r\n        $url,\r\n        [\r\n            'exceptions' => FALSE,\r\n            'multipart' => [\r\n                [\r\n                    'name'     => 'filename',\r\n                    'contents' => $import->format(new CsvFormatter()),\r\n                    'filename'  => \"import_{$request->getPMXID()}.csv\"\r\n                ]\r\n            ]\r\n        ]\r\n    );\r\n\r\nIt is being used frequently and works fine. I recently started developing a new feature which would lead to larger files. This is when the cURL error started happening. If the file is a few hundred KB it works fine. It the file is 1.8MB it doesn't. I don't know where the cut off is.\r\n\r\nGoogling has not helped. I dug into the CurlFactory class to try to shed some light on what the curl request looked like. I noticed there is a difference between sending based on content size. For a small amount of content the request contains:\r\n\r\n> --16b49cbca986ad7a8d042d673018bb96be0e2b31\r\n> Content-Disposition: form-data; name=\"filename\"; filename=\"import_200003626_32.csv\"\r\n> Content-Length: 5\r\n> Content-Type: text/csv\r\n> \r\n> asddd\r\n> --16b49cbca986ad7a8d042d673018bb96be0e2b31--\r\n\r\nFor a large request a MultipartStream object is created. For a small request the Except header is empty. For a large request the Except header is 100-Continue.\r\n\r\nI tried the following:\r\n\r\n1) Saved the file to disk, instead of passing in a string I passed in a file handle. Same Error.\r\n2) I tried sending the same request using postman to my api. Works.\r\n3) I tried doing a curl request from my server using the large file. Works fine.\r\n4) I set expect to false for the large file. Same Error.\r\n5) I tried setting stream to false for the large file. Same error.\r\n\r\nI feel that this could be a bug in my api being unable to handle the request in the way Guzzle is sending it. As I said previously, the server handles a standard curl request with the same file content fine. Does guzzle handle a 5 character string and 5MB string differently? How does this influence the curl request?\r\n\r\nI am using Guzzle 6.2"},"comment":{"url":"https://api.github.com/repos/guzzle/guzzle/issues/comments/393221549","html_url":"https://github.com/guzzle/guzzle/issues/1848#issuecomment-393221549","issue_url":"https://api.github.com/repos/guzzle/guzzle/issues/1848","id":393221549,"user":{"login":"MichaelBelgium","id":8951045,"avatar_url":"https://avatars3.githubusercontent.com/u/8951045?v=4","gravatar_id":"","url":"https://api.github.com/users/MichaelBelgium","html_url":"https://github.com/MichaelBelgium","followers_url":"https://api.github.com/users/MichaelBelgium/followers","following_url":"https://api.github.com/users/MichaelBelgium/following{/other_user}","gists_url":"https://api.github.com/users/MichaelBelgium/gists{/gist_id}","starred_url":"https://api.github.com/users/MichaelBelgium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MichaelBelgium/subscriptions","organizations_url":"https://api.github.com/users/MichaelBelgium/orgs","repos_url":"https://api.github.com/users/MichaelBelgium/repos","events_url":"https://api.github.com/users/MichaelBelgium/events{/privacy}","received_events_url":"https://api.github.com/users/MichaelBelgium/received_events","type":"User","site_admin":false},"created_at":"2018-05-30T16:12:21Z","updated_at":"2018-05-30T16:12:21Z","author_association":"NONE","body":"I'm having the same error with API calls (in Laravel)\r\n\r\n```PHP\r\n$response = $this->client->request('PUT', route('api.category.update', ['category' => $category]), [\r\n            'form_params' => $request->all()\r\n        ])->getBody();\r\n```\r\n\r\nIt occurs randomly.\r\n\r\nFull stack:\r\n\r\n```\r\n[2018-05-30 17:52:55] staging.ERROR: cURL error 52: Empty reply from server (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)\r\n[stacktrace]\r\n#0 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(150): GuzzleHttp\\\\Handler\\\\CurlFactory::createRejection(Object(GuzzleHttp\\\\Handler\\\\EasyHandle), Array)\r\n#1 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php(103): GuzzleHttp\\\\Handler\\\\CurlFactory::finishError(Object(GuzzleHttp\\\\Handler\\\\CurlHandler), Object(GuzzleHttp\\\\Handler\\\\EasyHandle), Object(GuzzleHttp\\\\Handler\\\\CurlFactory))\r\n#2 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php(43): GuzzleHttp\\\\Handler\\\\CurlFactory::finish(Object(GuzzleHttp\\\\Handler\\\\CurlHandler), Object(GuzzleHttp\\\\Handler\\\\EasyHandle), Object(GuzzleHttp\\\\Handler\\\\CurlFactory))\r\n#3 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(28): GuzzleHttp\\\\Handler\\\\CurlHandler->__invoke(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#4 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php(51): GuzzleHttp\\\\Handler\\\\Proxy::GuzzleHttp\\\\Handler\\\\{closure}(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#5 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php(66): GuzzleHttp\\\\Handler\\\\Proxy::GuzzleHttp\\\\Handler\\\\{closure}(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#6 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Middleware.php(30): GuzzleHttp\\\\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#7 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php(70): GuzzleHttp\\\\Middleware::GuzzleHttp\\\\{closure}(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#8 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Middleware.php(57): GuzzleHttp\\\\RedirectMiddleware->__invoke(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#9 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/HandlerStack.php(67): GuzzleHttp\\\\Middleware::GuzzleHttp\\\\{closure}(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#10 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Client.php(277): GuzzleHttp\\\\HandlerStack->__invoke(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#11 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Client.php(125): GuzzleHttp\\\\Client->transfer(Object(GuzzleHttp\\\\Psr7\\\\Request), Array)\r\n#12 /var/www/html/bakkerij/vendor/guzzlehttp/guzzle/src/Client.php(131): GuzzleHttp\\\\Client->requestAsync('PUT', Object(GuzzleHttp\\\\Psr7\\\\Uri), Array)\r\n#13 /var/www/html/bakkerij/app/Http/Controllers/CMS/CategoryController.php(84): GuzzleHttp\\\\Client->request('PUT', 'http://dev.bakk...', Array)\r\n#14 [internal function]: App\\\\Http\\\\Controllers\\\\CMS\\\\CategoryController->update(Object(Illuminate\\\\Http\\\\Request), Object(App\\\\Models\\\\Category))\r\n#15 /var/www/html/bakkerij/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)\r\n#16 /var/www/html/bakkerij/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\\\Routing\\\\Controller->callAction('update', Array)\r\n#17 /var/www/html/bakkerij/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\\\Routing\\\\ControllerDispatcher->dispatch(Object(Illuminate\\\\Routing\\\\Route), Object(App\\\\Http\\\\Controllers\\\\CMS\\\\CategoryController), 'update')\r\n#18 /var/www/html/bakkerij/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\\\Routing\\\\Route->runController()\r\n#19 /var/www/html/bakkerij/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\\\\Routing\\\\Route->run()\r\n....\r\n```\r\n\r\n"}}
{"actor":{"display_login":"MichaelBelgium"}}