http2: added non-connect request support
This commit is contained in:
@@ -323,9 +323,15 @@ func (h *http2Handler) roundTrip(ctx context.Context, w http.ResponseWriter, req
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: forward request
|
start := time.Now()
|
||||||
resp.StatusCode = http.StatusBadRequest
|
log.Infof("%s <-> %s", req.RemoteAddr, host)
|
||||||
w.WriteHeader(resp.StatusCode)
|
if err := h.forwardRequest(w, req, cc); err != nil {
|
||||||
|
log.Info("%s - %s: %s", req.RemoteAddr, host, err)
|
||||||
|
}
|
||||||
|
log.WithFields(map[string]any{
|
||||||
|
"duration": time.Since(start),
|
||||||
|
}).Infof("%s >-< %s", req.RemoteAddr, host)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,6 +462,7 @@ func (h *http2Handler) authenticate(ctx context.Context, w http.ResponseWriter,
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *http2Handler) forwardRequest(w http.ResponseWriter, r *http.Request, rw io.ReadWriter) (err error) {
|
func (h *http2Handler) forwardRequest(w http.ResponseWriter, r *http.Request, rw io.ReadWriter) (err error) {
|
||||||
if err = r.Write(rw); err != nil {
|
if err = r.Write(rw); err != nil {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user