@@ -2,8 +2,6 @@ package http
2
2
3
3
import (
4
4
"context"
5
- "crypto/rand"
6
- "encoding/base32"
7
5
"errors"
8
6
"net/http"
9
7
"runtime/debug"
@@ -97,12 +95,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
97
95
}
98
96
}()
99
97
100
- ctx := h .env .Context ()
101
- if ctx == nil {
102
- log .Error ("no root context found, using background" )
103
- ctx = context .Background ()
104
- }
105
-
106
98
if ! allowOrigin (r , h .cfg ) || ! allowReferer (r , h .cfg ) {
107
99
w .WriteHeader (http .StatusForbidden )
108
100
w .Write ([]byte ("403 - Forbidden" ))
@@ -128,7 +120,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
128
120
r .Body = bw
129
121
}
130
122
131
- req , err := parseRequest (ctx , r , h .root )
123
+ req , err := parseRequest (r , h .root )
132
124
if err != nil {
133
125
if err == ErrNotFound {
134
126
w .WriteHeader (http .StatusNotFound )
@@ -152,18 +144,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
152
144
}
153
145
defer cancel ()
154
146
155
- req .Context = logging .ContextWithLoggable (req .Context , uuidLoggable ())
156
- if cn , ok := w .(http.CloseNotifier ); ok {
157
- clientGone := cn .CloseNotify ()
158
- go func () {
159
- select {
160
- case <- clientGone :
161
- case <- req .Context .Done ():
162
- }
163
- cancel ()
164
- }()
165
- }
166
-
167
147
re , err := NewResponseEmitter (w , r .Method , req , withRequestBodyEOFChan (bodyEOFChan ))
168
148
if err != nil {
169
149
w .WriteHeader (http .StatusBadRequest )
@@ -186,15 +166,6 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
186
166
h .root .Call (req , re , h .env )
187
167
}
188
168
189
- func uuidLoggable () logging.Loggable {
190
- ids := make ([]byte , 16 )
191
- rand .Read (ids )
192
-
193
- return logging.Metadata {
194
- "requestId" : base32 .HexEncoding .EncodeToString (ids ),
195
- }
196
- }
197
-
198
169
func sanitizedErrStr (err error ) string {
199
170
s := err .Error ()
200
171
s = strings .Split (s , "\n " )[0 ]
0 commit comments