Modified RequestHandshake.cs, ResponseHandshake.cs

This commit is contained in:
sta
2013-04-15 11:48:51 +09:00
parent 5ea5828cf9
commit 9190984c7c
22 changed files with 23 additions and 30 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1 -5
View File
@@ -1,10 +1,6 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug_Ubuntu" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug_Ubuntu" />
<MonoDevelop.Ide.Workbench ActiveDocument="websocket-sharp/WebSocket.cs"> <MonoDevelop.Ide.Workbench />
<Files>
<File FileName="websocket-sharp/WebSocket.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore /> <BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints> </MonoDevelop.Ide.DebuggingService.Breakpoints>
+16 -20
View File
@@ -1,4 +1,4 @@
#region MIT License #region License
/* /*
* RequestHandshake.cs * RequestHandshake.cs
* *
@@ -37,13 +37,13 @@ namespace WebSocketSharp {
internal class RequestHandshake : Handshake internal class RequestHandshake : Handshake
{ {
#region Private Field #region Private Fields
private NameValueCollection _queryString; private NameValueCollection _queryString;
#endregion #endregion
#region Private Constructor #region Private Constructors
private RequestHandshake() private RequestHandshake()
{ {
@@ -51,20 +51,20 @@ namespace WebSocketSharp {
#endregion #endregion
#region Public Constructor #region Public Constructors
public RequestHandshake(string uriString) public RequestHandshake(string uriString)
{ {
HttpMethod = "GET"; HttpMethod = "GET";
RequestUri = uriString.ToUri(); RequestUri = uriString.ToUri();
AddHeader("User-Agent", "websocket-sharp/1.0");
AddHeader("Upgrade", "websocket"); AddHeader("Upgrade", "websocket");
AddHeader("Connection", "Upgrade"); AddHeader("Connection", "Upgrade");
} }
#endregion #endregion
#region Properties #region Public Properties
public CookieCollection Cookies { public CookieCollection Cookies {
get { get {
@@ -132,17 +132,7 @@ namespace WebSocketSharp {
#endregion #endregion
#region Public Static Methods #region Public Methods
public static RequestHandshake Parse(WebSocketContext context)
{
return new RequestHandshake {
Headers = context.Headers,
HttpMethod = "GET",
RequestUri = context.RequestUri,
ProtocolVersion = HttpVersion.Version11
};
}
public static RequestHandshake Parse(string[] request) public static RequestHandshake Parse(string[] request)
{ {
@@ -165,9 +155,15 @@ namespace WebSocketSharp {
}; };
} }
#endregion public static RequestHandshake Parse(WebSocketContext context)
{
#region Public Method return new RequestHandshake {
Headers = context.Headers,
HttpMethod = "GET",
RequestUri = context.RequestUri,
ProtocolVersion = HttpVersion.Version11
};
}
public void SetCookies(CookieCollection cookies) public void SetCookies(CookieCollection cookies)
{ {
+6 -5
View File
@@ -1,4 +1,4 @@
#region MIT License #region License
/* /*
* ResponseHandshake.cs * ResponseHandshake.cs
* *
@@ -35,7 +35,7 @@ namespace WebSocketSharp {
internal class ResponseHandshake : Handshake internal class ResponseHandshake : Handshake
{ {
#region Constructor #region Public Constructors
public ResponseHandshake() public ResponseHandshake()
: this(HttpStatusCode.SwitchingProtocols) : this(HttpStatusCode.SwitchingProtocols)
@@ -47,12 +47,13 @@ namespace WebSocketSharp {
public ResponseHandshake(HttpStatusCode code) public ResponseHandshake(HttpStatusCode code)
{ {
StatusCode = ((int)code).ToString(); StatusCode = ((int)code).ToString();
Reason = code.GetDescription(); Reason = code.GetDescription();
AddHeader("Server", "websocket-sharp/1.0");
} }
#endregion #endregion
#region Properties #region Public Properties
public CookieCollection Cookies { public CookieCollection Cookies {
get { get {
@@ -80,7 +81,7 @@ namespace WebSocketSharp {
#endregion #endregion
#region Methods #region Public Methods
public static ResponseHandshake CreateCloseResponse(HttpStatusCode code) public static ResponseHandshake CreateCloseResponse(HttpStatusCode code)
{ {
Binary file not shown.
Binary file not shown.