> When using the DefaultMux, inside ServeHTTP my req.URL.Schema is always
> empty. I thought it should be set to "http" according to the documentation
> http://tip.golang.org/pkg/net/url/#URL
The docs in net/http don't spell it out, but req.URL is constructed by
parsing the Request-URI on the first line of the HTTP request. That
typically looks something like
GET /foo.html HTTP/1.0
which is, of course, a rather limited URL. It has no schema, host,
port, query or fragment, which is why those things won't appear in
req.URL.
Dave.
typically looks something like
GET /foo.html HTTP/1.0
which is, of course, a rather limited URL. It has no schema, host,
port, query or fragment, which is why those things won't appear in
req.URL.
Dave.
You can test if a given *http.Request (req) is https connection like so:
isHTTPS := req.TLS != nil
Andrew