TODO: Add a timer to recreate the client ?
()
| 416 | |
| 417 | // TODO: Add a timer to recreate the client ? |
| 418 | func (info *RuntimeInfo) getHTTPClient() *http.Client { |
| 419 | sock := fmt.Sprintf("/var/run/faas/%s", info.RuntimeID) |
| 420 | client := &http.Client{ |
| 421 | Transport: &http.Transport{ |
| 422 | DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { |
| 423 | return net.Dial("unix", fmt.Sprintf("%s/%s", sock, RuntimeHTTPSock)) |
| 424 | }, |
| 425 | }, |
| 426 | // forbid redirect |
| 427 | CheckRedirect: func(req *http.Request, via []*http.Request) error { |
| 428 | return http.ErrUseLastResponse |
| 429 | }, |
| 430 | } |
| 431 | return client |
| 432 | } |