1
Fork 0

transport: don't export new_reader

The semantics are internal
This commit is contained in:
Drew DeVault 2023-02-12 12:21:14 +01:00
parent d350e8ccd9
commit c76599f71c
2 changed files with 9 additions and 2 deletions

View file

@ -7,6 +7,7 @@ use strings;
export type client = struct {
default_header: header,
default_transport: transport,
};
// Creates a new HTTP [[client]] with the provided User-Agent string, which is
@ -14,7 +15,7 @@ export type client = struct {
// resourfces associated with the HTTP client after use.
export fn newclient(ua: str) client = {
let client = client { ... };
client_add_header(&client, "User-Agent", ua);
header_add(&client, "User-Agent", ua);
return client;
};

View file

@ -48,7 +48,7 @@ export type transport = struct {
content: content_mode,
};
export fn new_reader(
fn new_reader(
conn: io::handle,
resp: *response,
scan: *bufio::scanner,
@ -71,6 +71,12 @@ export fn new_reader(
return new_identity_reader(conn, remain, length);
};
// TODO: Figure out the semantics for closing the stream
// The caller should probably be required to close it
// It should close/free any intermediate transport/content decoders
// And it should not close the actual connection if it's still in the
// connection pool
// Unless it isn't in the pool, then it should!
let stream: io::handle = conn;
let buffer: []u8 = bufio::scan_buffer(scan);
const iter = strings::tokenize(te, ",");