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>2003-07-08 12:56:30 +0400
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>2003-07-08 12:56:30 +0400
commite569aea4abde53f67605032b39d6bece4d44859a (patch)
treedd093566c54c8e8c226b64d5a868004e51fc7f67 /mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
parent246d207e0de8d16d00221a0dd50c7ecbfae1c7b7 (diff)
Ugh. Applied the wrong patch. Thanks again, Eric
svn path=/trunk/mcs/; revision=16034
Diffstat (limited to 'mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs')
-rw-r--r--mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs73
1 files changed, 50 insertions, 23 deletions
diff --git a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
index 63f9819eb9f..4591e038e92 100644
--- a/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
+++ b/mcs/class/System.Web/System.Web.Hosting/SimpleWorkerRequest.cs
@@ -17,7 +17,7 @@ namespace System.Web.Hosting
{
private string _Page;
private string _Query;
- private string _PathInfo;
+ private string _PathInfo = String.Empty;
private string _AppVirtualPath;
private string _AppPhysicalPath;
private string _AppInstallPath;
@@ -116,7 +116,7 @@ namespace System.Web.Hosting
public override string GetFilePath ()
{
- return CreatePath (false);
+ return CreatePath (false);
}
public override string GetFilePathTranslated ()
@@ -153,7 +153,7 @@ namespace System.Web.Hosting
public override string GetPathInfo ()
{
- return (null != _PathInfo) ? _PathInfo : String.Empty;
+ return _PathInfo;
}
public override string GetQueryString ()
@@ -163,8 +163,8 @@ namespace System.Web.Hosting
public override string GetRawUrl ()
{
- string path = CreatePath (true);
- if (null != _Query && _Query.Length > 0)
+ string path = CreatePath (true);
+ if (null != _Query && _Query.Length > 0)
return path + "?" + _Query;
return path;
@@ -262,41 +262,68 @@ namespace System.Web.Hosting
}
// Create's a path string
- private string CreatePath (bool bIncludePathInfo)
- {
- string sPath = Path.Combine (_AppVirtualPath, _Page);
+ private string CreatePath (bool bIncludePathInfo)
+ {
+ string sPath = Path.Combine (_AppVirtualPath, _Page);
- if (bIncludePathInfo && null != _PathInfo)
+ if (bIncludePathInfo)
{
- sPath = Path.Combine (sPath, _PathInfo);
+ sPath += _PathInfo;
}
- return sPath;
+ return sPath;
}
- // Parses out the string after / known as the "path info"
- private void ExtractPagePathInfo ()
- {
+ // "The extra path information, as given by the client. In
+ // other words, scripts can be accessed by their virtual
+ // pathname, followed by extra information at the end of this
+ // path. The extra information is sent as PATH_INFO."
+ private void ExtractPagePathInfo ()
+ {
if (_Page == null || _Page == String.Empty)
{
- return;
+ return;
}
string FullPath = GetFilePathTranslated();
- StringBuilder PathInfo = new StringBuilder();
+ int PathInfoLength = 0;
+
+ string LastFile = String.Empty;
- while (!(Directory.Exists (FullPath) || File.Exists (FullPath)))
+ while (PathInfoLength < _Page.Length)
{
- int last = FullPath.LastIndexOf (Path.DirectorySeparatorChar);
+ if (LastFile.Length > 0)
+ {
+ // increase it by the length of the file plus
+ // a "/"
+ //
+ PathInfoLength += LastFile.Length + 1;
+ }
+
+ if (File.Exists (FullPath) == true)
+ {
+ break;
+ }
+
+ if (Directory.Exists (FullPath) == true)
+ {
+ PathInfoLength -= (LastFile.Length + 1);
+ break;
+ }
+
+ LastFile = Path.GetFileName (FullPath);
+ FullPath = Path.GetDirectoryName (FullPath);
+ }
- PathInfo.Insert (0, FullPath.Substring (last));
- FullPath = FullPath.Substring (0, last);
+ if (PathInfoLength > _Page.Length)
+ {
+ return;
}
- _Page = _Page.Substring (0, _Page.Length - PathInfo.Length);
- _PathInfo = PathInfo.ToString();
- }
+ _PathInfo = _Page.Substring (_Page.Length - PathInfoLength);
+ _Page = _Page.Substring (0, _Page.Length - PathInfoLength);
+ }
}
}