hoppscotch / proxyscotch

📡 A simple proxy server created for https://hoppscotch.io
https://hoppscotch.io
MIT License
360 stars 93 forks source link

server crashes when body data is set #7

Closed 1fexd closed 4 years ago

1fexd commented 4 years ago

When sending body data though the pwa, the server crashes with the following error:

2020/01/04 18:57:48 http: panic serving 127.0.0.1:33336: assignment to entry in nil map
goroutine 7 [running]:
net/http.(*conn).serve.func1(0xc4200988c0)
    /usr/lib/go-1.10/src/net/http/server.go:1726 +0xd0
panic(0x693b00, 0x720c60)
    /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
net/textproto.MIMEHeader.Set(0x0, 0xc420154134, 0xc, 0xc42014a160, 0x1f)
    /usr/lib/go-1.10/src/net/textproto/header.go:22 +0xb0
net/http.Header.Set(0x0, 0xc420154134, 0xc, 0xc42014a160, 0x1f)
    /usr/lib/go-1.10/src/net/http/header.go:31 +0x53
postwoman.io/proxy/libproxy.proxyHandler(0x724620, 0xc4201600e0, 0xc420148100)
    /home/felix/go/src/postwoman.io/proxy/libproxy/proxy.go:136 +0x545
net/http.HandlerFunc.ServeHTTP(0x6ff280, 0x724620, 0xc4201600e0, 0xc420148100)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0x8796c0, 0x724620, 0xc4201600e0, 0xc420148100)
    /usr/lib/go-1.10/src/net/http/server.go:2340 +0x130
net/http.serverHandler.ServeHTTP(0xc42008b2b0, 0x724620, 0xc4201600e0, 0xc420148100)
    /usr/lib/go-1.10/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc4200988c0, 0x724820, 0xc420066540)
    /usr/lib/go-1.10/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /usr/lib/go-1.10/src/net/http/server.go:2798 +0x27b
2020/01/04 18:57:48 http: panic serving 127.0.0.1:33340: assignment to entry in nil map
goroutine 34 [running]:
net/http.(*conn).serve.func1(0xc4201a2000)
    /usr/lib/go-1.10/src/net/http/server.go:1726 +0xd0
panic(0x693b00, 0x720c60)
    /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
net/textproto.MIMEHeader.Set(0x0, 0xc4201ae084, 0xc, 0xc4201980e0, 0x1f)
    /usr/lib/go-1.10/src/net/textproto/header.go:22 +0xb0
net/http.Header.Set(0x0, 0xc4201ae084, 0xc, 0xc4201980e0, 0x1f)
    /usr/lib/go-1.10/src/net/http/header.go:31 +0x53
postwoman.io/proxy/libproxy.proxyHandler(0x724620, 0xc4201c6000, 0xc4201b8000)
    /home/felix/go/src/postwoman.io/proxy/libproxy/proxy.go:136 +0x545
net/http.HandlerFunc.ServeHTTP(0x6ff280, 0x724620, 0xc4201c6000, 0xc4201b8000)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0x8796c0, 0x724620, 0xc4201c6000, 0xc4201b8000)
    /usr/lib/go-1.10/src/net/http/server.go:2340 +0x130
net/http.serverHandler.ServeHTTP(0xc42008b2b0, 0x724620, 0xc4201c6000, 0xc4201b8000)
    /usr/lib/go-1.10/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc4201a2000, 0x724820, 0xc4201b0040)
    /usr/lib/go-1.10/src/net/http/server.go:1830 +0x651
created by net/http.(*Server).Serve
    /usr/lib/go-1.10/src/net/http/server.go:2798 +0x27b