diff options
author | Dreamacro <Dreamacro@vip.qq.com> | 2020-01-04 17:31:12 +0800 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2020-01-04 04:31:12 -0500 |
commit | 70b1be6ff459ebd2bf57b7788ab7d66c1f375b29 (patch) | |
tree | 0cfe35152745189383ec8acd26c908c1d775be98 /std/ws/mod.ts | |
parent | cbc4bbc71f4e619747707b1b9649abedfa234145 (diff) |
Fix ws handshake with correctly empty search string (#3587)
Diffstat (limited to 'std/ws/mod.ts')
-rw-r--r-- | std/ws/mod.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/std/ws/mod.ts b/std/ws/mod.ts index a32380efc..c256f58ad 100644 --- a/std/ws/mod.ts +++ b/std/ws/mod.ts @@ -411,13 +411,13 @@ export function createSecKey(): string { return btoa(key); } -async function handshake( +export async function handshake( url: URL, headers: Headers, bufReader: BufReader, bufWriter: BufWriter ): Promise<void> { - const { hostname, pathname, searchParams } = url; + const { hostname, pathname, search } = url; const key = createSecKey(); if (!headers.has("host")) { @@ -428,7 +428,7 @@ async function handshake( headers.set("sec-websocket-key", key); headers.set("sec-websocket-version", "13"); - let headerStr = `GET ${pathname}?${searchParams || ""} HTTP/1.1\r\n`; + let headerStr = `GET ${pathname}${search} HTTP/1.1\r\n`; for (const [key, value] of headers) { headerStr += `${key}: ${value}\r\n`; } |