-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
why ctx.Request.URI().RequestURI() is missing? #597
Comments
first ctx.RequestURI() is "/echo" ,missing is print "/" |
I had use "github.com/fasthttp/websocket"for websocket |
Ah, yep, I know where the error is. https://github.com/valyala/fasthttp/blob/master/server.go#L2063 |
ok thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had write a websocket proxy,but ctx.requesturi is miss and fmt.Println( ctx.Request.String()) is ok:
func Proxyhttp(ctx *fasthttp.RequestCtx){
fmt.Println( string(ctx.RequestURI())) //here is ok
if websocket.FastHTTPIsWebSocketUpgrade(ctx){
Dowebsocket(ctx, clientproxy.source)
}
}
func Dowebsocket( ctx *fasthttp.RequestCtx,sourcestr string){
upgrader := websocket.FastHTTPUpgrader{HandshakeTimeout: 15 * time.Second, CheckOrigin:func(ctx *fasthttp.RequestCtx) bool { return true }, }
upgrader.Upgrade(ctx,func(ws *websocket.Conn) {
wsURL := url.URL{Scheme: "ws", Host: sourcestr, Path:string(ctx.RequestURI())) }//here is miss
fmt.Println(string(ctx.URI().RequestURI())) //here is miss
dialer := websocket.Dialer{
Proxy: http.ProxyFromEnvironment,
HandshakeTimeout: 15 * time.Second,
}
server, _, err := dialer.Dial(wsURL.String(), nil)
...................
}
The text was updated successfully, but these errors were encountered: