Skip to content

Conversation

@Mpdreamz
Copy link
Member

Confirmed we do not handle the case where response.GetResponseStream() returns null in our WebException handling.

As per: http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.getresponsestream.aspx

You must call either the Stream.Close or the HttpWebResponse.Close method to close the stream and release the connection for reuse. It is not necessary to call both Stream.Close and HttpWebResponse.Close, but doing so does not cause an error. Failure to close the stream will cause your application to run out of connections.

We rely on disposing the stream only but in this case we need to forcefully call dispose on response instead.

can return null and we should close the response stream instead in those
cases because we can not rely on closing the stream.

Conflicts:
	src/Tests/tests.yaml
Conflicts:
	src/Elasticsearch.Net/Transport/Pipeline/ResponseBuilder.cs
@Mpdreamz Mpdreamz merged commit 9750fa6 into 5.x Oct 10, 2016
@Mpdreamz Mpdreamz deleted the fix/webexception-handling-5x branch October 10, 2016 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants