// registerHTTPSProtocol calls Transport.RegisterProtocol but // convering panics into errors. func registerHTTPSProtocol(t *http.Transport, rt http.RoundTripper) (err error) { defer func() { if e := recover(); e != nil { err = fmt.Errorf("%v", e) } }() t.RegisterProtocol("https", rt) return nil }
// New returns a Supervisor interface type connected to the net.URL specified in u // // Optionally specify a http.Transport to use, will use default http.Transport if nil. // This will also register a func New(url string, transport *http.Transport) Supervisor { if transport == nil { transport = new(http.Transport) } transport.RegisterProtocol("unix", new(supervisorTransport)) //xmlrpc.NewClient never returns an error client, _ := xmlrpc.NewClient(url, transport) return &supervisor{client} }
// registerFileProtocol registers support for file:// URLs on the given transport. func registerFileProtocol(transport *http.Transport) { transport.RegisterProtocol("file", http.NewFileTransport(http.Dir("/"))) }
func (t *UnleashedTransport) NewClient() *http.Client { transport := new(http.Transport) transport.RegisterProtocol(SchemeName, t) return &http.Client{Transport: transport} }