69 Commits
Author SHA1 Message Date
Egor Bogatov e42bf95d14 NS2.1 Sync new changes, mobile profiles (#13198)
* Add RuntimeHelpers.GetSubArray. Add missing types to NS's TypeForwarders.cs

* more NS2.1 changes

* ios changes

* Update Decimal (it's now readonly struct)

* fix mcs

* add ROMC.cs

* Fix tests, finish monodroid profile

* Make SRE-not-supported NS2.1 compatible

* Make monotouch_tv and watch NS2.1 compatible

* make some SRE types more NS21 compatible (non-abstract now)

* bump corefx

* More NS21 fixes

* bump coreclr acceptance tests

* Bump API snapshot submodule

* [csproj] Update project files
2019-03-06 08:55:16 +01:00
Martin Baulig 9648645fb3 [System]: Enable some System.Net.Requests tests from CoreFX. (#7080)
* [System]: Enable some System.Net.Requests tests from CoreFX.

* tests.make: add `$(XTEST_HARNESS_PATH)` to `TEST_MONO_PATH`,
  so we can find xunit.assert.

* corefx/SR.cs: add `System.Net.Requests` resources from corefx.

* HttpWebRequest: See below for detailed summary.

* Match parameter names of overridden base class members.

* Fixed order of some argument / state checks to match the
  tested behavior.

* Most async methods now throw exceptions instead of returning
  faulted tasks when called with incorrect arguments.

* HttpWebResponse.ContentType: use `string.empty` as default.

* WebConnectionStream.FlushAsync: override to return a finished task.

* HttpWebRequestTest.AllowReadStreamBuffering: removed this test.

* test-helpers/RemoteExecutorConsoleApp: silently ignore compiler-
  generated helper methods.

Enabled tests from CoreFX:
--------------------------

Added the following tests from external/corefx/src/System.Net.Requests/tests:

* AuthorizationTest, FileWebRequestTest, GlobalProxySelectionTest,
  HttpRequestCachePolicyTest, HttpWebRequestTest, HttpWebResponseHeaderTest,
  HttpWebResponseTest, LoggingTest, RequestStreamTest, WebRequestTest

Not working yet:

* AuthenticationManagerTest, FtpWebRequestTest

We are currently using
../../../external/corefx/src/System.Net.Requests/tests/*.cs:AuthenticationManagerTest.cs,FtpWebRequestTest.cs

Summary of HttpWebRequest changes:
----------------------------------

* Host - we are now using the implementation from corefx.

* DefaultMaxResponseHeadersLength (unused) - fix default value.

* AllowReadStreamBuffering (unused) - allow this property to
  be read/written.

* ContinueTimeout - likewise.

* DefaultCachePolicy (unused) - allow this property to be
  read/written and set default value.

* DefaultMaximumErrorResponseLength (unused) - likewise.

* Connection - use implementation from corefx.

* Method - use implementation from corefx, which has additional
  error checks.

* MaximumResponseHeadersLength - use implementation from corefx,
  adding error checks.

* ReadWriteTimeout - likewise.

* ProtocolVersion - include parameter name in ArgumentException.

* TransferEncoding - use implementation from corefx.

* BeginGetRequestStream / GetRequestStreamAsync / GetRequestStream:
  throw exceptions when called with incorrect arguments rather than
  returning faulted tasks.

* Disable the corefx tests for the moment.

* Bump API snapshot submodule

* Update tests.make
2018-02-28 00:32:06 +01:00
Martin Baulig 8bfcb27147 [System]: Revert my latest WebResponseStream changes.
This reverts PR #6662 (commit 18a1a25) and #6771 (commit da03780).

These two changes introduced a regression:
https://github.com/mono/mono/issues/6788
2018-02-08 12:52:36 -05:00
Martin Baulig 18a1a25345 [System]: Refactor and cleanup WebResponseStream (#6662)
We are now using nested streams to take care of buffering, chunked encoding and automatic decompression.

GZip / Deflate decompression have been moved inside `WebResponseStream`, the `HttpWebResponse` now always returns a `WebResponseStream` (and not a `GZipStream`) because we have to do extra book-keeping after reading the entire content.
2018-02-01 23:39:46 +01:00
Martin Baulig cd09ddbc55 New PR for the new web stack (#6125) 2017-12-14 10:06:47 +01:00
Filip Navara e6f020d390 Remove Content-Encoding header after doing automatic decompression
Match the .NET Framework behaviour by removing the Content-Encoding
header after doing automatic decompression.
2017-03-23 19:30:57 +01:00
Marek Safar 166830635e [System] Server property of HttpWebResponse should never be null 2016-10-03 09:38:23 +02:00
Alexander Köplinger 566f0a78b0 [System] Remove obsolete HttpWebRequest/Response constructors again
They were removed from a later revision of netstandard2.0 so we don't need to add them.
2016-09-25 13:02:48 +02:00
Alexander Köplinger 112631f5c6 [bcl] Add missing APIs for netstandard parity and expose a few APIs on mobile
This ensures we're compliant with the upcoming netstandard2.0 API surface area.
2016-09-23 17:50:06 +02:00
Marek Safar 88217fa1ad [System] Override SupportsHeaders in all WebResponse overrides 2016-06-06 16:59:33 +02:00
Marek Safar af11f84af0 [system] Cookies implementation from reference sources 2015-01-14 16:41:27 +01:00
Zoltan Varga c1b4366932 [bcl] Remove NET_4_5 defines from class libs. 2015-01-13 16:34:23 -05:00
Zoltan Varga 032f313d5f [bcl] Remove NET_4_0 defines from class libs. 2015-01-13 16:06:31 -05:00
Rolf Bjarne Kvinge 19f49f93f9 Revert "Revert "Merge branch 'master' of https://github.com/mono/mono""
This reverts commit 8f09dad435.

8f09dad435 is reverting a merge commit,
which will not do what you think it does. It will revert much more,
so revert the revert to get back the unintentionally reverted commits.

It looks like the next commit (1a15d4ec54)
is doing the original intention (reverting 164f9cbec4),
so this revert will leave the tree in a good state, with no pending
reverts.
2014-04-25 16:57:01 +02:00
Alexis Christoforides 8f09dad435 Revert "Merge branch 'master' of https://github.com/mono/mono"
This reverts commit 9dd632fb9e, reversing
changes made to 164f9cbec4.
2014-04-23 14:56:39 -04:00
Marek Safar 09366779f0 [system] Don't terminate response reading on bad cookie value. Fixes #18868 2014-04-22 14:31:19 +02:00
Marek Safar 1c89349477 Optmizes one string comparison.
Remove useless GC.SuppressFinalize
2013-09-24 16:00:57 +02:00
Martin Baulig 3016218856 HttpWebRequest/Response API fixes for .NET 4.5. 2013-03-12 17:22:59 -04:00
Rodrigo Kumpera 5007c14d62 Kill the MOONLIGHT define in System. 2013-02-11 13:01:11 -05:00
Martin Baulig f7cf18e47f [#7424]: Fix regression in same-origin-check for Cookies.
Disable same-origin checks when the cookie does not have a domain
and we default to the Uri's hostname.
2012-09-27 04:07:38 +02:00
Martin Baulig cabf7d1f13 Fixed and improved Mono's Cookie implementation.
* Updated the tests to reflect .NET 4.5's new improved behavior.
* Fixed subdomain matching rules.
* Added some very simple sanity checks, such as same origin and
  public suffixes.

This is far from perfect, but the tests now pass with .NET 4.5
and this also fixes a Monotouch bug from one of our customers.

TODO:

* Using 'Cookie.Version = 1' (RFC 2109 compliance) apparently got
  broken in .NET 4.5; I disabled the corresponding tests / made
  them use the default 'Version = 0' where possible.

* Same origin has not been tested for security (it previously
  didn't exist at all) and we should probably use the list at
  publicsuffix.org; but .NET 4.5 also allows you to set a cookie
  .co.uk (haven't tested their web stack, thoug - it's possible
  that they have additional checks there).
2012-09-13 02:00:56 +02:00
Martin Baulig cdd89cbad8 Correctly parse cookies.
* System.Net/CookieParser.cs: Replace GetNameValue() with Parse(),
  support multiple cookies, errors and "expires=Day, ...".

* Test/System.Net/CookieParserTest.cs: New nunit test suite for that.
2012-06-26 01:35:58 +02:00
Gonzalo Paniagua Javier b311822694 [HttpWebResponse] Close and Dispose are different beasts.
After calling Close () on response you are still allowed to access its
	properties. Calling Dispose() causes the usual exception to be thrown
	when accessing the properties.

	Fixes bug #685368.
2011-04-06 23:01:39 -04:00
Gonzalo Paniagua Javier e940d4fa30 [HttpWebRequest] Avoid nullref on empty cookie header.
If the Set-Cookie header is empty, the cookie instance is not created.
	Fixes bug #670189.
2011-02-13 14:53:59 -05:00
Sebastien Pouliot 27c2fe35b0 Refactoring to ease fix cookie support in moonlight client stack
* System.Net/CookieParser.cs: Add more common/shared code
* System.Net/HttpWebResponse.cs: Move out CookieParser class and some
utility methods so they can be shared with Moonlight http client stack

* System.dll.sources:
* mobile_System.dll.sources:
* moonlight_shared_System.dll.sources:
	Add new CookieParser.cs to the build
2010-11-05 14:39:31 -04: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
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 d3637642f7 2009-05-16 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs:
	* HttpWebRequest.cs: support automatic decompression of the response.
	Fixes bug #504391.



svn path=/trunk/mcs/; revision=134269
2009-05-16 05:47:01 +00:00
Gonzalo Paniagua Javier 0b70322ff1 2009-01-26 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: avoid throwing an exception when
	Content-Length is not present.

svn path=/trunk/mcs/; revision=124458
2009-01-26 06:44:21 +00:00
Gert Driesen 4c899bc324 * HttpWebResponse.cs: Initialize contentLength in ctor, as it must
remain accessible after the response is disposed (and the headers are
no longer available). Adding missing disposed checks in properties
(except for StatusCode) and GetResponseHeader. On the 2.0 profile,
headers must remain accessible after the HttpWebResponse is disposed.
* System_test.dll.sources: Added HttpWebResponseTest.cs.
* HttpWebResponseTest.cs: Enabled tests.

svn path=/trunk/mcs/; revision=108804
2008-07-25 18:42:53 +00:00
Gonzalo Paniagua Javier 036d915f04 2008-04-21 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: do not check the disposed status for properties
	and methods that return response data other than the stream itself.
	Fixes bug #381223.


svn path=/trunk/mcs/; revision=101389
2008-04-22 00:13:52 +00:00
Daniel Nauck d6bf0a923a fixed typo
svn path=/trunk/mcs/; revision=95979
2008-02-17 16:17:32 +00:00
Daniel Nauck 8f6285d8e3 2008-02-17 Daniel Nauck <[email protected]>
* HttpWebResponse.cs: refactored cookie expires parsing to
	allow all common expires datetime formats.


svn path=/trunk/mcs/; revision=95967
2008-02-17 13:57:36 +00:00
Daniel Nauck ca88bd5137 2008-02-09 Daniel Nauck <[email protected]>
* HttpWebResponse.cs: convert UTC/GMT Expires DateTime from a cookie
	into local time, also set the HttpOnly property if available.


svn path=/trunk/mcs/; revision=95334
2008-02-09 13:43:40 +00:00
Dick Porter 6b41703ee1 2007-06-21 Dick Porter <[email protected]>
* AuthenticationManager.cs: 
	* FtpWebRequest.cs: 
	* Cookie.cs: 
	* ServicePoint.cs: 
	* WebClient.cs: 
	* Authorization.cs: 
	* FileWebRequest.cs: 
	* HttpWebRequest.cs: 
	* WebResponse.cs: 
	* ServicePointManager.cs: 
	* HttpWebResponse.cs: Throw NotImplementedException indirectly, to
	reduce noise in Moma reports.



svn path=/trunk/mcs/; revision=80484
2007-06-21 15:24:34 +00:00
Dick Porter fa277dafe1 2007-06-19 Dick Porter <[email protected]>
* AuthenticationManager.cs: 
	* IWebProxyScript.cs: 
	* Authorization.cs: 
	* Cookie.cs: 
	* CookieException.cs: 
	* CredentialCache.cs: 
	* FileWebRequest.cs: 
	* WebRequest.cs: 
	* FileWebResponse.cs: 
	* WebResponse.cs: 
	* FtpWebRequest.cs: 
	* HttpWebRequest.cs: 
	* DecompressionMethods.cs: 
	* HttpWebResponse.cs: 
	* ProtocolViolationException.cs: 
	* ServicePoint.cs: 
	* ServicePointManager.cs: 
	* WebClient.cs: 
	* WebException.cs: 
	* WebHeaderCollection.cs: 
	* WebProxy.cs: 
	* WebExceptionStatus.cs: 2.0 profile updates



svn path=/trunk/mcs/; revision=80152
2007-06-19 13:23:16 +00:00
Gonzalo Paniagua Javier 85dc0b4809 2006-11-13 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: cookies are actually added to the request
	container if any. Fixes bug #79821.


svn path=/trunk/mcs/; revision=67792
2006-11-13 21:19:09 +00:00
Gonzalo Paniagua Javier ffaf18b587 2006-09-15 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: send the cookies from the collection we got for
	the given URI, not the whole collection.
	* HttpWebResponse.cs: only add the cookies to this instance, not to the
	cookie container set in the request.


svn path=/trunk/mcs/; revision=65493
2006-09-15 21:37:57 +00:00
Gonzalo Paniagua Javier 3cb5b085ee 2006-04-06 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: don't remove the Set-Cookie headers. Fixes bug
	#78028.


svn path=/trunk/mcs/; revision=59133
2006-04-06 18:50:21 +00:00
Chris Toshok e11d804054 In System.Net:
2006-04-03  Chris Toshok  <[email protected]>

	* HttpWebResponse.cs (ContentEncoding): return "" if the header
	isn't present.

In Test/System.Net:
2006-04-03  Chris Toshok  <[email protected]>

	* HttpWebRequestTest.cs (Missing_ContentEncoding): add test to
	handle missing content encoding header.


svn path=/trunk/mcs/; revision=58978
2006-04-03 21:33:43 +00:00
Gonzalo Paniagua Javier c117b859ee 2006-01-10 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: ignore non-integer values for max-age and version.
	Fixes bug #77199. Thanks to Cyrille Colin.


svn path=/trunk/mcs/; revision=55355
2006-01-10 23:22:00 +00:00
Gonzalo Paniagua Javier 374ef7101d 2006-01-10 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: cope with malformed cookies with '=' as value.
	Patch by Cyrille Colin. Fixes bug #77179.


svn path=/trunk/mcs/; revision=55307
2006-01-10 16:44:50 +00:00
Gonzalo Paniagua Javier c06238ff52 2005-12-08 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: don't loop forever when no name or value between
	semicolons. Fixes bug #76943.


svn path=/trunk/mcs/; revision=54118
2005-12-08 18:17:48 +00:00
Gonzalo Paniagua Javier 59d07a3df0 2005-12-06 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: don't fail if the cookie ends with a 'name'
	without a value. Fixes bug #76922.


svn path=/trunk/mcs/; revision=54007
2005-12-06 20:56:03 +00:00
Gonzalo Paniagua Javier 835abe7513 2005-11-17 Gonzalo Paniagua Javier <[email protected]>
* HttpListenerPrefixCollection.cs:
	* HttpWebResponse.cs:
	* Dns.cs:
	* HttpListenerRequest.cs:
	* HttpWebRequest.cs:
	* HttpListenerResponse.cs: a few signature fixes for 2.0.


svn path=/trunk/mcs/; revision=53210
2005-11-17 22:07:17 +00:00
Gonzalo Paniagua Javier b5ce71c485 2005-03-30 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: adding to a CookieCollection might not increment
	the number of items if the cookie is replaced. Now Count works properly.
	Fixed an array index exception (typo).

	* CookieCollection.cs: also compare the version.

	* HttpWebResponse.cs: when we have cookies, add them to the request
	container.

	* HttpWebRequest.cs: changed last parameter of HttpWebResponse ctor.


svn path=/trunk/mcs/; revision=42411
2005-03-31 02:32:49 +00:00
Miguel de Icaza d6408549e5 2005-03-29 Miguel de Icaza <[email protected]>
* HttpWebResponse.cs: Handle quotations in the cookies values, per
	the spec http://www.faqs.org/rfcs/rfc2109.html, it is allowed to
	have quotations.


svn path=/trunk/mcs/; revision=42362
2005-03-30 02:08:07 +00:00
Gonzalo Paniagua Javier 4f2bab519c 2005-03-10 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: moved cookie parsing into its own class.
	* WebHeaderCollection.cs: remove (probably bogus) GetMultipleValues
	call.
	* HttpWebRequest.cs: don't let exception raised in the ctor of
	HttpWebResponse vanish.

	Fixes bug #73275.


svn path=/trunk/mcs/; revision=41670
2005-03-10 23:29:30 +00:00
Gonzalo Paniagua Javier 5a767ce9e3 2005-02-12 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs:
	* WebConnection.cs:
	* HttpWebRequest.cs:
	* WebConnectionStream.cs: don't read the entire response unless the
	user requests it. Fixes bug #72443.


svn path=/trunk/mcs/; revision=40559
2005-02-12 21:54:47 +00:00
Gonzalo Paniagua Javier 6a0c4b7736 2004-12-12 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: added ReadAll method.

	* WebConnection.cs: in HandleError, set the response error after
	closing the socket. Use an async. delegate to finish reading any prior
	WebConnectionStream.

	* HttpWebRequest.cs: for error responses that allow content, read the
	stream immediately. Fixes bug #70483.


svn path=/trunk/mcs/; revision=37664
2004-12-12 20:43:09 +00:00