rhaidiz / broxy

An HTTP/HTTPS intercept proxy written in Go.
GNU General Public License v3.0
1k stars 58 forks source link

Panic while using broxy #6

Closed dhra closed 4 years ago

dhra commented 4 years ago
$ ./broxy
panic: runtime error: index out of range [0] with length 0

goroutine 25 [running]:
github.com/rhaidiz/broxy/modules/coreproxy.(*Controller).onReq(0xc00024a800, 0xc00024a100, 0xc0002ba3c0, 0x15, 0xc000024201)
    github.com/rhaidiz/broxy@/modules/coreproxy/coreproxy_controller.go:520 +0xa98
github.com/rhaidiz/broxy/modules/coreproxy.(*Coreproxy).onReqDef(...)
    github.com/rhaidiz/broxy@/modules/coreproxy/coreproxy.go:119
github.com/elazarl/goproxy.FuncReqHandler.Handle(0xc0004601a0, 0xc00024a100, 0xc0002ba3c0, 0xc000024270, 0xc0001ee100)
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/actions.go:19 +0x3a
github.com/elazarl/goproxy.(*ReqProxyConds).Do.func1(0xc00024a100, 0xc0002ba3c0, 0x0, 0x0)
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/dispatcher.go:200 +0xcc
github.com/elazarl/goproxy.FuncReqHandler.Handle(0xc0003239e0, 0xc00024a100, 0xc0002ba3c0, 0xc000261d70, 0x3)
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/actions.go:19 +0x3a
github.com/elazarl/goproxy.(*ProxyHttpServer).filterRequest(0xc000188be0, 0xc00024a100, 0xc0002ba3c0, 0x0, 0x0)
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/proxy.go:61 +0x74
github.com/elazarl/goproxy.(*ProxyHttpServer).handleHttps.func2(0x11e1f20, 0xc0003fc018, 0xc00046a780, 0xc0002ba060, 0xc00036a000, 0xc000188be0, 0x11db100, 0xc0001d60e0)
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/https.go:210 +0x59d
created by github.com/elazarl/goproxy.(*ProxyHttpServer).handleHttps
    github.com/elazarl/goproxy@v0.0.0-20191011121108-aa519ddbe484/https.go:180 +0x53c

Borxy version: Broxy v1.0.0-alpha.3

rhaidiz commented 4 years ago

Can you provide more details? Can't really reproduce it with like that.

dhra commented 4 years ago
  1. Add a new project.
  2. Click on Settings > Proxy > Import CA certificate into browser > Start proxy listener
  3. Set proxy on browser and start visiting first site then program panicked at this step.
rhaidiz commented 4 years ago

Does it panic visiting any web site? Which operating system are in on?

rhaidiz commented 4 years ago

Ok, I checked the code and there's definitely something that needs to be fixed where the error panic occurs, but it shouldn't happen with any web site. Only when loading a website for which it is not possible to resolve the ip address.

rhaidiz commented 4 years ago

Fixed with the latest release.