Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-04-28 04:49:10 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2006-04-28 04:49:10 +0400
commitac73df99bda9b7fcec984705efe113e1a9003c27 (patch)
treede36a796c2f4f3dcc6389a3cf5e5dbc9a4b95559
parent98c7aaaed3b6cdfddb90a8cd8c67dde70de58570 (diff)
2006-04-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebConnection.cs: reset the challenge and the status code when creating the tunnel and sending the proxy auth. headers. Improve error message when there's an error creating the tunnel. * HttpWebRequest.cs: don't trigger an early throw for a POST that gets a 401 or 407 response. svn path=/branches/mono-1-1-13/mcs/; revision=60023
-rw-r--r--mcs/class/System/System.Net/ChangeLog8
-rw-r--r--mcs/class/System/System.Net/HttpWebRequest.cs12
-rw-r--r--mcs/class/System/System.Net/WebConnection.cs7
3 files changed, 21 insertions, 6 deletions
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index 2350aea7a19..b97a75b2dc9 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,11 @@
+2006-04-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * WebConnection.cs: reset the challenge and the status code when
+ creating the tunnel and sending the proxy auth. headers. Improve error
+ message when there's an error creating the tunnel.
+ * HttpWebRequest.cs: don't trigger an early throw for a POST that gets
+ a 401 or 407 response.
+
2006-04-26 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* WebConnectionData.cs:
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
index aac0cb5ce88..9783525f71e 100644
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -1030,7 +1030,8 @@ namespace System.Net
void CheckSendError (WebConnectionData data)
{
// Got here, but no one called GetResponse
- if (data.StatusCode < 400)
+ int status = data.StatusCode;
+ if (status < 400 || status == 401 || status == 407)
return;
if (writeStream != null && asyncRead == null && !writeStream.CompleteRequestWritten) {
@@ -1142,7 +1143,7 @@ namespace System.Net
WebExceptionStatus protoError = WebExceptionStatus.ProtocolError;
HttpStatusCode code = 0;
if (throwMe == null && webResponse != null) {
- code = webResponse.StatusCode;
+ code = webResponse.StatusCode;
if (!authCompleted && ((code == HttpStatusCode.Unauthorized && credentials != null) ||
(ProxyQuery && code == HttpStatusCode.ProxyAuthenticationRequired))) {
if (!usedPreAuth && CheckAuthorization (webResponse, code)) {
@@ -1187,8 +1188,13 @@ namespace System.Net
if (throwMe == null) {
bool b = false;
int c = (int) code;
- if (allowAutoRedirect && c >= 300)
+ if (allowAutoRedirect && c >= 300) {
+ if (InternalAllowBuffering && writeStream.WriteBufferLength > 0) {
+ bodyBuffer = writeStream.WriteBuffer;
+ bodyBufferLength = writeStream.WriteBufferLength;
+ }
b = Redirect (result, code);
+ }
if (resp != null && c >= 300 && c != 304)
resp.ReadAll ();
diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs
index 5b1c834451c..b557a127703 100644
--- a/mcs/class/System/System.Net/WebConnection.cs
+++ b/mcs/class/System/System.Net/WebConnection.cs
@@ -175,6 +175,7 @@ namespace System.Net
sb.Append ("\r\nHost: ");
sb.Append (request.Address.Authority);
string challenge = Data.Challenge;
+ Data.Challenge = null;
bool have_auth = (request.Headers ["Proxy-Authorization"] != null);
if (have_auth) {
sb.Append ("\r\nProxy-Authorization: ");
@@ -187,11 +188,10 @@ namespace System.Net
sb.Append ("\r\nProxy-Authorization: ");
sb.Append (auth.Message);
}
- Data.Challenge = null;
}
-
sb.Append ("\r\n\r\n");
+ Data.StatusCode = 0;
byte [] connectBytes = Encoding.Default.GetBytes (sb.ToString ());
stream.Write (connectBytes, 0, connectBytes.Length);
@@ -202,7 +202,8 @@ namespace System.Net
Data.Challenge = result ["Proxy-Authenticate"];
return false;
} else if (status != 200) {
- HandleError (WebExceptionStatus.SecureChannelFailure, null, "CreateTunnel");
+ string msg = String.Format ("The remote server returned a {0} status code.", status);
+ HandleError (WebExceptionStatus.SecureChannelFailure, null, msg);
return false;
}