Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readRequest in go does not take a Conn as an argument #427

Closed
ry opened this issue May 21, 2019 · 0 comments · Fixed by #430
Closed

readRequest in go does not take a Conn as an argument #427

ry opened this issue May 21, 2019 · 0 comments · Fixed by #430

Comments

@ry
Copy link
Member

ry commented May 21, 2019

https://github.com/golang/go/blob/1d1ba85d9986bb56226046c06dec4ce63ef9fe48/src/net/http/request.go#L992

The corresponding code in http/server.ts should be changed to also not depend on conn.

deno_std/http/server.ts

Lines 201 to 220 in aad0896

async function readRequest(
conn: Conn,
bufr: BufReader
): Promise<[ServerRequest, BufState]> {
const req = new ServerRequest();
req.conn = conn;
req.r = bufr;
req.w = new BufWriter(conn);
const tp = new TextProtoReader(bufr);
let err: BufState;
// First line: GET /index.html HTTP/1.0
let firstLine: string;
[firstLine, err] = await tp.readLine();
if (err) {
return [null, err];
}
[req.method, req.url, req.proto] = firstLine.split(" ", 3);
[req.headers, err] = await tp.readMIMEHeader();
return [req, err];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant