├── http2 ├── .gitignore ├── h2demo │ ├── rootCA.srl │ ├── .gitignore │ ├── Makefile │ ├── README │ ├── server.crt │ ├── rootCA.pem │ ├── rootCA.key │ └── server.key ├── Makefile ├── go15.go ├── not_go15.go ├── not_go16.go ├── errors_test.go ├── README ├── gotrack_test.go ├── flow.go ├── flow_test.go ├── fixed_buffer.go ├── Dockerfile ├── headermap.go └── pipe_test.go ├── codereview.cfg ├── .gitignore ├── html ├── charset │ └── testdata │ │ ├── UTF-16BE-BOM.html │ │ ├── UTF-16LE-BOM.html │ │ ├── README │ │ └── No-encoding-declaration.html ├── testdata │ └── webkit │ │ ├── pending-spec-changes-plain-text-unsafe.dat │ │ ├── scripted │ │ ├── adoption01.dat │ │ └── webkit01.dat │ │ ├── adoption02.dat │ │ ├── inbody01.dat │ │ ├── isindex.dat │ │ ├── tests4.dat │ │ ├── tests24.dat │ │ ├── tests14.dat │ │ ├── pending-spec-changes.dat │ │ ├── README │ │ ├── tests12.dat │ │ └── comments01.dat ├── example_test.go ├── entity_test.go ├── escape_test.go └── atom │ └── atom.go ├── README ├── AUTHORS ├── CONTRIBUTORS ├── ipv4 ├── thunk_linux_386.s ├── sockopt_stub.go ├── sys_stub.go ├── payload.go ├── mocktransponder_test.go ├── sockopt_asmreqn_stub.go ├── sockopt_ssmreq_stub.go ├── icmp_stub.go ├── helper_stub.go ├── control_stub.go ├── sockopt_asmreq_stub.go ├── icmp_linux.go ├── zsys_netbsd.go ├── zsys_openbsd.go ├── control_windows.go ├── zsys_dragonfly.go ├── genericopt_stub.go ├── syscall_unix.go ├── syscall_linux_386.go ├── control_pktinfo.go ├── defs_netbsd.go ├── defs_openbsd.go ├── defs_dragonfly.go ├── control_bsd.go ├── sockopt_asmreqn_unix.go ├── sys_openbsd.go ├── helper_unix.go ├── sys_bsd.go ├── iana.go ├── helper_windows.go ├── sockopt_asmreq_unix.go ├── payload_nocmsg.go ├── genericopt_posix.go ├── sockopt_asmreq_windows.go ├── helper.go ├── zsys_solaris.go ├── sockopt_ssmreq_unix.go ├── icmp.go ├── sys_windows.go ├── sockopt.go ├── defs_solaris.go ├── sockopt_asmreq.go ├── sys_linux.go ├── sockopt_windows.go ├── icmp_test.go ├── control.go ├── zsys_freebsd_386.go ├── zsys_freebsd_arm.go └── zsys_freebsd_amd64.go ├── ipv6 ├── thunk_linux_386.s ├── sys_stub.go ├── sockopt_stub.go ├── payload.go ├── helper_stub.go ├── sockopt_ssmreq_stub.go ├── icmp_stub.go ├── control_stub.go ├── icmp_solaris.go ├── sockopt_asmreq_windows.go ├── sockopt_asmreq_unix.go ├── icmp_windows.go ├── icmp_linux.go ├── mocktransponder_test.go ├── control_windows.go ├── icmp_bsd.go ├── syscall_unix.go ├── genericopt_stub.go ├── syscall_linux_386.go ├── helper_unix.go ├── helper.go ├── helper_windows.go ├── header_test.go ├── payload_nocmsg.go ├── genericopt_posix.go ├── header.go ├── sockopt_ssmreq_unix.go ├── control_rfc2292_unix.go ├── icmp.go ├── sys_windows.go ├── zsys_netbsd.go ├── sockopt.go ├── zsys_dragonfly.go ├── zsys_openbsd.go ├── payload_cmsg.go ├── icmp_test.go ├── sys_bsd.go ├── defs_netbsd.go └── defs_dragonfly.go ├── internal └── nettest │ ├── rlimit_windows.go │ ├── rlimit_stub.go │ ├── error_stub.go │ ├── rlimit.go │ ├── stack_stub.go │ ├── rlimit_unix.go │ ├── stack_unix.go │ ├── error_posix.go │ ├── stack.go │ ├── stack_windows.go │ └── interface.go ├── icmp ├── sys_freebsd.go ├── helper.go ├── ipv6.go ├── listen_stub.go ├── timeexceeded.go ├── dstunreach.go ├── packettoobig.go ├── messagebody.go ├── echo.go ├── example_test.go ├── ipv4.go ├── ipv4_test.go ├── helper_posix.go ├── paramprob.go └── mpls.go ├── .gitattributes ├── proxy ├── direct.go └── per_host_test.go ├── webdav └── internal │ └── xml │ ├── README │ └── atom_test.go ├── context ├── ctxhttp │ ├── cancelreq.go │ └── cancelreq_go14.go └── withtimeout_test.go ├── websocket ├── examplehandler_test.go └── exampledial_test.go ├── CONTRIBUTING.md ├── idna ├── idna_test.go └── idna.go ├── netutil └── listen.go ├── PATENTS ├── LICENSE └── trace └── trace_test.go /http2/.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | h2i/h2i 3 | -------------------------------------------------------------------------------- /codereview.cfg: -------------------------------------------------------------------------------- 1 | issuerepo: golang/go 2 | -------------------------------------------------------------------------------- /http2/h2demo/rootCA.srl: -------------------------------------------------------------------------------- 1 | E2CE26BF3285059C 2 | -------------------------------------------------------------------------------- /http2/Makefile: -------------------------------------------------------------------------------- 1 | curlimage: 2 | docker build -t gohttp2/curl . 3 | 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Add no patterns to .hgignore except for files generated by the build. 2 | last-change 3 | -------------------------------------------------------------------------------- /http2/h2demo/.gitignore: -------------------------------------------------------------------------------- 1 | h2demo 2 | h2demo.linux 3 | client-id.dat 4 | client-secret.dat 5 | token.dat 6 | -------------------------------------------------------------------------------- /html/charset/testdata/UTF-16BE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/golang-net/master/html/charset/testdata/UTF-16BE-BOM.html -------------------------------------------------------------------------------- /html/charset/testdata/UTF-16LE-BOM.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dropbox/golang-net/master/html/charset/testdata/UTF-16LE-BOM.html -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This repository holds supplementary Go networking libraries. 2 | 3 | To submit changes to this repository, see http://golang.org/doc/contribute.html. 4 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # This source code refers to The Go Authors for copyright purposes. 2 | # The master list of authors is in the main Go distribution, 3 | # visible at http://tip.golang.org/AUTHORS. 4 | -------------------------------------------------------------------------------- /CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This source code was written by the Go contributors. 2 | # The master list of contributors is in the main Go distribution, 3 | # visible at http://tip.golang.org/CONTRIBUTORS. 4 | -------------------------------------------------------------------------------- /html/testdata/webkit/pending-spec-changes-plain-text-unsafe.dat: -------------------------------------------------------------------------------- 1 | #data 2 | fillertext 3 | #errors 4 | #document 5 | | 6 | | 7 | | 8 | | "fillertext" 9 | |
10 | -------------------------------------------------------------------------------- /ipv4/thunk_linux_386.s: -------------------------------------------------------------------------------- 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 | // +build go1.2 6 | 7 | TEXT ·socketcall(SB),4,$0-36 8 | JMP syscall·socketcall(SB) 9 | -------------------------------------------------------------------------------- /ipv6/thunk_linux_386.s: -------------------------------------------------------------------------------- 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 | // +build go1.2 6 | 7 | TEXT ·socketcall(SB),4,$0-36 8 | JMP syscall·socketcall(SB) 9 | -------------------------------------------------------------------------------- /http2/h2demo/Makefile: -------------------------------------------------------------------------------- 1 | h2demo.linux: h2demo.go 2 | GOOS=linux go build --tags=h2demo -o h2demo.linux . 3 | 4 | FORCE: 5 | 6 | upload: FORCE 7 | go install golang.org/x/build/cmd/upload 8 | upload --verbose --osarch=linux-amd64 --tags=h2demo --file=go:golang.org/x/net/http2/h2demo --public http2-demo-server-tls/h2demo 9 | -------------------------------------------------------------------------------- /internal/nettest/rlimit_windows.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 nettest 6 | 7 | func maxOpenFiles() int { return 4 * defaultMaxOpenFiles /* actually it's 16581375 */ } 8 | -------------------------------------------------------------------------------- /internal/nettest/rlimit_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build nacl plan9 6 | 7 | package nettest 8 | 9 | func maxOpenFiles() int { return defaultMaxOpenFiles } 10 | -------------------------------------------------------------------------------- /icmp/sys_freebsd.go: -------------------------------------------------------------------------------- 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 icmp 6 | 7 | import "syscall" 8 | 9 | func init() { 10 | freebsdVersion, _ = syscall.SysctlUint32("kern.osreldate") 11 | } 12 | -------------------------------------------------------------------------------- /internal/nettest/error_stub.go: -------------------------------------------------------------------------------- 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 | // +build nacl plan9 6 | 7 | package nettest 8 | 9 | func protocolNotSupported(err error) bool { 10 | return false 11 | } 12 | -------------------------------------------------------------------------------- /http2/go15.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build go1.5 6 | 7 | package http2 8 | 9 | import "net/http" 10 | 11 | func requestCancel(req *http.Request) <-chan struct{} { return req.Cancel } 12 | -------------------------------------------------------------------------------- /http2/not_go15.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build !go1.5 6 | 7 | package http2 8 | 9 | import "net/http" 10 | 11 | func requestCancel(req *http.Request) <-chan struct{} { return nil } 12 | -------------------------------------------------------------------------------- /ipv4/sockopt_stub.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 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 | // +build nacl plan9 solaris 6 | 7 | package ipv4 8 | 9 | func setInt(fd int, opt *sockOpt, v int) error { 10 | return errOpNoSupport 11 | } 12 | -------------------------------------------------------------------------------- /ipv4/sys_stub.go: -------------------------------------------------------------------------------- 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 | // +build nacl plan9 solaris 6 | 7 | package ipv4 8 | 9 | type sysSockoptLen int32 10 | 11 | var ( 12 | ctlOpts = [ctlMax]ctlOpt{} 13 | 14 | sockOpts = [ssoMax]sockOpt{} 15 | ) 16 | -------------------------------------------------------------------------------- /ipv6/sys_stub.go: -------------------------------------------------------------------------------- 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 | // +build nacl plan9 solaris 6 | 7 | package ipv6 8 | 9 | type sysSockoptLen int32 10 | 11 | var ( 12 | ctlOpts = [ctlMax]ctlOpt{} 13 | 14 | sockOpts = [ssoMax]sockOpt{} 15 | ) 16 | -------------------------------------------------------------------------------- /http2/not_go16.go: -------------------------------------------------------------------------------- 1 | // Copyright 2015 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 | // +build !go1.6 6 | 7 | package http2 8 | 9 | import "net/http" 10 | 11 | func configureTransport(t1 *http.Transport) (*Transport, error) { 12 | return nil, errTransportVersion 13 | } 14 | -------------------------------------------------------------------------------- /html/testdata/webkit/scripted/adoption01.dat: -------------------------------------------------------------------------------- 1 | #data 2 |

TEXT 3 | #errors 4 | #document 5 | | 6 | | 7 | | 8 | |

9 | | 10 | | id="B" 11 | | 3 3 | #errors 4 | #document 5 | | 6 | | 7 | | 8 | | "1" 9 | | 4 15 | #errors 16 | #document 17 | | 18 | | 19 | | 20 | | "1" 21 | | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 |

No encoding declaration

18 | 19 | 20 |
21 | 22 | 23 |
 
24 | 25 | 26 | 27 | 28 | 29 |
30 |

A page with no encoding information in HTTP, BOM, XML declaration or meta element will be treated as UTF-8.

31 |

The test on this page contains a div with a class name that contains the following sequence of bytes: 0xC3 0xBD 0xC3 0xA4 0xC3 0xA8. These represent different sequences of characters in ISO 8859-15, ISO 8859-1 and UTF-8. The external, UTF-8-encoded stylesheet contains a selector .test div.ýäè. This matches the sequence of bytes above when they are interpreted as UTF-8. If the class name matches the selector then the test will pass.

32 |
33 |
34 |
Next test
HTML5
35 |

the-input-byte-stream-015
Result summary & related tests
Detailed results for this test
Link to spec

36 |
Assumptions:
  • The test is read from a server that supports HTTP.
37 |
38 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ipv6/defs_dragonfly.go: -------------------------------------------------------------------------------- 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 | // +build ignore 6 | 7 | // +godefs map struct_in6_addr [16]byte /* in6_addr */ 8 | 9 | package ipv6 10 | 11 | /* 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | */ 18 | import "C" 19 | 20 | const ( 21 | sysIPV6_UNICAST_HOPS = C.IPV6_UNICAST_HOPS 22 | sysIPV6_MULTICAST_IF = C.IPV6_MULTICAST_IF 23 | sysIPV6_MULTICAST_HOPS = C.IPV6_MULTICAST_HOPS 24 | sysIPV6_MULTICAST_LOOP = C.IPV6_MULTICAST_LOOP 25 | sysIPV6_JOIN_GROUP = C.IPV6_JOIN_GROUP 26 | sysIPV6_LEAVE_GROUP = C.IPV6_LEAVE_GROUP 27 | sysIPV6_PORTRANGE = C.IPV6_PORTRANGE 28 | sysICMP6_FILTER = C.ICMP6_FILTER 29 | 30 | sysIPV6_CHECKSUM = C.IPV6_CHECKSUM 31 | sysIPV6_V6ONLY = C.IPV6_V6ONLY 32 | 33 | sysIPV6_IPSEC_POLICY = C.IPV6_IPSEC_POLICY 34 | 35 | sysIPV6_RTHDRDSTOPTS = C.IPV6_RTHDRDSTOPTS 36 | sysIPV6_RECVPKTINFO = C.IPV6_RECVPKTINFO 37 | sysIPV6_RECVHOPLIMIT = C.IPV6_RECVHOPLIMIT 38 | sysIPV6_RECVRTHDR = C.IPV6_RECVRTHDR 39 | sysIPV6_RECVHOPOPTS = C.IPV6_RECVHOPOPTS 40 | sysIPV6_RECVDSTOPTS = C.IPV6_RECVDSTOPTS 41 | 42 | sysIPV6_USE_MIN_MTU = C.IPV6_USE_MIN_MTU 43 | sysIPV6_RECVPATHMTU = C.IPV6_RECVPATHMTU 44 | 45 | sysIPV6_PATHMTU = C.IPV6_PATHMTU 46 | 47 | sysIPV6_PKTINFO = C.IPV6_PKTINFO 48 | sysIPV6_HOPLIMIT = C.IPV6_HOPLIMIT 49 | sysIPV6_NEXTHOP = C.IPV6_NEXTHOP 50 | sysIPV6_HOPOPTS = C.IPV6_HOPOPTS 51 | sysIPV6_DSTOPTS = C.IPV6_DSTOPTS 52 | sysIPV6_RTHDR = C.IPV6_RTHDR 53 | 54 | sysIPV6_RECVTCLASS = C.IPV6_RECVTCLASS 55 | 56 | sysIPV6_AUTOFLOWLABEL = C.IPV6_AUTOFLOWLABEL 57 | 58 | sysIPV6_TCLASS = C.IPV6_TCLASS 59 | sysIPV6_DONTFRAG = C.IPV6_DONTFRAG 60 | 61 | sysIPV6_PREFER_TEMPADDR = C.IPV6_PREFER_TEMPADDR 62 | 63 | sysIPV6_PORTRANGE_DEFAULT = C.IPV6_PORTRANGE_DEFAULT 64 | sysIPV6_PORTRANGE_HIGH = C.IPV6_PORTRANGE_HIGH 65 | sysIPV6_PORTRANGE_LOW = C.IPV6_PORTRANGE_LOW 66 | 67 | sysSizeofSockaddrInet6 = C.sizeof_struct_sockaddr_in6 68 | sysSizeofInet6Pktinfo = C.sizeof_struct_in6_pktinfo 69 | sysSizeofIPv6Mtuinfo = C.sizeof_struct_ip6_mtuinfo 70 | 71 | sysSizeofIPv6Mreq = C.sizeof_struct_ipv6_mreq 72 | 73 | sysSizeofICMPv6Filter = C.sizeof_struct_icmp6_filter 74 | ) 75 | 76 | type sysSockaddrInet6 C.struct_sockaddr_in6 77 | 78 | type sysInet6Pktinfo C.struct_in6_pktinfo 79 | 80 | type sysIPv6Mtuinfo C.struct_ip6_mtuinfo 81 | 82 | type sysIPv6Mreq C.struct_ipv6_mreq 83 | 84 | type sysICMPv6Filter C.struct_icmp6_filter 85 | -------------------------------------------------------------------------------- /html/atom/atom.go: -------------------------------------------------------------------------------- 1 | // Copyright 2012 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 atom provides integer codes (also known as atoms) for a fixed set of 6 | // frequently occurring HTML strings: tag names and attribute keys such as "p" 7 | // and "id". 8 | // 9 | // Sharing an atom's name between all elements with the same tag can result in 10 | // fewer string allocations when tokenizing and parsing HTML. Integer 11 | // comparisons are also generally faster than string comparisons. 12 | // 13 | // The value of an atom's particular code is not guaranteed to stay the same 14 | // between versions of this package. Neither is any ordering guaranteed: 15 | // whether atom.H1 < atom.H2 may also change. The codes are not guaranteed to 16 | // be dense. The only guarantees are that e.g. looking up "div" will yield 17 | // atom.Div, calling atom.Div.String will return "div", and atom.Div != 0. 18 | package atom // import "golang.org/x/net/html/atom" 19 | 20 | // Atom is an integer code for a string. The zero value maps to "". 21 | type Atom uint32 22 | 23 | // String returns the atom's name. 24 | func (a Atom) String() string { 25 | start := uint32(a >> 8) 26 | n := uint32(a & 0xff) 27 | if start+n > uint32(len(atomText)) { 28 | return "" 29 | } 30 | return atomText[start : start+n] 31 | } 32 | 33 | func (a Atom) string() string { 34 | return atomText[a>>8 : a>>8+a&0xff] 35 | } 36 | 37 | // fnv computes the FNV hash with an arbitrary starting value h. 38 | func fnv(h uint32, s []byte) uint32 { 39 | for i := range s { 40 | h ^= uint32(s[i]) 41 | h *= 16777619 42 | } 43 | return h 44 | } 45 | 46 | func match(s string, t []byte) bool { 47 | for i, c := range t { 48 | if s[i] != c { 49 | return false 50 | } 51 | } 52 | return true 53 | } 54 | 55 | // Lookup returns the atom whose name is s. It returns zero if there is no 56 | // such atom. The lookup is case sensitive. 57 | func Lookup(s []byte) Atom { 58 | if len(s) == 0 || len(s) > maxAtomLen { 59 | return 0 60 | } 61 | h := fnv(hash0, s) 62 | if a := table[h&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { 63 | return a 64 | } 65 | if a := table[(h>>16)&uint32(len(table)-1)]; int(a&0xff) == len(s) && match(a.string(), s) { 66 | return a 67 | } 68 | return 0 69 | } 70 | 71 | // String returns a string whose contents are equal to s. In that sense, it is 72 | // equivalent to string(s) but may be more efficient. 73 | func String(s []byte) string { 74 | if a := Lookup(s); a != 0 { 75 | return a.String() 76 | } 77 | return string(s) 78 | } 79 | --------------------------------------------------------------------------------