mirror of
https://github.com/valyala/fasthttp.git
synced 2026-06-15 16:07:51 +03:00
Added RequestCtx.IsTLS, which may be used for determining whether the connection is encrypted
This commit is contained in:
@@ -248,9 +248,9 @@ type HijackHandler func(c net.Conn)
|
||||
// The server skips calling the handler in the following cases:
|
||||
//
|
||||
// * 'Connection: close' header exists in either request or response.
|
||||
// * Unexpected error during writing response to the connection.
|
||||
// * Unexpected error during response writing to the connection.
|
||||
//
|
||||
// The server no longer processes requests from hijacked connections.
|
||||
// The server stops processing requests from hijacked connections.
|
||||
// Server limits such as Concurrency, ReadTimeout, WriteTimeout, etc.
|
||||
// aren't applied to hijacked connections.
|
||||
//
|
||||
@@ -266,6 +266,14 @@ func (ctx *RequestCtx) Hijack(handler HijackHandler) {
|
||||
ctx.hijackHandler = handler
|
||||
}
|
||||
|
||||
// IsTLS returns true if the underlying connection is tls.Conn.
|
||||
//
|
||||
// tls.Conn is an encrypted connection (aka SSL, HTTPS).
|
||||
func (ctx *RequestCtx) IsTLS() bool {
|
||||
_, ok := ctx.c.(*tls.Conn)
|
||||
return ok
|
||||
}
|
||||
|
||||
type firstByteReader struct {
|
||||
c net.Conn
|
||||
ch byte
|
||||
|
||||
Reference in New Issue
Block a user