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 headers are set in the pwa #5

Closed 1fexd closed 4 years ago

1fexd commented 4 years ago

When setting a header in the progressive web app, the server crashes

2020/01/01 17:36:37 http: panic serving 127.0.0.1:60756: 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(0x694b00, 0x721cc0)
    /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
net/textproto.MIMEHeader.Add(0x0, 0xc42001af90, 0x9, 0xc420016a20, 0x24)
    /usr/lib/go-1.10/src/net/textproto/header.go:15 +0xec
net/http.Header.Add(0x0, 0xc42001af73, 0x9, 0xc420016a20, 0x24)
    /usr/lib/go-1.10/src/net/http/header.go:24 +0x53
postwoman.io/proxy/libproxy.proxyHandler(0x725680, 0xc420170000, 0xc42016e000)
    /home/felix/go/src/postwoman.io/proxy/libproxy/proxy.go:137 +0x63d
net/http.HandlerFunc.ServeHTTP(0x700288, 0x725680, 0xc420170000, 0xc42016e000)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0x87a6c0, 0x725680, 0xc420170000, 0xc42016e000)
    /usr/lib/go-1.10/src/net/http/server.go:2340 +0x130
net/http.serverHandler.ServeHTTP(0xc42008cf70, 0x725680, 0xc420170000, 0xc42016e000)
    /usr/lib/go-1.10/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc4200988c0, 0x725880, 0xc420066500)
    /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/01 17:36:37 SessionId 5cb4acf5-3a1f-4203-b4d9-93e091ebf96c
2020/01/01 17:36:37 http: panic serving 127.0.0.1:60760: assignment to entry in nil map
goroutine 9 [running]:
net/http.(*conn).serve.func1(0xc420098960)
    /usr/lib/go-1.10/src/net/http/server.go:1726 +0xd0
panic(0x694b00, 0x721cc0)
    /usr/lib/go-1.10/src/runtime/panic.go:502 +0x229
net/textproto.MIMEHeader.Add(0x0, 0xc42018a0a0, 0x9, 0xc4201a0060, 0x24)
    /usr/lib/go-1.10/src/net/textproto/header.go:15 +0xec
net/http.Header.Add(0x0, 0xc42018a083, 0x9, 0xc4201a0060, 0x24)
    /usr/lib/go-1.10/src/net/http/header.go:24 +0x53
postwoman.io/proxy/libproxy.proxyHandler(0x725680, 0xc4201aa000, 0xc420198000)
    /home/felix/go/src/postwoman.io/proxy/libproxy/proxy.go:137 +0x63d
net/http.HandlerFunc.ServeHTTP(0x700288, 0x725680, 0xc4201aa000, 0xc420198000)
    /usr/lib/go-1.10/src/net/http/server.go:1947 +0x44
net/http.(*ServeMux).ServeHTTP(0x87a6c0, 0x725680, 0xc4201aa000, 0xc420198000)
    /usr/lib/go-1.10/src/net/http/server.go:2340 +0x130
net/http.serverHandler.ServeHTTP(0xc42008cf70, 0x725680, 0xc4201aa000, 0xc420198000)
    /usr/lib/go-1.10/src/net/http/server.go:2697 +0xbc
net/http.(*conn).serve(0xc420098960, 0x725880, 0xc42018e040)
    /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