Commit Graph
189 Commits
Author SHA1 Message Date
Marek Safar d1d81c9cb5 [system] Fix warnings 2014-05-27 17:04:24 +02:00
Martin Baulig e49d56e8d1 [Http]: Cleanup chained async operations; bug #19161. 2014-05-21 02:26:48 +02:00
Martin Baulig f647afb02f [Http]: Correctly handle request bodies when resending with authentication.
My previous changes modified the way how we're handing the request body when
resending a request due to a 30x redirection.

Authentication is a "special" form of redirection because we sometimes need
to resend a request with additional authentication headers.  Unfortunately,
I forgot this, causing a regression which is now fixed.

This has been reported as bugs #19119 and #19068.
2014-04-17 22:27:19 +02:00
Martin Baulig f986a59333 [Http]: Disable redirect with body and no buffering. 2014-04-08 08:24:40 +02:00
Martin Baulig 461855eddd [Http]: Clear the 'SendChunked' flag when redirecting. 2014-04-08 08:24:21 +02:00
Martin Baulig 9f7e64c187 [Http]: Remove chunked/etc headers when redirecting a request as GET. 2014-04-08 08:23:54 +02:00
Miguel de Icaza 0a13aae80e System/PCL: Implement HttpWebRequest.SupportsCookieContainer, WebRequest.CreateHttp; Fixes #18378 2014-03-13 22:53:49 -04:00
Martin Baulig 8f2d3ea31d HttpWebRequest: Only add "Content-Length" if we have a body; fixes #17736. 2014-02-26 15:49:25 +01:00
Martin Baulig faaa8a7c94 Async-ify the remaining WebConnectionStream pieces. 2014-02-25 18:57:30 +01:00
AxlPr b3ae7c6d11 Fixed time outs on http redirects
Fixed bug introduced by change 6ab86f50fd
where http request times out when it encounters a redirect.
2014-02-19 13:27:22 +00:00
Martin Baulig da6c88b49b [System] WebConnection and WebConnectionStream code cleanups.
* Merged WebConnection.EndWrite() and EndWrite2().

* WebConnectionStream.BeginWrite(): Use the same async-write
  callback for both chunked and non-chunked; remove the single-use
  small WriteRequestAsync() and inline it here to make the code
  more readable.

* WebConnectionStream.WriteRequestAsyncCB(): Now called for all
  async writes, call WebConnection.EndWrite() here.

The code is now more readable and easier to understand.  This is
the first part of a series of cleanups, which should eventually
lead towards full async and 100-continue.
2014-02-19 11:08:18 +01:00
Martin Baulig 5e03c107bc Put back and fix the SSL async patch.
Revert "Revert "Merge pull request #829 from symform/httpwebreq-async-ssl""

This reverts commit 56d9a057eb, which was a
revert of 35899c07ff, thus putting 35889 back.
2014-02-13 18:48:16 +01:00
Martin Baulig 4b5f5f96c8 [System]: Reset NTLM auth state when redirecting; distinguish host and proxy. 2014-02-13 15:48:44 +01:00
Marek Safar 56d9a057eb Revert "Merge pull request #829 from symform/httpwebreq-async-ssl"
This reverts commit 35899c07ff, reversing
changes made to 80166fd02f.
2014-02-10 18:48:03 +01:00
Sebastien Pouliot 35899c07ff Merge pull request #829 from symform/httpwebreq-async-ssl
Convert blocking operations in HttpWebRequest and SslClientStream to non-blocking
2014-02-07 16:48:05 -05:00
OttoG e4a09c8613 Changed compiler directive according to documentation
EndGetRequestStream with TransportContext parameter was introduced in .NET 3.5. Also added "using" statement for System.Net (namespace for TransportContext).
2013-12-11 22:03:18 +01:00
OttoG a9079357c6 Stub implementation of EndGetRequestStream overload in HttpWebRequest.cs
I am not sure if a "do-nothing" implementation like this is acceptable in the Mono code base, but it does solve the problem described in https://bugzilla.xamarin.com/show_bug.cgi?id=12875 (successfully executing simple requests using the Google API .NET client library).
2013-12-11 12:35:57 +01:00
Marek Safar 6ab86f50fd [system] Redirect of put requests was converted to get. Fixes #16670 2013-12-09 14:18:15 +01:00
Bassam Tabbara 90f9595967 Convert blocking operations in HttpWebRequest and SslClientStream to non-blocking operations. This fixes #15451.
More details:
  * HttpWebRequest now writes the HTTP request headers asynchronously. This will avoid blocking a thread pool thread until the headers are written.
  * SslClientStream was doing the TLS negotiations in a blocking manner. Converted the negotiation method to an async state machine where all operations are done asynchronously.
  * The test case identified in #15451 now completes quickly with less than 15 threads created, vs. 100s of threads used before this fix.

Future work if needed:
  * I did not convert SslServerStream but the same pattern could be used here.
  * SendAlert is still blocking. I thought it was not worth converting it to non-blocking.
2013-12-06 09:32:22 -08:00
Jérémie Laval 96935b19e1 [System] Add crude (for now) socket stealing of an HttpWebRequest.
HttpWebRequest is a very tricky piece of code when it comes to its socket, this patch is more like a hack to get something working out of it but it's definitely not the best option.
2013-07-29 00:47:11 -04:00
Jérémie Laval ee7a497ed4 [System] Don't overwrite custom Connection header on HttpWebRequest 2013-07-29 00:47:11 -04:00
Martin Baulig e181a1a44d [System]: Partially fix #12393. 2013-06-26 01:35:28 +02:00
Martin Baulig 3016218856 HttpWebRequest/Response API fixes for .NET 4.5. 2013-03-12 17:22:59 -04:00
Martin Baulig 879250e505 Misc PCL-related API fixes. 2013-03-04 12:40:21 -05:00
Marek Safar 5aeeb9cf7b Fix few warnings 2013-02-25 19:10:09 +01:00
Miguel de Icaza 14f0405443 Revert "[HttpWebRequest] Avoid using the threadpool for synchronous requests"
This reverts commit b190db44cb.

The reason is:

"The HttpWebRequests tests are not enough"

"A quick review of the code shows that the code is taking a lock, while
calling a function that retries connections (which in turn takes another
important lock --for the socket--) which might casue a stack overflow
if someone calls SetWriteStream"

"This also will make the opereation sync when calling Begin/End"

"Finally, this is a patch that improves the use of the threadpool, but
the threadpool still will end up exhausted"

Probably best to just increase the number of threads?
2013-02-15 11:11:58 -05:00
Rodrigo Kumpera 1b92a4148c Since MOBILE implies NET_4_* now, take this into account and simplify our ifdefs. 2013-02-11 18:42:18 -05:00
Rodrigo Kumpera 5007c14d62 Kill the MOONLIGHT define in System. 2013-02-11 13:01:11 -05:00
Andres G. Aragoneses b190db44cb [HttpWebRequest] Avoid using the threadpool for synchronous requests
The code path for synchronous requests was the same as the one for
asynchronous ones: the threadpool. It's actually not needed in this
case because the thread is going to wait anyway, so there's no need
to use the threadpool.

This helps in scenarios in which SOA is heavily used:
- The process is hosted under xsp/mono-fastcgi/... which use the threadpool
too.
- If the requests generate other requests to other REST services, the
usage of the threadpool in these cases may interfere with the usage of
the threadpool by xsp/mono-fastcgi/...
- The thread that is serving a request shouldn't request another thread
for a blocking operation, preventing the use of that thread by other
possible incoming requests.

This commit is contributed under the terms of MIT/X11 licence.

(It doesn't cause any breakage in the System test suite.)
2013-02-07 21:25:34 +00:00
Martin Baulig 1ccb01e108 [#7637][Web]: Support empty write streams. 2012-10-27 01:15:21 +02:00
Martin Baulig 63a38bdcd9 [#7258][Web]: Fix proxy authentication.
Add internal WebHeaderCollection.GetValues_internal() which lets
you disable splitting the results on commas.

We may get something like

Proxy-Authenticate: Digest realm="MyRealm", nonce="le1+UCAk1gLAdQAA",
qop="auth", stale=false, NTLM

from the server, which needs to be split into two headers.
2012-10-17 21:00:22 +02:00
Marek Safar 7748c8af5f BeginGetRequestStream cannot be called once the request has been submitted. 2012-10-04 11:53:15 +01:00
Martin Potter c289daf4db If a CookieContainer is set, always use its cookies.
Previously, cookies from the WebHeaderCollection and CookieContainer were sent. This also fixes a bug with ServicePoint sending duplicate cookies when SendRequestHeaders is called more than once:

* WebConnection.InitConnection
* HttpWebRequest.SetWriteStream
* HttpWebRequest. SendRequestHeaders
* WebConnectionStream.WriteRequest
* HttpWebRequest.SendRequestHeaders

Replacing the cookie header value in the WebHeaderCollection with the cookies stored in the CookieContainer also matches the behavior of Microsoft's .NET implementation.
2012-08-05 21:52:54 -07:00
Martin Baulig 15053c403f Oops, actually remove the 'Date' header. 2012-06-26 03:06:56 +02:00
Martin Baulig abab46be8b Fix DateTime.MinValue in HttpWebRequest.Date.
* HttpWebRequestTest.cs: Extend this by adding each DateTimeKind
  and testing the result.  This test now passes again.
2012-06-26 02:51:09 +02:00
Marek Safar 6ca8ad7642 Remove double null check 2012-06-07 11:38:53 +01:00
Sebastien Pouliot 42daa4fd3a Add some stubs for methods required by the portable class library profiles 2012-05-10 08:45:13 -04:00
Gonzalo Paniagua Javier 033a2536df .NET 4.0+ flushes the request stream when content length is not set
Fixes bug #4640
2012-04-30 14:18:53 -04:00
Marek Safar bfea12c482 Add exception ignore mode to HttpWebRequest 2012-04-25 14:26:56 +01:00
Gonzalo Paniagua Javier 9007f5e043 Avoid deadlocking when getting the ServicePoint
SSL connections were deadlocking when getting the service point for the
	connection in the last few releases of 2.10.x and in master.

	Fixes bug #4599.
2012-04-24 04:54:54 -04:00
Gonzalo Paniagua Javier c64a76e3aa Redirect right after NTLM authentication works now
Fixes bug #3894.
2012-03-18 17:44:30 -04:00
Marek Safar 2869713c48 Fix some compiler warnings 2012-02-17 12:37:25 +00:00
Marek Safar ae11667cff WebHeaderCollection fixes 2011-12-07 18:34:27 +00:00
Marek Safar 099d9e7fcc Add some 4.5 api 2011-12-07 18:34:26 +00:00
Gonzalo Paniagua Javier 8e67b8c2fc Don't send the buffered request until GetResponse is called
Allows changing some header values after writing the request until the
	call to (Begin)GetResponse()
2011-10-16 01:57:41 -04:00
Gonzalo Paniagua Javier 1ac0557bfc Support FTP + RETR + proxy
Fixes bug #690887.
2011-04-30 11:07:56 +02:00
Gonzalo Paniagua Javier 4e7c632f10 Remove unused variable 2011-04-22 14:20:57 -04:00
Gonzalo Paniagua Javier 1411c9d420 [HttpWebRequest] Fix half-baked commit
Fixes bug #688100.
2011-04-18 10:56:57 -04:00
Gonzalo Paniagua Javier e4e0cb670f [HttpWebRequest] Only uppercase known methods 2011-03-10 19:05:26 -05:00
Gonzalo Paniagua Javier 75c12dbd2c Turn the method to upper case.
Fixes bug #675731.
2011-03-08 17:35:35 -05:00