Browse Source

Fixed HttpServer.cs

pull/14/head
sta 13 years ago
parent
commit
8868761635
  1. BIN
      Example/bin/Debug_Ubuntu/example.exe
  2. BIN
      Example/bin/Debug_Ubuntu/example.exe.mdb
  3. BIN
      Example/bin/Debug_Ubuntu/websocket-sharp.dll
  4. BIN
      Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
  5. BIN
      Example1/bin/Debug_Ubuntu/example1.exe
  6. BIN
      Example1/bin/Debug_Ubuntu/example1.exe.mdb
  7. BIN
      Example1/bin/Debug_Ubuntu/websocket-sharp.dll
  8. BIN
      Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
  9. BIN
      Example2/bin/Debug_Ubuntu/example2.exe
  10. BIN
      Example2/bin/Debug_Ubuntu/example2.exe.mdb
  11. BIN
      Example2/bin/Debug_Ubuntu/websocket-sharp.dll
  12. BIN
      Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
  13. BIN
      Example3/bin/Debug_Ubuntu/Example3.exe
  14. BIN
      Example3/bin/Debug_Ubuntu/Example3.exe.mdb
  15. BIN
      Example3/bin/Debug_Ubuntu/websocket-sharp.dll
  16. BIN
      Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
  17. 27
      websocket-sharp/Server/HttpServer.cs
  18. BIN
      websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll
  19. BIN
      websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
  20. BIN
      websocket-sharp/websocket-sharp.pidb

BIN
Example/bin/Debug_Ubuntu/example.exe

BIN
Example/bin/Debug_Ubuntu/example.exe.mdb

BIN
Example/bin/Debug_Ubuntu/websocket-sharp.dll

BIN
Example/bin/Debug_Ubuntu/websocket-sharp.dll.mdb

BIN
Example1/bin/Debug_Ubuntu/example1.exe

BIN
Example1/bin/Debug_Ubuntu/example1.exe.mdb

BIN
Example1/bin/Debug_Ubuntu/websocket-sharp.dll

BIN
Example1/bin/Debug_Ubuntu/websocket-sharp.dll.mdb

BIN
Example2/bin/Debug_Ubuntu/example2.exe

BIN
Example2/bin/Debug_Ubuntu/example2.exe.mdb

BIN
Example2/bin/Debug_Ubuntu/websocket-sharp.dll

BIN
Example2/bin/Debug_Ubuntu/websocket-sharp.dll.mdb

BIN
Example3/bin/Debug_Ubuntu/Example3.exe

BIN
Example3/bin/Debug_Ubuntu/Example3.exe.mdb

BIN
Example3/bin/Debug_Ubuntu/websocket-sharp.dll

BIN
Example3/bin/Debug_Ubuntu/websocket-sharp.dll.mdb

27
websocket-sharp/Server/HttpServer.cs

@ -154,17 +154,8 @@ namespace WebSocketSharp.Server {
{
if (isUpgrade(req, "websocket"))
{
if (req.IsWebSocketRequest)
{
if (upgradeToWebSocket(context))
return;
res.StatusCode = (int)HttpStatusCode.NotImplemented;
}
else
{
res.StatusCode = (int)HttpStatusCode.BadRequest;
}
if (upgradeToWebSocket(context))
return;
}
else
{
@ -253,9 +244,21 @@ namespace WebSocketSharp.Server {
private bool upgradeToWebSocket(HttpListenerContext context)
{
var path = context.Request.RawUrl;
var req = context.Request;
var res = context.Response;
if (!req.IsWebSocketRequest)
{
res.StatusCode = (int)HttpStatusCode.BadRequest;
return false;
}
var path = req.RawUrl;
if (!_wsServers.ContainsKey(path))
{
res.StatusCode = (int)HttpStatusCode.NotImplemented;
return false;
}
var wsContext = context.AcceptWebSocket(path);
var socket = wsContext.WebSocket;

BIN
websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll

BIN
websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb

BIN
websocket-sharp/websocket-sharp.pidb

Loading…
Cancel
Save