-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tls incompatible with winhttp #18
Comments
in tls/conn.go, after reading the handshake around line 1356, c.readRecord returns no data available. With the other clients, this method returns data |
found the problem I think but I don't have a fix yet and I have to sign-off. If you look at the pcap, the client cipher comes in with the encrypted handshake data in the same packet. I believe your code isn't able to handle when the handle shake comes in with the encrypted data. With other clients the encrypted handshake data comes in, in a separate packet. |
I have built an exe and reproduced it, will debug it. |
also failed with gorilla server on win10: set GOHOSTARCH=amd64
set GOHOSTOS=windows
go version go1.16 windows/amd64 package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{}
func echo(w http.ResponseWriter, r *http.Request) {
c, err := upgrader.Upgrade(w, r, nil)
if err != nil {
log.Print("upgrade:", err)
return
}
defer c.Close()
for {
mt, message, err := c.ReadMessage()
if err != nil {
log.Println("read:", err)
break
}
err = c.WriteMessage(mt, message)
if err != nil {
log.Println("write:", err)
break
}
fmt.Println("onEcho:", string(message))
}
}
func main() {
addr := "localhost:8888"
mux := &http.ServeMux{}
mux.HandleFunc("/ws", echo)
server := http.Server{
Addr: addr,
Handler: mux,
}
log.Println("running on:", addr)
log.Fatalln(server.ListenAndServeTLS("server.crt", "server.key"))
} when I debug, the tls handshake succeeded for golang, but got the dwError = 12175(ERROR_WINHTTP_SECURE_FAILURE) for c++. what's your windows version? |
I was testing with a letsencrypt server cert so the windows client accepted it. I figured out how to disable the server cert verification in the c++ client app to disabled the server cert verification add
after hRequestHandle is initialized. here is the complete code
this client works with your gorrilla websocket example above with out error for me |
fixed: lesismal/llib@d120a1b |
thank you |
I used visual studio 2019 and ran this against websocket_tls server . If I simply change the port to 28000 and replace WINHTTP_FLAG_SECURE with 0, this code is able to connect to the non-tls websocket example
The text was updated successfully, but these errors were encountered: