gddo-server: parse host and url from request correctly

Most browsers send requests to http://godoc.org/net/http as

GET /net/http HTTP/1.1
Host: godoc.org

instead of as expected in current tests

GET https://godoc.org/net/http HTTP/1.1
Host: godoc.org

This causes http.Request.URL to have empty strings for the "Scheme" and
"Host" fields (see https://golang.org/src/net/http/request.go#L120 and
RFC 7230 Section 5.3). As a result, server logs show most gddoEvent
structs as having an empty "Host" field and a relative path for the URL.

This CL enables the parsing of these fields from the other fields of the
http.Request struct.

Change-Id: Iab923a0d9a70f32f36b6e4a15019afc648699796
Reviewed-on: https://go-review.googlesource.com/c/gddo/+/236143
Reviewed-by: Julie Qiu <julie@golang.org>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
2 files changed