You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.2 KiB
51 lines
1.2 KiB
#if !NET20
|
|
|
|
using System.Collections.Generic;
|
|
using System;
|
|
|
|
namespace Apewer.WebSocket
|
|
{
|
|
internal class HttpRequest
|
|
{
|
|
private readonly IDictionary<string, string> _headers = new Dictionary<string, string>(System.StringComparer.InvariantCultureIgnoreCase);
|
|
|
|
public string Method { get; set; }
|
|
|
|
public string Path { get; set; }
|
|
|
|
public string Body { get; set; }
|
|
|
|
public string Scheme { get; set; }
|
|
|
|
public byte[] Bytes { get; set; }
|
|
|
|
public string this[string name]
|
|
{
|
|
get
|
|
{
|
|
string value;
|
|
return _headers.TryGetValue(name, out value) ? value : default(string);
|
|
}
|
|
}
|
|
|
|
public IDictionary<string, string> Headers
|
|
{
|
|
get
|
|
{
|
|
return _headers;
|
|
}
|
|
}
|
|
|
|
public string[] SubProtocols {
|
|
get
|
|
{
|
|
string value;
|
|
return _headers.TryGetValue("Sec-WebSocket-Protocol", out value)
|
|
? value.Split(new []{',', ' '}, StringSplitOptions.RemoveEmptyEntries)
|
|
: new string[0];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|