When we get an error from the server before writing an entire
unbuffered response, the server might close the connection leading to
write errors. Ignore those and return the actual HTTP status code from
the original server error.
* HttpWebRequest.cs:
* WebConnectionStream.cs: if there's an error writing the headers from
a buffered request, propagate the error instead of hiding it and
causing a different one later (ie, ObjectDisposedException instead of
the original WebException). This happened when posting without
Content-Length set to an HTTPS url without validating the server
certificate.
svn path=/trunk/mcs/; revision=139885
* WebConnectionStream.cs: when sending a 0-length POST, ignore further
writes instead of throwing.
Fixes bug #524049.
svn path=/trunk/mcs/; revision=138447
* WebClient.cs: set the content length when uploading values. This
allows reusing the connection.
* WebConnectionStream.cs: SetHeaders() takes ownership of the buffer
and does not need to copy it any more. WriteRequest() wasn't always
setting 'requestWritten' to true.
* HttpWebRequest.cs: change in SetHeaders call.
svn path=/trunk/mcs/; revision=137497
Modified CanRead and CanWrite to return false when instance is disposed.
* HttpWebRequestTest.cs: Enabled tests, and removed test that is now
covered by two separate CanTimeout tests for request and response
stream.
* HttpWebResponseStreamTest.cs: Enabled tests.
svn path=/trunk/mcs/; revision=137450
* WebConnection.cs: provide better error message when there's an error
writing.
* WebConnectionStream.cs: don't nullify the buffer until
CheckFinalStatus() decides that there are no more authentication
retries or redirects.
svn path=/trunk/mcs/; revision=137332
* HttpWebRequest.cs: avoid duplicating Accept-Encoding if GetHeaders()
is called twice.
* WebConnectionStream.cs: don't send a 0 content length for non-write
requests.
svn path=/trunk/mcs/; revision=137233
* WebConnectionStream.cs: when buffering the response, we have to set
the internal length and regenerate the headers.
svn path=/trunk/mcs/; revision=137043
* HttpWebRequest.cs: don't send Content-Length header when SendChunked
is enabled.
* WebConnectionStream.cs: send the headers immediately when possible.
When writing the request before a Close(), if there was an exception
it was lost.
svn path=/trunk/mcs/; revision=137019
* WebAsyncResult.cs: new field that tells us if the request is being
written automatically because we reached the content length.
* WebConnection.cs:
* WebConnectionStream.cs: make sure we only access the NetworkStream
while we own it. Automatically write the request when we reach
ContentLength number of bytes. Kill the write buffer as soon as
possible. Don't use the buffer at all when chunked encoding is
enabled.
Fixes bugs #515931 and #510642.
svn path=/trunk/mcs/; revision=136900
* WebConnectionStream.cs: close the underlying socket if there's an
exception when closing the stream. Fixes bug #514996.
svn path=/trunk/mcs/; revision=136572
* WebConnectionStream.cs: Keep count of all bytes written, and perform
write overflow check in both buffered and non-buffered writing (if
not using chunked transfer encoding). Fixes bug #510642.
svn path=/trunk/mcs/; revision=136570
zero-length string literal. Fixed exception argument name to match
MS.
* WebConnectionStream.cs: Throw a WebException that wraps an
IOException when closing the stream before all bytes are written.
svn path=/trunk/mcs/; revision=136543
* WebConnectionStream.cs: if the buffer has been killed, return -1 for
its length. Fixes regression in System.Runtime.Remoting.
svn path=/trunk/mcs/; revision=123449
* HttpConnection.cs: we were not writing the headers for 0-length
responses.
* WebConnectionStream.cs: for 204/304 responses with an explicit
content-length of 0, release the socket only once.
Fixes bug #465638.
svn path=/trunk/mcs/; revision=123250
* WebConnectionStream.cs: when there's a NTLM authentication in
progress, don't let the connection be used by the next request if we
have the entire response in the input buffer.
svn path=/trunk/mcs/; revision=117511
* HttpWebRequest.cs: don't call ProxyRequest twice.
* WebConnectionData.cs: remove unused fields.
* WebConnection.cs:
* WebConnectionStream.cs: when setting the input buffer, check to see
if the entire response is already there and free up the request slot.
Fixes bug #423156.
* ResponseStream.cs:
* HttpListenerResponse.cs: buffer the headers so that they are sent
together with the data on the first Write (if any). The fix above
didn't work with our HttpListener without this.
svn path=/trunk/mcs/; revision=116868
* WebConnectionStream.cs: when receiving a 0 content-length, free up
the slot for the next request immediately.
Fixes bug #427974.
svn path=/trunk/mcs/; revision=113610
* WebConnectionStream.cs (WriteRequest): For small requests,
cluster together the header + body in a single write call, avoids
the latency problems observed in an TLS application that makes
many web service calls.
2008-08-22 Geoff Norton <[email protected]>
* WebConnection.cs: Set NoDelay
svn path=/trunk/mcs/; revision=111430
* HttpWebRequest.cs: send the request if ContentLength is set for
POST/PUT, the request stream has that exact amount of bytes in it and
we're trying to get the response stream.
This way, closing the request stream is not needed in order to actually
send the request. Fixes bug #77753.
* WebConnectionStream.cs: throw if the number of bytes written is
greater than the specified request content length.
svn path=/trunk/mcs/; revision=57920
* WebConnectionStream.cs: initiate writing the body before trying to
read. This fixes the performance problems observed in web services.
Closes bug #75455.
svn path=/trunk/mcs/; revision=46896
* WebConnection.cs: if cnc.EndRead throws, mark the asyncresult as done.
* WebConnectionStream.cs: if we're done with the body of a chunk, don't
require the next chunk header to be there, as some servers might close
the connection (while also sending 'Connection: close').
svn path=/trunk/mcs/; revision=46512
* WebConnection.cs:
* HttpWebRequest.cs:
* WebConnectionStream.cs: initiate the polling for input data after
sending the header so that we detect any response that the server sends
back even if we're still trying to write the request for a POST/PUT.
If we get the response (or an error) before any one calls GetResponse(),
keep it around instead of ignoring it.
svn path=/trunk/mcs/; revision=45785
* WebConnection.cs: removed a 'slightly' important line by mistake.
* WebConnectionStream.cs: if the transfer encoding is chunked, ignore
content-length header if present.
svn path=/trunk/mcs/; revision=43952
* WebConnection.cs: no need to use an AutoResetEvent.
* WebConnectionStream.cs: don't start any more reads on the socket
after getting a 0 signalling the end. This fixes Ben's infamous foo.cs
test.
svn path=/trunk/mcs/; revision=43916
* WebConnectionStream.cs: if the BeginRead/BeginWrite is completed
synchronously, no need to create the ManualResetEvent to wait on.
svn path=/trunk/mcs/; revision=43178
* WebConnectionStream.cs:
* WebAsyncResult.cs: ensure we only call EndRead once per async. result.
Update total before invoking the callback when present.
svn path=/trunk/mcs/; revision=43016
* WebConnection.cs:
* WebConnectionStream.cs: don't start reading until we've sent at least
the headers. This way we ensure that a Write happens before any Read,
which is needed by the SSL code.
svn path=/trunk/mcs/; revision=42792