diff --git a/doc/go_spec.html b/doc/go_spec.html index 0e52d4d230c..43281c99531 100644 --- a/doc/go_spec.html +++ b/doc/go_spec.html @@ -1,5 +1,5 @@ - + ` var rawTokens = []Token{ - CharData([]byte("\n")), + CharData("\n"), ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + CharData("\n"), + Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), - ), - CharData([]byte("\n")), + CharData("\n"), StartElement{Name{"", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, - CharData([]byte("World <>'\" 白鵬翔")), + CharData("World <>'\" 白鵬翔"), EndElement{Name{"", "hello"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"", "goodbye"}, []Attr{}}, EndElement{Name{"", "goodbye"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"", "outer"}, []Attr{{Name{"foo", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"", "inner"}, []Attr{}}, EndElement{Name{"", "inner"}}, - CharData([]byte("\n ")), + CharData("\n "), EndElement{Name{"", "outer"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"tag", "name"}, []Attr{}}, - CharData([]byte("\n ")), - CharData([]byte("Some text here.")), - CharData([]byte("\n ")), + CharData("\n "), + CharData("Some text here."), + CharData("\n "), EndElement{Name{"tag", "name"}}, - CharData([]byte("\n")), + CharData("\n"), EndElement{Name{"", "body"}}, - Comment([]byte(" missing final newline ")), + Comment(" missing final newline "), } var cookedTokens = []Token{ - CharData([]byte("\n")), + CharData("\n"), ProcInst{"xml", []byte(`version="1.0" encoding="UTF-8"`)}, - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + CharData("\n"), + Directive(`DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"`), - ), - CharData([]byte("\n")), + CharData("\n"), StartElement{Name{"ns2", "body"}, []Attr{{Name{"xmlns", "foo"}, "ns1"}, {Name{"", "xmlns"}, "ns2"}, {Name{"xmlns", "tag"}, "ns3"}}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"ns2", "hello"}, []Attr{{Name{"", "lang"}, "en"}}}, - CharData([]byte("World <>'\" 白鵬翔")), + CharData("World <>'\" 白鵬翔"), EndElement{Name{"ns2", "hello"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"ns2", "goodbye"}, []Attr{}}, EndElement{Name{"ns2", "goodbye"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"ns2", "outer"}, []Attr{{Name{"ns1", "attr"}, "value"}, {Name{"xmlns", "tag"}, "ns4"}}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"ns2", "inner"}, []Attr{}}, EndElement{Name{"ns2", "inner"}}, - CharData([]byte("\n ")), + CharData("\n "), EndElement{Name{"ns2", "outer"}}, - CharData([]byte("\n ")), + CharData("\n "), StartElement{Name{"ns3", "name"}, []Attr{}}, - CharData([]byte("\n ")), - CharData([]byte("Some text here.")), - CharData([]byte("\n ")), + CharData("\n "), + CharData("Some text here."), + CharData("\n "), EndElement{Name{"ns3", "name"}}, - CharData([]byte("\n")), + CharData("\n"), EndElement{Name{"ns2", "body"}}, - Comment([]byte(" missing final newline ")), + Comment(" missing final newline "), } const testInputAltEncoding = ` @@ -101,11 +99,11 @@ const testInputAltEncoding = ` VALUE` var rawTokensAltEncoding = []Token{ - CharData([]byte("\n")), + CharData("\n"), ProcInst{"xml", []byte(`version="1.0" encoding="x-testing-uppercase"`)}, - CharData([]byte("\n")), + CharData("\n"), StartElement{Name{"", "tag"}, []Attr{}}, - CharData([]byte("value")), + CharData("value"), EndElement{Name{"", "tag"}}, } @@ -270,21 +268,21 @@ var nestedDirectivesInput = ` ` var nestedDirectivesTokens = []Token{ - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE []`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE [">]`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE []`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE ['>]`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE []`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE ['>]`)), - CharData([]byte("\n")), - Directive([]byte(`DOCTYPE []`)), - CharData([]byte("\n")), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE [">]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE ['>]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), + Directive(`DOCTYPE ['>]`), + CharData("\n"), + Directive(`DOCTYPE []`), + CharData("\n"), } func TestNestedDirectives(t *testing.T) { diff --git a/src/pkg/net/http/sniff.go b/src/pkg/net/http/sniff.go index 5707c7f057f..c1c78e2417d 100644 --- a/src/pkg/net/http/sniff.go +++ b/src/pkg/net/http/sniff.go @@ -48,23 +48,23 @@ type sniffSig interface { // Data matching the table in section 6. var sniffSignatures = []sniffSig{ - htmlSig([]byte("