forked from bonesoul/uhttpsharp
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathHttpContext.cs
More file actions
42 lines (36 loc) · 1.05 KB
/
HttpContext.cs
File metadata and controls
42 lines (36 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Dynamic;
using System.Net;
using uhttpsharp.Headers;
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, EndPoint remoteEndPoint)
{
_request = request;
_remoteEndPoint = remoteEndPoint;
_cookies = new CookiesStorage(_request.Headers.GetByNameOrDefault("cookie", string.Empty));
}
public IHttpRequest Request
{
get { return _request; }
}
public IHttpResponse Response { get; set; }
public ICookiesStorage Cookies
{
get { return _cookies; }
}
public dynamic State
{
get { return _state; }
}
public EndPoint RemoteEndPoint
{
get { return _remoteEndPoint; }
}
}
}