ires 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -45
- data/ext/Gopkg.lock +31 -1
- data/ext/ires/image.go +227 -0
- data/ext/ires/ires.go +47 -59
- data/ext/ires/uri.go +143 -0
- data/ext/main.go +18 -9
- data/ext/vendor/github.com/PuerkitoBio/purell/LICENSE +12 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/README.md +187 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/bench_test.go +57 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/benchmarks/v0.1.0 +9 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/example_test.go +35 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell.go +379 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell_test.go +768 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/urlnorm_test.go +53 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/LICENSE +27 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/README.md +16 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc.go +180 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc_test.go +641 -0
- data/ext/vendor/github.com/{satori/go.uuid → goware/urlx}/LICENSE +3 -1
- data/ext/vendor/github.com/goware/urlx/README.md +172 -0
- data/ext/vendor/github.com/goware/urlx/urlx.go +196 -0
- data/ext/vendor/github.com/goware/urlx/urlx_test.go +232 -0
- data/ext/vendor/golang.org/x/net/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/net/LICENSE +27 -0
- data/ext/vendor/golang.org/x/net/PATENTS +22 -0
- data/ext/vendor/golang.org/x/net/README.md +16 -0
- data/ext/vendor/golang.org/x/net/bpf/asm.go +41 -0
- data/ext/vendor/golang.org/x/net/bpf/constants.go +218 -0
- data/ext/vendor/golang.org/x/net/bpf/doc.go +82 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions.go +704 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions_test.go +525 -0
- data/ext/vendor/golang.org/x/net/bpf/setter.go +10 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.bpf +1 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.txt +79 -0
- data/ext/vendor/golang.org/x/net/bpf/vm.go +140 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_aluop_test.go +512 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_bpf_test.go +192 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_extension_test.go +49 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_instructions.go +174 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_jump_test.go +380 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_load_test.go +246 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_ret_test.go +115 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_scratch_test.go +247 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_test.go +144 -0
- data/ext/vendor/golang.org/x/net/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/net/context/context.go +54 -0
- data/ext/vendor/golang.org/x/net/context/context_test.go +583 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +74 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go +29 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go +147 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17_test.go +79 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +105 -0
- data/ext/vendor/golang.org/x/net/context/go17.go +72 -0
- data/ext/vendor/golang.org/x/net/context/go19.go +20 -0
- data/ext/vendor/golang.org/x/net/context/pre_go17.go +300 -0
- data/ext/vendor/golang.org/x/net/context/pre_go19.go +109 -0
- data/ext/vendor/golang.org/x/net/context/withtimeout_test.go +31 -0
- data/ext/vendor/golang.org/x/net/dict/dict.go +210 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/example_test.go +132 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message.go +1997 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +1116 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom.go +78 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom_test.go +109 -0
- data/ext/vendor/golang.org/x/net/html/atom/gen.go +709 -0
- data/ext/vendor/golang.org/x/net/html/atom/table.go +777 -0
- data/ext/vendor/golang.org/x/net/html/atom/table_test.go +373 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset.go +257 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset_test.go +237 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-charset.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-UTF-8-BOM.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-content.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/No-encoding-declaration.html +47 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/README +9 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-content.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-charset-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-content-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/const.go +104 -0
- data/ext/vendor/golang.org/x/net/html/doc.go +106 -0
- data/ext/vendor/golang.org/x/net/html/doctype.go +156 -0
- data/ext/vendor/golang.org/x/net/html/entity.go +2253 -0
- data/ext/vendor/golang.org/x/net/html/entity_test.go +29 -0
- data/ext/vendor/golang.org/x/net/html/escape.go +258 -0
- data/ext/vendor/golang.org/x/net/html/escape_test.go +97 -0
- data/ext/vendor/golang.org/x/net/html/example_test.go +40 -0
- data/ext/vendor/golang.org/x/net/html/foreign.go +226 -0
- data/ext/vendor/golang.org/x/net/html/node.go +193 -0
- data/ext/vendor/golang.org/x/net/html/node_test.go +146 -0
- data/ext/vendor/golang.org/x/net/html/parse.go +2094 -0
- data/ext/vendor/golang.org/x/net/html/parse_test.go +388 -0
- data/ext/vendor/golang.org/x/net/html/render.go +271 -0
- data/ext/vendor/golang.org/x/net/html/render_test.go +156 -0
- data/ext/vendor/golang.org/x/net/html/testdata/go1.html +2237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/README +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption01.dat +194 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption02.dat +31 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/comments01.dat +135 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/doctype01.dat +370 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities01.dat +603 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities02.dat +249 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/html5test-com.dat +246 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/inbody01.dat +43 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/isindex.dat +40 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes-plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes.dat +52 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scriptdata01.dat +308 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/adoption01.dat +15 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/webkit01.dat +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tables01.dat +212 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests1.dat +1952 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests10.dat +799 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests11.dat +482 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests12.dat +62 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests14.dat +74 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests15.dat +208 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests16.dat +2299 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests17.dat +153 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests18.dat +269 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests19.dat +1237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests2.dat +763 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests20.dat +455 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests21.dat +221 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests22.dat +157 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests23.dat +155 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests24.dat +79 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests25.dat +219 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests26.dat +313 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests3.dat +305 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests4.dat +59 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests5.dat +191 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests6.dat +663 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests7.dat +390 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests8.dat +148 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests9.dat +457 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests_innerHTML_1.dat +741 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tricky01.dat +261 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit01.dat +610 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit02.dat +159 -0
- data/ext/vendor/golang.org/x/net/html/token.go +1219 -0
- data/ext/vendor/golang.org/x/net/html/token_test.go +748 -0
- data/ext/vendor/golang.org/x/net/http2/Dockerfile +51 -0
- data/ext/vendor/golang.org/x/net/http2/Makefile +3 -0
- data/ext/vendor/golang.org/x/net/http2/README +20 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers_test.go +309 -0
- data/ext/vendor/golang.org/x/net/http2/client_conn_pool.go +256 -0
- data/ext/vendor/golang.org/x/net/http2/configure_transport.go +80 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer.go +146 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer_test.go +157 -0
- data/ext/vendor/golang.org/x/net/http2/errors.go +133 -0
- data/ext/vendor/golang.org/x/net/http2/errors_test.go +24 -0
- data/ext/vendor/golang.org/x/net/http2/flow.go +50 -0
- data/ext/vendor/golang.org/x/net/http2/flow_test.go +53 -0
- data/ext/vendor/golang.org/x/net/http2/frame.go +1579 -0
- data/ext/vendor/golang.org/x/net/http2/frame_test.go +1191 -0
- data/ext/vendor/golang.org/x/net/http2/go16.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go17.go +106 -0
- data/ext/vendor/golang.org/x/net/http2/go17_not18.go +36 -0
- data/ext/vendor/golang.org/x/net/http2/go18.go +56 -0
- data/ext/vendor/golang.org/x/net/http2/go18_test.go +79 -0
- data/ext/vendor/golang.org/x/net/http2/go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go19_test.go +60 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack_test.go +33 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/Makefile +8 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/README +16 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/h2demo.go +538 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/launch.go +302 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.pem +26 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.srl +1 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.crt +20 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/tmpl.go +1991 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/README.md +97 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/h2i.go +522 -0
- data/ext/vendor/golang.org/x/net/http2/headermap.go +78 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode.go +240 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode_test.go +386 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack.go +490 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack_test.go +722 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/huffman.go +212 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables.go +479 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables_test.go +214 -0
- data/ext/vendor/golang.org/x/net/http2/http2.go +391 -0
- data/ext/vendor/golang.org/x/net/http2/http2_test.go +199 -0
- data/ext/vendor/golang.org/x/net/http2/not_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/http2/not_go17.go +87 -0
- data/ext/vendor/golang.org/x/net/http2/not_go18.go +29 -0
- data/ext/vendor/golang.org/x/net/http2/not_go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/pipe.go +163 -0
- data/ext/vendor/golang.org/x/net/http2/pipe_test.go +130 -0
- data/ext/vendor/golang.org/x/net/http2/server.go +2857 -0
- data/ext/vendor/golang.org/x/net/http2/server_push_test.go +521 -0
- data/ext/vendor/golang.org/x/net/http2/server_test.go +3721 -0
- data/ext/vendor/golang.org/x/net/http2/testdata/draft-ietf-httpbis-http2.xml +5021 -0
- data/ext/vendor/golang.org/x/net/http2/transport.go +2285 -0
- data/ext/vendor/golang.org/x/net/http2/transport_test.go +3714 -0
- data/ext/vendor/golang.org/x/net/http2/write.go +370 -0
- data/ext/vendor/golang.org/x/net/http2/writesched.go +242 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority.go +452 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority_test.go +541 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random.go +72 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random_test.go +44 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_test.go +125 -0
- data/ext/vendor/golang.org/x/net/http2/z_spec_test.go +356 -0
- data/ext/vendor/golang.org/x/net/icmp/dstunreach.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/echo.go +45 -0
- data/ext/vendor/golang.org/x/net/icmp/endpoint.go +113 -0
- data/ext/vendor/golang.org/x/net/icmp/example_test.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/extension.go +89 -0
- data/ext/vendor/golang.org/x/net/icmp/extension_test.go +259 -0
- data/ext/vendor/golang.org/x/net/icmp/helper_posix.go +75 -0
- data/ext/vendor/golang.org/x/net/icmp/interface.go +236 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4.go +61 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4_test.go +83 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv6.go +23 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_posix.go +100 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_stub.go +33 -0
- data/ext/vendor/golang.org/x/net/icmp/message.go +152 -0
- data/ext/vendor/golang.org/x/net/icmp/message_test.go +134 -0
- data/ext/vendor/golang.org/x/net/icmp/messagebody.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/mpls.go +77 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart.go +109 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart_test.go +442 -0
- data/ext/vendor/golang.org/x/net/icmp/packettoobig.go +43 -0
- data/ext/vendor/golang.org/x/net/icmp/paramprob.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/ping_test.go +200 -0
- data/ext/vendor/golang.org/x/net/icmp/sys_freebsd.go +11 -0
- data/ext/vendor/golang.org/x/net/icmp/timeexceeded.go +39 -0
- data/ext/vendor/golang.org/x/net/idna/example_test.go +70 -0
- data/ext/vendor/golang.org/x/net/idna/idna.go +680 -0
- data/ext/vendor/golang.org/x/net/idna/idna_test.go +108 -0
- data/ext/vendor/golang.org/x/net/idna/punycode.go +203 -0
- data/ext/vendor/golang.org/x/net/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/net/idna/tables.go +4477 -0
- data/ext/vendor/golang.org/x/net/idna/trie.go +72 -0
- data/ext/vendor/golang.org/x/net/idna/trieval.go +114 -0
- data/ext/vendor/golang.org/x/net/internal/iana/const.go +180 -0
- data/ext/vendor/golang.org/x/net/internal/iana/gen.go +293 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_bsd.go +53 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go +15 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_posix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_stub.go +32 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_unix.go +29 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_windows.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/interface.go +94 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/rlimit.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/stack.go +147 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +13 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_darwin.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_dragonfly.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_freebsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_linux.go +49 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_netbsd.go +47 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_openbsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_solaris.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_unix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_windows.go +26 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_stub.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +39 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +16 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +74 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +77 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/reflect.go +62 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket.go +285 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go +259 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_test.go +46 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsd.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_darwin.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_netbsd.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_posix.go +168 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris.go +71 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_stub.go +64 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_unix.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_windows.go +70 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +65 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +68 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +60 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries.go +525 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv4/batch.go +191 -0
- data/ext/vendor/golang.org/x/net/ipv4/bpf_test.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/control.go +144 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_bsd.go +40 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_pktinfo.go +39 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_unix.go +73 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_darwin.go +77 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_dragonfly.go +38 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_freebsd.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_linux.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_netbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_openbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_solaris.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv4/dgramopt.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/doc.go +244 -0
- data/ext/vendor/golang.org/x/net/ipv4/endpoint.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv4/example_test.go +224 -0
- data/ext/vendor/golang.org/x/net/ipv4/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv4/genericopt.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/header.go +159 -0
- data/ext/vendor/golang.org/x/net/ipv4/header_test.go +228 -0
- data/ext/vendor/golang.org/x/net/ipv4/helper.go +63 -0
- data/ext/vendor/golang.org/x/net/ipv4/iana.go +34 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_linux.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_test.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicast_test.go +334 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastlistener_test.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastsockopt_test.go +195 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet.go +69 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_8.go +56 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg.go +36 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_8_test.go +248 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_9_test.go +388 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_test.go +140 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt.go +44 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_posix.go +71 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_stub.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_darwin.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_freebsd.go +76 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_linux.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_solaris.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_windows.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicast_test.go +247 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicastsockopt_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +31 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_solaris.go +100 -0
- data/ext/vendor/golang.org/x/net/ipv6/batch.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv6/bpf_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/control.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go +48 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go +94 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_unix.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_darwin.go +112 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_dragonfly.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_freebsd.go +105 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_linux.go +147 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_netbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_openbsd.go +89 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_solaris.go +114 -0
- data/ext/vendor/golang.org/x/net/ipv6/dgramopt.go +302 -0
- data/ext/vendor/golang.org/x/net/ipv6/doc.go +243 -0
- data/ext/vendor/golang.org/x/net/ipv6/endpoint.go +128 -0
- data/ext/vendor/golang.org/x/net/ipv6/example_test.go +216 -0
- data/ext/vendor/golang.org/x/net/ipv6/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv6/genericopt.go +58 -0
- data/ext/vendor/golang.org/x/net/ipv6/header.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/header_test.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/helper.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/iana.go +82 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp.go +60 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_bsd.go +29 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_solaris.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_stub.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_windows.go +22 -0
- data/ext/vendor/golang.org/x/net/ipv6/mocktransponder_test.go +32 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicast_test.go +264 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastlistener_test.go +261 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastsockopt_test.go +157 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_8.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_9.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +41 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_8_test.go +242 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_9_test.go +373 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt.go +43 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_posix.go +87 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_stub.go +46 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_test.go +133 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq.go +24 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bsd.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_darwin.go +106 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_freebsd.go +92 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_linux.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_solaris.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_windows.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicast_test.go +184 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicastsockopt_test.go +120 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_darwin.go +131 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go +88 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_386.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_netbsd.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_openbsd.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_solaris.go +131 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex.go +351 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex_test.go +119 -0
- data/ext/vendor/golang.org/x/net/lif/address.go +105 -0
- data/ext/vendor/golang.org/x/net/lif/address_test.go +123 -0
- data/ext/vendor/golang.org/x/net/lif/binary.go +115 -0
- data/ext/vendor/golang.org/x/net/lif/defs_solaris.go +90 -0
- data/ext/vendor/golang.org/x/net/lif/lif.go +43 -0
- data/ext/vendor/golang.org/x/net/lif/link.go +126 -0
- data/ext/vendor/golang.org/x/net/lif/link_test.go +63 -0
- data/ext/vendor/golang.org/x/net/lif/sys.go +21 -0
- data/ext/vendor/golang.org/x/net/lif/sys_solaris_amd64.s +8 -0
- data/ext/vendor/golang.org/x/net/lif/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/lif/zsys_solaris_amd64.go +103 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest.go +456 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go16.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go17.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_test.go +76 -0
- data/ext/vendor/golang.org/x/net/netutil/listen.go +48 -0
- data/ext/vendor/golang.org/x/net/netutil/listen_test.go +101 -0
- data/ext/vendor/golang.org/x/net/proxy/direct.go +18 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host.go +140 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host_test.go +55 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy.go +134 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy_test.go +215 -0
- data/ext/vendor/golang.org/x/net/proxy/socks5.go +214 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/gen.go +713 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list.go +135 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list_test.go +416 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table.go +9419 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table_test.go +16756 -0
- data/ext/vendor/golang.org/x/net/route/address.go +425 -0
- data/ext/vendor/golang.org/x/net/route/address_darwin_test.go +63 -0
- data/ext/vendor/golang.org/x/net/route/address_test.go +103 -0
- data/ext/vendor/golang.org/x/net/route/binary.go +90 -0
- data/ext/vendor/golang.org/x/net/route/defs_darwin.go +114 -0
- data/ext/vendor/golang.org/x/net/route/defs_dragonfly.go +113 -0
- data/ext/vendor/golang.org/x/net/route/defs_freebsd.go +337 -0
- data/ext/vendor/golang.org/x/net/route/defs_netbsd.go +112 -0
- data/ext/vendor/golang.org/x/net/route/defs_openbsd.go +116 -0
- data/ext/vendor/golang.org/x/net/route/interface.go +64 -0
- data/ext/vendor/golang.org/x/net/route/interface_announce.go +32 -0
- data/ext/vendor/golang.org/x/net/route/interface_classic.go +66 -0
- data/ext/vendor/golang.org/x/net/route/interface_freebsd.go +78 -0
- data/ext/vendor/golang.org/x/net/route/interface_multicast.go +30 -0
- data/ext/vendor/golang.org/x/net/route/interface_openbsd.go +90 -0
- data/ext/vendor/golang.org/x/net/route/message.go +72 -0
- data/ext/vendor/golang.org/x/net/route/message_darwin_test.go +34 -0
- data/ext/vendor/golang.org/x/net/route/message_freebsd_test.go +92 -0
- data/ext/vendor/golang.org/x/net/route/message_test.go +239 -0
- data/ext/vendor/golang.org/x/net/route/route.go +123 -0
- data/ext/vendor/golang.org/x/net/route/route_classic.go +67 -0
- data/ext/vendor/golang.org/x/net/route/route_openbsd.go +65 -0
- data/ext/vendor/golang.org/x/net/route/route_test.go +390 -0
- data/ext/vendor/golang.org/x/net/route/sys.go +39 -0
- data/ext/vendor/golang.org/x/net/route/sys_darwin.go +87 -0
- data/ext/vendor/golang.org/x/net/route/sys_dragonfly.go +76 -0
- data/ext/vendor/golang.org/x/net/route/sys_freebsd.go +155 -0
- data/ext/vendor/golang.org/x/net/route/sys_netbsd.go +71 -0
- data/ext/vendor/golang.org/x/net/route/sys_openbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/route/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/route/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/route/zsys_dragonfly.go +98 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_386.go +126 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_arm.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_netbsd.go +97 -0
- data/ext/vendor/golang.org/x/net/route/zsys_openbsd.go +101 -0
- data/ext/vendor/golang.org/x/net/trace/events.go +532 -0
- data/ext/vendor/golang.org/x/net/trace/histogram.go +365 -0
- data/ext/vendor/golang.org/x/net/trace/histogram_test.go +325 -0
- data/ext/vendor/golang.org/x/net/trace/trace.go +1082 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go17.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_test.go +178 -0
- data/ext/vendor/golang.org/x/net/webdav/file.go +796 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.6.go +17 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.7.go +16 -0
- data/ext/vendor/golang.org/x/net/webdav/file_test.go +1184 -0
- data/ext/vendor/golang.org/x/net/webdav/if.go +173 -0
- data/ext/vendor/golang.org/x/net/webdav/if_test.go +322 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/README +11 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/atom_test.go +56 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/example_test.go +151 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +1223 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal_test.go +1939 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read.go +692 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read_test.go +744 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go +371 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml.go +1998 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml_test.go +752 -0
- data/ext/vendor/golang.org/x/net/webdav/litmus_test_server.go +94 -0
- data/ext/vendor/golang.org/x/net/webdav/lock.go +445 -0
- data/ext/vendor/golang.org/x/net/webdav/lock_test.go +731 -0
- data/ext/vendor/golang.org/x/net/webdav/prop.go +418 -0
- data/ext/vendor/golang.org/x/net/webdav/prop_test.go +613 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav.go +702 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav_test.go +344 -0
- data/ext/vendor/golang.org/x/net/webdav/xml.go +519 -0
- data/ext/vendor/golang.org/x/net/webdav/xml_test.go +906 -0
- data/ext/vendor/golang.org/x/net/websocket/client.go +106 -0
- data/ext/vendor/golang.org/x/net/websocket/dial.go +24 -0
- data/ext/vendor/golang.org/x/net/websocket/dial_test.go +43 -0
- data/ext/vendor/golang.org/x/net/websocket/exampledial_test.go +31 -0
- data/ext/vendor/golang.org/x/net/websocket/examplehandler_test.go +26 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi.go +583 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi_test.go +608 -0
- data/ext/vendor/golang.org/x/net/websocket/server.go +113 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket.go +448 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket_test.go +665 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf.go +94 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf_test.go +83 -0
- data/ext/vendor/golang.org/x/text/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/text/LICENSE +27 -0
- data/ext/vendor/golang.org/x/text/PATENTS +22 -0
- data/ext/vendor/golang.org/x/text/README.md +91 -0
- data/ext/vendor/golang.org/x/text/cases/cases.go +162 -0
- data/ext/vendor/golang.org/x/text/cases/context.go +376 -0
- data/ext/vendor/golang.org/x/text/cases/context_test.go +438 -0
- data/ext/vendor/golang.org/x/text/cases/example_test.go +53 -0
- data/ext/vendor/golang.org/x/text/cases/fold.go +34 -0
- data/ext/vendor/golang.org/x/text/cases/fold_test.go +51 -0
- data/ext/vendor/golang.org/x/text/cases/gen.go +839 -0
- data/ext/vendor/golang.org/x/text/cases/gen_trieval.go +219 -0
- data/ext/vendor/golang.org/x/text/cases/icu.go +61 -0
- data/ext/vendor/golang.org/x/text/cases/icu_test.go +210 -0
- data/ext/vendor/golang.org/x/text/cases/info.go +82 -0
- data/ext/vendor/golang.org/x/text/cases/map.go +816 -0
- data/ext/vendor/golang.org/x/text/cases/map_test.go +950 -0
- data/ext/vendor/golang.org/x/text/cases/tables.go +2251 -0
- data/ext/vendor/golang.org/x/text/cases/tables_test.go +1158 -0
- data/ext/vendor/golang.org/x/text/cases/trieval.go +215 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/doc.go +35 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/extract.go +195 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/main.go +356 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/message.go +127 -0
- data/ext/vendor/golang.org/x/text/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder.go +702 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder_test.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem.go +294 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem_test.go +215 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract.go +309 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract_test.go +266 -0
- data/ext/vendor/golang.org/x/text/collate/build/order.go +393 -0
- data/ext/vendor/golang.org/x/text/collate/build/order_test.go +229 -0
- data/ext/vendor/golang.org/x/text/collate/build/table.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie_test.go +107 -0
- data/ext/vendor/golang.org/x/text/collate/collate.go +403 -0
- data/ext/vendor/golang.org/x/text/collate/collate_test.go +482 -0
- data/ext/vendor/golang.org/x/text/collate/export_test.go +51 -0
- data/ext/vendor/golang.org/x/text/collate/index.go +32 -0
- data/ext/vendor/golang.org/x/text/collate/maketables.go +553 -0
- data/ext/vendor/golang.org/x/text/collate/option.go +239 -0
- data/ext/vendor/golang.org/x/text/collate/option_test.go +209 -0
- data/ext/vendor/golang.org/x/text/collate/reg_test.go +230 -0
- data/ext/vendor/golang.org/x/text/collate/sort.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/sort_test.go +55 -0
- data/ext/vendor/golang.org/x/text/collate/table_test.go +291 -0
- data/ext/vendor/golang.org/x/text/collate/tables.go +73789 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/Makefile +7 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/chars.go +1156 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/col.go +97 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/colcmp.go +529 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/darwin.go +111 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/gen.go +183 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/icu.go +209 -0
- data/ext/vendor/golang.org/x/text/currency/common.go +66 -0
- data/ext/vendor/golang.org/x/text/currency/currency.go +185 -0
- data/ext/vendor/golang.org/x/text/currency/currency_test.go +171 -0
- data/ext/vendor/golang.org/x/text/currency/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/currency/format.go +215 -0
- data/ext/vendor/golang.org/x/text/currency/format_test.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/gen.go +400 -0
- data/ext/vendor/golang.org/x/text/currency/gen_common.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/query.go +152 -0
- data/ext/vendor/golang.org/x/text/currency/query_test.go +107 -0
- data/ext/vendor/golang.org/x/text/currency/tables.go +2574 -0
- data/ext/vendor/golang.org/x/text/currency/tables_test.go +93 -0
- data/ext/vendor/golang.org/x/text/doc.go +13 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap.go +249 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap_test.go +258 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/maketables.go +556 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/tables.go +7410 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding.go +335 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding_test.go +290 -0
- data/ext/vendor/golang.org/x/text/encoding/example_test.go +42 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/gen.go +173 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go +86 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go +144 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/map.go +105 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/tables.go +352 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/gen.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +209 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/tables.go +2348 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go +180 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/gen.go +137 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +81 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +1621 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/internal.go +75 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all_test.go +248 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/eucjp.go +225 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +299 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +189 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/tables.go +26971 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/all_test.go +94 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/euckr.go +177 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/maketables.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/tables.go +34152 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +269 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +245 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go +43999 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-gb18030.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-16le.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-32be.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-8.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-windows-1252.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-iso-2022-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-utf-8.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-utf-8.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-utf-8.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go +114 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +199 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go +140 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go +37142 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/override.go +82 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode.go +434 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode_test.go +499 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32.go +296 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go +248 -0
- data/ext/vendor/golang.org/x/text/feature/plural/common.go +70 -0
- data/ext/vendor/golang.org/x/text/feature/plural/data_test.go +190 -0
- data/ext/vendor/golang.org/x/text/feature/plural/example_test.go +46 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen.go +513 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen_common.go +74 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message.go +244 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message_test.go +197 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural.go +258 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural_test.go +216 -0
- data/ext/vendor/golang.org/x/text/feature/plural/tables.go +540 -0
- data/ext/vendor/golang.org/x/text/gen.go +318 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg.go +366 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go +316 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/codec.go +407 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint.go +62 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint_test.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collate_test.go +121 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem_test.go +183 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab_test.go +64 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract.go +145 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract_test.go +131 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter.go +178 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter_test.go +63 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric.go +236 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric_test.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/table.go +275 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie_test.go +106 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter.go +31 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter_test.go +42 -0
- data/ext/vendor/golang.org/x/text/internal/export/README +4 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/common_test.go +55 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/example_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen.go +276 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_common.go +59 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_test.go +91 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_trieval.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna.go +717 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna_test.go +308 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode.go +201 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/tables.go +4557 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trie.go +70 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trieval.go +119 -0
- data/ext/vendor/golang.org/x/text/internal/format/format.go +41 -0
- data/ext/vendor/golang.org/x/text/internal/gen.go +52 -0
- data/ext/vendor/golang.org/x/text/internal/gen/code.go +351 -0
- data/ext/vendor/golang.org/x/text/internal/gen/gen.go +281 -0
- data/ext/vendor/golang.org/x/text/internal/gen_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/internal.go +51 -0
- data/ext/vendor/golang.org/x/text/internal/internal_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/match.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/match_test.go +56 -0
- data/ext/vendor/golang.org/x/text/internal/number/common.go +40 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal.go +498 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal_test.go +329 -0
- data/ext/vendor/golang.org/x/text/internal/number/format.go +540 -0
- data/ext/vendor/golang.org/x/text/internal/number/format_test.go +522 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen.go +458 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen_common.go +44 -0
- data/ext/vendor/golang.org/x/text/internal/number/number.go +154 -0
- data/ext/vendor/golang.org/x/text/internal/number/number_test.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern.go +485 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern_test.go +438 -0
- data/ext/vendor/golang.org/x/text/internal/number/roundingmode_string.go +16 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables.go +1154 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables_test.go +125 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set.go +86 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set_test.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/tables.go +117 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag_test.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/codesize.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/flag.go +22 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gc.go +14 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gccgo.go +11 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_6.go +23 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_7.go +17 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/text.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/compact.go +58 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/data_test.go +875 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_compact_test.go +71 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_test.go +148 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/gen_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/print.go +251 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/triegen.go +494 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/example_test.go +81 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd_test.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go +87 -0
- data/ext/vendor/golang.org/x/text/language/Makefile +16 -0
- data/ext/vendor/golang.org/x/text/language/common.go +16 -0
- data/ext/vendor/golang.org/x/text/language/coverage.go +197 -0
- data/ext/vendor/golang.org/x/text/language/coverage_test.go +154 -0
- data/ext/vendor/golang.org/x/text/language/display/dict.go +92 -0
- data/ext/vendor/golang.org/x/text/language/display/dict_test.go +39 -0
- data/ext/vendor/golang.org/x/text/language/display/display.go +420 -0
- data/ext/vendor/golang.org/x/text/language/display/display_test.go +705 -0
- data/ext/vendor/golang.org/x/text/language/display/examples_test.go +116 -0
- data/ext/vendor/golang.org/x/text/language/display/lookup.go +251 -0
- data/ext/vendor/golang.org/x/text/language/display/maketables.go +602 -0
- data/ext/vendor/golang.org/x/text/language/display/tables.go +50344 -0
- data/ext/vendor/golang.org/x/text/language/doc.go +102 -0
- data/ext/vendor/golang.org/x/text/language/examples_test.go +413 -0
- data/ext/vendor/golang.org/x/text/language/gen.go +1706 -0
- data/ext/vendor/golang.org/x/text/language/gen_common.go +20 -0
- data/ext/vendor/golang.org/x/text/language/gen_index.go +162 -0
- data/ext/vendor/golang.org/x/text/language/go1_1.go +38 -0
- data/ext/vendor/golang.org/x/text/language/go1_2.go +11 -0
- data/ext/vendor/golang.org/x/text/language/httpexample_test.go +48 -0
- data/ext/vendor/golang.org/x/text/language/index.go +769 -0
- data/ext/vendor/golang.org/x/text/language/language.go +887 -0
- data/ext/vendor/golang.org/x/text/language/language_test.go +878 -0
- data/ext/vendor/golang.org/x/text/language/lookup.go +396 -0
- data/ext/vendor/golang.org/x/text/language/lookup_test.go +457 -0
- data/ext/vendor/golang.org/x/text/language/match.go +933 -0
- data/ext/vendor/golang.org/x/text/language/match_test.go +505 -0
- data/ext/vendor/golang.org/x/text/language/parse.go +859 -0
- data/ext/vendor/golang.org/x/text/language/parse_test.go +517 -0
- data/ext/vendor/golang.org/x/text/language/tables.go +3675 -0
- data/ext/vendor/golang.org/x/text/language/tags.go +143 -0
- data/ext/vendor/golang.org/x/text/language/testdata/CLDRLocaleMatcherTest.txt +389 -0
- data/ext/vendor/golang.org/x/text/language/testdata/GoLocaleMatcherTest.txt +226 -0
- data/ext/vendor/golang.org/x/text/message/catalog.go +28 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog.go +292 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog_test.go +194 -0
- data/ext/vendor/golang.org/x/text/message/catalog/dict.go +90 -0
- data/ext/vendor/golang.org/x/text/message/doc.go +100 -0
- data/ext/vendor/golang.org/x/text/message/examples_test.go +42 -0
- data/ext/vendor/golang.org/x/text/message/fmt_test.go +1889 -0
- data/ext/vendor/golang.org/x/text/message/format.go +532 -0
- data/ext/vendor/golang.org/x/text/message/message.go +169 -0
- data/ext/vendor/golang.org/x/text/message/message_test.go +181 -0
- data/ext/vendor/golang.org/x/text/message/print.go +1194 -0
- data/ext/vendor/golang.org/x/text/number/doc.go +28 -0
- data/ext/vendor/golang.org/x/text/number/examples_test.go +28 -0
- data/ext/vendor/golang.org/x/text/number/format.go +122 -0
- data/ext/vendor/golang.org/x/text/number/format_test.go +107 -0
- data/ext/vendor/golang.org/x/text/number/number.go +77 -0
- data/ext/vendor/golang.org/x/text/number/number_test.go +190 -0
- data/ext/vendor/golang.org/x/text/number/option.go +177 -0
- data/ext/vendor/golang.org/x/text/runes/cond.go +187 -0
- data/ext/vendor/golang.org/x/text/runes/cond_test.go +282 -0
- data/ext/vendor/golang.org/x/text/runes/example_test.go +60 -0
- data/ext/vendor/golang.org/x/text/runes/runes.go +355 -0
- data/ext/vendor/golang.org/x/text/runes/runes_test.go +664 -0
- data/ext/vendor/golang.org/x/text/search/index.go +35 -0
- data/ext/vendor/golang.org/x/text/search/pattern.go +155 -0
- data/ext/vendor/golang.org/x/text/search/pattern_test.go +357 -0
- data/ext/vendor/golang.org/x/text/search/search.go +237 -0
- data/ext/vendor/golang.org/x/text/search/tables.go +12448 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bench_test.go +54 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule.go +340 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go +851 -0
- data/ext/vendor/golang.org/x/text/secure/doc.go +6 -0
- data/ext/vendor/golang.org/x/text/secure/precis/benchmark_test.go +82 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class.go +36 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class_test.go +50 -0
- data/ext/vendor/golang.org/x/text/secure/precis/context.go +139 -0
- data/ext/vendor/golang.org/x/text/secure/precis/doc.go +14 -0
- data/ext/vendor/golang.org/x/text/secure/precis/enforce_test.go +396 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen.go +310 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen_trieval.go +68 -0
- data/ext/vendor/golang.org/x/text/secure/precis/nickname.go +72 -0
- data/ext/vendor/golang.org/x/text/secure/precis/options.go +157 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile.go +402 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile_test.go +149 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profiles.go +78 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables.go +3887 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables_test.go +69 -0
- data/ext/vendor/golang.org/x/text/secure/precis/transformer.go +32 -0
- data/ext/vendor/golang.org/x/text/secure/precis/trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/transform/examples_test.go +37 -0
- data/ext/vendor/golang.org/x/text/transform/transform.go +705 -0
- data/ext/vendor/golang.org/x/text/transform/transform_test.go +1317 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bidi.go +198 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core.go +1058 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core_test.go +224 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen.go +133 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go +57 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/ranges_test.go +53 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables.go +1813 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/trieval.go +60 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/base.go +100 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate.go +359 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/data_test.go +186 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/decode.go +171 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/examples_test.go +21 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/makexml.go +400 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve.go +602 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve_test.go +368 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice.go +144 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice_test.go +175 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/xml.go +1487 -0
- data/ext/vendor/golang.org/x/text/unicode/doc.go +8 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition.go +508 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition_test.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_iter_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo.go +259 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo_test.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter.go +457 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter_test.go +98 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/maketables.go +976 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/norm_test.go +14 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize.go +609 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize_test.go +1287 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter_test.go +56 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/tables.go +7651 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform_test.go +101 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/triegen.go +117 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/ucd_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge.go +260 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge_test.go +184 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable.go +70 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go +55 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/tables.go +6376 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/bits.go +59 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/example_test.go +118 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen.go +195 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen_bits.go +63 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames.go +48 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames_test.go +46 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/tables.go +15514 -0
- data/ext/vendor/golang.org/x/text/width/common_test.go +92 -0
- data/ext/vendor/golang.org/x/text/width/example_test.go +52 -0
- data/ext/vendor/golang.org/x/text/width/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/width/gen_common.go +96 -0
- data/ext/vendor/golang.org/x/text/width/gen_trieval.go +34 -0
- data/ext/vendor/golang.org/x/text/width/kind_string.go +16 -0
- data/ext/vendor/golang.org/x/text/width/runes_test.go +461 -0
- data/ext/vendor/golang.org/x/text/width/tables.go +1316 -0
- data/ext/vendor/golang.org/x/text/width/tables_test.go +59 -0
- data/ext/vendor/golang.org/x/text/width/transform.go +239 -0
- data/ext/vendor/golang.org/x/text/width/transform_test.go +701 -0
- data/ext/vendor/golang.org/x/text/width/trieval.go +30 -0
- data/ext/vendor/golang.org/x/text/width/width.go +206 -0
- data/lib/ires/version.rb +1 -1
- data/shared/darwin/ires.so +0 -0
- data/shared/linux/ires.so +0 -0
- metadata +1011 -23
- data/ext/operate/image.go +0 -176
- data/ext/util/uri/uri.go +0 -105
- data/ext/vendor/github.com/satori/go.uuid/README.md +0 -65
- data/ext/vendor/github.com/satori/go.uuid/benchmarks_test.go +0 -121
- data/ext/vendor/github.com/satori/go.uuid/uuid.go +0 -488
- data/ext/vendor/github.com/satori/go.uuid/uuid_test.go +0 -633
@@ -0,0 +1,24 @@
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package http2
|
6
|
+
|
7
|
+
import "testing"
|
8
|
+
|
9
|
+
func TestErrCodeString(t *testing.T) {
|
10
|
+
tests := []struct {
|
11
|
+
err ErrCode
|
12
|
+
want string
|
13
|
+
}{
|
14
|
+
{ErrCodeProtocol, "PROTOCOL_ERROR"},
|
15
|
+
{0xd, "HTTP_1_1_REQUIRED"},
|
16
|
+
{0xf, "unknown error code 0xf"},
|
17
|
+
}
|
18
|
+
for i, tt := range tests {
|
19
|
+
got := tt.err.String()
|
20
|
+
if got != tt.want {
|
21
|
+
t.Errorf("%d. Error = %q; want %q", i, got, tt.want)
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,50 @@
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
// Flow control
|
6
|
+
|
7
|
+
package http2
|
8
|
+
|
9
|
+
// flow is the flow control window's size.
|
10
|
+
type flow struct {
|
11
|
+
// n is the number of DATA bytes we're allowed to send.
|
12
|
+
// A flow is kept both on a conn and a per-stream.
|
13
|
+
n int32
|
14
|
+
|
15
|
+
// conn points to the shared connection-level flow that is
|
16
|
+
// shared by all streams on that conn. It is nil for the flow
|
17
|
+
// that's on the conn directly.
|
18
|
+
conn *flow
|
19
|
+
}
|
20
|
+
|
21
|
+
func (f *flow) setConnFlow(cf *flow) { f.conn = cf }
|
22
|
+
|
23
|
+
func (f *flow) available() int32 {
|
24
|
+
n := f.n
|
25
|
+
if f.conn != nil && f.conn.n < n {
|
26
|
+
n = f.conn.n
|
27
|
+
}
|
28
|
+
return n
|
29
|
+
}
|
30
|
+
|
31
|
+
func (f *flow) take(n int32) {
|
32
|
+
if n > f.available() {
|
33
|
+
panic("internal error: took too much")
|
34
|
+
}
|
35
|
+
f.n -= n
|
36
|
+
if f.conn != nil {
|
37
|
+
f.conn.n -= n
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
// add adds n bytes (positive or negative) to the flow control window.
|
42
|
+
// It returns false if the sum would exceed 2^31-1.
|
43
|
+
func (f *flow) add(n int32) bool {
|
44
|
+
remain := (1<<31 - 1) - f.n
|
45
|
+
if n > remain {
|
46
|
+
return false
|
47
|
+
}
|
48
|
+
f.n += n
|
49
|
+
return true
|
50
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package http2
|
6
|
+
|
7
|
+
import "testing"
|
8
|
+
|
9
|
+
func TestFlow(t *testing.T) {
|
10
|
+
var st flow
|
11
|
+
var conn flow
|
12
|
+
st.add(3)
|
13
|
+
conn.add(2)
|
14
|
+
|
15
|
+
if got, want := st.available(), int32(3); got != want {
|
16
|
+
t.Errorf("available = %d; want %d", got, want)
|
17
|
+
}
|
18
|
+
st.setConnFlow(&conn)
|
19
|
+
if got, want := st.available(), int32(2); got != want {
|
20
|
+
t.Errorf("after parent setup, available = %d; want %d", got, want)
|
21
|
+
}
|
22
|
+
|
23
|
+
st.take(2)
|
24
|
+
if got, want := conn.available(), int32(0); got != want {
|
25
|
+
t.Errorf("after taking 2, conn = %d; want %d", got, want)
|
26
|
+
}
|
27
|
+
if got, want := st.available(), int32(0); got != want {
|
28
|
+
t.Errorf("after taking 2, stream = %d; want %d", got, want)
|
29
|
+
}
|
30
|
+
}
|
31
|
+
|
32
|
+
func TestFlowAdd(t *testing.T) {
|
33
|
+
var f flow
|
34
|
+
if !f.add(1) {
|
35
|
+
t.Fatal("failed to add 1")
|
36
|
+
}
|
37
|
+
if !f.add(-1) {
|
38
|
+
t.Fatal("failed to add -1")
|
39
|
+
}
|
40
|
+
if got, want := f.available(), int32(0); got != want {
|
41
|
+
t.Fatalf("size = %d; want %d", got, want)
|
42
|
+
}
|
43
|
+
if !f.add(1<<31 - 1) {
|
44
|
+
t.Fatal("failed to add 2^31-1")
|
45
|
+
}
|
46
|
+
if got, want := f.available(), int32(1<<31-1); got != want {
|
47
|
+
t.Fatalf("size = %d; want %d", got, want)
|
48
|
+
}
|
49
|
+
if f.add(1) {
|
50
|
+
t.Fatal("adding 1 to max shouldn't be allowed")
|
51
|
+
}
|
52
|
+
|
53
|
+
}
|
@@ -0,0 +1,1579 @@
|
|
1
|
+
// Copyright 2014 The Go Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style
|
3
|
+
// license that can be found in the LICENSE file.
|
4
|
+
|
5
|
+
package http2
|
6
|
+
|
7
|
+
import (
|
8
|
+
"bytes"
|
9
|
+
"encoding/binary"
|
10
|
+
"errors"
|
11
|
+
"fmt"
|
12
|
+
"io"
|
13
|
+
"log"
|
14
|
+
"strings"
|
15
|
+
"sync"
|
16
|
+
|
17
|
+
"golang.org/x/net/http2/hpack"
|
18
|
+
"golang.org/x/net/lex/httplex"
|
19
|
+
)
|
20
|
+
|
21
|
+
const frameHeaderLen = 9
|
22
|
+
|
23
|
+
var padZeros = make([]byte, 255) // zeros for padding
|
24
|
+
|
25
|
+
// A FrameType is a registered frame type as defined in
|
26
|
+
// http://http2.github.io/http2-spec/#rfc.section.11.2
|
27
|
+
type FrameType uint8
|
28
|
+
|
29
|
+
const (
|
30
|
+
FrameData FrameType = 0x0
|
31
|
+
FrameHeaders FrameType = 0x1
|
32
|
+
FramePriority FrameType = 0x2
|
33
|
+
FrameRSTStream FrameType = 0x3
|
34
|
+
FrameSettings FrameType = 0x4
|
35
|
+
FramePushPromise FrameType = 0x5
|
36
|
+
FramePing FrameType = 0x6
|
37
|
+
FrameGoAway FrameType = 0x7
|
38
|
+
FrameWindowUpdate FrameType = 0x8
|
39
|
+
FrameContinuation FrameType = 0x9
|
40
|
+
)
|
41
|
+
|
42
|
+
var frameName = map[FrameType]string{
|
43
|
+
FrameData: "DATA",
|
44
|
+
FrameHeaders: "HEADERS",
|
45
|
+
FramePriority: "PRIORITY",
|
46
|
+
FrameRSTStream: "RST_STREAM",
|
47
|
+
FrameSettings: "SETTINGS",
|
48
|
+
FramePushPromise: "PUSH_PROMISE",
|
49
|
+
FramePing: "PING",
|
50
|
+
FrameGoAway: "GOAWAY",
|
51
|
+
FrameWindowUpdate: "WINDOW_UPDATE",
|
52
|
+
FrameContinuation: "CONTINUATION",
|
53
|
+
}
|
54
|
+
|
55
|
+
func (t FrameType) String() string {
|
56
|
+
if s, ok := frameName[t]; ok {
|
57
|
+
return s
|
58
|
+
}
|
59
|
+
return fmt.Sprintf("UNKNOWN_FRAME_TYPE_%d", uint8(t))
|
60
|
+
}
|
61
|
+
|
62
|
+
// Flags is a bitmask of HTTP/2 flags.
|
63
|
+
// The meaning of flags varies depending on the frame type.
|
64
|
+
type Flags uint8
|
65
|
+
|
66
|
+
// Has reports whether f contains all (0 or more) flags in v.
|
67
|
+
func (f Flags) Has(v Flags) bool {
|
68
|
+
return (f & v) == v
|
69
|
+
}
|
70
|
+
|
71
|
+
// Frame-specific FrameHeader flag bits.
|
72
|
+
const (
|
73
|
+
// Data Frame
|
74
|
+
FlagDataEndStream Flags = 0x1
|
75
|
+
FlagDataPadded Flags = 0x8
|
76
|
+
|
77
|
+
// Headers Frame
|
78
|
+
FlagHeadersEndStream Flags = 0x1
|
79
|
+
FlagHeadersEndHeaders Flags = 0x4
|
80
|
+
FlagHeadersPadded Flags = 0x8
|
81
|
+
FlagHeadersPriority Flags = 0x20
|
82
|
+
|
83
|
+
// Settings Frame
|
84
|
+
FlagSettingsAck Flags = 0x1
|
85
|
+
|
86
|
+
// Ping Frame
|
87
|
+
FlagPingAck Flags = 0x1
|
88
|
+
|
89
|
+
// Continuation Frame
|
90
|
+
FlagContinuationEndHeaders Flags = 0x4
|
91
|
+
|
92
|
+
FlagPushPromiseEndHeaders Flags = 0x4
|
93
|
+
FlagPushPromisePadded Flags = 0x8
|
94
|
+
)
|
95
|
+
|
96
|
+
var flagName = map[FrameType]map[Flags]string{
|
97
|
+
FrameData: {
|
98
|
+
FlagDataEndStream: "END_STREAM",
|
99
|
+
FlagDataPadded: "PADDED",
|
100
|
+
},
|
101
|
+
FrameHeaders: {
|
102
|
+
FlagHeadersEndStream: "END_STREAM",
|
103
|
+
FlagHeadersEndHeaders: "END_HEADERS",
|
104
|
+
FlagHeadersPadded: "PADDED",
|
105
|
+
FlagHeadersPriority: "PRIORITY",
|
106
|
+
},
|
107
|
+
FrameSettings: {
|
108
|
+
FlagSettingsAck: "ACK",
|
109
|
+
},
|
110
|
+
FramePing: {
|
111
|
+
FlagPingAck: "ACK",
|
112
|
+
},
|
113
|
+
FrameContinuation: {
|
114
|
+
FlagContinuationEndHeaders: "END_HEADERS",
|
115
|
+
},
|
116
|
+
FramePushPromise: {
|
117
|
+
FlagPushPromiseEndHeaders: "END_HEADERS",
|
118
|
+
FlagPushPromisePadded: "PADDED",
|
119
|
+
},
|
120
|
+
}
|
121
|
+
|
122
|
+
// a frameParser parses a frame given its FrameHeader and payload
|
123
|
+
// bytes. The length of payload will always equal fh.Length (which
|
124
|
+
// might be 0).
|
125
|
+
type frameParser func(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error)
|
126
|
+
|
127
|
+
var frameParsers = map[FrameType]frameParser{
|
128
|
+
FrameData: parseDataFrame,
|
129
|
+
FrameHeaders: parseHeadersFrame,
|
130
|
+
FramePriority: parsePriorityFrame,
|
131
|
+
FrameRSTStream: parseRSTStreamFrame,
|
132
|
+
FrameSettings: parseSettingsFrame,
|
133
|
+
FramePushPromise: parsePushPromise,
|
134
|
+
FramePing: parsePingFrame,
|
135
|
+
FrameGoAway: parseGoAwayFrame,
|
136
|
+
FrameWindowUpdate: parseWindowUpdateFrame,
|
137
|
+
FrameContinuation: parseContinuationFrame,
|
138
|
+
}
|
139
|
+
|
140
|
+
func typeFrameParser(t FrameType) frameParser {
|
141
|
+
if f := frameParsers[t]; f != nil {
|
142
|
+
return f
|
143
|
+
}
|
144
|
+
return parseUnknownFrame
|
145
|
+
}
|
146
|
+
|
147
|
+
// A FrameHeader is the 9 byte header of all HTTP/2 frames.
|
148
|
+
//
|
149
|
+
// See http://http2.github.io/http2-spec/#FrameHeader
|
150
|
+
type FrameHeader struct {
|
151
|
+
valid bool // caller can access []byte fields in the Frame
|
152
|
+
|
153
|
+
// Type is the 1 byte frame type. There are ten standard frame
|
154
|
+
// types, but extension frame types may be written by WriteRawFrame
|
155
|
+
// and will be returned by ReadFrame (as UnknownFrame).
|
156
|
+
Type FrameType
|
157
|
+
|
158
|
+
// Flags are the 1 byte of 8 potential bit flags per frame.
|
159
|
+
// They are specific to the frame type.
|
160
|
+
Flags Flags
|
161
|
+
|
162
|
+
// Length is the length of the frame, not including the 9 byte header.
|
163
|
+
// The maximum size is one byte less than 16MB (uint24), but only
|
164
|
+
// frames up to 16KB are allowed without peer agreement.
|
165
|
+
Length uint32
|
166
|
+
|
167
|
+
// StreamID is which stream this frame is for. Certain frames
|
168
|
+
// are not stream-specific, in which case this field is 0.
|
169
|
+
StreamID uint32
|
170
|
+
}
|
171
|
+
|
172
|
+
// Header returns h. It exists so FrameHeaders can be embedded in other
|
173
|
+
// specific frame types and implement the Frame interface.
|
174
|
+
func (h FrameHeader) Header() FrameHeader { return h }
|
175
|
+
|
176
|
+
func (h FrameHeader) String() string {
|
177
|
+
var buf bytes.Buffer
|
178
|
+
buf.WriteString("[FrameHeader ")
|
179
|
+
h.writeDebug(&buf)
|
180
|
+
buf.WriteByte(']')
|
181
|
+
return buf.String()
|
182
|
+
}
|
183
|
+
|
184
|
+
func (h FrameHeader) writeDebug(buf *bytes.Buffer) {
|
185
|
+
buf.WriteString(h.Type.String())
|
186
|
+
if h.Flags != 0 {
|
187
|
+
buf.WriteString(" flags=")
|
188
|
+
set := 0
|
189
|
+
for i := uint8(0); i < 8; i++ {
|
190
|
+
if h.Flags&(1<<i) == 0 {
|
191
|
+
continue
|
192
|
+
}
|
193
|
+
set++
|
194
|
+
if set > 1 {
|
195
|
+
buf.WriteByte('|')
|
196
|
+
}
|
197
|
+
name := flagName[h.Type][Flags(1<<i)]
|
198
|
+
if name != "" {
|
199
|
+
buf.WriteString(name)
|
200
|
+
} else {
|
201
|
+
fmt.Fprintf(buf, "0x%x", 1<<i)
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
if h.StreamID != 0 {
|
206
|
+
fmt.Fprintf(buf, " stream=%d", h.StreamID)
|
207
|
+
}
|
208
|
+
fmt.Fprintf(buf, " len=%d", h.Length)
|
209
|
+
}
|
210
|
+
|
211
|
+
func (h *FrameHeader) checkValid() {
|
212
|
+
if !h.valid {
|
213
|
+
panic("Frame accessor called on non-owned Frame")
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
func (h *FrameHeader) invalidate() { h.valid = false }
|
218
|
+
|
219
|
+
// frame header bytes.
|
220
|
+
// Used only by ReadFrameHeader.
|
221
|
+
var fhBytes = sync.Pool{
|
222
|
+
New: func() interface{} {
|
223
|
+
buf := make([]byte, frameHeaderLen)
|
224
|
+
return &buf
|
225
|
+
},
|
226
|
+
}
|
227
|
+
|
228
|
+
// ReadFrameHeader reads 9 bytes from r and returns a FrameHeader.
|
229
|
+
// Most users should use Framer.ReadFrame instead.
|
230
|
+
func ReadFrameHeader(r io.Reader) (FrameHeader, error) {
|
231
|
+
bufp := fhBytes.Get().(*[]byte)
|
232
|
+
defer fhBytes.Put(bufp)
|
233
|
+
return readFrameHeader(*bufp, r)
|
234
|
+
}
|
235
|
+
|
236
|
+
func readFrameHeader(buf []byte, r io.Reader) (FrameHeader, error) {
|
237
|
+
_, err := io.ReadFull(r, buf[:frameHeaderLen])
|
238
|
+
if err != nil {
|
239
|
+
return FrameHeader{}, err
|
240
|
+
}
|
241
|
+
return FrameHeader{
|
242
|
+
Length: (uint32(buf[0])<<16 | uint32(buf[1])<<8 | uint32(buf[2])),
|
243
|
+
Type: FrameType(buf[3]),
|
244
|
+
Flags: Flags(buf[4]),
|
245
|
+
StreamID: binary.BigEndian.Uint32(buf[5:]) & (1<<31 - 1),
|
246
|
+
valid: true,
|
247
|
+
}, nil
|
248
|
+
}
|
249
|
+
|
250
|
+
// A Frame is the base interface implemented by all frame types.
|
251
|
+
// Callers will generally type-assert the specific frame type:
|
252
|
+
// *HeadersFrame, *SettingsFrame, *WindowUpdateFrame, etc.
|
253
|
+
//
|
254
|
+
// Frames are only valid until the next call to Framer.ReadFrame.
|
255
|
+
type Frame interface {
|
256
|
+
Header() FrameHeader
|
257
|
+
|
258
|
+
// invalidate is called by Framer.ReadFrame to make this
|
259
|
+
// frame's buffers as being invalid, since the subsequent
|
260
|
+
// frame will reuse them.
|
261
|
+
invalidate()
|
262
|
+
}
|
263
|
+
|
264
|
+
// A Framer reads and writes Frames.
|
265
|
+
type Framer struct {
|
266
|
+
r io.Reader
|
267
|
+
lastFrame Frame
|
268
|
+
errDetail error
|
269
|
+
|
270
|
+
// lastHeaderStream is non-zero if the last frame was an
|
271
|
+
// unfinished HEADERS/CONTINUATION.
|
272
|
+
lastHeaderStream uint32
|
273
|
+
|
274
|
+
maxReadSize uint32
|
275
|
+
headerBuf [frameHeaderLen]byte
|
276
|
+
|
277
|
+
// TODO: let getReadBuf be configurable, and use a less memory-pinning
|
278
|
+
// allocator in server.go to minimize memory pinned for many idle conns.
|
279
|
+
// Will probably also need to make frame invalidation have a hook too.
|
280
|
+
getReadBuf func(size uint32) []byte
|
281
|
+
readBuf []byte // cache for default getReadBuf
|
282
|
+
|
283
|
+
maxWriteSize uint32 // zero means unlimited; TODO: implement
|
284
|
+
|
285
|
+
w io.Writer
|
286
|
+
wbuf []byte
|
287
|
+
|
288
|
+
// AllowIllegalWrites permits the Framer's Write methods to
|
289
|
+
// write frames that do not conform to the HTTP/2 spec. This
|
290
|
+
// permits using the Framer to test other HTTP/2
|
291
|
+
// implementations' conformance to the spec.
|
292
|
+
// If false, the Write methods will prefer to return an error
|
293
|
+
// rather than comply.
|
294
|
+
AllowIllegalWrites bool
|
295
|
+
|
296
|
+
// AllowIllegalReads permits the Framer's ReadFrame method
|
297
|
+
// to return non-compliant frames or frame orders.
|
298
|
+
// This is for testing and permits using the Framer to test
|
299
|
+
// other HTTP/2 implementations' conformance to the spec.
|
300
|
+
// It is not compatible with ReadMetaHeaders.
|
301
|
+
AllowIllegalReads bool
|
302
|
+
|
303
|
+
// ReadMetaHeaders if non-nil causes ReadFrame to merge
|
304
|
+
// HEADERS and CONTINUATION frames together and return
|
305
|
+
// MetaHeadersFrame instead.
|
306
|
+
ReadMetaHeaders *hpack.Decoder
|
307
|
+
|
308
|
+
// MaxHeaderListSize is the http2 MAX_HEADER_LIST_SIZE.
|
309
|
+
// It's used only if ReadMetaHeaders is set; 0 means a sane default
|
310
|
+
// (currently 16MB)
|
311
|
+
// If the limit is hit, MetaHeadersFrame.Truncated is set true.
|
312
|
+
MaxHeaderListSize uint32
|
313
|
+
|
314
|
+
// TODO: track which type of frame & with which flags was sent
|
315
|
+
// last. Then return an error (unless AllowIllegalWrites) if
|
316
|
+
// we're in the middle of a header block and a
|
317
|
+
// non-Continuation or Continuation on a different stream is
|
318
|
+
// attempted to be written.
|
319
|
+
|
320
|
+
logReads, logWrites bool
|
321
|
+
|
322
|
+
debugFramer *Framer // only use for logging written writes
|
323
|
+
debugFramerBuf *bytes.Buffer
|
324
|
+
debugReadLoggerf func(string, ...interface{})
|
325
|
+
debugWriteLoggerf func(string, ...interface{})
|
326
|
+
|
327
|
+
frameCache *frameCache // nil if frames aren't reused (default)
|
328
|
+
}
|
329
|
+
|
330
|
+
func (fr *Framer) maxHeaderListSize() uint32 {
|
331
|
+
if fr.MaxHeaderListSize == 0 {
|
332
|
+
return 16 << 20 // sane default, per docs
|
333
|
+
}
|
334
|
+
return fr.MaxHeaderListSize
|
335
|
+
}
|
336
|
+
|
337
|
+
func (f *Framer) startWrite(ftype FrameType, flags Flags, streamID uint32) {
|
338
|
+
// Write the FrameHeader.
|
339
|
+
f.wbuf = append(f.wbuf[:0],
|
340
|
+
0, // 3 bytes of length, filled in in endWrite
|
341
|
+
0,
|
342
|
+
0,
|
343
|
+
byte(ftype),
|
344
|
+
byte(flags),
|
345
|
+
byte(streamID>>24),
|
346
|
+
byte(streamID>>16),
|
347
|
+
byte(streamID>>8),
|
348
|
+
byte(streamID))
|
349
|
+
}
|
350
|
+
|
351
|
+
func (f *Framer) endWrite() error {
|
352
|
+
// Now that we know the final size, fill in the FrameHeader in
|
353
|
+
// the space previously reserved for it. Abuse append.
|
354
|
+
length := len(f.wbuf) - frameHeaderLen
|
355
|
+
if length >= (1 << 24) {
|
356
|
+
return ErrFrameTooLarge
|
357
|
+
}
|
358
|
+
_ = append(f.wbuf[:0],
|
359
|
+
byte(length>>16),
|
360
|
+
byte(length>>8),
|
361
|
+
byte(length))
|
362
|
+
if f.logWrites {
|
363
|
+
f.logWrite()
|
364
|
+
}
|
365
|
+
|
366
|
+
n, err := f.w.Write(f.wbuf)
|
367
|
+
if err == nil && n != len(f.wbuf) {
|
368
|
+
err = io.ErrShortWrite
|
369
|
+
}
|
370
|
+
return err
|
371
|
+
}
|
372
|
+
|
373
|
+
func (f *Framer) logWrite() {
|
374
|
+
if f.debugFramer == nil {
|
375
|
+
f.debugFramerBuf = new(bytes.Buffer)
|
376
|
+
f.debugFramer = NewFramer(nil, f.debugFramerBuf)
|
377
|
+
f.debugFramer.logReads = false // we log it ourselves, saying "wrote" below
|
378
|
+
// Let us read anything, even if we accidentally wrote it
|
379
|
+
// in the wrong order:
|
380
|
+
f.debugFramer.AllowIllegalReads = true
|
381
|
+
}
|
382
|
+
f.debugFramerBuf.Write(f.wbuf)
|
383
|
+
fr, err := f.debugFramer.ReadFrame()
|
384
|
+
if err != nil {
|
385
|
+
f.debugWriteLoggerf("http2: Framer %p: failed to decode just-written frame", f)
|
386
|
+
return
|
387
|
+
}
|
388
|
+
f.debugWriteLoggerf("http2: Framer %p: wrote %v", f, summarizeFrame(fr))
|
389
|
+
}
|
390
|
+
|
391
|
+
func (f *Framer) writeByte(v byte) { f.wbuf = append(f.wbuf, v) }
|
392
|
+
func (f *Framer) writeBytes(v []byte) { f.wbuf = append(f.wbuf, v...) }
|
393
|
+
func (f *Framer) writeUint16(v uint16) { f.wbuf = append(f.wbuf, byte(v>>8), byte(v)) }
|
394
|
+
func (f *Framer) writeUint32(v uint32) {
|
395
|
+
f.wbuf = append(f.wbuf, byte(v>>24), byte(v>>16), byte(v>>8), byte(v))
|
396
|
+
}
|
397
|
+
|
398
|
+
const (
|
399
|
+
minMaxFrameSize = 1 << 14
|
400
|
+
maxFrameSize = 1<<24 - 1
|
401
|
+
)
|
402
|
+
|
403
|
+
// SetReuseFrames allows the Framer to reuse Frames.
|
404
|
+
// If called on a Framer, Frames returned by calls to ReadFrame are only
|
405
|
+
// valid until the next call to ReadFrame.
|
406
|
+
func (fr *Framer) SetReuseFrames() {
|
407
|
+
if fr.frameCache != nil {
|
408
|
+
return
|
409
|
+
}
|
410
|
+
fr.frameCache = &frameCache{}
|
411
|
+
}
|
412
|
+
|
413
|
+
type frameCache struct {
|
414
|
+
dataFrame DataFrame
|
415
|
+
}
|
416
|
+
|
417
|
+
func (fc *frameCache) getDataFrame() *DataFrame {
|
418
|
+
if fc == nil {
|
419
|
+
return &DataFrame{}
|
420
|
+
}
|
421
|
+
return &fc.dataFrame
|
422
|
+
}
|
423
|
+
|
424
|
+
// NewFramer returns a Framer that writes frames to w and reads them from r.
|
425
|
+
func NewFramer(w io.Writer, r io.Reader) *Framer {
|
426
|
+
fr := &Framer{
|
427
|
+
w: w,
|
428
|
+
r: r,
|
429
|
+
logReads: logFrameReads,
|
430
|
+
logWrites: logFrameWrites,
|
431
|
+
debugReadLoggerf: log.Printf,
|
432
|
+
debugWriteLoggerf: log.Printf,
|
433
|
+
}
|
434
|
+
fr.getReadBuf = func(size uint32) []byte {
|
435
|
+
if cap(fr.readBuf) >= int(size) {
|
436
|
+
return fr.readBuf[:size]
|
437
|
+
}
|
438
|
+
fr.readBuf = make([]byte, size)
|
439
|
+
return fr.readBuf
|
440
|
+
}
|
441
|
+
fr.SetMaxReadFrameSize(maxFrameSize)
|
442
|
+
return fr
|
443
|
+
}
|
444
|
+
|
445
|
+
// SetMaxReadFrameSize sets the maximum size of a frame
|
446
|
+
// that will be read by a subsequent call to ReadFrame.
|
447
|
+
// It is the caller's responsibility to advertise this
|
448
|
+
// limit with a SETTINGS frame.
|
449
|
+
func (fr *Framer) SetMaxReadFrameSize(v uint32) {
|
450
|
+
if v > maxFrameSize {
|
451
|
+
v = maxFrameSize
|
452
|
+
}
|
453
|
+
fr.maxReadSize = v
|
454
|
+
}
|
455
|
+
|
456
|
+
// ErrorDetail returns a more detailed error of the last error
|
457
|
+
// returned by Framer.ReadFrame. For instance, if ReadFrame
|
458
|
+
// returns a StreamError with code PROTOCOL_ERROR, ErrorDetail
|
459
|
+
// will say exactly what was invalid. ErrorDetail is not guaranteed
|
460
|
+
// to return a non-nil value and like the rest of the http2 package,
|
461
|
+
// its return value is not protected by an API compatibility promise.
|
462
|
+
// ErrorDetail is reset after the next call to ReadFrame.
|
463
|
+
func (fr *Framer) ErrorDetail() error {
|
464
|
+
return fr.errDetail
|
465
|
+
}
|
466
|
+
|
467
|
+
// ErrFrameTooLarge is returned from Framer.ReadFrame when the peer
|
468
|
+
// sends a frame that is larger than declared with SetMaxReadFrameSize.
|
469
|
+
var ErrFrameTooLarge = errors.New("http2: frame too large")
|
470
|
+
|
471
|
+
// terminalReadFrameError reports whether err is an unrecoverable
|
472
|
+
// error from ReadFrame and no other frames should be read.
|
473
|
+
func terminalReadFrameError(err error) bool {
|
474
|
+
if _, ok := err.(StreamError); ok {
|
475
|
+
return false
|
476
|
+
}
|
477
|
+
return err != nil
|
478
|
+
}
|
479
|
+
|
480
|
+
// ReadFrame reads a single frame. The returned Frame is only valid
|
481
|
+
// until the next call to ReadFrame.
|
482
|
+
//
|
483
|
+
// If the frame is larger than previously set with SetMaxReadFrameSize, the
|
484
|
+
// returned error is ErrFrameTooLarge. Other errors may be of type
|
485
|
+
// ConnectionError, StreamError, or anything else from the underlying
|
486
|
+
// reader.
|
487
|
+
func (fr *Framer) ReadFrame() (Frame, error) {
|
488
|
+
fr.errDetail = nil
|
489
|
+
if fr.lastFrame != nil {
|
490
|
+
fr.lastFrame.invalidate()
|
491
|
+
}
|
492
|
+
fh, err := readFrameHeader(fr.headerBuf[:], fr.r)
|
493
|
+
if err != nil {
|
494
|
+
return nil, err
|
495
|
+
}
|
496
|
+
if fh.Length > fr.maxReadSize {
|
497
|
+
return nil, ErrFrameTooLarge
|
498
|
+
}
|
499
|
+
payload := fr.getReadBuf(fh.Length)
|
500
|
+
if _, err := io.ReadFull(fr.r, payload); err != nil {
|
501
|
+
return nil, err
|
502
|
+
}
|
503
|
+
f, err := typeFrameParser(fh.Type)(fr.frameCache, fh, payload)
|
504
|
+
if err != nil {
|
505
|
+
if ce, ok := err.(connError); ok {
|
506
|
+
return nil, fr.connError(ce.Code, ce.Reason)
|
507
|
+
}
|
508
|
+
return nil, err
|
509
|
+
}
|
510
|
+
if err := fr.checkFrameOrder(f); err != nil {
|
511
|
+
return nil, err
|
512
|
+
}
|
513
|
+
if fr.logReads {
|
514
|
+
fr.debugReadLoggerf("http2: Framer %p: read %v", fr, summarizeFrame(f))
|
515
|
+
}
|
516
|
+
if fh.Type == FrameHeaders && fr.ReadMetaHeaders != nil {
|
517
|
+
return fr.readMetaFrame(f.(*HeadersFrame))
|
518
|
+
}
|
519
|
+
return f, nil
|
520
|
+
}
|
521
|
+
|
522
|
+
// connError returns ConnectionError(code) but first
|
523
|
+
// stashes away a public reason to the caller can optionally relay it
|
524
|
+
// to the peer before hanging up on them. This might help others debug
|
525
|
+
// their implementations.
|
526
|
+
func (fr *Framer) connError(code ErrCode, reason string) error {
|
527
|
+
fr.errDetail = errors.New(reason)
|
528
|
+
return ConnectionError(code)
|
529
|
+
}
|
530
|
+
|
531
|
+
// checkFrameOrder reports an error if f is an invalid frame to return
|
532
|
+
// next from ReadFrame. Mostly it checks whether HEADERS and
|
533
|
+
// CONTINUATION frames are contiguous.
|
534
|
+
func (fr *Framer) checkFrameOrder(f Frame) error {
|
535
|
+
last := fr.lastFrame
|
536
|
+
fr.lastFrame = f
|
537
|
+
if fr.AllowIllegalReads {
|
538
|
+
return nil
|
539
|
+
}
|
540
|
+
|
541
|
+
fh := f.Header()
|
542
|
+
if fr.lastHeaderStream != 0 {
|
543
|
+
if fh.Type != FrameContinuation {
|
544
|
+
return fr.connError(ErrCodeProtocol,
|
545
|
+
fmt.Sprintf("got %s for stream %d; expected CONTINUATION following %s for stream %d",
|
546
|
+
fh.Type, fh.StreamID,
|
547
|
+
last.Header().Type, fr.lastHeaderStream))
|
548
|
+
}
|
549
|
+
if fh.StreamID != fr.lastHeaderStream {
|
550
|
+
return fr.connError(ErrCodeProtocol,
|
551
|
+
fmt.Sprintf("got CONTINUATION for stream %d; expected stream %d",
|
552
|
+
fh.StreamID, fr.lastHeaderStream))
|
553
|
+
}
|
554
|
+
} else if fh.Type == FrameContinuation {
|
555
|
+
return fr.connError(ErrCodeProtocol, fmt.Sprintf("unexpected CONTINUATION for stream %d", fh.StreamID))
|
556
|
+
}
|
557
|
+
|
558
|
+
switch fh.Type {
|
559
|
+
case FrameHeaders, FrameContinuation:
|
560
|
+
if fh.Flags.Has(FlagHeadersEndHeaders) {
|
561
|
+
fr.lastHeaderStream = 0
|
562
|
+
} else {
|
563
|
+
fr.lastHeaderStream = fh.StreamID
|
564
|
+
}
|
565
|
+
}
|
566
|
+
|
567
|
+
return nil
|
568
|
+
}
|
569
|
+
|
570
|
+
// A DataFrame conveys arbitrary, variable-length sequences of octets
|
571
|
+
// associated with a stream.
|
572
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.1
|
573
|
+
type DataFrame struct {
|
574
|
+
FrameHeader
|
575
|
+
data []byte
|
576
|
+
}
|
577
|
+
|
578
|
+
func (f *DataFrame) StreamEnded() bool {
|
579
|
+
return f.FrameHeader.Flags.Has(FlagDataEndStream)
|
580
|
+
}
|
581
|
+
|
582
|
+
// Data returns the frame's data octets, not including any padding
|
583
|
+
// size byte or padding suffix bytes.
|
584
|
+
// The caller must not retain the returned memory past the next
|
585
|
+
// call to ReadFrame.
|
586
|
+
func (f *DataFrame) Data() []byte {
|
587
|
+
f.checkValid()
|
588
|
+
return f.data
|
589
|
+
}
|
590
|
+
|
591
|
+
func parseDataFrame(fc *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
|
592
|
+
if fh.StreamID == 0 {
|
593
|
+
// DATA frames MUST be associated with a stream. If a
|
594
|
+
// DATA frame is received whose stream identifier
|
595
|
+
// field is 0x0, the recipient MUST respond with a
|
596
|
+
// connection error (Section 5.4.1) of type
|
597
|
+
// PROTOCOL_ERROR.
|
598
|
+
return nil, connError{ErrCodeProtocol, "DATA frame with stream ID 0"}
|
599
|
+
}
|
600
|
+
f := fc.getDataFrame()
|
601
|
+
f.FrameHeader = fh
|
602
|
+
|
603
|
+
var padSize byte
|
604
|
+
if fh.Flags.Has(FlagDataPadded) {
|
605
|
+
var err error
|
606
|
+
payload, padSize, err = readByte(payload)
|
607
|
+
if err != nil {
|
608
|
+
return nil, err
|
609
|
+
}
|
610
|
+
}
|
611
|
+
if int(padSize) > len(payload) {
|
612
|
+
// If the length of the padding is greater than the
|
613
|
+
// length of the frame payload, the recipient MUST
|
614
|
+
// treat this as a connection error.
|
615
|
+
// Filed: https://github.com/http2/http2-spec/issues/610
|
616
|
+
return nil, connError{ErrCodeProtocol, "pad size larger than data payload"}
|
617
|
+
}
|
618
|
+
f.data = payload[:len(payload)-int(padSize)]
|
619
|
+
return f, nil
|
620
|
+
}
|
621
|
+
|
622
|
+
var (
|
623
|
+
errStreamID = errors.New("invalid stream ID")
|
624
|
+
errDepStreamID = errors.New("invalid dependent stream ID")
|
625
|
+
errPadLength = errors.New("pad length too large")
|
626
|
+
errPadBytes = errors.New("padding bytes must all be zeros unless AllowIllegalWrites is enabled")
|
627
|
+
)
|
628
|
+
|
629
|
+
func validStreamIDOrZero(streamID uint32) bool {
|
630
|
+
return streamID&(1<<31) == 0
|
631
|
+
}
|
632
|
+
|
633
|
+
func validStreamID(streamID uint32) bool {
|
634
|
+
return streamID != 0 && streamID&(1<<31) == 0
|
635
|
+
}
|
636
|
+
|
637
|
+
// WriteData writes a DATA frame.
|
638
|
+
//
|
639
|
+
// It will perform exactly one Write to the underlying Writer.
|
640
|
+
// It is the caller's responsibility not to violate the maximum frame size
|
641
|
+
// and to not call other Write methods concurrently.
|
642
|
+
func (f *Framer) WriteData(streamID uint32, endStream bool, data []byte) error {
|
643
|
+
return f.WriteDataPadded(streamID, endStream, data, nil)
|
644
|
+
}
|
645
|
+
|
646
|
+
// WriteData writes a DATA frame with optional padding.
|
647
|
+
//
|
648
|
+
// If pad is nil, the padding bit is not sent.
|
649
|
+
// The length of pad must not exceed 255 bytes.
|
650
|
+
// The bytes of pad must all be zero, unless f.AllowIllegalWrites is set.
|
651
|
+
//
|
652
|
+
// It will perform exactly one Write to the underlying Writer.
|
653
|
+
// It is the caller's responsibility not to violate the maximum frame size
|
654
|
+
// and to not call other Write methods concurrently.
|
655
|
+
func (f *Framer) WriteDataPadded(streamID uint32, endStream bool, data, pad []byte) error {
|
656
|
+
if !validStreamID(streamID) && !f.AllowIllegalWrites {
|
657
|
+
return errStreamID
|
658
|
+
}
|
659
|
+
if len(pad) > 0 {
|
660
|
+
if len(pad) > 255 {
|
661
|
+
return errPadLength
|
662
|
+
}
|
663
|
+
if !f.AllowIllegalWrites {
|
664
|
+
for _, b := range pad {
|
665
|
+
if b != 0 {
|
666
|
+
// "Padding octets MUST be set to zero when sending."
|
667
|
+
return errPadBytes
|
668
|
+
}
|
669
|
+
}
|
670
|
+
}
|
671
|
+
}
|
672
|
+
var flags Flags
|
673
|
+
if endStream {
|
674
|
+
flags |= FlagDataEndStream
|
675
|
+
}
|
676
|
+
if pad != nil {
|
677
|
+
flags |= FlagDataPadded
|
678
|
+
}
|
679
|
+
f.startWrite(FrameData, flags, streamID)
|
680
|
+
if pad != nil {
|
681
|
+
f.wbuf = append(f.wbuf, byte(len(pad)))
|
682
|
+
}
|
683
|
+
f.wbuf = append(f.wbuf, data...)
|
684
|
+
f.wbuf = append(f.wbuf, pad...)
|
685
|
+
return f.endWrite()
|
686
|
+
}
|
687
|
+
|
688
|
+
// A SettingsFrame conveys configuration parameters that affect how
|
689
|
+
// endpoints communicate, such as preferences and constraints on peer
|
690
|
+
// behavior.
|
691
|
+
//
|
692
|
+
// See http://http2.github.io/http2-spec/#SETTINGS
|
693
|
+
type SettingsFrame struct {
|
694
|
+
FrameHeader
|
695
|
+
p []byte
|
696
|
+
}
|
697
|
+
|
698
|
+
func parseSettingsFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
699
|
+
if fh.Flags.Has(FlagSettingsAck) && fh.Length > 0 {
|
700
|
+
// When this (ACK 0x1) bit is set, the payload of the
|
701
|
+
// SETTINGS frame MUST be empty. Receipt of a
|
702
|
+
// SETTINGS frame with the ACK flag set and a length
|
703
|
+
// field value other than 0 MUST be treated as a
|
704
|
+
// connection error (Section 5.4.1) of type
|
705
|
+
// FRAME_SIZE_ERROR.
|
706
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
707
|
+
}
|
708
|
+
if fh.StreamID != 0 {
|
709
|
+
// SETTINGS frames always apply to a connection,
|
710
|
+
// never a single stream. The stream identifier for a
|
711
|
+
// SETTINGS frame MUST be zero (0x0). If an endpoint
|
712
|
+
// receives a SETTINGS frame whose stream identifier
|
713
|
+
// field is anything other than 0x0, the endpoint MUST
|
714
|
+
// respond with a connection error (Section 5.4.1) of
|
715
|
+
// type PROTOCOL_ERROR.
|
716
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
717
|
+
}
|
718
|
+
if len(p)%6 != 0 {
|
719
|
+
// Expecting even number of 6 byte settings.
|
720
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
721
|
+
}
|
722
|
+
f := &SettingsFrame{FrameHeader: fh, p: p}
|
723
|
+
if v, ok := f.Value(SettingInitialWindowSize); ok && v > (1<<31)-1 {
|
724
|
+
// Values above the maximum flow control window size of 2^31 - 1 MUST
|
725
|
+
// be treated as a connection error (Section 5.4.1) of type
|
726
|
+
// FLOW_CONTROL_ERROR.
|
727
|
+
return nil, ConnectionError(ErrCodeFlowControl)
|
728
|
+
}
|
729
|
+
return f, nil
|
730
|
+
}
|
731
|
+
|
732
|
+
func (f *SettingsFrame) IsAck() bool {
|
733
|
+
return f.FrameHeader.Flags.Has(FlagSettingsAck)
|
734
|
+
}
|
735
|
+
|
736
|
+
func (f *SettingsFrame) Value(s SettingID) (v uint32, ok bool) {
|
737
|
+
f.checkValid()
|
738
|
+
buf := f.p
|
739
|
+
for len(buf) > 0 {
|
740
|
+
settingID := SettingID(binary.BigEndian.Uint16(buf[:2]))
|
741
|
+
if settingID == s {
|
742
|
+
return binary.BigEndian.Uint32(buf[2:6]), true
|
743
|
+
}
|
744
|
+
buf = buf[6:]
|
745
|
+
}
|
746
|
+
return 0, false
|
747
|
+
}
|
748
|
+
|
749
|
+
// ForeachSetting runs fn for each setting.
|
750
|
+
// It stops and returns the first error.
|
751
|
+
func (f *SettingsFrame) ForeachSetting(fn func(Setting) error) error {
|
752
|
+
f.checkValid()
|
753
|
+
buf := f.p
|
754
|
+
for len(buf) > 0 {
|
755
|
+
if err := fn(Setting{
|
756
|
+
SettingID(binary.BigEndian.Uint16(buf[:2])),
|
757
|
+
binary.BigEndian.Uint32(buf[2:6]),
|
758
|
+
}); err != nil {
|
759
|
+
return err
|
760
|
+
}
|
761
|
+
buf = buf[6:]
|
762
|
+
}
|
763
|
+
return nil
|
764
|
+
}
|
765
|
+
|
766
|
+
// WriteSettings writes a SETTINGS frame with zero or more settings
|
767
|
+
// specified and the ACK bit not set.
|
768
|
+
//
|
769
|
+
// It will perform exactly one Write to the underlying Writer.
|
770
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
771
|
+
func (f *Framer) WriteSettings(settings ...Setting) error {
|
772
|
+
f.startWrite(FrameSettings, 0, 0)
|
773
|
+
for _, s := range settings {
|
774
|
+
f.writeUint16(uint16(s.ID))
|
775
|
+
f.writeUint32(s.Val)
|
776
|
+
}
|
777
|
+
return f.endWrite()
|
778
|
+
}
|
779
|
+
|
780
|
+
// WriteSettingsAck writes an empty SETTINGS frame with the ACK bit set.
|
781
|
+
//
|
782
|
+
// It will perform exactly one Write to the underlying Writer.
|
783
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
784
|
+
func (f *Framer) WriteSettingsAck() error {
|
785
|
+
f.startWrite(FrameSettings, FlagSettingsAck, 0)
|
786
|
+
return f.endWrite()
|
787
|
+
}
|
788
|
+
|
789
|
+
// A PingFrame is a mechanism for measuring a minimal round trip time
|
790
|
+
// from the sender, as well as determining whether an idle connection
|
791
|
+
// is still functional.
|
792
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.7
|
793
|
+
type PingFrame struct {
|
794
|
+
FrameHeader
|
795
|
+
Data [8]byte
|
796
|
+
}
|
797
|
+
|
798
|
+
func (f *PingFrame) IsAck() bool { return f.Flags.Has(FlagPingAck) }
|
799
|
+
|
800
|
+
func parsePingFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
|
801
|
+
if len(payload) != 8 {
|
802
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
803
|
+
}
|
804
|
+
if fh.StreamID != 0 {
|
805
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
806
|
+
}
|
807
|
+
f := &PingFrame{FrameHeader: fh}
|
808
|
+
copy(f.Data[:], payload)
|
809
|
+
return f, nil
|
810
|
+
}
|
811
|
+
|
812
|
+
func (f *Framer) WritePing(ack bool, data [8]byte) error {
|
813
|
+
var flags Flags
|
814
|
+
if ack {
|
815
|
+
flags = FlagPingAck
|
816
|
+
}
|
817
|
+
f.startWrite(FramePing, flags, 0)
|
818
|
+
f.writeBytes(data[:])
|
819
|
+
return f.endWrite()
|
820
|
+
}
|
821
|
+
|
822
|
+
// A GoAwayFrame informs the remote peer to stop creating streams on this connection.
|
823
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.8
|
824
|
+
type GoAwayFrame struct {
|
825
|
+
FrameHeader
|
826
|
+
LastStreamID uint32
|
827
|
+
ErrCode ErrCode
|
828
|
+
debugData []byte
|
829
|
+
}
|
830
|
+
|
831
|
+
// DebugData returns any debug data in the GOAWAY frame. Its contents
|
832
|
+
// are not defined.
|
833
|
+
// The caller must not retain the returned memory past the next
|
834
|
+
// call to ReadFrame.
|
835
|
+
func (f *GoAwayFrame) DebugData() []byte {
|
836
|
+
f.checkValid()
|
837
|
+
return f.debugData
|
838
|
+
}
|
839
|
+
|
840
|
+
func parseGoAwayFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
841
|
+
if fh.StreamID != 0 {
|
842
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
843
|
+
}
|
844
|
+
if len(p) < 8 {
|
845
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
846
|
+
}
|
847
|
+
return &GoAwayFrame{
|
848
|
+
FrameHeader: fh,
|
849
|
+
LastStreamID: binary.BigEndian.Uint32(p[:4]) & (1<<31 - 1),
|
850
|
+
ErrCode: ErrCode(binary.BigEndian.Uint32(p[4:8])),
|
851
|
+
debugData: p[8:],
|
852
|
+
}, nil
|
853
|
+
}
|
854
|
+
|
855
|
+
func (f *Framer) WriteGoAway(maxStreamID uint32, code ErrCode, debugData []byte) error {
|
856
|
+
f.startWrite(FrameGoAway, 0, 0)
|
857
|
+
f.writeUint32(maxStreamID & (1<<31 - 1))
|
858
|
+
f.writeUint32(uint32(code))
|
859
|
+
f.writeBytes(debugData)
|
860
|
+
return f.endWrite()
|
861
|
+
}
|
862
|
+
|
863
|
+
// An UnknownFrame is the frame type returned when the frame type is unknown
|
864
|
+
// or no specific frame type parser exists.
|
865
|
+
type UnknownFrame struct {
|
866
|
+
FrameHeader
|
867
|
+
p []byte
|
868
|
+
}
|
869
|
+
|
870
|
+
// Payload returns the frame's payload (after the header). It is not
|
871
|
+
// valid to call this method after a subsequent call to
|
872
|
+
// Framer.ReadFrame, nor is it valid to retain the returned slice.
|
873
|
+
// The memory is owned by the Framer and is invalidated when the next
|
874
|
+
// frame is read.
|
875
|
+
func (f *UnknownFrame) Payload() []byte {
|
876
|
+
f.checkValid()
|
877
|
+
return f.p
|
878
|
+
}
|
879
|
+
|
880
|
+
func parseUnknownFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
881
|
+
return &UnknownFrame{fh, p}, nil
|
882
|
+
}
|
883
|
+
|
884
|
+
// A WindowUpdateFrame is used to implement flow control.
|
885
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.9
|
886
|
+
type WindowUpdateFrame struct {
|
887
|
+
FrameHeader
|
888
|
+
Increment uint32 // never read with high bit set
|
889
|
+
}
|
890
|
+
|
891
|
+
func parseWindowUpdateFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
892
|
+
if len(p) != 4 {
|
893
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
894
|
+
}
|
895
|
+
inc := binary.BigEndian.Uint32(p[:4]) & 0x7fffffff // mask off high reserved bit
|
896
|
+
if inc == 0 {
|
897
|
+
// A receiver MUST treat the receipt of a
|
898
|
+
// WINDOW_UPDATE frame with an flow control window
|
899
|
+
// increment of 0 as a stream error (Section 5.4.2) of
|
900
|
+
// type PROTOCOL_ERROR; errors on the connection flow
|
901
|
+
// control window MUST be treated as a connection
|
902
|
+
// error (Section 5.4.1).
|
903
|
+
if fh.StreamID == 0 {
|
904
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
905
|
+
}
|
906
|
+
return nil, streamError(fh.StreamID, ErrCodeProtocol)
|
907
|
+
}
|
908
|
+
return &WindowUpdateFrame{
|
909
|
+
FrameHeader: fh,
|
910
|
+
Increment: inc,
|
911
|
+
}, nil
|
912
|
+
}
|
913
|
+
|
914
|
+
// WriteWindowUpdate writes a WINDOW_UPDATE frame.
|
915
|
+
// The increment value must be between 1 and 2,147,483,647, inclusive.
|
916
|
+
// If the Stream ID is zero, the window update applies to the
|
917
|
+
// connection as a whole.
|
918
|
+
func (f *Framer) WriteWindowUpdate(streamID, incr uint32) error {
|
919
|
+
// "The legal range for the increment to the flow control window is 1 to 2^31-1 (2,147,483,647) octets."
|
920
|
+
if (incr < 1 || incr > 2147483647) && !f.AllowIllegalWrites {
|
921
|
+
return errors.New("illegal window increment value")
|
922
|
+
}
|
923
|
+
f.startWrite(FrameWindowUpdate, 0, streamID)
|
924
|
+
f.writeUint32(incr)
|
925
|
+
return f.endWrite()
|
926
|
+
}
|
927
|
+
|
928
|
+
// A HeadersFrame is used to open a stream and additionally carries a
|
929
|
+
// header block fragment.
|
930
|
+
type HeadersFrame struct {
|
931
|
+
FrameHeader
|
932
|
+
|
933
|
+
// Priority is set if FlagHeadersPriority is set in the FrameHeader.
|
934
|
+
Priority PriorityParam
|
935
|
+
|
936
|
+
headerFragBuf []byte // not owned
|
937
|
+
}
|
938
|
+
|
939
|
+
func (f *HeadersFrame) HeaderBlockFragment() []byte {
|
940
|
+
f.checkValid()
|
941
|
+
return f.headerFragBuf
|
942
|
+
}
|
943
|
+
|
944
|
+
func (f *HeadersFrame) HeadersEnded() bool {
|
945
|
+
return f.FrameHeader.Flags.Has(FlagHeadersEndHeaders)
|
946
|
+
}
|
947
|
+
|
948
|
+
func (f *HeadersFrame) StreamEnded() bool {
|
949
|
+
return f.FrameHeader.Flags.Has(FlagHeadersEndStream)
|
950
|
+
}
|
951
|
+
|
952
|
+
func (f *HeadersFrame) HasPriority() bool {
|
953
|
+
return f.FrameHeader.Flags.Has(FlagHeadersPriority)
|
954
|
+
}
|
955
|
+
|
956
|
+
func parseHeadersFrame(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) {
|
957
|
+
hf := &HeadersFrame{
|
958
|
+
FrameHeader: fh,
|
959
|
+
}
|
960
|
+
if fh.StreamID == 0 {
|
961
|
+
// HEADERS frames MUST be associated with a stream. If a HEADERS frame
|
962
|
+
// is received whose stream identifier field is 0x0, the recipient MUST
|
963
|
+
// respond with a connection error (Section 5.4.1) of type
|
964
|
+
// PROTOCOL_ERROR.
|
965
|
+
return nil, connError{ErrCodeProtocol, "HEADERS frame with stream ID 0"}
|
966
|
+
}
|
967
|
+
var padLength uint8
|
968
|
+
if fh.Flags.Has(FlagHeadersPadded) {
|
969
|
+
if p, padLength, err = readByte(p); err != nil {
|
970
|
+
return
|
971
|
+
}
|
972
|
+
}
|
973
|
+
if fh.Flags.Has(FlagHeadersPriority) {
|
974
|
+
var v uint32
|
975
|
+
p, v, err = readUint32(p)
|
976
|
+
if err != nil {
|
977
|
+
return nil, err
|
978
|
+
}
|
979
|
+
hf.Priority.StreamDep = v & 0x7fffffff
|
980
|
+
hf.Priority.Exclusive = (v != hf.Priority.StreamDep) // high bit was set
|
981
|
+
p, hf.Priority.Weight, err = readByte(p)
|
982
|
+
if err != nil {
|
983
|
+
return nil, err
|
984
|
+
}
|
985
|
+
}
|
986
|
+
if len(p)-int(padLength) <= 0 {
|
987
|
+
return nil, streamError(fh.StreamID, ErrCodeProtocol)
|
988
|
+
}
|
989
|
+
hf.headerFragBuf = p[:len(p)-int(padLength)]
|
990
|
+
return hf, nil
|
991
|
+
}
|
992
|
+
|
993
|
+
// HeadersFrameParam are the parameters for writing a HEADERS frame.
|
994
|
+
type HeadersFrameParam struct {
|
995
|
+
// StreamID is the required Stream ID to initiate.
|
996
|
+
StreamID uint32
|
997
|
+
// BlockFragment is part (or all) of a Header Block.
|
998
|
+
BlockFragment []byte
|
999
|
+
|
1000
|
+
// EndStream indicates that the header block is the last that
|
1001
|
+
// the endpoint will send for the identified stream. Setting
|
1002
|
+
// this flag causes the stream to enter one of "half closed"
|
1003
|
+
// states.
|
1004
|
+
EndStream bool
|
1005
|
+
|
1006
|
+
// EndHeaders indicates that this frame contains an entire
|
1007
|
+
// header block and is not followed by any
|
1008
|
+
// CONTINUATION frames.
|
1009
|
+
EndHeaders bool
|
1010
|
+
|
1011
|
+
// PadLength is the optional number of bytes of zeros to add
|
1012
|
+
// to this frame.
|
1013
|
+
PadLength uint8
|
1014
|
+
|
1015
|
+
// Priority, if non-zero, includes stream priority information
|
1016
|
+
// in the HEADER frame.
|
1017
|
+
Priority PriorityParam
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
// WriteHeaders writes a single HEADERS frame.
|
1021
|
+
//
|
1022
|
+
// This is a low-level header writing method. Encoding headers and
|
1023
|
+
// splitting them into any necessary CONTINUATION frames is handled
|
1024
|
+
// elsewhere.
|
1025
|
+
//
|
1026
|
+
// It will perform exactly one Write to the underlying Writer.
|
1027
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
1028
|
+
func (f *Framer) WriteHeaders(p HeadersFrameParam) error {
|
1029
|
+
if !validStreamID(p.StreamID) && !f.AllowIllegalWrites {
|
1030
|
+
return errStreamID
|
1031
|
+
}
|
1032
|
+
var flags Flags
|
1033
|
+
if p.PadLength != 0 {
|
1034
|
+
flags |= FlagHeadersPadded
|
1035
|
+
}
|
1036
|
+
if p.EndStream {
|
1037
|
+
flags |= FlagHeadersEndStream
|
1038
|
+
}
|
1039
|
+
if p.EndHeaders {
|
1040
|
+
flags |= FlagHeadersEndHeaders
|
1041
|
+
}
|
1042
|
+
if !p.Priority.IsZero() {
|
1043
|
+
flags |= FlagHeadersPriority
|
1044
|
+
}
|
1045
|
+
f.startWrite(FrameHeaders, flags, p.StreamID)
|
1046
|
+
if p.PadLength != 0 {
|
1047
|
+
f.writeByte(p.PadLength)
|
1048
|
+
}
|
1049
|
+
if !p.Priority.IsZero() {
|
1050
|
+
v := p.Priority.StreamDep
|
1051
|
+
if !validStreamIDOrZero(v) && !f.AllowIllegalWrites {
|
1052
|
+
return errDepStreamID
|
1053
|
+
}
|
1054
|
+
if p.Priority.Exclusive {
|
1055
|
+
v |= 1 << 31
|
1056
|
+
}
|
1057
|
+
f.writeUint32(v)
|
1058
|
+
f.writeByte(p.Priority.Weight)
|
1059
|
+
}
|
1060
|
+
f.wbuf = append(f.wbuf, p.BlockFragment...)
|
1061
|
+
f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...)
|
1062
|
+
return f.endWrite()
|
1063
|
+
}
|
1064
|
+
|
1065
|
+
// A PriorityFrame specifies the sender-advised priority of a stream.
|
1066
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.3
|
1067
|
+
type PriorityFrame struct {
|
1068
|
+
FrameHeader
|
1069
|
+
PriorityParam
|
1070
|
+
}
|
1071
|
+
|
1072
|
+
// PriorityParam are the stream prioritzation parameters.
|
1073
|
+
type PriorityParam struct {
|
1074
|
+
// StreamDep is a 31-bit stream identifier for the
|
1075
|
+
// stream that this stream depends on. Zero means no
|
1076
|
+
// dependency.
|
1077
|
+
StreamDep uint32
|
1078
|
+
|
1079
|
+
// Exclusive is whether the dependency is exclusive.
|
1080
|
+
Exclusive bool
|
1081
|
+
|
1082
|
+
// Weight is the stream's zero-indexed weight. It should be
|
1083
|
+
// set together with StreamDep, or neither should be set. Per
|
1084
|
+
// the spec, "Add one to the value to obtain a weight between
|
1085
|
+
// 1 and 256."
|
1086
|
+
Weight uint8
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
func (p PriorityParam) IsZero() bool {
|
1090
|
+
return p == PriorityParam{}
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
func parsePriorityFrame(_ *frameCache, fh FrameHeader, payload []byte) (Frame, error) {
|
1094
|
+
if fh.StreamID == 0 {
|
1095
|
+
return nil, connError{ErrCodeProtocol, "PRIORITY frame with stream ID 0"}
|
1096
|
+
}
|
1097
|
+
if len(payload) != 5 {
|
1098
|
+
return nil, connError{ErrCodeFrameSize, fmt.Sprintf("PRIORITY frame payload size was %d; want 5", len(payload))}
|
1099
|
+
}
|
1100
|
+
v := binary.BigEndian.Uint32(payload[:4])
|
1101
|
+
streamID := v & 0x7fffffff // mask off high bit
|
1102
|
+
return &PriorityFrame{
|
1103
|
+
FrameHeader: fh,
|
1104
|
+
PriorityParam: PriorityParam{
|
1105
|
+
Weight: payload[4],
|
1106
|
+
StreamDep: streamID,
|
1107
|
+
Exclusive: streamID != v, // was high bit set?
|
1108
|
+
},
|
1109
|
+
}, nil
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
// WritePriority writes a PRIORITY frame.
|
1113
|
+
//
|
1114
|
+
// It will perform exactly one Write to the underlying Writer.
|
1115
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
1116
|
+
func (f *Framer) WritePriority(streamID uint32, p PriorityParam) error {
|
1117
|
+
if !validStreamID(streamID) && !f.AllowIllegalWrites {
|
1118
|
+
return errStreamID
|
1119
|
+
}
|
1120
|
+
if !validStreamIDOrZero(p.StreamDep) {
|
1121
|
+
return errDepStreamID
|
1122
|
+
}
|
1123
|
+
f.startWrite(FramePriority, 0, streamID)
|
1124
|
+
v := p.StreamDep
|
1125
|
+
if p.Exclusive {
|
1126
|
+
v |= 1 << 31
|
1127
|
+
}
|
1128
|
+
f.writeUint32(v)
|
1129
|
+
f.writeByte(p.Weight)
|
1130
|
+
return f.endWrite()
|
1131
|
+
}
|
1132
|
+
|
1133
|
+
// A RSTStreamFrame allows for abnormal termination of a stream.
|
1134
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.4
|
1135
|
+
type RSTStreamFrame struct {
|
1136
|
+
FrameHeader
|
1137
|
+
ErrCode ErrCode
|
1138
|
+
}
|
1139
|
+
|
1140
|
+
func parseRSTStreamFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
1141
|
+
if len(p) != 4 {
|
1142
|
+
return nil, ConnectionError(ErrCodeFrameSize)
|
1143
|
+
}
|
1144
|
+
if fh.StreamID == 0 {
|
1145
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
1146
|
+
}
|
1147
|
+
return &RSTStreamFrame{fh, ErrCode(binary.BigEndian.Uint32(p[:4]))}, nil
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
// WriteRSTStream writes a RST_STREAM frame.
|
1151
|
+
//
|
1152
|
+
// It will perform exactly one Write to the underlying Writer.
|
1153
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
1154
|
+
func (f *Framer) WriteRSTStream(streamID uint32, code ErrCode) error {
|
1155
|
+
if !validStreamID(streamID) && !f.AllowIllegalWrites {
|
1156
|
+
return errStreamID
|
1157
|
+
}
|
1158
|
+
f.startWrite(FrameRSTStream, 0, streamID)
|
1159
|
+
f.writeUint32(uint32(code))
|
1160
|
+
return f.endWrite()
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
// A ContinuationFrame is used to continue a sequence of header block fragments.
|
1164
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.10
|
1165
|
+
type ContinuationFrame struct {
|
1166
|
+
FrameHeader
|
1167
|
+
headerFragBuf []byte
|
1168
|
+
}
|
1169
|
+
|
1170
|
+
func parseContinuationFrame(_ *frameCache, fh FrameHeader, p []byte) (Frame, error) {
|
1171
|
+
if fh.StreamID == 0 {
|
1172
|
+
return nil, connError{ErrCodeProtocol, "CONTINUATION frame with stream ID 0"}
|
1173
|
+
}
|
1174
|
+
return &ContinuationFrame{fh, p}, nil
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
func (f *ContinuationFrame) HeaderBlockFragment() []byte {
|
1178
|
+
f.checkValid()
|
1179
|
+
return f.headerFragBuf
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
func (f *ContinuationFrame) HeadersEnded() bool {
|
1183
|
+
return f.FrameHeader.Flags.Has(FlagContinuationEndHeaders)
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
// WriteContinuation writes a CONTINUATION frame.
|
1187
|
+
//
|
1188
|
+
// It will perform exactly one Write to the underlying Writer.
|
1189
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
1190
|
+
func (f *Framer) WriteContinuation(streamID uint32, endHeaders bool, headerBlockFragment []byte) error {
|
1191
|
+
if !validStreamID(streamID) && !f.AllowIllegalWrites {
|
1192
|
+
return errStreamID
|
1193
|
+
}
|
1194
|
+
var flags Flags
|
1195
|
+
if endHeaders {
|
1196
|
+
flags |= FlagContinuationEndHeaders
|
1197
|
+
}
|
1198
|
+
f.startWrite(FrameContinuation, flags, streamID)
|
1199
|
+
f.wbuf = append(f.wbuf, headerBlockFragment...)
|
1200
|
+
return f.endWrite()
|
1201
|
+
}
|
1202
|
+
|
1203
|
+
// A PushPromiseFrame is used to initiate a server stream.
|
1204
|
+
// See http://http2.github.io/http2-spec/#rfc.section.6.6
|
1205
|
+
type PushPromiseFrame struct {
|
1206
|
+
FrameHeader
|
1207
|
+
PromiseID uint32
|
1208
|
+
headerFragBuf []byte // not owned
|
1209
|
+
}
|
1210
|
+
|
1211
|
+
func (f *PushPromiseFrame) HeaderBlockFragment() []byte {
|
1212
|
+
f.checkValid()
|
1213
|
+
return f.headerFragBuf
|
1214
|
+
}
|
1215
|
+
|
1216
|
+
func (f *PushPromiseFrame) HeadersEnded() bool {
|
1217
|
+
return f.FrameHeader.Flags.Has(FlagPushPromiseEndHeaders)
|
1218
|
+
}
|
1219
|
+
|
1220
|
+
func parsePushPromise(_ *frameCache, fh FrameHeader, p []byte) (_ Frame, err error) {
|
1221
|
+
pp := &PushPromiseFrame{
|
1222
|
+
FrameHeader: fh,
|
1223
|
+
}
|
1224
|
+
if pp.StreamID == 0 {
|
1225
|
+
// PUSH_PROMISE frames MUST be associated with an existing,
|
1226
|
+
// peer-initiated stream. The stream identifier of a
|
1227
|
+
// PUSH_PROMISE frame indicates the stream it is associated
|
1228
|
+
// with. If the stream identifier field specifies the value
|
1229
|
+
// 0x0, a recipient MUST respond with a connection error
|
1230
|
+
// (Section 5.4.1) of type PROTOCOL_ERROR.
|
1231
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
1232
|
+
}
|
1233
|
+
// The PUSH_PROMISE frame includes optional padding.
|
1234
|
+
// Padding fields and flags are identical to those defined for DATA frames
|
1235
|
+
var padLength uint8
|
1236
|
+
if fh.Flags.Has(FlagPushPromisePadded) {
|
1237
|
+
if p, padLength, err = readByte(p); err != nil {
|
1238
|
+
return
|
1239
|
+
}
|
1240
|
+
}
|
1241
|
+
|
1242
|
+
p, pp.PromiseID, err = readUint32(p)
|
1243
|
+
if err != nil {
|
1244
|
+
return
|
1245
|
+
}
|
1246
|
+
pp.PromiseID = pp.PromiseID & (1<<31 - 1)
|
1247
|
+
|
1248
|
+
if int(padLength) > len(p) {
|
1249
|
+
// like the DATA frame, error out if padding is longer than the body.
|
1250
|
+
return nil, ConnectionError(ErrCodeProtocol)
|
1251
|
+
}
|
1252
|
+
pp.headerFragBuf = p[:len(p)-int(padLength)]
|
1253
|
+
return pp, nil
|
1254
|
+
}
|
1255
|
+
|
1256
|
+
// PushPromiseParam are the parameters for writing a PUSH_PROMISE frame.
|
1257
|
+
type PushPromiseParam struct {
|
1258
|
+
// StreamID is the required Stream ID to initiate.
|
1259
|
+
StreamID uint32
|
1260
|
+
|
1261
|
+
// PromiseID is the required Stream ID which this
|
1262
|
+
// Push Promises
|
1263
|
+
PromiseID uint32
|
1264
|
+
|
1265
|
+
// BlockFragment is part (or all) of a Header Block.
|
1266
|
+
BlockFragment []byte
|
1267
|
+
|
1268
|
+
// EndHeaders indicates that this frame contains an entire
|
1269
|
+
// header block and is not followed by any
|
1270
|
+
// CONTINUATION frames.
|
1271
|
+
EndHeaders bool
|
1272
|
+
|
1273
|
+
// PadLength is the optional number of bytes of zeros to add
|
1274
|
+
// to this frame.
|
1275
|
+
PadLength uint8
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
// WritePushPromise writes a single PushPromise Frame.
|
1279
|
+
//
|
1280
|
+
// As with Header Frames, This is the low level call for writing
|
1281
|
+
// individual frames. Continuation frames are handled elsewhere.
|
1282
|
+
//
|
1283
|
+
// It will perform exactly one Write to the underlying Writer.
|
1284
|
+
// It is the caller's responsibility to not call other Write methods concurrently.
|
1285
|
+
func (f *Framer) WritePushPromise(p PushPromiseParam) error {
|
1286
|
+
if !validStreamID(p.StreamID) && !f.AllowIllegalWrites {
|
1287
|
+
return errStreamID
|
1288
|
+
}
|
1289
|
+
var flags Flags
|
1290
|
+
if p.PadLength != 0 {
|
1291
|
+
flags |= FlagPushPromisePadded
|
1292
|
+
}
|
1293
|
+
if p.EndHeaders {
|
1294
|
+
flags |= FlagPushPromiseEndHeaders
|
1295
|
+
}
|
1296
|
+
f.startWrite(FramePushPromise, flags, p.StreamID)
|
1297
|
+
if p.PadLength != 0 {
|
1298
|
+
f.writeByte(p.PadLength)
|
1299
|
+
}
|
1300
|
+
if !validStreamID(p.PromiseID) && !f.AllowIllegalWrites {
|
1301
|
+
return errStreamID
|
1302
|
+
}
|
1303
|
+
f.writeUint32(p.PromiseID)
|
1304
|
+
f.wbuf = append(f.wbuf, p.BlockFragment...)
|
1305
|
+
f.wbuf = append(f.wbuf, padZeros[:p.PadLength]...)
|
1306
|
+
return f.endWrite()
|
1307
|
+
}
|
1308
|
+
|
1309
|
+
// WriteRawFrame writes a raw frame. This can be used to write
|
1310
|
+
// extension frames unknown to this package.
|
1311
|
+
func (f *Framer) WriteRawFrame(t FrameType, flags Flags, streamID uint32, payload []byte) error {
|
1312
|
+
f.startWrite(t, flags, streamID)
|
1313
|
+
f.writeBytes(payload)
|
1314
|
+
return f.endWrite()
|
1315
|
+
}
|
1316
|
+
|
1317
|
+
func readByte(p []byte) (remain []byte, b byte, err error) {
|
1318
|
+
if len(p) == 0 {
|
1319
|
+
return nil, 0, io.ErrUnexpectedEOF
|
1320
|
+
}
|
1321
|
+
return p[1:], p[0], nil
|
1322
|
+
}
|
1323
|
+
|
1324
|
+
func readUint32(p []byte) (remain []byte, v uint32, err error) {
|
1325
|
+
if len(p) < 4 {
|
1326
|
+
return nil, 0, io.ErrUnexpectedEOF
|
1327
|
+
}
|
1328
|
+
return p[4:], binary.BigEndian.Uint32(p[:4]), nil
|
1329
|
+
}
|
1330
|
+
|
1331
|
+
type streamEnder interface {
|
1332
|
+
StreamEnded() bool
|
1333
|
+
}
|
1334
|
+
|
1335
|
+
type headersEnder interface {
|
1336
|
+
HeadersEnded() bool
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
type headersOrContinuation interface {
|
1340
|
+
headersEnder
|
1341
|
+
HeaderBlockFragment() []byte
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
// A MetaHeadersFrame is the representation of one HEADERS frame and
|
1345
|
+
// zero or more contiguous CONTINUATION frames and the decoding of
|
1346
|
+
// their HPACK-encoded contents.
|
1347
|
+
//
|
1348
|
+
// This type of frame does not appear on the wire and is only returned
|
1349
|
+
// by the Framer when Framer.ReadMetaHeaders is set.
|
1350
|
+
type MetaHeadersFrame struct {
|
1351
|
+
*HeadersFrame
|
1352
|
+
|
1353
|
+
// Fields are the fields contained in the HEADERS and
|
1354
|
+
// CONTINUATION frames. The underlying slice is owned by the
|
1355
|
+
// Framer and must not be retained after the next call to
|
1356
|
+
// ReadFrame.
|
1357
|
+
//
|
1358
|
+
// Fields are guaranteed to be in the correct http2 order and
|
1359
|
+
// not have unknown pseudo header fields or invalid header
|
1360
|
+
// field names or values. Required pseudo header fields may be
|
1361
|
+
// missing, however. Use the MetaHeadersFrame.Pseudo accessor
|
1362
|
+
// method access pseudo headers.
|
1363
|
+
Fields []hpack.HeaderField
|
1364
|
+
|
1365
|
+
// Truncated is whether the max header list size limit was hit
|
1366
|
+
// and Fields is incomplete. The hpack decoder state is still
|
1367
|
+
// valid, however.
|
1368
|
+
Truncated bool
|
1369
|
+
}
|
1370
|
+
|
1371
|
+
// PseudoValue returns the given pseudo header field's value.
|
1372
|
+
// The provided pseudo field should not contain the leading colon.
|
1373
|
+
func (mh *MetaHeadersFrame) PseudoValue(pseudo string) string {
|
1374
|
+
for _, hf := range mh.Fields {
|
1375
|
+
if !hf.IsPseudo() {
|
1376
|
+
return ""
|
1377
|
+
}
|
1378
|
+
if hf.Name[1:] == pseudo {
|
1379
|
+
return hf.Value
|
1380
|
+
}
|
1381
|
+
}
|
1382
|
+
return ""
|
1383
|
+
}
|
1384
|
+
|
1385
|
+
// RegularFields returns the regular (non-pseudo) header fields of mh.
|
1386
|
+
// The caller does not own the returned slice.
|
1387
|
+
func (mh *MetaHeadersFrame) RegularFields() []hpack.HeaderField {
|
1388
|
+
for i, hf := range mh.Fields {
|
1389
|
+
if !hf.IsPseudo() {
|
1390
|
+
return mh.Fields[i:]
|
1391
|
+
}
|
1392
|
+
}
|
1393
|
+
return nil
|
1394
|
+
}
|
1395
|
+
|
1396
|
+
// PseudoFields returns the pseudo header fields of mh.
|
1397
|
+
// The caller does not own the returned slice.
|
1398
|
+
func (mh *MetaHeadersFrame) PseudoFields() []hpack.HeaderField {
|
1399
|
+
for i, hf := range mh.Fields {
|
1400
|
+
if !hf.IsPseudo() {
|
1401
|
+
return mh.Fields[:i]
|
1402
|
+
}
|
1403
|
+
}
|
1404
|
+
return mh.Fields
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
func (mh *MetaHeadersFrame) checkPseudos() error {
|
1408
|
+
var isRequest, isResponse bool
|
1409
|
+
pf := mh.PseudoFields()
|
1410
|
+
for i, hf := range pf {
|
1411
|
+
switch hf.Name {
|
1412
|
+
case ":method", ":path", ":scheme", ":authority":
|
1413
|
+
isRequest = true
|
1414
|
+
case ":status":
|
1415
|
+
isResponse = true
|
1416
|
+
default:
|
1417
|
+
return pseudoHeaderError(hf.Name)
|
1418
|
+
}
|
1419
|
+
// Check for duplicates.
|
1420
|
+
// This would be a bad algorithm, but N is 4.
|
1421
|
+
// And this doesn't allocate.
|
1422
|
+
for _, hf2 := range pf[:i] {
|
1423
|
+
if hf.Name == hf2.Name {
|
1424
|
+
return duplicatePseudoHeaderError(hf.Name)
|
1425
|
+
}
|
1426
|
+
}
|
1427
|
+
}
|
1428
|
+
if isRequest && isResponse {
|
1429
|
+
return errMixPseudoHeaderTypes
|
1430
|
+
}
|
1431
|
+
return nil
|
1432
|
+
}
|
1433
|
+
|
1434
|
+
func (fr *Framer) maxHeaderStringLen() int {
|
1435
|
+
v := fr.maxHeaderListSize()
|
1436
|
+
if uint32(int(v)) == v {
|
1437
|
+
return int(v)
|
1438
|
+
}
|
1439
|
+
// They had a crazy big number for MaxHeaderBytes anyway,
|
1440
|
+
// so give them unlimited header lengths:
|
1441
|
+
return 0
|
1442
|
+
}
|
1443
|
+
|
1444
|
+
// readMetaFrame returns 0 or more CONTINUATION frames from fr and
|
1445
|
+
// merge them into into the provided hf and returns a MetaHeadersFrame
|
1446
|
+
// with the decoded hpack values.
|
1447
|
+
func (fr *Framer) readMetaFrame(hf *HeadersFrame) (*MetaHeadersFrame, error) {
|
1448
|
+
if fr.AllowIllegalReads {
|
1449
|
+
return nil, errors.New("illegal use of AllowIllegalReads with ReadMetaHeaders")
|
1450
|
+
}
|
1451
|
+
mh := &MetaHeadersFrame{
|
1452
|
+
HeadersFrame: hf,
|
1453
|
+
}
|
1454
|
+
var remainSize = fr.maxHeaderListSize()
|
1455
|
+
var sawRegular bool
|
1456
|
+
|
1457
|
+
var invalid error // pseudo header field errors
|
1458
|
+
hdec := fr.ReadMetaHeaders
|
1459
|
+
hdec.SetEmitEnabled(true)
|
1460
|
+
hdec.SetMaxStringLength(fr.maxHeaderStringLen())
|
1461
|
+
hdec.SetEmitFunc(func(hf hpack.HeaderField) {
|
1462
|
+
if VerboseLogs && fr.logReads {
|
1463
|
+
fr.debugReadLoggerf("http2: decoded hpack field %+v", hf)
|
1464
|
+
}
|
1465
|
+
if !httplex.ValidHeaderFieldValue(hf.Value) {
|
1466
|
+
invalid = headerFieldValueError(hf.Value)
|
1467
|
+
}
|
1468
|
+
isPseudo := strings.HasPrefix(hf.Name, ":")
|
1469
|
+
if isPseudo {
|
1470
|
+
if sawRegular {
|
1471
|
+
invalid = errPseudoAfterRegular
|
1472
|
+
}
|
1473
|
+
} else {
|
1474
|
+
sawRegular = true
|
1475
|
+
if !validWireHeaderFieldName(hf.Name) {
|
1476
|
+
invalid = headerFieldNameError(hf.Name)
|
1477
|
+
}
|
1478
|
+
}
|
1479
|
+
|
1480
|
+
if invalid != nil {
|
1481
|
+
hdec.SetEmitEnabled(false)
|
1482
|
+
return
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
size := hf.Size()
|
1486
|
+
if size > remainSize {
|
1487
|
+
hdec.SetEmitEnabled(false)
|
1488
|
+
mh.Truncated = true
|
1489
|
+
return
|
1490
|
+
}
|
1491
|
+
remainSize -= size
|
1492
|
+
|
1493
|
+
mh.Fields = append(mh.Fields, hf)
|
1494
|
+
})
|
1495
|
+
// Lose reference to MetaHeadersFrame:
|
1496
|
+
defer hdec.SetEmitFunc(func(hf hpack.HeaderField) {})
|
1497
|
+
|
1498
|
+
var hc headersOrContinuation = hf
|
1499
|
+
for {
|
1500
|
+
frag := hc.HeaderBlockFragment()
|
1501
|
+
if _, err := hdec.Write(frag); err != nil {
|
1502
|
+
return nil, ConnectionError(ErrCodeCompression)
|
1503
|
+
}
|
1504
|
+
|
1505
|
+
if hc.HeadersEnded() {
|
1506
|
+
break
|
1507
|
+
}
|
1508
|
+
if f, err := fr.ReadFrame(); err != nil {
|
1509
|
+
return nil, err
|
1510
|
+
} else {
|
1511
|
+
hc = f.(*ContinuationFrame) // guaranteed by checkFrameOrder
|
1512
|
+
}
|
1513
|
+
}
|
1514
|
+
|
1515
|
+
mh.HeadersFrame.headerFragBuf = nil
|
1516
|
+
mh.HeadersFrame.invalidate()
|
1517
|
+
|
1518
|
+
if err := hdec.Close(); err != nil {
|
1519
|
+
return nil, ConnectionError(ErrCodeCompression)
|
1520
|
+
}
|
1521
|
+
if invalid != nil {
|
1522
|
+
fr.errDetail = invalid
|
1523
|
+
if VerboseLogs {
|
1524
|
+
log.Printf("http2: invalid header: %v", invalid)
|
1525
|
+
}
|
1526
|
+
return nil, StreamError{mh.StreamID, ErrCodeProtocol, invalid}
|
1527
|
+
}
|
1528
|
+
if err := mh.checkPseudos(); err != nil {
|
1529
|
+
fr.errDetail = err
|
1530
|
+
if VerboseLogs {
|
1531
|
+
log.Printf("http2: invalid pseudo headers: %v", err)
|
1532
|
+
}
|
1533
|
+
return nil, StreamError{mh.StreamID, ErrCodeProtocol, err}
|
1534
|
+
}
|
1535
|
+
return mh, nil
|
1536
|
+
}
|
1537
|
+
|
1538
|
+
func summarizeFrame(f Frame) string {
|
1539
|
+
var buf bytes.Buffer
|
1540
|
+
f.Header().writeDebug(&buf)
|
1541
|
+
switch f := f.(type) {
|
1542
|
+
case *SettingsFrame:
|
1543
|
+
n := 0
|
1544
|
+
f.ForeachSetting(func(s Setting) error {
|
1545
|
+
n++
|
1546
|
+
if n == 1 {
|
1547
|
+
buf.WriteString(", settings:")
|
1548
|
+
}
|
1549
|
+
fmt.Fprintf(&buf, " %v=%v,", s.ID, s.Val)
|
1550
|
+
return nil
|
1551
|
+
})
|
1552
|
+
if n > 0 {
|
1553
|
+
buf.Truncate(buf.Len() - 1) // remove trailing comma
|
1554
|
+
}
|
1555
|
+
case *DataFrame:
|
1556
|
+
data := f.Data()
|
1557
|
+
const max = 256
|
1558
|
+
if len(data) > max {
|
1559
|
+
data = data[:max]
|
1560
|
+
}
|
1561
|
+
fmt.Fprintf(&buf, " data=%q", data)
|
1562
|
+
if len(f.Data()) > max {
|
1563
|
+
fmt.Fprintf(&buf, " (%d bytes omitted)", len(f.Data())-max)
|
1564
|
+
}
|
1565
|
+
case *WindowUpdateFrame:
|
1566
|
+
if f.StreamID == 0 {
|
1567
|
+
buf.WriteString(" (conn)")
|
1568
|
+
}
|
1569
|
+
fmt.Fprintf(&buf, " incr=%v", f.Increment)
|
1570
|
+
case *PingFrame:
|
1571
|
+
fmt.Fprintf(&buf, " ping=%q", f.Data[:])
|
1572
|
+
case *GoAwayFrame:
|
1573
|
+
fmt.Fprintf(&buf, " LastStreamID=%v ErrCode=%v Debug=%q",
|
1574
|
+
f.LastStreamID, f.ErrCode, f.debugData)
|
1575
|
+
case *RSTStreamFrame:
|
1576
|
+
fmt.Fprintf(&buf, " ErrCode=%v", f.ErrCode)
|
1577
|
+
}
|
1578
|
+
return buf.String()
|
1579
|
+
}
|