Skip to content

Commit

Permalink
feat(http/driver): added forkedHTTP2
Browse files Browse the repository at this point in the history
  • Loading branch information
bundleman committed Oct 7, 2023
1 parent 04ac583 commit cf26bde
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.21.0

require (
github.com/PuerkitoBio/goquery v1.8.0
github.com/Sssilencee/http2 v0.0.0-20231003233935-736cf3782b1a
github.com/antchfx/htmlquery v1.2.4
github.com/antchfx/xpath v1.2.0
github.com/antlr/antlr4/runtime/Go/antlr v0.0.0-20211211185417-43fb4c2dbe28
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF0
github.com/Masterminds/vcs v1.13.0/go.mod h1:N09YCmOQr6RLxC6UNHzuVwAdodYbbnycGHSmwVJjcKA=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/Sssilencee/http2 v0.0.0-20231003233935-736cf3782b1a h1:venKwyQpY4TRNcsONy/MMJUHGgGHfkDu2lbNrjdelA8=
github.com/Sssilencee/http2 v0.0.0-20231003233935-736cf3782b1a/go.mod h1:xVSIqycM8BiAZ/Ruwv7gRfxk+ERD10zov3Bg/6j+oWc=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/antchfx/htmlquery v1.2.4 h1:qLteofCMe/KGovBI6SQgmou2QNyedFUW+pE+BpeZ494=
Expand Down
6 changes: 3 additions & 3 deletions pkg/drivers/http/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"compress/flate"
"compress/gzip"
"context"
"golang.org/x/net/http2"
forkedHTTP2 "github.com/Sssilencee/http2"
"io"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -86,10 +86,10 @@ func addProxy(httpClient *pester.Client, proxyStr string) error {
httpClient.Transport.(*http.Transport).Proxy = proxy
}

if _, isHTTPTransport := httpClient.Transport.(*http2.Transport); isHTTPTransport {
if _, isHTTPTransport := httpClient.Transport.(*forkedHTTP2.Transport); isHTTPTransport {
httpTr1 := &http.Transport{}
httpTr1.Proxy = proxy
http2.ConfigureTransport(httpTr1)
forkedHTTP2.ConfigureTransport(httpTr1)
}

return nil
Expand Down

0 comments on commit cf26bde

Please sign in to comment.