Skip to content

http.DefaultTransport.Do crashes if req.URL is nil #1602

@gopherbot

Description

@gopherbot

by jbarham:

What steps will reproduce the problem?

1. req := &http.Request{RawURL: "http://example.com";}
2. http.DefaultTransport.Do(req)

What is the expected output?

http.DefaultTransport.Do should return error

What do you see instead?

panic: runtime error: invalid memory address or nil pointer dereference

[signal 0xb code=0x1 addr=0x10 pc=0x42ca05]

runtime.panic+0xac /home/jbarham/go/src/pkg/runtime/proc.c:1083
    runtime.panic(0x50694c, 0xf840014300)
runtime.panicstring+0xa3 /home/jbarham/go/src/pkg/runtime/runtime.c:116
    runtime.panicstring(0x6ca9ef, 0x4be52d)
runtime.sigpanic+0x144 /home/jbarham/go/src/pkg/runtime/linux/thread.c:292
    runtime.sigpanic()
http.*transport·Do+0x4d /home/jbarham/go/src/pkg/http/transport.go:39
...

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Ubuntu

Which revision are you using?  (hg identify)

c5c62aeb6267 release/release.2011-03-07.1

Please provide any additional information below.

Fault is presumably at
http://code.google.com/p/go/source/browse/src/pkg/http/transport.go#39since it doesn't
check for req.URL == nil

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions