summaryrefslogtreecommitdiff
path: root/ws/mod.ts
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-07-08 04:20:41 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-07-07 15:20:41 -0400
commit9a01d6455ec3cfa955967102f576cb542999321a (patch)
tree82a4ab5776a09432f23b9ed99a31306c884c833e /ws/mod.ts
parent6a0858bd5d9d327ac7f46bee5f5b2fab642f2a3f (diff)
Upgrade to v0.11.0 (update Reader interface) (denoland/deno_std#527)
Original: https://github.com/denoland/deno_std/commit/3ea90d54f6dad4bcc3d32e63601096a6c0ff3ce4
Diffstat (limited to 'ws/mod.ts')
-rw-r--r--ws/mod.ts14
1 files changed, 7 insertions, 7 deletions
diff --git a/ws/mod.ts b/ws/mod.ts
index 946eb4bf4..df8cab01f 100644
--- a/ws/mod.ts
+++ b/ws/mod.ts
@@ -4,7 +4,7 @@ import { decode, encode } from "../strings/mod.ts";
type Conn = Deno.Conn;
type Writer = Deno.Writer;
-import { BufReader, BufWriter, EOF, UnexpectedEOFError } from "../io/bufio.ts";
+import { BufReader, BufWriter, UnexpectedEOFError } from "../io/bufio.ts";
import { readLong, readShort, sliceLongToBytes } from "../io/ioutil.ts";
import { Sha1 } from "./sha1.ts";
import { writeResponse } from "../http/server.ts";
@@ -142,7 +142,7 @@ export async function writeFrame(
/** Read websocket frame from given BufReader */
export async function readFrame(buf: BufReader): Promise<WebSocketFrame> {
let b = await buf.readByte();
- if (b === EOF) throw new UnexpectedEOFError();
+ if (b === Deno.EOF) throw new UnexpectedEOFError();
let isLastFrame = false;
switch (b >>> 4) {
case 0b1000:
@@ -157,16 +157,16 @@ export async function readFrame(buf: BufReader): Promise<WebSocketFrame> {
const opcode = b & 0x0f;
// has_mask & payload
b = await buf.readByte();
- if (b === EOF) throw new UnexpectedEOFError();
+ if (b === Deno.EOF) throw new UnexpectedEOFError();
const hasMask = b >>> 7;
let payloadLength = b & 0b01111111;
if (payloadLength === 126) {
const l = await readShort(buf);
- if (l === EOF) throw new UnexpectedEOFError();
+ if (l === Deno.EOF) throw new UnexpectedEOFError();
payloadLength = l;
} else if (payloadLength === 127) {
const l = await readLong(buf);
- if (l === EOF) throw new UnexpectedEOFError();
+ if (l === Deno.EOF) throw new UnexpectedEOFError();
payloadLength = Number(l);
}
// mask
@@ -442,7 +442,7 @@ async function handshake(
const tpReader = new TextProtoReader(bufReader);
const statusLine = await tpReader.readLine();
- if (statusLine === EOF) {
+ if (statusLine === Deno.EOF) {
throw new UnexpectedEOFError();
}
const m = statusLine.match(/^(?<version>\S+) (?<statusCode>\S+) /);
@@ -460,7 +460,7 @@ async function handshake(
}
const responseHeaders = await tpReader.readMIMEHeader();
- if (responseHeaders === EOF) {
+ if (responseHeaders === Deno.EOF) {
throw new UnexpectedEOFError();
}