Commit Graph
27 Commits
Author SHA1 Message Date
Rodrigo Kumpera 5007c14d62 Kill the MOONLIGHT define in System. 2013-02-11 13:01:11 -05:00
Marek Safar e1dfad1f12 Remove unreachable code 2012-10-14 15:05:42 +01: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 94bfdf21e6 Only set Cookie.Port if Cookie.Version == 1.
Background:

* Cookie.Port's property setter sets Version to 1, thus forcing strict
  RFC 2109 compliance.  This is also what the .NET runtime does when
  assigning this property.

* When parsing the result of a web request, .NET 4.5 only sets Cookie.Port
  when the Set-Cookie: header contains "Version=1".

* Google Chrome does not check cookie ports at all.
2012-09-22 02:23:15 +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
Marek Safar d4f6c46e62 Fix setting cookie port from uri 2012-04-24 18:12:36 +01: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
Sebastien Pouliot 1cc8e885d5 In Test/System.Net:
2010-01-21  Sebastien Pouliot  <[email protected]>

	* CookieContainerTest.cs: Additional test cases from Tom Philpot

In System.Net:
2010-01-21  Sebastien Pouliot  <[email protected]>

	* CookieContainer.cs: Fix to cloning and expiration. Patch
	by Tom Philpot <[email protected]>


svn path=/trunk/mcs/; revision=149976
2010-01-21 15:02:51 +00:00
Sebastien Pouliot 4a1a02cb04 In Test/System.Net:
2009-12-24  Sebastien Pouliot  <[email protected]>

	* CookieContainerTest.cs: Split many tests into smaller test 
	cases. Add test cases for DefaultPerDomainCookieLimit and
	DefaultCookieLimit. Remove all [Category ("NotWorking")] since
	everything works now.

In System.Net:
2009-12-24  Sebastien Pouliot  <[email protected]>

	* Cookie.cs: Re-work ToString to be useable in more cases. Fix
	some issues found by Gendarme.
	* CookieContainer.cs: Fix all NonWorking (and new) unit tests.
	Implement removing oldest cookies when limits are reached.
	* CookieCollection.cs: Move to generics internally. Fix sort to 
	be closer to MS implementation (but still not 100% identical).
	Fix some issues found by Gendarme.


svn path=/trunk/mcs/; revision=148891
2009-12-24 15:24:13 +00:00
Sebastien Pouliot 96cff3ef51 2009-08-17 Sebastien Pouliot <[email protected]>
* CookieCollection.cs: Seal class for NET_2_1 (SL3)
	* CookieContainer.cs: Seal class for NET_2_1 (SL3)
	* NetworkCredential.cs: Use in NET_2_1 (SL3) but without implementing
	ICredentialsByHost


svn path=/trunk/mcs/; revision=140055
2009-08-17 12:45:34 +00:00
Gert Driesen ae22b8dbe3 * CookieContainer.cs: Provide meaningful information in exception
messages, and improve compatibility with MS. Modified set_Capacity to
no longer change MaxCookieSize when new value is less than
MaxCookieSize.
* CookieTest.cs: Added test for Path.
* CookieContainerTest.cs: Added and improved .ctor tests.
Improved tests for Capacity and MaxCookieSize. Added tests for
PerDomainCapacity. Added tests for Add overloads, GetCookieHeader,
GetCookies and SetCookies. Added test for bug #421827.

svn path=/trunk/mcs/; revision=134295
2009-05-17 15:06:17 +00:00
Gonzalo Paniagua Javier d61f08756c fix prev patch
svn path=/trunk/mcs/; revision=133874
2009-05-11 04:13:35 +00:00
Gonzalo Paniagua Javier 0c79c076a8 2009-05-10 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: matching hosts to domain names like MS does.
	Bug #421827 fixed.


svn path=/trunk/mcs/; revision=133872
2009-05-11 03:55:21 +00:00
Gonzalo Paniagua Javier a01b5f3fa1 2009-02-10 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: separate cookies with "; " instead of just ';'.
	Fixes bug #386727.


svn path=/trunk/mcs/; revision=126530
2009-02-10 23:35:11 +00:00
Gonzalo Paniagua Javier 1c19d120ad 2008-05-28 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: apply slightly modified patch from [email protected]
	that fixes bug #356537.


svn path=/trunk/mcs/; revision=104338
2008-05-28 22:14:48 +00:00
Marek Habersack da4429171a 2007-04-23 Marek Habersack <[email protected]>
* CookieContainerTest.cs: the GetCookies test works now.

2007-04-23  Marek Habersack  <[email protected]>

	* CookieContainer.cs: Sort the collection by the path relevance before returning from
	the GetCookies method. Fixes bug #81421.

svn path=/trunk/mcs/; revision=76101
2007-04-23 09:49:08 +00:00
Marek Habersack 6bbdd1a526 2007-04-23 Marek Habersack <[email protected]>
* Cookie.cs: do not return "/" for Path if it wasn't set
	explicitly.

	* CookieContainer.cs: set cookie path only if its version is
	"Netscape" and is null or empty. Fixes #81420.


svn path=/trunk/mcs/; revision=76095
2007-04-23 07:50:23 +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 dafa708ed0 2006-08-03 Gonzalo Paniagua Javier <[email protected]>
* CookieCollection.cs:
	* CookieContainer.cs: remove expired cookies.


svn path=/trunk/mcs/; revision=63290
2006-08-03 13:44:57 +00:00
Gonzalo Paniagua Javier 6cc798f162 2006-07-03 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: don't send a secure cookie over an insecure
	channel.


svn path=/trunk/mcs/; revision=62238
2006-07-04 01:44:07 +00:00
Gonzalo Paniagua Javier 8bf5e08335 2005-12-09 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: fix matching of subdomains. Patch by Cyrille
	Colin.


svn path=/trunk/mcs/; revision=54171
2005-12-09 20:50:25 +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
Gonzalo Paniagua Javier 447c63141e 2004-12-11 Gonzalo Paniagua Javier <[email protected]>
* CookieContainer.cs: quote the port number.


svn path=/trunk/mcs/; revision=37630
2004-12-11 07:40:23 +00:00
Gonzalo Paniagua Javier c46bb06223 2004-12-01 Gonzalo Paniagua Javier <[email protected]>
* Test/System.Net/CookieContainerTest.cs: added tests for
	CookieContainer.

	* System.Net/CookieContainer.cs: style, fixed checks for properties,
	implemented the MonoTODOs for the method that take an Uri. GetCookies
	and GetCookieHeaders now really return only the cookies that are
	requested filtering by the Uri parameter.

	* System.Net/Cookie.cs: style, added default values for Comment, Domain
	and Port.

	* System_test.dll.sources: added CookieContainerTest.cs.


svn path=/trunk/mcs/; revision=36918
2004-12-01 23:27:23 +00:00
Duncan Mak 24f5ef2c44 Add MIT license to System.dll
svn path=/trunk/mcs/; revision=30054
2004-06-21 18:02:11 +00:00
Gonzalo Paniagua Javier cc8432099d Reworked HttpWebRequest and related classes.
svn path=/trunk/mcs/; revision=15149
2003-06-06 06:57:36 +00:00
Lawrence Pit c24932898e 2002-05-06 Lawrence Pit <[email protected]>
* WebRequest.cs: added
	* WebResponse.cs: implemented
	* WebException.cs: implemented
	* WebHeaderCollection.cs: added
	* HttpVersion.cs: implemented
	* HttpContinueDelegate.cs: added
	* IWebProxy.cs: added
	* IWebRequestCreate.cs: added
	* ICertificatePolicy.cs: added
	* ServicePoint.cs: stubbed
	* ServicePointManager.cs: stubbed
	* CookieContainer.cs: added
	* Authorization.cs: implemented

svn path=/trunk/mcs/; revision=4315
2002-05-05 18:37:57 +00:00