55 "github.com/1f349/violet/logger"
66 "github.com/1f349/violet/proxy"
77 "github.com/1f349/violet/utils"
8- "github.com/google/uuid"
98 websocket2 "github.com/gorilla/websocket"
109 "github.com/rs/cors"
1110 "golang.org/x/net/http/httpguts"
@@ -130,8 +129,7 @@ func (r Route) internalServeHTTP(rw http.ResponseWriter, req *http.Request) {
130129 // create the internal request
131130 req2 , err := http .NewRequest (req .Method , u .String (), req .Body )
132131 if err != nil {
133- Logger .Warn ("Error generating new request" , "err" , err )
134- utils .RespondVioletError (rw , http .StatusBadGateway , "error generating new request" )
132+ utils .RespondVioletError (rw , http .StatusBadGateway , "Invalid request for proxy" )
135133 return
136134 }
137135
@@ -182,7 +180,7 @@ func (r Route) internalServeHTTP(rw http.ResponseWriter, req *http.Request) {
182180 }
183181 if err != nil {
184182 Logger .Warn ("Error receiving internal round trip response" , "route src" , r .Src , "url" , req2 .URL .String (), "err" , err )
185- utils .RespondVioletError (rw , http .StatusBadGateway , "error receiving internal round trip response" )
183+ utils .RespondVioletError (rw , http .StatusBadGateway , "Error receiving internal round trip response" )
186184 return
187185 }
188186
@@ -192,9 +190,8 @@ func (r Route) internalServeHTTP(rw http.ResponseWriter, req *http.Request) {
192190 }
193191
194192 if resp .StatusCode == http .StatusLoopDetected {
195- u := uuid .New ()
196- Logger .Warn ("Loop Detected" , "id" , u , "method" , req .Method , "url" , req .URL , "url2" , req2 .URL .String ())
197- utils .RespondVioletError (rw , http .StatusLoopDetected , "error loop detected: " + u .String ())
193+ Logger .Warn ("Loop Detected" , "method" , req .Method , "url" , req .URL , "url2" , req2 .URL .String ())
194+ utils .RespondVioletError (rw , http .StatusLoopDetected , "Error loop detected" )
198195 return
199196 }
200197
@@ -225,7 +222,7 @@ func (r Route) internalReverseProxyMeta(rw http.ResponseWriter, req, req2 *http.
225222
226223 reqUpType := upgradeType (req2 .Header )
227224 if ! asciiIsPrint (reqUpType ) {
228- utils .RespondVioletError (rw , http .StatusBadRequest , fmt .Sprintf ("client tried to switch to invalid protocol %q " , reqUpType ))
225+ utils .RespondVioletError (rw , http .StatusBadRequest , fmt .Sprintf ("Invalid protocol %s " , reqUpType ))
229226 return true
230227 }
231228 removeHopByHopHeaders (req2 .Header )
0 commit comments