Fix for subprotocols for server

This commit is contained in:
sta
2014-02-07 16:47:59 +09:00
parent 7e6b82306c
commit 253f8f7ddc
6 changed files with 89 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
*
* The MIT License
*
* Copyright (c) 2012-2013 sta.blockhead
* Copyright (c) 2012-2014 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -241,7 +241,7 @@ namespace WebSocketSharp.Net.WebSockets
/// WebSocket connection request.
/// </summary>
/// <remarks>
/// This property represents the subprotocols of the WebSocket connection.
/// This property represents the subprotocols requested from the client.
/// </remarks>
/// <value>
/// An IEnumerable&lt;string&gt; that contains the values of the
@@ -249,7 +249,10 @@ namespace WebSocketSharp.Net.WebSockets
/// </value>
public override IEnumerable<string> SecWebSocketProtocols {
get {
return _context.Request.Headers.GetValues ("Sec-WebSocket-Protocol");
var protocols = _context.Request.Headers ["Sec-WebSocket-Protocol"];
if (protocols != null)
foreach (var protocol in protocols.Split (','))
yield return protocol.Trim ();
}
}

View File

@@ -251,7 +251,7 @@ namespace WebSocketSharp.Net.WebSockets
/// WebSocket connection request.
/// </summary>
/// <remarks>
/// This property represents the subprotocols of the WebSocket connection.
/// This property represents the subprotocols requested from the client.
/// </remarks>
/// <value>
/// An IEnumerable&lt;string&gt; that contains the values of the
@@ -259,7 +259,10 @@ namespace WebSocketSharp.Net.WebSockets
/// </value>
public override IEnumerable<string> SecWebSocketProtocols {
get {
return _request.Headers.GetValues ("Sec-WebSocket-Protocol");
var protocols = _request.Headers ["Sec-WebSocket-Protocol"];
if (protocols != null)
foreach (var protocol in protocols.Split (','))
yield return protocol.Trim ();
}
}

View File

@@ -4,7 +4,7 @@
*
* The MIT License
*
* Copyright (c) 2012-2013 sta.blockhead
* Copyright (c) 2012-2014 sta.blockhead
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -173,7 +173,7 @@ namespace WebSocketSharp.Net.WebSockets
/// WebSocket connection request.
/// </summary>
/// <remarks>
/// This property represents the subprotocols of the WebSocket connection.
/// This property represents the subprotocols requested from the client.
/// </remarks>
/// <value>
/// An IEnumerable&lt;string&gt; that contains the values of the