[Modify] Polish it
This commit is contained in:
parent
f11a8c30c2
commit
1a5f82ce01
@ -784,34 +784,42 @@ namespace WebSocketSharp.Server
|
|||||||
{
|
{
|
||||||
if (!authenticateClient (context)) {
|
if (!authenticateClient (context)) {
|
||||||
context.Close (HttpStatusCode.Forbidden);
|
context.Close (HttpStatusCode.Forbidden);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var uri = context.RequestUri;
|
var uri = context.RequestUri;
|
||||||
|
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
context.Close (HttpStatusCode.BadRequest);
|
context.Close (HttpStatusCode.BadRequest);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_allowForwardedRequest) {
|
if (!_allowForwardedRequest) {
|
||||||
if (uri.Port != _port) {
|
if (uri.Port != _port) {
|
||||||
context.Close (HttpStatusCode.BadRequest);
|
context.Close (HttpStatusCode.BadRequest);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkHostNameForRequest (uri.DnsSafeHost)) {
|
if (!checkHostNameForRequest (uri.DnsSafeHost)) {
|
||||||
context.Close (HttpStatusCode.NotFound);
|
context.Close (HttpStatusCode.NotFound);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = uri.AbsolutePath;
|
var path = uri.AbsolutePath;
|
||||||
|
|
||||||
if (path.IndexOfAny (new[] { '%', '+' }) > -1)
|
if (path.IndexOfAny (new[] { '%', '+' }) > -1)
|
||||||
path = HttpUtility.UrlDecode (path, Encoding.UTF8);
|
path = HttpUtility.UrlDecode (path, Encoding.UTF8);
|
||||||
|
|
||||||
WebSocketServiceHost host;
|
WebSocketServiceHost host;
|
||||||
|
|
||||||
if (!_services.InternalTryGetServiceHost (path, out host)) {
|
if (!_services.InternalTryGetServiceHost (path, out host)) {
|
||||||
context.Close (HttpStatusCode.NotImplemented);
|
context.Close (HttpStatusCode.NotImplemented);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user