-
-
Notifications
You must be signed in to change notification settings - Fork 229
Open
Labels
bugSomething isn't workingSomething isn't working
Description
TLS client version
v1.7.10
System information
Model Name: MacBook Pro
Chip: Apple M1 Pro
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 16 GB
Issue description
I recieve following error
failed to do request: Get "https://httpbin.org/deflate": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
when making request with tls-client.
I think it's related to decompression. It works for gzip and brotli compression but gives error for deflate.
Steps to reproduce / Code Sample
package main
import (
"fmt"
"io"
"strings"
fhttp "github.com/bogdanfinn/fhttp"
tls_client "github.com/bogdanfinn/tls-client"
profiles "github.com/bogdanfinn/tls-client/profiles"
)
func main() {
// Create client with Firefox browser profile
options := []tls_client.HttpClientOption{
tls_client.WithTimeoutSeconds(30),
tls_client.WithClientProfile(profiles.Chrome_131),
tls_client.WithDebug(),
// tls_client.WithForceHttp1(),
}
client, err := tls_client.NewHttpClient(tls_client.NewNoopLogger(), options...)
if err != nil {
fmt.Printf("Failed to create client: %v\n", err)
return
}
url := "https://httpbin.org/deflate"
// Create a test request
req, err := fhttp.NewRequest("GET", url, strings.NewReader(""))
if err != nil {
fmt.Printf("Failed to create request: %v\n", err)
return
}
// Set some basic headers
req.Header = fhttp.Header{
"accept": {"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"},
"accept-language": {"en-US,en;q=0.5"},
"accept-encoding": {"deflate"},
"user-agent": {"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0"},
}
// Enable redirect following
client.SetFollowRedirect(true)
// Make the request
fmt.Println("Sending request...")
resp, err := client.Do(req)
if err != nil {
fmt.Printf("Request failed: %v\n", err)
return
}
defer resp.Body.Close()
// Read and print response
fmt.Printf("Status Code: %d\n", resp.StatusCode)
fmt.Println("Headers:", resp.Header)
// decomBody := fhttp.DecompressBody(resp)
body, err := io.ReadAll(resp.Body)
if err != nil {
fmt.Printf("Failed to read body: %v\n", err)
return
}
fmt.Println("Body:", string(body))
} Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working