http::new_request: wrap Host in [] for ipv6
This commit is contained in:
parent
4bb0cd5c7e
commit
8cde44d639
|
@ -11,6 +11,7 @@ export fn main() void = {
|
||||||
scheme = "http",
|
scheme = "http",
|
||||||
host = ip::LOCAL_V6,
|
host = ip::LOCAL_V6,
|
||||||
path = "/",
|
path = "/",
|
||||||
|
port = 8080,
|
||||||
...
|
...
|
||||||
});
|
});
|
||||||
http::write_header(os::stdout, &req.header)!;
|
http::write_header(os::stdout, &req.header)!;
|
||||||
|
|
|
@ -51,8 +51,11 @@ fn new_request(client: *client, method: str, target: *uri::uri) request = {
|
||||||
let host = match (req.target.host) {
|
let host = match (req.target.host) {
|
||||||
case let host: str =>
|
case let host: str =>
|
||||||
yield host;
|
yield host;
|
||||||
case let ip: ip::addr =>
|
case let ip: ip::addr4 =>
|
||||||
yield ip::string(ip);
|
yield ip::string(ip);
|
||||||
|
case let ip: ip::addr6 =>
|
||||||
|
static let buf: [64 + 2]u8 = [0...];
|
||||||
|
yield fmt::bsprintf(buf, "[{}]", ip::string(ip));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (req.target.scheme == "http" && req.target.port != 80) {
|
if (req.target.scheme == "http" && req.target.port != 80) {
|
||||||
|
|
Loading…
Reference in a new issue