Home > other >  Http2 how an agent and then ignore all certificate
Http2 how an agent and then ignore all certificate

Time:09-27

I see online send a http2 request code looks something like this
Tr:=http2. Transport {}
CConn, err:=tr. NewClientConn (conn)
if err ! Nil={
Return nil, err
}
CConn. RoundTrip (the req)
I'd like to leave this code proxy server, how to set? Conveniently ignore all certificate
Http1.1 can walk agent I write so

HTTP proxy:=func (_ *. Request) (* url in the url, the error) {
The return url. Parse (" http://127.0.0.1:8080 ")
}

Tr:=& amp; HTTP. Transport {
TLSClientConfig: & amp; The TLS. Config {InsecureSkipVerify: true},
//ignore certificateProxy: the Proxy,//set agent
}

Client:=& amp; . The HTTP Client {Transport: tr}

/////////////////////////////////

//////////////

Urltmp:="https://m.facebook.com"
Resp, err:=client. Get (urltmp)

CodePudding user response:

Try
Tr:=& amp; HTTP. Transport {
TLSClientConfig: & amp; The TLS. Config {InsecureSkipVerify: true},
//ignore certificateProxy: the Proxy,//set agent
}
//err:=http2 ConfigureTransport (tr)
Tr2:=& amp; Http2. Transport {}
Tr2. T1=tr//to use reflection to set here, the reflection is not introduced in detail, refer to the API reflect yourself
  • Related