Commit Graph
168 Commits
Author SHA1 Message Date
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
Gonzalo Paniagua Javier 6450a342e5 [HttpWebRequest] EndGetResponse already does this. 2011-02-14 14:36:14 -05:00
Gonzalo Paniagua Javier 2fa2ca3565 [HttpWebRequest] Use the timeout in GetResponse()
The timeout was not being used in GetResponse.
	Fixes bug #603794.
2011-02-13 15:01:29 -05:00
Gonzalo Paniagua Javier b92b165ddb [HttpWebRequest] Error handling for POST/PUT
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.
2011-02-10 17:25:15 -05:00
Gonzalo Paniagua Javier f4c13c06c7 Allow forcing HTTP protocol version
If the version is manually set, ignore the version from the service
	point when set.

	Fixes bug #668199.
2011-01-31 10:48:37 -05:00
Gonzalo Paniagua Javier c6b1dd9db3 [HttpWebRequest] New 4.0 AddRange overloads. 2011-01-18 18:56:32 -05:00
Gonzalo Paniagua Javier fb13ef43ce [HttpWebRequest] Support 4.0 Date property. 2011-01-18 16:44:12 -05:00
Gonzalo Paniagua Javier 9ae3d21c17 [HttpWebRequest] Support 4.0 Host property. 2011-01-18 12:52:58 -05:00
Gonzalo Paniagua Javier 604d5faa0b More StringComparison.Ordinal
Use StringComparison.Ordinal when calling IndexOf to find the index of
	an ASCII string.
2010-10-31 17:23:18 -04:00
Gonzalo Paniagua Javier ce6effffda Set have_response
Set have_response to true when there's a protocol error or a previous
	exception for POST/PUT.
	Patch by Bassam Tabbara.
2010-10-04 02:44:40 -04:00
Gonzalo Paniagua Javier 8823d1c040 Remove Content-Length header when not needed
If we are redirecting to a GET from a POST, the Content-Length header
	might have stale data and it will be sent. Some servers, instead of
	ignoring it, keep waiting for the data to be sent (for a GET!).

	Fixes bug #636219.
2010-09-01 17:57:55 -04:00
Gonzalo Paniagua Javier f832b99535 Avoid sending data in the challenge phase of NTLM
If there's a POST/PUT request that gets a NTLM 401, we save the data
	and don't send it again until after the challenge phase. Ie, instead of
	sending all the data 3 times, we only send it at most twice.
2010-09-01 15:52:09 -04:00
Gonzalo Paniagua Javier d40bb3a606 2010-06-16 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: DELETE allows an entity body.
	Fixes bug #614483.


svn path=/trunk/mcs/; revision=159036
2010-06-16 20:24:45 +00:00
Gonzalo Paniagua Javier f4ce05c1ce 2010-06-15 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: 307 does not change request method.


svn path=/trunk/mcs/; revision=158980
2010-06-15 21:58:30 +00:00
Gonzalo Paniagua Javier f0f2e24381 2010-04-15 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: set content length to -1 on redirect. Reset
	'FinishedReading' on redirects. Fixes bug #593596.


svn path=/trunk/mcs/; revision=155604
2010-04-16 02:16:12 +00:00
Gonzalo Paniagua Javier 6ad1d32e9e 2010-03-27 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: when PreAuthenticate is true, don't remove the
	existing authorization related headers until we know we have a
	replacement. Fixes bug #591633.


svn path=/trunk/mcs/; revision=154348
2010-03-27 16:27:20 +00:00
Sebastien Pouliot 355a27b73d In System.Timers:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Timer.cs: Removed old NET_2_0 defines and added some new
	MOONLIGHT defines (needed for the client stack)

In System.Net:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* AuthenticationManager.cs: Internal type for Moonlight.
	Add BasicClient, DigestClient, NtlmClient for NET_2_1 since
	this applies to both monotouch and moonlight (client stack).
	Removed unneeded NET_2_0 defines
	* CookieContainer.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll. Removed unneeded NET_2_0
	defines
	* HttpContinueDelegate.cs: Internal type for Moonlight.
	* HttpRequestCreator.cs: Remove a MOONLIGHT define
	* HttpStatusCode.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll
	* HttpWebRequest.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight).
	Removed unneeded NET_2_0 and NET_1_1 defines
	* HttpWebResponse.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* IAuthenticationModule.cs: Internal type for Moonlight.
	* ICertificatePolicy.cs: Internal type for Moonlight.
	* ICredentialPolicy.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* IWebRequestCreate.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll
	* ServicePoint.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight)
	* ServicePointManager.cs: Remove a MOONLIGHT define
	* WebException.cs: For Moonlight it needs to be internal in 
	System.dll and public in System.Net.dll. Removed unneeded NET_2_0
	defines
	* WebHeaderCollection.cs: Internal type for Moonlight. Removed 
	unneeded NET_2_0 defines
	* WebRequest.cs: Internal type for Moonlight. Change S.Config
	to NET_2_1 defines (applies to both monotouch and moonlight)
	* WebResponse.cs: Internal type for Moonlight. Removed unneeded
	NET_2_0 defines

In System.Net.Sockets:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Socket.cs: Remove some NET_2_0 defines (using) and add a few
	MOONLIGHT defines needed to reuse Socket in the client http stack
	* Socket_2_1.cs: Remove some MOONLIGHT defines
	* SocketAsyncEventArgs.cs: For Moonlight check policy if outside
	System.dll (the client stack use sockets with it's own web 
	xdomain policy)

In System:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* Uri.cs: Remove some MOONLIGHT defines

In .:
2010-03-19  Sebastien Pouliot  <[email protected]>

	* moonlight_*_System.dll.sources: Bring extra types so we can
	build a full, managed, internal HTTP stack to be reused for SL3+
	* Makefile: Add a INSIDE_SYSTEM define when compiling System.dll
	to makes it possible to rebuild the same types in System.Net.dll


svn path=/trunk/mcs/; revision=153916
2010-03-19 19:01:31 +00:00
Gonzalo Paniagua Javier 544931f4aa 2010-01-13 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: when the server returns several different
	authentication methods, pick the one that works.
	Fixes bug #562043.


svn path=/trunk/mcs/; revision=149500
2010-01-13 23:22:38 +00:00
Gonzalo Paniagua Javier ae20ad47f0 2009-08-13 Gonzalo Paniagua Javier <[email protected]>
* 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
2009-08-13 22:12:18 +00:00
Jb Evain f2a6f61bad use a 2.0 network stack for MONOTOUCH
svn path=/trunk/mcs/; revision=139255
2009-08-02 15:43:12 +00:00
Gonzalo Paniagua Javier 547e70a03b 2009-07-07 Gonzalo Paniagua Javier <[email protected]>
* 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
2009-07-07 14:57:51 +00:00
Gonzalo Paniagua Javier 7ff2c1978d 2009-07-02 Gonzalo Paniagua Javier <[email protected]>
* 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
2009-07-02 07:33:12 +00:00