diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs
index 77ef3229..8ed09b1d 100644
--- a/websocket-sharp/Server/HttpServer.cs
+++ b/websocket-sharp/Server/HttpServer.cs
@@ -100,10 +100,10 @@ namespace WebSocketSharp.Server
///
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
public HttpServer (int port)
: this (port, port == 443 ? true : false)
@@ -119,14 +119,14 @@ namespace WebSocketSharp.Server
/// requests on .
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
/// A that indicates providing a secure connection or not.
/// (true indicates providing a secure connection.)
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
///
/// Pair of and is invalid.
@@ -208,10 +208,10 @@ namespace WebSocketSharp.Server
}
///
- /// Gets a value indicating whether the server has been started.
+ /// Gets a value indicating whether the server has started.
///
///
- /// true if the server has been started; otherwise, false.
+ /// true if the server has started; otherwise, false.
///
public bool IsListening {
get {
@@ -220,10 +220,10 @@ namespace WebSocketSharp.Server
}
///
- /// Gets a value indicating whether the server provides secure connection.
+ /// Gets a value indicating whether the server provides a secure connection.
///
///
- /// true if the server provides secure connection; otherwise,
+ /// true if the server provides a secure connection; otherwise,
/// false.
///
public bool IsSecure {
@@ -271,7 +271,7 @@ namespace WebSocketSharp.Server
/// Gets the port on which to listen for incoming requests.
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
public int Port {
get {
@@ -432,52 +432,63 @@ namespace WebSocketSharp.Server
{
var args = new HttpRequestEventArgs (context);
var method = context.Request.HttpMethod;
- if (method == "GET" && OnGet != null) {
- OnGet (this, args);
- return;
- }
- if (method == "HEAD" && OnHead != null) {
- OnHead (this, args);
- return;
+ if (method == "GET") {
+ if (OnGet != null) {
+ OnGet (this, args);
+ return;
+ }
}
-
- if (method == "POST" && OnPost != null) {
- OnPost (this, args);
- return;
+ else if (method == "HEAD") {
+ if (OnHead != null) {
+ OnHead (this, args);
+ return;
+ }
}
-
- if (method == "PUT" && OnPut != null) {
- OnPut (this, args);
- return;
+ else if (method == "POST") {
+ if (OnPost != null) {
+ OnPost (this, args);
+ return;
+ }
}
-
- if (method == "DELETE" && OnDelete != null) {
- OnDelete (this, args);
- return;
+ else if (method == "PUT") {
+ if (OnPut != null) {
+ OnPut (this, args);
+ return;
+ }
}
-
- if (method == "OPTIONS" && OnOptions != null) {
- OnOptions (this, args);
- return;
+ else if (method == "DELETE") {
+ if (OnDelete != null) {
+ OnDelete (this, args);
+ return;
+ }
}
-
- if (method == "TRACE" && OnTrace != null) {
- OnTrace (this, args);
- return;
+ else if (method == "OPTIONS") {
+ if (OnOptions != null) {
+ OnOptions (this, args);
+ return;
+ }
}
-
- if (method == "CONNECT" && OnConnect != null) {
- OnConnect (this, args);
- return;
+ else if (method == "TRACE") {
+ if (OnTrace != null) {
+ OnTrace (this, args);
+ return;
+ }
}
-
- if (method == "PATCH" && OnPatch != null) {
- OnPatch (this, args);
- return;
+ else if (method == "CONNECT") {
+ if (OnConnect != null) {
+ OnConnect (this, args);
+ return;
+ }
+ }
+ else if (method == "PATCH") {
+ if (OnPatch != null) {
+ OnPatch (this, args);
+ return;
+ }
}
- context.Response.Close (HttpStatusCode.NotImplemented);
+ context.Response.StatusCode = (int) HttpStatusCode.NotImplemented;
}
private void acceptRequestAsync (HttpListenerContext context)
@@ -590,10 +601,10 @@ namespace WebSocketSharp.Server
_receiveRequestThread.Start ();
}
- private void stopListener (int timeOut)
+ private void stopListener (int millisecondsTimeout)
{
_listener.Close ();
- _receiveRequestThread.Join (timeOut);
+ _receiveRequestThread.Join (millisecondsTimeout);
}
#endregion
diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs
index f593576d..81a05f8d 100644
--- a/websocket-sharp/Server/WebSocketServer.cs
+++ b/websocket-sharp/Server/WebSocketServer.cs
@@ -103,10 +103,10 @@ namespace WebSocketSharp.Server
///
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
public WebSocketServer (int port)
: this (System.Net.IPAddress.Any, port)
@@ -118,8 +118,15 @@ namespace WebSocketSharp.Server
/// with the specified WebSocket URL.
///
///
- /// An instance initialized by this constructor listens for the incoming
- /// connection requests on the port number of .
+ ///
+ /// An instance initialized by this constructor listens for the incoming
+ /// connection requests on the port (if any) in .
+ ///
+ ///
+ /// So if is without a port, either port 80 or 443
+ /// is used on which to listen. It's determined by the scheme (ws or wss)
+ /// in . (port 80 if the scheme is ws.)
+ ///
///
///
/// A that represents the WebSocket URL of the server.
@@ -161,14 +168,14 @@ namespace WebSocketSharp.Server
/// connection requests on .
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
/// A that indicates providing a secure connection or not.
/// (true indicates providing a secure connection.)
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
///
/// Pair of and is invalid.
@@ -193,19 +200,20 @@ namespace WebSocketSharp.Server
///
///
///
- /// A that represents the local IP address.
+ /// A that represents the local IP address
+ /// of the server.
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
/// is .
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
///
- /// is not the local IP address.
+ /// isn't a local IP address.
///
public WebSocketServer (System.Net.IPAddress address, int port)
: this (address, port, port == 443 ? true : false)
@@ -222,10 +230,11 @@ namespace WebSocketSharp.Server
/// connection requests on .
///
///
- /// A that represents the local IP address.
+ /// A that represents the local IP address
+ /// of the server.
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
///
/// A that indicates providing a secure connection or not.
@@ -235,11 +244,11 @@ namespace WebSocketSharp.Server
/// is .
///
///
- /// is not between 1 and 65535.
+ /// isn't between 1 and 65535.
///
///
///
- /// is not the local IP address.
+ /// isn't a local IP address.
///
///
/// -or-
@@ -332,10 +341,10 @@ namespace WebSocketSharp.Server
}
///
- /// Gets a value indicating whether the server has been started.
+ /// Gets a value indicating whether the server has started.
///
///
- /// true if the server has been started; otherwise, false.
+ /// true if the server has started; otherwise, false.
///
public bool IsListening {
get {
@@ -344,10 +353,10 @@ namespace WebSocketSharp.Server
}
///
- /// Gets a value indicating whether the server provides secure connection.
+ /// Gets a value indicating whether the server provides a secure connection.
///
///
- /// true if the server provides secure connection; otherwise,
+ /// true if the server provides a secure connection; otherwise,
/// false.
///
public bool IsSecure {
@@ -395,7 +404,7 @@ namespace WebSocketSharp.Server
/// Gets the port on which to listen for incoming connection requests.
///
///
- /// An that represents the port number to listen.
+ /// An that represents the port number on which to listen.
///
public int Port {
get {
@@ -622,10 +631,10 @@ namespace WebSocketSharp.Server
_receiveRequestThread.Start ();
}
- private void stopListener (int timeOut)
+ private void stopListener (int millisecondsTimeout)
{
_listener.Stop ();
- _receiveRequestThread.Join (timeOut);
+ _receiveRequestThread.Join (millisecondsTimeout);
}
private static bool tryCreateUri (string uriString, out Uri result, out string message)