diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2008-11-25 07:32:57 -0800 |
---|---|---|
committer | Andrew <andrewarnott@gmail.com> | 2008-11-25 07:32:57 -0800 |
commit | dbb8e6cf3329dfee52fa78a19026134eaae2bae7 (patch) | |
tree | 7f6930398658fdac29aa6896143f90b1ba037e86 /src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs | |
parent | 3d69557f925cb7e05e85b0b99371faaf9c2109c6 (diff) | |
download | DotNetOpenAuth-dbb8e6cf3329dfee52fa78a19026134eaae2bae7.zip DotNetOpenAuth-dbb8e6cf3329dfee52fa78a19026134eaae2bae7.tar.gz DotNetOpenAuth-dbb8e6cf3329dfee52fa78a19026134eaae2bae7.tar.bz2 |
Hundreds more stylecop fixes.
Mostly just doc bugs now.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs')
-rw-r--r-- | src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs b/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs index 6d1ee8d..d059c36 100644 --- a/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs +++ b/src/DotNetOpenAuth.Test/Hosting/TestingWorkerRequest.cs @@ -12,7 +12,9 @@ namespace DotNetOpenAuth.Test.Hosting { internal class TestingWorkerRequest : SimpleWorkerRequest { private Stream entityStream; + private HttpListenerContext context; + private TextWriter writer; public TestingWorkerRequest(string page, string query, Stream entityStream, TextWriter writer) @@ -20,6 +22,7 @@ namespace DotNetOpenAuth.Test.Hosting { this.entityStream = entityStream; this.writer = writer; } + public TestingWorkerRequest(HttpListenerContext context, TextWriter output) : base(context.Request.Url.LocalPath.TrimStart('/'), context.Request.Url.Query, output) { this.entityStream = context.Request.InputStream; @@ -29,66 +32,85 @@ namespace DotNetOpenAuth.Test.Hosting { public override string GetFilePath() { string filePath = this.context.Request.Url.LocalPath.Replace("/", "\\"); - if (filePath.EndsWith("\\", StringComparison.Ordinal)) + if (filePath.EndsWith("\\", StringComparison.Ordinal)) { filePath += "default.aspx"; + } return filePath; } + public override int GetLocalPort() { return this.context.Request.Url.Port; } + public override string GetServerName() { return this.context.Request.Url.Host; } + public override string GetQueryString() { return this.context.Request.Url.Query.TrimStart('?'); } + public override string GetHttpVerbName() { return this.context.Request.HttpMethod; } + public override string GetLocalAddress() { return this.context.Request.LocalEndPoint.Address.ToString(); } + public override string GetHttpVersion() { return "HTTP/1.1"; } + public override string GetProtocol() { return this.context.Request.Url.Scheme; } + public override string GetRawUrl() { return this.context.Request.RawUrl; } + public override int GetTotalEntityBodyLength() { return (int)this.context.Request.ContentLength64; } + public override string GetKnownRequestHeader(int index) { return this.context.Request.Headers[GetKnownRequestHeaderName(index)]; } + public override string GetUnknownRequestHeader(string name) { return this.context.Request.Headers[name]; } + public override bool IsEntireEntityBodyIsPreloaded() { return false; } + public override int ReadEntityBody(byte[] buffer, int size) { return this.entityStream.Read(buffer, 0, size); } + public override int ReadEntityBody(byte[] buffer, int offset, int size) { return this.entityStream.Read(buffer, offset, size); } + public override void SendCalculatedContentLength(int contentLength) { this.context.Response.ContentLength64 = contentLength; } + public override void SendStatus(int statusCode, string statusDescription) { if (this.context != null) { this.context.Response.StatusCode = statusCode; this.context.Response.StatusDescription = statusDescription; } } + public override void SendKnownResponseHeader(int index, string value) { if (this.context != null) { this.context.Response.Headers[(HttpResponseHeader)index] = value; } } + public override void SendUnknownResponseHeader(string name, string value) { if (this.context != null) { this.context.Response.Headers[name] = value; |