Commit 5b98d04f authored by Shani Elharrar's avatar Shani Elharrar

Added RemoteEndPoint to HttpContext

parent 3f33722f
......@@ -2,7 +2,7 @@
<package>
<metadata>
<id>uHttpSharp</id>
<version>0.1.4.5</version>
<version>0.1.4.6</version>
<title>uHttpSharp</title>
<authors>Shani Elharrar, Joe White, Hüseyin Uslu</authors>
<owners>Shani Elharrar, Joe White, Hüseyin Uslu</owners>
......

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uhttpsharp.Demo", "uhttpsharp-demo\uhttpsharp.Demo.csproj", "{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "uhttpsharp", "uhttpsharp\uhttpsharp.csproj", "{3D681959-4DA3-4A71-A68B-704D6411D5EA}"
......@@ -30,6 +32,17 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Any CPU.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Any CPU.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Mixed Platforms.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|x86.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|x86.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Any CPU.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Mixed Platforms.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Mixed Platforms.Build.0 = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|x86.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|x86.Build.0 = Release|x86
{3D681959-4DA3-4A71-A68B-704D6411D5EA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D681959-4DA3-4A71-A68B-704D6411D5EA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D681959-4DA3-4A71-A68B-704D6411D5EA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
......@@ -50,27 +63,11 @@ Global
{41C9BDAC-21BE-4C50-933D-9E047F767E63}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{41C9BDAC-21BE-4C50-933D-9E047F767E63}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{41C9BDAC-21BE-4C50-933D-9E047F767E63}.Release|x86.ActiveCfg = Release|Any CPU
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Any CPU.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Any CPU.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|Mixed Platforms.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|x86.ActiveCfg = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Debug|x86.Build.0 = Debug|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Any CPU.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Mixed Platforms.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|Mixed Platforms.Build.0 = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|x86.ActiveCfg = Release|x86
{55C5E8D2-F55E-4B9F-B96F-FCE201739D07}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = uhttpsharp-demo\uhttpsharp.Demo.csproj
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = uhttpsharp-demo\uhttpsharp.Demo.csproj
EndGlobalSection
EndGlobal
......@@ -17,4 +17,5 @@ namespace uhttpsharp.Clients
}
}
......@@ -80,7 +80,7 @@ namespace uhttpsharp
{
UpdateLastOperationTime();
var context = new HttpContext(request);
var context = new HttpContext(request, _client.RemoteEndPoint);
Logger.InfoFormat("{1} : Got request {0}", request.Uri, _client.RemoteEndPoint);
......
using System.Dynamic;
using System.Net;
using uhttpsharp.Headers;
namespace uhttpsharp
......@@ -6,11 +7,13 @@ namespace uhttpsharp
internal class HttpContext : IHttpContext
{
private readonly IHttpRequest _request;
private readonly EndPoint _remoteEndPoint;
private readonly ICookiesStorage _cookies;
private readonly ExpandoObject _state = new ExpandoObject();
public HttpContext(IHttpRequest request)
public HttpContext(IHttpRequest request, EndPoint remoteEndPoint)
{
_request = request;
_remoteEndPoint = remoteEndPoint;
_cookies = new CookiesStorage(_request.Headers.GetByNameOrDefault("cookie", string.Empty));
}
......@@ -31,5 +34,9 @@ namespace uhttpsharp
{
get { return _state; }
}
public EndPoint RemoteEndPoint
{
get { return _remoteEndPoint; }
}
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using log4net.Core;
......@@ -20,6 +21,8 @@ namespace uhttpsharp
dynamic State { get; }
EndPoint RemoteEndPoint { get; }
}
public interface ICookiesStorage : IHttpHeaders
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment