...
1
2
3
4
5
6
7 package http2
8
9 import "net/http"
10
11
12 func fillNetHTTPServerConfig(conf *http2Config, srv *http.Server) {
13 fillNetHTTPConfig(conf, srv.HTTP2)
14 }
15
16
17 func fillNetHTTPTransportConfig(conf *http2Config, tr *http.Transport) {
18 fillNetHTTPConfig(conf, tr.HTTP2)
19 }
20
21 func fillNetHTTPConfig(conf *http2Config, h2 *http.HTTP2Config) {
22 if h2 == nil {
23 return
24 }
25 if h2.MaxConcurrentStreams != 0 {
26 conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams)
27 }
28 if h2.MaxEncoderHeaderTableSize != 0 {
29 conf.MaxEncoderHeaderTableSize = uint32(h2.MaxEncoderHeaderTableSize)
30 }
31 if h2.MaxDecoderHeaderTableSize != 0 {
32 conf.MaxDecoderHeaderTableSize = uint32(h2.MaxDecoderHeaderTableSize)
33 }
34 if h2.MaxConcurrentStreams != 0 {
35 conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams)
36 }
37 if h2.MaxReadFrameSize != 0 {
38 conf.MaxReadFrameSize = uint32(h2.MaxReadFrameSize)
39 }
40 if h2.MaxReceiveBufferPerConnection != 0 {
41 conf.MaxUploadBufferPerConnection = int32(h2.MaxReceiveBufferPerConnection)
42 }
43 if h2.MaxReceiveBufferPerStream != 0 {
44 conf.MaxUploadBufferPerStream = int32(h2.MaxReceiveBufferPerStream)
45 }
46 if h2.SendPingTimeout != 0 {
47 conf.SendPingTimeout = h2.SendPingTimeout
48 }
49 if h2.PingTimeout != 0 {
50 conf.PingTimeout = h2.PingTimeout
51 }
52 if h2.WriteByteTimeout != 0 {
53 conf.WriteByteTimeout = h2.WriteByteTimeout
54 }
55 if h2.PermitProhibitedCipherSuites {
56 conf.PermitProhibitedCipherSuites = true
57 }
58 if h2.CountError != nil {
59 conf.CountError = h2.CountError
60 }
61 }
62
View as plain text