Skip to content

Commit

Permalink
2004-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
Browse files Browse the repository at this point in the history
	* HttpWebRequest.cs: added the exception status to the error message.
	* WebConnection.cs: add headers using SetInternal instead of Add to
	bypass header name validation. Fixes bug #55994.
	* WebHeaderCollection.cs: added SetInternal (string header).

svn path=/trunk/mcs/; revision=24549
  • Loading branch information
gonzalop committed Mar 24, 2004
1 parent eeeca84 commit b24f237
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,10 @@
2004-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* HttpWebRequest.cs: added the exception status to the error message.
* WebConnection.cs: add headers using SetInternal instead of Add to
bypass header name validation. Fixes bug #55994.
* WebHeaderCollection.cs: added SetInternal (string header).

2004-03-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>

* WebConnection.cs:
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System/System.Net/HttpWebRequest.cs
Expand Up @@ -927,7 +927,7 @@ internal void SetResponseError (WebExceptionStatus status, Exception e)
r = asyncWrite;

if (r != null) {
WebException wexc = new WebException ("Error getting response stream", e, status, null);
WebException wexc = new WebException ("Error getting response stream: " + status, e, status, null);
r.SetCompleted (false, wexc);
r.DoCallback ();
asyncRead = null;
Expand Down
2 changes: 1 addition & 1 deletion mcs/class/System/System.Net/WebConnection.cs
Expand Up @@ -351,7 +351,7 @@ int GetResponse (byte [] buffer, int max)
return -1;

foreach (string s in headers)
Data.Headers.Add (s);
Data.Headers.SetInternal (s);

if (Data.StatusCode == (int) HttpStatusCode.Continue) {
sPoint.SendContinue = true;
Expand Down
10 changes: 10 additions & 0 deletions mcs/class/System/System.Net/WebHeaderCollection.cs
Expand Up @@ -225,6 +225,16 @@ public override string ToString ()

// Internal Methods

// With this we don't check for invalid characters in header. See bug #55994.
internal void SetInternal (string header)
{
int pos = header.IndexOf (':');
if (pos == -1)
throw new ArgumentException ("no colon found", "header");

SetInternal (header.Substring (0, pos), header.Substring (pos + 1));
}

internal void SetInternal (string name, string value)
{
if (value == null)
Expand Down

0 comments on commit b24f237

Please sign in to comment.