Commit Graph
56 Commits
Author SHA1 Message Date
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
Gonzalo Paniagua Javier 9312f1b1e9 2004-11-01 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: don't lock up when the cookie received ends with
	a semicolon. Patch by Darryl VanDorp. Fixes bug #68956.

svn path=/trunk/mcs/; revision=35530
2004-11-01 19:55:45 +00:00
Gonzalo Paniagua Javier f4c1dfb1e7 2004-09-13 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: remove unused SplitValue method.

svn path=/trunk/mcs/; revision=33817
2004-09-13 17:53:56 +00:00
Gonzalo Paniagua Javier 5f80f81cd4 2004-08-11 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: set-cookie and set-cookie2 can be present more
	than once and have multiple values. Don't rely on string.split when
	parsing cookie values.

	* WebHeaderCollection.cs: same thing for set-cookie and set-cookie2.
	Fixed GetValues (it was splitting values that contained a comma) and
	changed SetInternal to handle multi-value headers.

	Fixes bug #62744.

svn path=/trunk/mcs/; revision=32235
2004-08-11 20:03:15 +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 4df757a617 2003-10-13 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs:
	* HttpWebResponse.cs: better abort handling and leave the stream in a
	stable status on abort.

svn path=/trunk/mcs/; revision=18943
2003-10-13 00:19:54 +00:00
Gonzalo Paniagua Javier 3c6f61256d 2003-10-02 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: handle 304 � la MS.
	* WebConnection.cs: set the response data when reading 0 bytes.

svn path=/trunk/mcs/; revision=18518
2003-10-02 04:44:48 +00:00
Gonzalo Paniagua Javier 1b462e1ef9 2003-06-26 Gonzalo Paniagua Javier <[email protected]>
* WebConnection.cs: close the socket and connection when disposing.
	* WebRequest.cs: removed setter for RequestUri. Allow non-public ctors
	when creating instances.

	* HttpWebRequest.cs:
	* HttpWebResponse.cs:
	* FileWebRequest.cs: support serialization.

	* FileWebResponse.cs: support serialization and fixed dispose checks.

	* FileWebRequestCreator.cs:
	* HttpRequestCreator.cs: added internal .ctor.

svn path=/trunk/mcs/; revision=15644
2003-06-26 02:03:38 +00:00
Gonzalo Paniagua Javier 5f56352dc6 2003-06-14 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: if CookieContainer has not been set, make HttpWebResponse ignore
	Set-Cookie* headers.

	* HttpWebResponse.cs: Set-Cookie and Set-Cookie headers removed if CookieContainer have
	been provided to the request.

svn path=/trunk/mcs/; revision=15379
2003-06-14 13:22:53 +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
Miguel de Icaza 6419036c57 2003-04-24 Miguel de Icaza <[email protected]>
* WebClient.cs (DownloadData): Instead of using a MemoryStream,
	keep track of all the small chunks in an ArrayList.  The
	MemoryStream had the property of reallocating itself, and the
	problem was that MemoryStream.GetBuffer would return the buffer
	(correctly), but not something of the right size.  So clients of
	DownloadData would get the extra unused bytes as part of the
	result.

	The solution would have been to make another copy at this point,
	instead, we only keep the small allocations around in the
	ArrayList, and we only do one large allocation at the end.

	* HttpWebResponse.cs: If there is a Content-Length header, pass
	this information to our HttpWebResponseStream, so it knows when to
	stop, instead of waiting for the stream to be shut down by the
	other end.

	* HttpWebRequest.cs: Only set the `delay-header-writing' mode on
	the underlying stream if the method will do a content transfer and
	no Content-Length was provided. If not (HEAD and GET or
	Content-Length provided), keep going.

svn path=/trunk/mcs/; revision=13986
2003-04-24 22:50:29 +00:00
Gonzalo Paniagua Javier dd020c9afa removed writeline
svn path=/trunk/mcs/; revision=13716
2003-04-17 14:42:34 +00:00
Gonzalo Paniagua Javier 943d0451fa 2003-04-12 Gonzalo Paniagua Javier <[email protected]>
* HttpWebResponse.cs: fixes bug #41180.

svn path=/trunk/mcs/; revision=13532
2003-04-12 01:17:38 +00:00
Gonzalo Paniagua Javier 70b2f8cb22 2003-03-07 Gonzalo Paniagua Javier <[email protected]>
* HttpWebRequest.cs: implemented IDisposable, make the request stream
	read only. Changed the way of disposing the socket.

	* HttpWebResponse.cs: wrapped the socket in a write-only NetworkStream,
	handle chunked transfer encoding (no more hangs), added serialization
	stuff, call CheckDisposed at the beginning of methods/properties (not
	in a finally clause).

svn path=/trunk/mcs/; revision=12283
2003-03-07 04:21:25 +00:00