transport: don't export new_reader
The semantics are internal
This commit is contained in:
parent
d350e8ccd9
commit
c76599f71c
|
@ -7,6 +7,7 @@ use strings;
|
||||||
|
|
||||||
export type client = struct {
|
export type client = struct {
|
||||||
default_header: header,
|
default_header: header,
|
||||||
|
default_transport: transport,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Creates a new HTTP [[client]] with the provided User-Agent string, which is
|
// 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.
|
// resourfces associated with the HTTP client after use.
|
||||||
export fn newclient(ua: str) client = {
|
export fn newclient(ua: str) client = {
|
||||||
let client = client { ... };
|
let client = client { ... };
|
||||||
client_add_header(&client, "User-Agent", ua);
|
header_add(&client, "User-Agent", ua);
|
||||||
return client;
|
return client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ export type transport = struct {
|
||||||
content: content_mode,
|
content: content_mode,
|
||||||
};
|
};
|
||||||
|
|
||||||
export fn new_reader(
|
fn new_reader(
|
||||||
conn: io::handle,
|
conn: io::handle,
|
||||||
resp: *response,
|
resp: *response,
|
||||||
scan: *bufio::scanner,
|
scan: *bufio::scanner,
|
||||||
|
@ -71,6 +71,12 @@ export fn new_reader(
|
||||||
return new_identity_reader(conn, remain, length);
|
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 stream: io::handle = conn;
|
||||||
let buffer: []u8 = bufio::scan_buffer(scan);
|
let buffer: []u8 = bufio::scan_buffer(scan);
|
||||||
const iter = strings::tokenize(te, ",");
|
const iter = strings::tokenize(te, ",");
|
||||||
|
|
Loading…
Reference in a new issue