Closed Gekko0114 closed 8 months ago
Thanks for the info, will take a look shortly. Do you have a fix (even a theoretical) for that btw ?
You can fix it by replacing httpWriteHeader(bw, headerHost, u.Host) with the following code:
host := u.Host
if headerHTTP, ok := header.(HandshakeHeaderHTTP); ok {
httpHeaderHTTP := http.Header(headerHTTP)
if v := httpHeaderHTTP.Get(headerHost); v != "" {
host = v
}
}
httpWriteHeader(bw, headerHost, host)
And you need to comment out https://github.com/gobwas/ws/blob/master/http.go#L323-L325.
However, since handshakeheader
is an interface, so I don't think my code is a perfect solution.
My solution is specific to HandshakeHeaderHTTP
type.
I think you should decide how to fix it because this solution is related to this library's design itself.
@cristaloleg have you looked at this?
Yes, but AFAIR we didn't found a solution. Feel free to make a PR.
Yes, but AFAIR we didn't found a solution. Feel free to make a PR.
Please have a look at: https://github.com/gobwas/ws/pull/194 Merry Christmas!
Hello Gobwas,
Thanks for the great package!
I found that httpWriteUpgradeRequest doesn't work as intended. When I try to add dial function like this:
I want to assign request's header to
h
, but it doesn't work as expected due to this code httpWriteHeader(bw, headerHost, u.Host). This causes bothh
andu.Host
to be assigned to the request's header.I hope this problem can be resolved soon. Thanks,
FYI We discussed this problem in this PR.