Skip to content

Request timeout not working  #13

@batuzyn

Description

@batuzyn

Hello,
Thank you for good package.

I want to use utls with proxy and tried this package with context and http.client timeout. But it's not working for me.

requestMaxTimeout := 10 //seconds
ctxTimeout, cancelRequest := context.WithTimeout(context.Background(), time.Second*time.Duration(requestMaxTimeout))
defer cancelRequest()
httpClient = http.Client{
			Timeout: time.Second*time.Duration(requestMaxTimeout),
			Transport: &http.Transport{Proxy: http.ProxyURL(proxyDetails.ProxyURL),
				TLSClientConfig: &tls.Config{InsecureSkipVerify: true}},
			CheckRedirect: func(req *http.Request, via []*http.Request) error {
				return http.ErrUseLastResponse
			},

response, err := httpClient.Do(request.WithContext(ctxTimeout))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions