Pārlūkot izejas kodu

* ServletWorkerRequest.jvm.cs: fixed ctor, UrlDecode applied on requested url
fixed GetRawUrl, removed protocol, hostname and port
fixed GetUriPath, _requestUri is always initialized

svn path=/trunk/mcs/; revision=58013

Vladimir Krasnov 20 gadi atpakaļ
vecāks
revīzija
e8e59bb8cb

+ 7 - 0
mcs/class/System.Web/System.Web.Hosting/ChangeLog

@@ -1,3 +1,10 @@
+2006-03-15  Vladimir Krasnov  <[email protected]>
+
+	* ServletWorkerRequest.jvm.cs: fixed ctor, UrlDecode applied on 
+	requested url
+	fixed GetRawUrl, removed protocol, hostname and port
+	fixed GetUriPath, _requestUri is always initialized
+
 2006-03-03 Gonzalo Paniagua Javier <[email protected]>
 
 	* ApplicationHost.cs: ShadowCopyDirectories is not a URL. Set

+ 9 - 20
mcs/class/System.Web/System.Web.Hosting/ServletWorkerRequest.jvm.cs

@@ -97,17 +97,16 @@ namespace System.Web.Hosting {
 			_HttpServletRequest = req;
 			_HttpServletResponse = resp;
 
-			string requestUri = req.getRequestURI();
+			_requestUri = HttpUtility.UrlDecode(req.getRequestURI());
 			const int dotInvokeLength = 7; //".invoke".Length
-			if (requestUri.Length > dotInvokeLength &&
-				String.CompareOrdinal(".invoke", 0, requestUri, 
-				requestUri.Length - dotInvokeLength, dotInvokeLength) == 0) {
-				
-				_requestUri = requestUri.Substring(0, requestUri.Length - dotInvokeLength);
+			if (_requestUri.Length > dotInvokeLength &&
+				String.CompareOrdinal(".invoke", 0, _requestUri, 
+				_requestUri.Length - dotInvokeLength, dotInvokeLength) == 0) {
 
-				int paramNameStart = requestUri.LastIndexOf('/');
-				_pathInfo = requestUri.Substring(paramNameStart,
-					requestUri.Length - paramNameStart - dotInvokeLength);
+				_requestUri = _requestUri.Substring(0, _requestUri.Length - dotInvokeLength);
+				
+				int paramNameStart = _requestUri.LastIndexOf('/');
+				_pathInfo = _requestUri.Substring(paramNameStart, _requestUri.Length - paramNameStart);
 			}
 		}
 
@@ -208,18 +207,8 @@ namespace System.Web.Hosting {
 		public override string GetRawUrl () {
 			if (_rawUrl == null) {
 				StringBuilder builder = new StringBuilder();
-				builder.Append(GetProtocol());
-				builder.Append("://");
-				builder.Append(GetServerName());
-				int port = _HttpServletRequest.getServerPort();
-				if (port != 80) {
-					builder.Append(':');
-					builder.Append(port);
-				}
 				builder.Append(GetUriPath());
 				string pathInfo = GetPathInfo();
-				if (pathInfo != null)
-					builder.Append(pathInfo);
 				string query = GetQueryString();
 				if (query != null && query.Length > 0) {
 					builder.Append('?');
@@ -293,7 +282,7 @@ namespace System.Web.Hosting {
 		}
 
 		public override string GetUriPath() {
-			return _requestUri != null ? _requestUri : _HttpServletRequest.getRequestURI();
+			return _requestUri;
 		}
 
 		public override IntPtr GetUserToken() {