|
5 | 5 | using System.Collections.Generic;
|
6 | 6 | using System.Security.Cryptography;
|
7 | 7 | using System.Text;
|
| 8 | +using Microsoft.AspNetCore.Http; |
8 | 9 |
|
9 | 10 | namespace Microsoft.AspNetCore.WebSockets.Internal
|
10 | 11 | {
|
@@ -63,14 +64,14 @@ public static bool CheckSupportedWebSocketRequest(string method, IEnumerable<Key
|
63 | 64 | return validConnection && validUpgrade && validVersion && validKey;
|
64 | 65 | }
|
65 | 66 |
|
66 |
| - public static IEnumerable<KeyValuePair<string, string>> GenerateResponseHeaders(string key, string subProtocol) |
| 67 | + public static void GenerateResponseHeaders(string key, string subProtocol, IHeaderDictionary headers) |
67 | 68 | {
|
68 |
| - yield return new KeyValuePair<string, string>(Constants.Headers.Connection, Constants.Headers.ConnectionUpgrade); |
69 |
| - yield return new KeyValuePair<string, string>(Constants.Headers.Upgrade, Constants.Headers.UpgradeWebSocket); |
70 |
| - yield return new KeyValuePair<string, string>(Constants.Headers.SecWebSocketAccept, CreateResponseKey(key)); |
| 69 | + headers[Constants.Headers.Connection] = Constants.Headers.ConnectionUpgrade; |
| 70 | + headers[Constants.Headers.Upgrade] = Constants.Headers.UpgradeWebSocket; |
| 71 | + headers[Constants.Headers.SecWebSocketAccept] = CreateResponseKey(key); |
71 | 72 | if (!string.IsNullOrWhiteSpace(subProtocol))
|
72 | 73 | {
|
73 |
| - yield return new KeyValuePair<string, string>(Constants.Headers.SecWebSocketProtocol, subProtocol); |
| 74 | + headers[Constants.Headers.SecWebSocketProtocol] = subProtocol; |
74 | 75 | }
|
75 | 76 | }
|
76 | 77 |
|
|
0 commit comments