You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
example one, Test_WithoutProxy, using http.client send a https request directly
example two Test_WithProxy, using http.client send a https request with dailConext to go socks proxy
see the two test here
package uu
import (
"context"
"encoding/hex"
"fmt"
"github.com/armon/go-socks5"
"golang.org/x/net/proxy"
"log"
"net"
"net/http"
"testing"
)
func StartSimpleHttpsServer() string {
l, err0 := net.Listen("tcp", "127.0.0.1:40030")
if err0 != nil {
log.Fatal(err0)
}
go func() {
for true {
conn, err := l.Accept()
if err != nil {
fmt.Println("accept fail -> ", err)
} else {
var buf = make([]byte, 1024*24*10)
n, err1 := conn.Read(buf)
if err1 != nil {
fmt.Println("read fail -> ", err1)
} else {
fmt.Println("read bytes -> ", n)
fmt.Println("hex dump -> \n", hex.Dump(buf[:n]))
}
}
}
}()
return l.Addr().String()
}
func TestWithBuildInProxy(t *testing.T) {
conf := &socks5.Config{}
server, err := socks5.New(conf)
if err != nil {
panic(err)
}
var socksProxyServer = "127.0.0.1:40012"
go func() {
if err := server.ListenAndServe("tcp", socksProxyServer); err != nil {
panic(err)
}
}()
var httpsServerAddr = StartSimpleHttpsServer()
workFlow(httpsServerAddr, socksProxyServer)
}
func Test_WithoutProxy(t *testing.T) {
var httpsServerAddr = StartSimpleHttpsServer()
workFlow(httpsServerAddr, "")
}
func workFlow(httpsServerAddr, socksServerAddr string) {
fmt.Println("https server -> ", httpsServerAddr)
fmt.Println("socks server -> ", socksServerAddr)
var client = &http.Client{}
if socksServerAddr != "" {
dialer, err := proxy.SOCKS5("tcp", socksServerAddr, nil, &net.Dialer{})
if err != nil {
log.Fatal(err)
}
var transport = &http.Transport{
DialContext: func(ctx context.Context, network, address string) (net.Conn, error) {
return dialer.Dial(network, address)
},
}
client.Transport = transport
}
//start a request
resp, err := client.Get(fmt.Sprintf("https://%s/hello", httpsServerAddr))
if err != nil {
fmt.Println("http get fail -> ", err)
} else {
fmt.Println("http get ok -> ", resp)
}
}
What did you expect to see?
http client with dailContext act the some like without dailContext
What did you see instead?
the tls server can see tls extension application_lay_protocol_negotiation if http client send sequest directly
the tls server can not see tls extension application_lay_protocol_negotiation if http client send sequest with dailContext
The text was updated successfully, but these errors were encountered:
liaogang
changed the title
affected/package: net.http
affected/package: net.http, http client with dailContext send a request dirrence from client without dailContext
Jul 1, 2023
liaogang
changed the title
affected/package: net.http, http client with dailContext send a request dirrence from client without dailContext
affected/package: net.http, http client with dailContext send a request different from client without dailContext
Jul 1, 2023
liaogang
changed the title
affected/package: net.http, http client with dailContext send a request different from client without dailContext
net.http, http client with dailContext send a request different from client without dailContext
Jul 1, 2023
liaogang
changed the title
net.http, http client with dailContext send a request different from client without dailContext
net.http: http client with dailContext send a request different from client without dailContext
Jul 1, 2023
liaogang
changed the title
net.http: http client with dailContext send a request different from client without dailContext
net.http: http client with dailContext send a https request different from client without dailContext
Jul 1, 2023
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
example one, Test_WithoutProxy, using http.client send a https request directly
example two Test_WithProxy, using http.client send a https request with dailConext to go socks proxy
see the two test here
What did you expect to see?
http client with dailContext act the some like without dailContext
What did you see instead?
the tls server can see tls extension application_lay_protocol_negotiation if http client send sequest directly
the tls server can not see tls extension application_lay_protocol_negotiation if http client send sequest with dailContext
the diffrence extension is here
The text was updated successfully, but these errors were encountered: