mirror of
https://github.com/codex-storage/nim-websock.git
synced 2025-02-02 05:44:53 +00:00
"Host" header override (#87)
Override "Host" header for externally resolved addresses
This commit is contained in:
parent
d60df8176d
commit
2af07c5736
@ -107,6 +107,7 @@ proc connect*(
|
|||||||
_: type WebSocket,
|
_: type WebSocket,
|
||||||
host: string | TransportAddress,
|
host: string | TransportAddress,
|
||||||
path: string,
|
path: string,
|
||||||
|
hostName: string = "", # override used when the hostname has been externally resolved
|
||||||
protocols: seq[string] = @[],
|
protocols: seq[string] = @[],
|
||||||
factories: seq[ExtFactory] = @[],
|
factories: seq[ExtFactory] = @[],
|
||||||
secure = false,
|
secure = false,
|
||||||
@ -133,7 +134,7 @@ proc connect*(
|
|||||||
("Cache-Control", "no-cache"),
|
("Cache-Control", "no-cache"),
|
||||||
("Sec-WebSocket-Version", $version),
|
("Sec-WebSocket-Version", $version),
|
||||||
("Sec-WebSocket-Key", key),
|
("Sec-WebSocket-Key", key),
|
||||||
("Host", $host)]
|
("Host", if hostName.len > 0: hostName else: $host)]
|
||||||
|
|
||||||
var headers = HttpTable.init(headerData)
|
var headers = HttpTable.init(headerData)
|
||||||
if protocols.len > 0:
|
if protocols.len > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user