{"action":"closed","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/18864","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/18864/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/18864/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/18864/events","html_url":"https://github.com/dotnet/corefx/issues/18864","id":223936058,"number":18864,"title":"Incomplete HTTP responses behaves different between Core and NETFX","user":{"login":"davidsh","id":7684835,"avatar_url":"https://avatars0.githubusercontent.com/u/7684835?v=4","gravatar_id":"","url":"https://api.github.com/users/davidsh","html_url":"https://github.com/davidsh","followers_url":"https://api.github.com/users/davidsh/followers","following_url":"https://api.github.com/users/davidsh/following{/other_user}","gists_url":"https://api.github.com/users/davidsh/gists{/gist_id}","starred_url":"https://api.github.com/users/davidsh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidsh/subscriptions","organizations_url":"https://api.github.com/users/davidsh/orgs","repos_url":"https://api.github.com/users/davidsh/repos","events_url":"https://api.github.com/users/davidsh/events{/privacy}","received_events_url":"https://api.github.com/users/davidsh/received_events","type":"User","site_admin":false},"labels":[{"id":497898703,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Net.Http","name":"area-System.Net.Http","color":"d4c5f9","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":16,"created_at":"2017-04-24T20:08:25Z","updated_at":"2018-05-07T17:41:07Z","closed_at":"2018-05-07T17:41:07Z","author_association":"MEMBER","body":"While investigation #17691, I discovered a test that hangs on .NET Framework.\r\n\r\nWhile the test intended to test a scenario with a \"server that slowly returned data\", it is testing it in the wrong manner.  Returning an HTTP response with a Content-Length header that is geater than the number of bytes actually being returned will cause a client to wait until all promised bytes are returned. This is how, for example, the long-polling type of scenarios work.\r\n\r\nThe fact the .NET Core is working and returning \"partial data\" doesn't seem right. I believe the bug is that .NET Core is not behaving as per RFC. And this test is testing something invalid.\r\n\r\nIf we really wanted a specific test for \"slow data\", we should return all data promised (but perhaps delayed slightly).\r\n\r\n```c#\r\n        [ActiveIssue(18864)]\r\n        [OuterLoop] // TODO: Issue #11345\r\n        [Fact]\r\n        public async Task SendAsync_ReadFromSlowStreamingServer_PartialDataReturned()\r\n        {\r\n            await LoopbackServer.CreateServerAsync(async (server, url) =>\r\n            {\r\n                using (var client = new HttpClient())\r\n                {\r\n                    Task<HttpResponseMessage> getResponse = client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead);\r\n\r\n                    await LoopbackServer.AcceptSocketAsync(server, async (s, stream, reader, writer) =>\r\n                    {\r\n                        while (!string.IsNullOrEmpty(reader.ReadLine())) ;\r\n                        await writer.WriteAsync(\r\n                            \"HTTP/1.1 200 OK\\r\\n\" +\r\n                            $\"Date: {DateTimeOffset.UtcNow:R}\\r\\n\" +\r\n                            \"Content-Length: 16000\\r\\n\" +\r\n                            \"\\r\\n\" +\r\n                            \"less than 16000 bytes\");\r\n\r\n                        using (HttpResponseMessage response = await getResponse)\r\n                        {\r\n                            var buffer = new byte[8000];\r\n                            using (Stream clientStream = await response.Content.ReadAsStreamAsync())\r\n                            {\r\n                                int bytesRead = await clientStream.ReadAsync(buffer, 0, buffer.Length);\r\n                                _output.WriteLine($\"Bytes read from stream: {bytesRead}\");\r\n                                Assert.True(bytesRead < buffer.Length, \"bytesRead should be less than buffer.Length\");\r\n                            }\r\n                        }\r\n\r\n                        return null;\r\n                    });\r\n                }\r\n            });\r\n        }\r\n```"}}
{"actor":{"display_login":"davidsh"}}