mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
all: update comment URLs from HTTP to HTTPS, where possible
Each URL was manually verified to ensure it did not serve up incorrect content. Change-Id: I4dc846227af95a73ee9a3074d0c379ff0fa955df Reviewed-on: https://go-review.googlesource.com/115798 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
7cb1810fe8
commit
161874da2a
130 changed files with 206 additions and 206 deletions
|
|
@ -94,7 +94,7 @@ const (
|
||||||
// application can only parse GNU formatted archives.
|
// application can only parse GNU formatted archives.
|
||||||
//
|
//
|
||||||
// Reference:
|
// Reference:
|
||||||
// http://www.gnu.org/software/tar/manual/html_node/Standard.html
|
// https://www.gnu.org/software/tar/manual/html_node/Standard.html
|
||||||
FormatGNU
|
FormatGNU
|
||||||
|
|
||||||
// Schily's tar format, which is incompatible with USTAR.
|
// Schily's tar format, which is incompatible with USTAR.
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ func timeZone(offset time.Duration) *time.Location {
|
||||||
|
|
||||||
// msDosTimeToTime converts an MS-DOS date and time into a time.Time.
|
// msDosTimeToTime converts an MS-DOS date and time into a time.Time.
|
||||||
// The resolution is 2s.
|
// The resolution is 2s.
|
||||||
// See: http://msdn.microsoft.com/en-us/library/ms724247(v=VS.85).aspx
|
// See: https://msdn.microsoft.com/en-us/library/ms724247(v=VS.85).aspx
|
||||||
func msDosTimeToTime(dosDate, dosTime uint16) time.Time {
|
func msDosTimeToTime(dosDate, dosTime uint16) time.Time {
|
||||||
return time.Date(
|
return time.Date(
|
||||||
// date bits 0-4: day of month; 5-8: month; 9-15: years since 1980
|
// date bits 0-4: day of month; 5-8: month; 9-15: years since 1980
|
||||||
|
|
@ -222,7 +222,7 @@ func msDosTimeToTime(dosDate, dosTime uint16) time.Time {
|
||||||
|
|
||||||
// timeToMsDosTime converts a time.Time to an MS-DOS date and time.
|
// timeToMsDosTime converts a time.Time to an MS-DOS date and time.
|
||||||
// The resolution is 2s.
|
// The resolution is 2s.
|
||||||
// See: http://msdn.microsoft.com/en-us/library/ms724274(v=VS.85).aspx
|
// See: https://msdn.microsoft.com/en-us/library/ms724274(v=VS.85).aspx
|
||||||
func timeToMsDosTime(t time.Time) (fDate uint16, fTime uint16) {
|
func timeToMsDosTime(t time.Time) (fDate uint16, fTime uint16) {
|
||||||
fDate = uint16(t.Day() + int(t.Month())<<5 + (t.Year()-1980)<<9)
|
fDate = uint16(t.Day() + int(t.Month())<<5 + (t.Year()-1980)<<9)
|
||||||
fTime = uint16(t.Second()/2 + t.Minute()<<5 + t.Hour()<<11)
|
fTime = uint16(t.Second()/2 + t.Minute()<<5 + t.Hour()<<11)
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) {
|
||||||
// packedAttribute returns host compiler struct attribute that will be
|
// packedAttribute returns host compiler struct attribute that will be
|
||||||
// used to match gc's struct layout. For example, on 386 Windows,
|
// used to match gc's struct layout. For example, on 386 Windows,
|
||||||
// gcc wants to 8-align int64s, but gc does not.
|
// gcc wants to 8-align int64s, but gc does not.
|
||||||
// Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86,
|
// Use __gcc_struct__ to work around https://gcc.gnu.org/PR52991 on x86,
|
||||||
// and https://golang.org/issue/5603.
|
// and https://golang.org/issue/5603.
|
||||||
func (p *Package) packedAttribute() string {
|
func (p *Package) packedAttribute() string {
|
||||||
s := "__attribute__((__packed__"
|
s := "__attribute__((__packed__"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
|
|
||||||
// This file contains the algorithm to place phi nodes in a function.
|
// This file contains the algorithm to place phi nodes in a function.
|
||||||
// For small functions, we use Braun, Buchwald, Hack, Leißa, Mallon, and Zwinkau.
|
// For small functions, we use Braun, Buchwald, Hack, Leißa, Mallon, and Zwinkau.
|
||||||
// http://pp.info.uni-karlsruhe.de/uploads/publikationen/braun13cc.pdf
|
// https://pp.info.uni-karlsruhe.de/uploads/publikationen/braun13cc.pdf
|
||||||
// For large functions, we use Sreedhar & Gao: A Linear Time Algorithm for Placing Φ-Nodes.
|
// For large functions, we use Sreedhar & Gao: A Linear Time Algorithm for Placing Φ-Nodes.
|
||||||
// http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.8.1979&rep=rep1&type=pdf
|
// http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.8.1979&rep=rep1&type=pdf
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ package ssa
|
||||||
|
|
||||||
import "cmd/internal/src"
|
import "cmd/internal/src"
|
||||||
|
|
||||||
// from http://research.swtch.com/sparse
|
// from https://research.swtch.com/sparse
|
||||||
// in turn, from Briggs and Torczon
|
// in turn, from Briggs and Torczon
|
||||||
|
|
||||||
type sparseEntry struct {
|
type sparseEntry struct {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
package ssa
|
package ssa
|
||||||
|
|
||||||
// from http://research.swtch.com/sparse
|
// from https://research.swtch.com/sparse
|
||||||
// in turn, from Briggs and Torczon
|
// in turn, from Briggs and Torczon
|
||||||
|
|
||||||
type sparseSet struct {
|
type sparseSet struct {
|
||||||
|
|
|
||||||
2
src/cmd/dist/sys_windows.go
vendored
2
src/cmd/dist/sys_windows.go
vendored
|
|
@ -14,7 +14,7 @@ var (
|
||||||
procGetSystemInfo = modkernel32.NewProc("GetSystemInfo")
|
procGetSystemInfo = modkernel32.NewProc("GetSystemInfo")
|
||||||
)
|
)
|
||||||
|
|
||||||
// see http://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
|
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
|
||||||
type systeminfo struct {
|
type systeminfo struct {
|
||||||
wProcessorArchitecture uint16
|
wProcessorArchitecture uint16
|
||||||
wReserved uint16
|
wReserved uint16
|
||||||
|
|
|
||||||
|
|
@ -2925,7 +2925,7 @@ func TestCgoPkgConfig(t *testing.T) {
|
||||||
// OpenBSD's pkg-config is strict about whitespace and only
|
// OpenBSD's pkg-config is strict about whitespace and only
|
||||||
// supports backslash-escaped whitespace. It does not support
|
// supports backslash-escaped whitespace. It does not support
|
||||||
// quotes, which the normal freedesktop.org pkg-config does
|
// quotes, which the normal freedesktop.org pkg-config does
|
||||||
// support. See http://man.openbsd.org/pkg-config.1
|
// support. See https://man.openbsd.org/pkg-config.1
|
||||||
tg.tempFile("foo.pc", `
|
tg.tempFile("foo.pc", `
|
||||||
Name: foo
|
Name: foo
|
||||||
Description: The foo library
|
Description: The foo library
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// LINUX for zSeries ELF Application Binary Interface Supplement
|
// LINUX for zSeries ELF Application Binary Interface Supplement
|
||||||
// http://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x1472.html
|
// https://refspecs.linuxfoundation.org/ELF/zSeries/lzsabi0_zSeries/x1472.html
|
||||||
var S390XDWARFRegisters = map[int16]int16{}
|
var S390XDWARFRegisters = map[int16]int16{}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
|
||||||
|
|
@ -617,7 +617,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
|
||||||
// so for now we'll just use non-lazy pointers,
|
// so for now we'll just use non-lazy pointers,
|
||||||
// which don't need to be told which library to use.
|
// which don't need to be told which library to use.
|
||||||
//
|
//
|
||||||
// http://networkpx.blogspot.com/2009/09/about-lcdyldinfoonly-command.html
|
// https://networkpx.blogspot.com/2009/09/about-lcdyldinfoonly-command.html
|
||||||
// has details about what we're avoiding.
|
// has details about what we're avoiding.
|
||||||
|
|
||||||
addgotsym(ctxt, s)
|
addgotsym(ctxt, s)
|
||||||
|
|
|
||||||
|
|
@ -1962,7 +1962,7 @@ func usage() {
|
||||||
type SymbolType int8
|
type SymbolType int8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// see also http://9p.io/magic/man2html/1/nm
|
// see also https://9p.io/magic/man2html/1/nm
|
||||||
TextSym SymbolType = 'T'
|
TextSym SymbolType = 'T'
|
||||||
DataSym SymbolType = 'D'
|
DataSym SymbolType = 'D'
|
||||||
BSSSym SymbolType = 'B'
|
BSSSym SymbolType = 'B'
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mach-O file writing
|
// Mach-O file writing
|
||||||
// http://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
|
// https://developer.apple.com/mac/library/DOCUMENTATION/DeveloperTools/Conceptual/MachORuntime/Reference/reference.html
|
||||||
|
|
||||||
var machohdr MachoHdr
|
var machohdr MachoHdr
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ const (
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// PE (Portable Executable) file writing
|
// PE (Portable Executable) file writing
|
||||||
// http://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
|
// https://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx
|
||||||
|
|
||||||
// DOS stub that prints out
|
// DOS stub that prints out
|
||||||
// "This program cannot be run in DOS mode."
|
// "This program cannot be run in DOS mode."
|
||||||
|
|
|
||||||
|
|
@ -1048,7 +1048,7 @@ func readelfsym(arch *sys.Arch, syms *sym.Symbols, elfobj *ElfObj, i int, elfsym
|
||||||
// __i686.get_pc_thunk.bx is allowed to be duplicated, to
|
// __i686.get_pc_thunk.bx is allowed to be duplicated, to
|
||||||
// workaround that we set dupok.
|
// workaround that we set dupok.
|
||||||
// TODO(minux): correctly handle __i686.get_pc_thunk.bx without
|
// TODO(minux): correctly handle __i686.get_pc_thunk.bx without
|
||||||
// set dupok generally. See http://codereview.appspot.com/5823055/
|
// set dupok generally. See https://golang.org/cl/5823055
|
||||||
// comment #5 for details.
|
// comment #5 for details.
|
||||||
if s != nil && elfsym.other == 2 {
|
if s != nil && elfsym.other == 2 {
|
||||||
s.Attr |= sym.AttrDuplicateOK | sym.AttrVisibilityHidden
|
s.Attr |= sym.AttrDuplicateOK | sym.AttrVisibilityHidden
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ func assignAddress(ctxt *ld.Link, sect *sym.Section, n int, s *sym.Symbol, va ui
|
||||||
}
|
}
|
||||||
|
|
||||||
// asmb writes the final WebAssembly module binary.
|
// asmb writes the final WebAssembly module binary.
|
||||||
// Spec: http://webassembly.github.io/spec/core/binary/modules.html
|
// Spec: https://webassembly.github.io/spec/core/binary/modules.html
|
||||||
func asmb(ctxt *ld.Link) {
|
func asmb(ctxt *ld.Link) {
|
||||||
if ctxt.Debugvlog != 0 {
|
if ctxt.Debugvlog != 0 {
|
||||||
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
|
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ package bzip2
|
||||||
import "io"
|
import "io"
|
||||||
|
|
||||||
// There's no RFC for bzip2. I used the Wikipedia page for reference and a lot
|
// There's no RFC for bzip2. I used the Wikipedia page for reference and a lot
|
||||||
// of guessing: http://en.wikipedia.org/wiki/Bzip2
|
// of guessing: https://en.wikipedia.org/wiki/Bzip2
|
||||||
// The source code to pyflate was useful for debugging:
|
// The source code to pyflate was useful for debugging:
|
||||||
// http://www.paul.sladen.org/projects/pyflate
|
// http://www.paul.sladen.org/projects/pyflate
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -720,7 +720,7 @@ func (w *Writer) Write(data []byte) (n int, err error) {
|
||||||
// In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.
|
// In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.
|
||||||
func (w *Writer) Flush() error {
|
func (w *Writer) Flush() error {
|
||||||
// For more about flushing:
|
// For more about flushing:
|
||||||
// http://www.bolet.org/~pornin/deflate-flush.html
|
// https://www.bolet.org/~pornin/deflate-flush.html
|
||||||
return w.d.syncFlush()
|
return w.d.syncFlush()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ var lzwTests = []lzwTest{
|
||||||
"\x54\x9e\x08\x29\xf2\x44\x8a\x93\x27\x54\x04",
|
"\x54\x9e\x08\x29\xf2\x44\x8a\x93\x27\x54\x04",
|
||||||
io.ErrUnexpectedEOF,
|
io.ErrUnexpectedEOF,
|
||||||
},
|
},
|
||||||
// This example comes from http://en.wikipedia.org/wiki/Graphics_Interchange_Format.
|
// This example comes from https://en.wikipedia.org/wiki/Graphics_Interchange_Format.
|
||||||
{
|
{
|
||||||
"gif;LSB;8",
|
"gif;LSB;8",
|
||||||
"\x28\xff\xff\xff\x28\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
|
"\x28\xff\xff\xff\x28\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ type zlibTest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare-to-golden test data was generated by the ZLIB example program at
|
// Compare-to-golden test data was generated by the ZLIB example program at
|
||||||
// http://www.zlib.net/zpipe.c
|
// https://www.zlib.net/zpipe.c
|
||||||
|
|
||||||
var zlibTests = []zlibTest{
|
var zlibTests = []zlibTest{
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ func TestTd(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test vectors are from FIPS 197:
|
// Test vectors are from FIPS 197:
|
||||||
// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
// https://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||||
|
|
||||||
// Appendix A of FIPS 197: Key expansion examples
|
// Appendix A of FIPS 197: Key expansion examples
|
||||||
type KeyTest struct {
|
type KeyTest struct {
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@
|
||||||
//
|
//
|
||||||
// See FIPS 197 for specification, and see Daemen and Rijmen's Rijndael submission
|
// See FIPS 197 for specification, and see Daemen and Rijmen's Rijndael submission
|
||||||
// for implementation details.
|
// for implementation details.
|
||||||
// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
// https://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||||
// http://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf
|
// https://csrc.nist.gov/archive/aes/rijndael/Rijndael-ammended.pdf
|
||||||
|
|
||||||
package aes
|
package aes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ package aes
|
||||||
|
|
||||||
// This file contains AES constants - 8720 bytes of initialized data.
|
// This file contains AES constants - 8720 bytes of initialized data.
|
||||||
|
|
||||||
// http://www.csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
// https://csrc.nist.gov/publications/fips/fips197/fips-197.pdf
|
||||||
|
|
||||||
// AES is based on the mathematical behavior of binary polynomials
|
// AES is based on the mathematical behavior of binary polynomials
|
||||||
// (polynomials over GF(2)) modulo the irreducible polynomial x⁸ + x⁴ + x³ + x + 1.
|
// (polynomials over GF(2)) modulo the irreducible polynomial x⁸ + x⁴ + x³ + x + 1.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// cfbTests contains the test vectors from
|
// cfbTests contains the test vectors from
|
||||||
// http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, section
|
// https://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf, section
|
||||||
// F.3.13.
|
// F.3.13.
|
||||||
var cfbTests = []struct {
|
var cfbTests = []struct {
|
||||||
key, iv, plaintext, ciphertext string
|
key, iv, plaintext, ciphertext string
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package cipher implements standard block cipher modes that can be wrapped
|
// Package cipher implements standard block cipher modes that can be wrapped
|
||||||
// around low-level block cipher implementations.
|
// around low-level block cipher implementations.
|
||||||
// See http://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html
|
// See https://csrc.nist.gov/groups/ST/toolkit/BCM/current_modes.html
|
||||||
// and NIST Special Publication 800-38A.
|
// and NIST Special Publication 800-38A.
|
||||||
package cipher
|
package cipher
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ type gcmFieldElement struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// gcm represents a Galois Counter Mode with a specific key. See
|
// gcm represents a Galois Counter Mode with a specific key. See
|
||||||
// http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf
|
// https://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf
|
||||||
type gcm struct {
|
type gcm struct {
|
||||||
cipher Block
|
cipher Block
|
||||||
nonceSize int
|
nonceSize int
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ func fromHex(s string) *big.Int {
|
||||||
|
|
||||||
func TestVectors(t *testing.T) {
|
func TestVectors(t *testing.T) {
|
||||||
// This test runs the full set of NIST test vectors from
|
// This test runs the full set of NIST test vectors from
|
||||||
// http://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvectors.zip
|
// https://csrc.nist.gov/groups/STM/cavp/documents/dss/186-3ecdsatestvectors.zip
|
||||||
//
|
//
|
||||||
// The SigVer.rsp file has been edited to remove test vectors for
|
// The SigVer.rsp file has been edited to remove test vectors for
|
||||||
// unsupported algorithms and has been compressed.
|
// unsupported algorithms and has been compressed.
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Curve represents a short-form Weierstrass curve with a=-3.
|
// A Curve represents a short-form Weierstrass curve with a=-3.
|
||||||
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
|
// See https://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
|
||||||
type Curve interface {
|
type Curve interface {
|
||||||
// Params returns the parameters for the curve.
|
// Params returns the parameters for the curve.
|
||||||
Params() *CurveParams
|
Params() *CurveParams
|
||||||
|
|
@ -108,7 +108,7 @@ func (curve *CurveParams) Add(x1, y1, x2, y2 *big.Int) (*big.Int, *big.Int) {
|
||||||
// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and
|
// addJacobian takes two points in Jacobian coordinates, (x1, y1, z1) and
|
||||||
// (x2, y2, z2) and returns their sum, also in Jacobian form.
|
// (x2, y2, z2) and returns their sum, also in Jacobian form.
|
||||||
func (curve *CurveParams) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) {
|
func (curve *CurveParams) addJacobian(x1, y1, z1, x2, y2, z2 *big.Int) (*big.Int, *big.Int, *big.Int) {
|
||||||
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl
|
// See https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-2007-bl
|
||||||
x3, y3, z3 := new(big.Int), new(big.Int), new(big.Int)
|
x3, y3, z3 := new(big.Int), new(big.Int), new(big.Int)
|
||||||
if z1.Sign() == 0 {
|
if z1.Sign() == 0 {
|
||||||
x3.Set(x2)
|
x3.Set(x2)
|
||||||
|
|
@ -191,7 +191,7 @@ func (curve *CurveParams) Double(x1, y1 *big.Int) (*big.Int, *big.Int) {
|
||||||
// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and
|
// doubleJacobian takes a point in Jacobian coordinates, (x, y, z), and
|
||||||
// returns its double, also in Jacobian form.
|
// returns its double, also in Jacobian form.
|
||||||
func (curve *CurveParams) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) {
|
func (curve *CurveParams) doubleJacobian(x, y, z *big.Int) (*big.Int, *big.Int, *big.Int) {
|
||||||
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
|
// See https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
|
||||||
delta := new(big.Int).Mul(z, z)
|
delta := new(big.Int).Mul(z, z)
|
||||||
delta.Mod(delta, curve.P)
|
delta.Mod(delta, curve.P)
|
||||||
gamma := new(big.Int).Mul(y, y)
|
gamma := new(big.Int).Mul(y, y)
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ package elliptic
|
||||||
// This is a constant-time, 32-bit implementation of P224. See FIPS 186-3,
|
// This is a constant-time, 32-bit implementation of P224. See FIPS 186-3,
|
||||||
// section D.2.2.
|
// section D.2.2.
|
||||||
//
|
//
|
||||||
// See http://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background.
|
// See https://www.imperialviolet.org/2010/12/04/ecc.html ([1]) for background.
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -503,7 +503,7 @@ func p224Contract(out, in *p224FieldElement) {
|
||||||
|
|
||||||
// p224AddJacobian computes *out = a+b where a != b.
|
// p224AddJacobian computes *out = a+b where a != b.
|
||||||
func p224AddJacobian(x3, y3, z3, x1, y1, z1, x2, y2, z2 *p224FieldElement) {
|
func p224AddJacobian(x3, y3, z3, x1, y1, z1, x2, y2, z2 *p224FieldElement) {
|
||||||
// See http://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-p224Add-2007-bl
|
// See https://hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-p224Add-2007-bl
|
||||||
var z1z1, z2z2, u1, u2, s1, s2, h, i, j, r, v p224FieldElement
|
var z1z1, z2z2, u1, u2, s1, s2, h, i, j, r, v p224FieldElement
|
||||||
var c p224LargeFieldElement
|
var c p224LargeFieldElement
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -817,7 +817,7 @@ func p256Scalar8(out *[p256Limbs]uint32) {
|
||||||
|
|
||||||
// p256PointDouble sets {xOut,yOut,zOut} = 2*{x,y,z}.
|
// p256PointDouble sets {xOut,yOut,zOut} = 2*{x,y,z}.
|
||||||
//
|
//
|
||||||
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
|
// See https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#doubling-dbl-2009-l
|
||||||
func p256PointDouble(xOut, yOut, zOut, x, y, z *[p256Limbs]uint32) {
|
func p256PointDouble(xOut, yOut, zOut, x, y, z *[p256Limbs]uint32) {
|
||||||
var delta, gamma, alpha, beta, tmp, tmp2 [p256Limbs]uint32
|
var delta, gamma, alpha, beta, tmp, tmp2 [p256Limbs]uint32
|
||||||
|
|
||||||
|
|
@ -850,7 +850,7 @@ func p256PointDouble(xOut, yOut, zOut, x, y, z *[p256Limbs]uint32) {
|
||||||
// p256PointAddMixed sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,1}.
|
// p256PointAddMixed sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,1}.
|
||||||
// (i.e. the second point is affine.)
|
// (i.e. the second point is affine.)
|
||||||
//
|
//
|
||||||
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
|
// See https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
|
||||||
//
|
//
|
||||||
// Note that this function does not handle P+P, infinity+P nor P+infinity
|
// Note that this function does not handle P+P, infinity+P nor P+infinity
|
||||||
// correctly.
|
// correctly.
|
||||||
|
|
@ -886,7 +886,7 @@ func p256PointAddMixed(xOut, yOut, zOut, x1, y1, z1, x2, y2 *[p256Limbs]uint32)
|
||||||
|
|
||||||
// p256PointAdd sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,z2}.
|
// p256PointAdd sets {xOut,yOut,zOut} = {x1,y1,z1} + {x2,y2,z2}.
|
||||||
//
|
//
|
||||||
// See http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
|
// See https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#addition-add-2007-bl
|
||||||
//
|
//
|
||||||
// Note that this function does not handle P+P, infinity+P nor P+infinity
|
// Note that this function does not handle P+P, infinity+P nor P+infinity
|
||||||
// correctly.
|
// correctly.
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
// detail in:
|
// detail in:
|
||||||
// S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with
|
// S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with
|
||||||
// 256-bit primes"
|
// 256-bit primes"
|
||||||
// http://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
// https://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
||||||
// https://eprint.iacr.org/2013/816.pdf
|
// https://eprint.iacr.org/2013/816.pdf
|
||||||
|
|
||||||
// +build amd64
|
// +build amd64
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
// P256. The optimizations performed here are described in detail in:
|
// P256. The optimizations performed here are described in detail in:
|
||||||
// S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with
|
// S.Gueron and V.Krasnov, "Fast prime field elliptic-curve cryptography with
|
||||||
// 256-bit primes"
|
// 256-bit primes"
|
||||||
// http://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
// https://link.springer.com/article/10.1007%2Fs13389-014-0090-x
|
||||||
// https://eprint.iacr.org/2013/816.pdf
|
// https://eprint.iacr.org/2013/816.pdf
|
||||||
|
|
||||||
#include "textflag.h"
|
#include "textflag.h"
|
||||||
|
|
|
||||||
|
|
@ -1733,9 +1733,9 @@ TEXT ·p256PointAddAffineAsm(SB), NOSPLIT, $0
|
||||||
#undef CAR2
|
#undef CAR2
|
||||||
|
|
||||||
// p256PointDoubleAsm(P3, P1 *p256Point)
|
// p256PointDoubleAsm(P3, P1 *p256Point)
|
||||||
// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html#doubling-dbl-2007-bl
|
// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html#doubling-dbl-2007-bl
|
||||||
// http://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
|
// https://www.hyperelliptic.org/EFD/g1p/auto-shortw.html
|
||||||
// http://www.hyperelliptic.org/EFD/g1p/auto-shortw-projective-3.html
|
// https://www.hyperelliptic.org/EFD/g1p/auto-shortw-projective-3.html
|
||||||
#define P3ptr R1
|
#define P3ptr R1
|
||||||
#define P1ptr R2
|
#define P1ptr R2
|
||||||
#define CPOOL R4
|
#define CPOOL R4
|
||||||
|
|
@ -1783,7 +1783,7 @@ TEXT ·p256PointAddAffineAsm(SB), NOSPLIT, $0
|
||||||
#define CAR1 V28
|
#define CAR1 V28
|
||||||
#define CAR2 V29
|
#define CAR2 V29
|
||||||
/*
|
/*
|
||||||
* http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2004-hmv
|
* https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2004-hmv
|
||||||
* Cost: 4M + 4S + 1*half + 5add + 2*2 + 1*3.
|
* Cost: 4M + 4S + 1*half + 5add + 2*2 + 1*3.
|
||||||
* Source: 2004 Hankerson–Menezes–Vanstone, page 91.
|
* Source: 2004 Hankerson–Menezes–Vanstone, page 91.
|
||||||
* A = 3(X₁-Z₁²)×(X₁+Z₁²)
|
* A = 3(X₁-Z₁²)×(X₁+Z₁²)
|
||||||
|
|
@ -1995,7 +1995,7 @@ TEXT ·p256PointDoubleAsm(SB), NOSPLIT, $0
|
||||||
* Y₃ = D×(A×C² - X₃) - B×C³
|
* Y₃ = D×(A×C² - X₃) - B×C³
|
||||||
* Z₃ = Z₁×Z₂×C
|
* Z₃ = Z₁×Z₂×C
|
||||||
*
|
*
|
||||||
* Three-operand formula (adopted): http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-1998-cmo-2
|
* Three-operand formula (adopted): https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#addition-add-1998-cmo-2
|
||||||
* Temp storage: T1,T2,U1,H,Z3=X3=Y3,S1,R
|
* Temp storage: T1,T2,U1,H,Z3=X3=Y3,S1,R
|
||||||
*
|
*
|
||||||
* T1 = Z1*Z1
|
* T1 = Z1*Z1
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIPS 198-1:
|
// FIPS 198-1:
|
||||||
// http://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf
|
// https://csrc.nist.gov/publications/fips/fips198-1/FIPS-198-1_final.pdf
|
||||||
|
|
||||||
// key is zero padded to the block size of the hash function
|
// key is zero padded to the block size of the hash function
|
||||||
// ipad = 0x36 byte repeated for key length
|
// ipad = 0x36 byte repeated for key length
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ type hmacTest struct {
|
||||||
|
|
||||||
var hmacTests = []hmacTest{
|
var hmacTests = []hmacTest{
|
||||||
// Tests from US FIPS 198
|
// Tests from US FIPS 198
|
||||||
// http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf
|
// https://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf
|
||||||
{
|
{
|
||||||
sha1.New,
|
sha1.New,
|
||||||
[]byte{
|
[]byte{
|
||||||
|
|
@ -205,7 +205,7 @@ var hmacTests = []hmacTest{
|
||||||
sha256.BlockSize,
|
sha256.BlockSize,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Tests from http://csrc.nist.gov/groups/ST/toolkit/examples.html
|
// Tests from https://csrc.nist.gov/groups/ST/toolkit/examples.html
|
||||||
// (truncated tag tests are left out)
|
// (truncated tag tests are left out)
|
||||||
{
|
{
|
||||||
sha1.New,
|
sha1.New,
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type rc4Test struct {
|
||||||
|
|
||||||
var golden = []rc4Test{
|
var golden = []rc4Test{
|
||||||
// Test vectors from the original cypherpunk posting of ARC4:
|
// Test vectors from the original cypherpunk posting of ARC4:
|
||||||
// http://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1
|
// https://groups.google.com/group/sci.crypt/msg/10a300c9d21afca0?pli=1
|
||||||
{
|
{
|
||||||
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
|
[]byte{0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef},
|
||||||
[]byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79},
|
[]byte{0x74, 0x94, 0xc2, 0xe7, 0x10, 0x4b, 0x08, 0x79},
|
||||||
|
|
@ -30,7 +30,7 @@ var golden = []rc4Test{
|
||||||
[]byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61},
|
[]byte{0xd6, 0xa1, 0x41, 0xa7, 0xec, 0x3c, 0x38, 0xdf, 0xbd, 0x61},
|
||||||
},
|
},
|
||||||
|
|
||||||
// Test vectors from the Wikipedia page: http://en.wikipedia.org/wiki/RC4
|
// Test vectors from the Wikipedia page: https://en.wikipedia.org/wiki/RC4
|
||||||
{
|
{
|
||||||
[]byte{0x4b, 0x65, 0x79},
|
[]byte{0x4b, 0x65, 0x79},
|
||||||
[]byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19},
|
[]byte{0xeb, 0x9f, 0x77, 0x81, 0xb7, 0x34, 0xca, 0x72, 0xa7, 0x19},
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ var (
|
||||||
// We require pub.E to fit into a 32-bit integer so that we
|
// We require pub.E to fit into a 32-bit integer so that we
|
||||||
// do not have different behavior depending on whether
|
// do not have different behavior depending on whether
|
||||||
// int is 32 or 64 bits. See also
|
// int is 32 or 64 bits. See also
|
||||||
// http://www.imperialviolet.org/2012/03/16/rsae.html.
|
// https://www.imperialviolet.org/2012/03/16/rsae.html.
|
||||||
func checkPub(pub *PublicKey) error {
|
func checkPub(pub *PublicKey) error {
|
||||||
if pub.N == nil {
|
if pub.N == nil {
|
||||||
return errPublicModulus
|
return errPublicModulus
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
//
|
//
|
||||||
// The algorithm is detailed in FIPS 180-4:
|
// The algorithm is detailed in FIPS 180-4:
|
||||||
//
|
//
|
||||||
// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
// https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
||||||
//
|
//
|
||||||
// Wt = Mt; for 0 <= t <= 15
|
// Wt = Mt; for 0 <= t <= 15
|
||||||
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63
|
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
//
|
//
|
||||||
// The algorithm is detailed in FIPS 180-4:
|
// The algorithm is detailed in FIPS 180-4:
|
||||||
//
|
//
|
||||||
// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
// https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
||||||
|
|
||||||
// The avx2-version is described in an Intel White-Paper:
|
// The avx2-version is described in an Intel White-Paper:
|
||||||
// "Fast SHA-256 Implementations on Intel Architecture Processors"
|
// "Fast SHA-256 Implementations on Intel Architecture Processors"
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
//
|
//
|
||||||
// The algorithm is detailed in FIPS 180-4:
|
// The algorithm is detailed in FIPS 180-4:
|
||||||
//
|
//
|
||||||
// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
// https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
||||||
//
|
//
|
||||||
// Wt = Mt; for 0 <= t <= 15
|
// Wt = Mt; for 0 <= t <= 15
|
||||||
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63
|
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 63
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
//
|
//
|
||||||
// The algorithm is detailed in FIPS 180-4:
|
// The algorithm is detailed in FIPS 180-4:
|
||||||
//
|
//
|
||||||
// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
// https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
||||||
//
|
//
|
||||||
// Wt = Mt; for 0 <= t <= 15
|
// Wt = Mt; for 0 <= t <= 15
|
||||||
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 79
|
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 79
|
||||||
|
|
@ -274,7 +274,7 @@ end:
|
||||||
|
|
||||||
// Version below is based on "Fast SHA512 Implementations on Intel
|
// Version below is based on "Fast SHA512 Implementations on Intel
|
||||||
// Architecture Processors" White-paper
|
// Architecture Processors" White-paper
|
||||||
// http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-sha512-implementations-ia-processors-paper.pdf
|
// https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-sha512-implementations-ia-processors-paper.pdf
|
||||||
// AVX2 version by Intel, same algorithm in Linux kernel:
|
// AVX2 version by Intel, same algorithm in Linux kernel:
|
||||||
// https://github.com/torvalds/linux/blob/master/arch/x86/crypto/sha512-avx2-asm.S
|
// https://github.com/torvalds/linux/blob/master/arch/x86/crypto/sha512-avx2-asm.S
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
//
|
//
|
||||||
// The algorithm is detailed in FIPS 180-4:
|
// The algorithm is detailed in FIPS 180-4:
|
||||||
//
|
//
|
||||||
// http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
// https://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
|
||||||
//
|
//
|
||||||
// Wt = Mt; for 0 <= t <= 15
|
// Wt = Mt; for 0 <= t <= 15
|
||||||
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 79
|
// Wt = SIGMA1(Wt-2) + SIGMA0(Wt-15) + Wt-16; for 16 <= t <= 79
|
||||||
|
|
|
||||||
|
|
@ -246,19 +246,19 @@ type ClientHelloInfo struct {
|
||||||
// ServerName indicates the name of the server requested by the client
|
// ServerName indicates the name of the server requested by the client
|
||||||
// in order to support virtual hosting. ServerName is only set if the
|
// in order to support virtual hosting. ServerName is only set if the
|
||||||
// client is using SNI (see
|
// client is using SNI (see
|
||||||
// http://tools.ietf.org/html/rfc4366#section-3.1).
|
// https://tools.ietf.org/html/rfc4366#section-3.1).
|
||||||
ServerName string
|
ServerName string
|
||||||
|
|
||||||
// SupportedCurves lists the elliptic curves supported by the client.
|
// SupportedCurves lists the elliptic curves supported by the client.
|
||||||
// SupportedCurves is set only if the Supported Elliptic Curves
|
// SupportedCurves is set only if the Supported Elliptic Curves
|
||||||
// Extension is being used (see
|
// Extension is being used (see
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.1.1).
|
// https://tools.ietf.org/html/rfc4492#section-5.1.1).
|
||||||
SupportedCurves []CurveID
|
SupportedCurves []CurveID
|
||||||
|
|
||||||
// SupportedPoints lists the point formats supported by the client.
|
// SupportedPoints lists the point formats supported by the client.
|
||||||
// SupportedPoints is set only if the Supported Point Formats Extension
|
// SupportedPoints is set only if the Supported Point Formats Extension
|
||||||
// is being used (see
|
// is being used (see
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.1.2).
|
// https://tools.ietf.org/html/rfc4492#section-5.1.2).
|
||||||
SupportedPoints []uint8
|
SupportedPoints []uint8
|
||||||
|
|
||||||
// SignatureSchemes lists the signature and hash schemes that the client
|
// SignatureSchemes lists the signature and hash schemes that the client
|
||||||
|
|
|
||||||
|
|
@ -1061,9 +1061,9 @@ func (c *Conn) Write(b []byte) (int, error) {
|
||||||
// This can be prevented by splitting each Application Data
|
// This can be prevented by splitting each Application Data
|
||||||
// record into two records, effectively randomizing the IV.
|
// record into two records, effectively randomizing the IV.
|
||||||
//
|
//
|
||||||
// http://www.openssl.org/~bodo/tls-cbc.txt
|
// https://www.openssl.org/~bodo/tls-cbc.txt
|
||||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=665814
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=665814
|
||||||
// http://www.imperialviolet.org/2012/01/15/beastfollowup.html
|
// https://www.imperialviolet.org/2012/01/15/beastfollowup.html
|
||||||
|
|
||||||
var m int
|
var m int
|
||||||
if len(b) > 1 && c.vers <= VersionTLS10 {
|
if len(b) > 1 && c.vers <= VersionTLS10 {
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ func (m *clientHelloMsg) marshal() []byte {
|
||||||
z = z[9:]
|
z = z[9:]
|
||||||
}
|
}
|
||||||
if len(m.supportedCurves) > 0 {
|
if len(m.supportedCurves) > 0 {
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.5.1
|
// https://tools.ietf.org/html/rfc4492#section-5.5.1
|
||||||
z[0] = byte(extensionSupportedCurves >> 8)
|
z[0] = byte(extensionSupportedCurves >> 8)
|
||||||
z[1] = byte(extensionSupportedCurves)
|
z[1] = byte(extensionSupportedCurves)
|
||||||
l := 2 + 2*len(m.supportedCurves)
|
l := 2 + 2*len(m.supportedCurves)
|
||||||
|
|
@ -209,7 +209,7 @@ func (m *clientHelloMsg) marshal() []byte {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(m.supportedPoints) > 0 {
|
if len(m.supportedPoints) > 0 {
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.5.2
|
// https://tools.ietf.org/html/rfc4492#section-5.5.2
|
||||||
z[0] = byte(extensionSupportedPoints >> 8)
|
z[0] = byte(extensionSupportedPoints >> 8)
|
||||||
z[1] = byte(extensionSupportedPoints)
|
z[1] = byte(extensionSupportedPoints)
|
||||||
l := 1 + len(m.supportedPoints)
|
l := 1 + len(m.supportedPoints)
|
||||||
|
|
@ -224,7 +224,7 @@ func (m *clientHelloMsg) marshal() []byte {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if m.ticketSupported {
|
if m.ticketSupported {
|
||||||
// http://tools.ietf.org/html/rfc5077#section-3.2
|
// https://tools.ietf.org/html/rfc5077#section-3.2
|
||||||
z[0] = byte(extensionSessionTicket >> 8)
|
z[0] = byte(extensionSessionTicket >> 8)
|
||||||
z[1] = byte(extensionSessionTicket)
|
z[1] = byte(extensionSessionTicket)
|
||||||
l := len(m.sessionTicket)
|
l := len(m.sessionTicket)
|
||||||
|
|
@ -414,7 +414,7 @@ func (m *clientHelloMsg) unmarshal(data []byte) bool {
|
||||||
case extensionStatusRequest:
|
case extensionStatusRequest:
|
||||||
m.ocspStapling = length > 0 && data[0] == statusTypeOCSP
|
m.ocspStapling = length > 0 && data[0] == statusTypeOCSP
|
||||||
case extensionSupportedCurves:
|
case extensionSupportedCurves:
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.5.1
|
// https://tools.ietf.org/html/rfc4492#section-5.5.1
|
||||||
if length < 2 {
|
if length < 2 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -430,7 +430,7 @@ func (m *clientHelloMsg) unmarshal(data []byte) bool {
|
||||||
d = d[2:]
|
d = d[2:]
|
||||||
}
|
}
|
||||||
case extensionSupportedPoints:
|
case extensionSupportedPoints:
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.5.2
|
// https://tools.ietf.org/html/rfc4492#section-5.5.2
|
||||||
if length < 1 {
|
if length < 1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +441,7 @@ func (m *clientHelloMsg) unmarshal(data []byte) bool {
|
||||||
m.supportedPoints = make([]uint8, l)
|
m.supportedPoints = make([]uint8, l)
|
||||||
copy(m.supportedPoints, data[1:])
|
copy(m.supportedPoints, data[1:])
|
||||||
case extensionSessionTicket:
|
case extensionSessionTicket:
|
||||||
// http://tools.ietf.org/html/rfc5077#section-3.2
|
// https://tools.ietf.org/html/rfc5077#section-3.2
|
||||||
m.ticketSupported = true
|
m.ticketSupported = true
|
||||||
m.sessionTicket = data[:length]
|
m.sessionTicket = data[:length]
|
||||||
case extensionSignatureAlgorithms:
|
case extensionSignatureAlgorithms:
|
||||||
|
|
@ -1224,7 +1224,7 @@ func (m *certificateRequestMsg) marshal() (x []byte) {
|
||||||
return m.raw
|
return m.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://tools.ietf.org/html/rfc4346#section-7.4.4
|
// See https://tools.ietf.org/html/rfc4346#section-7.4.4
|
||||||
length := 1 + len(m.certificateTypes) + 2
|
length := 1 + len(m.certificateTypes) + 2
|
||||||
casLength := 0
|
casLength := 0
|
||||||
for _, ca := range m.certificateAuthorities {
|
for _, ca := range m.certificateAuthorities {
|
||||||
|
|
@ -1374,7 +1374,7 @@ func (m *certificateVerifyMsg) marshal() (x []byte) {
|
||||||
return m.raw
|
return m.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://tools.ietf.org/html/rfc4346#section-7.4.8
|
// See https://tools.ietf.org/html/rfc4346#section-7.4.8
|
||||||
siglength := len(m.signature)
|
siglength := len(m.signature)
|
||||||
length := 2 + siglength
|
length := 2 + siglength
|
||||||
if m.hasSignatureAndHash {
|
if m.hasSignatureAndHash {
|
||||||
|
|
@ -1452,7 +1452,7 @@ func (m *newSessionTicketMsg) marshal() (x []byte) {
|
||||||
return m.raw
|
return m.raw
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://tools.ietf.org/html/rfc5077#section-3.3
|
// See https://tools.ietf.org/html/rfc5077#section-3.3
|
||||||
ticketLen := len(m.ticket)
|
ticketLen := len(m.ticket)
|
||||||
length := 2 + 4 + ticketLen
|
length := 2 + 4 + ticketLen
|
||||||
x = make([]byte, 4+length)
|
x = make([]byte, 4+length)
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func pickTLS12HashForSignature(sigType uint8, clientList []SignatureScheme) (Sig
|
||||||
if len(clientList) == 0 {
|
if len(clientList) == 0 {
|
||||||
// If the client didn't specify any signature_algorithms
|
// If the client didn't specify any signature_algorithms
|
||||||
// extension then we can assume that it supports SHA1. See
|
// extension then we can assume that it supports SHA1. See
|
||||||
// http://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
|
// https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
|
||||||
switch sigType {
|
switch sigType {
|
||||||
case signatureRSA:
|
case signatureRSA:
|
||||||
return PKCS1WithSHA1, nil
|
return PKCS1WithSHA1, nil
|
||||||
|
|
@ -239,7 +239,7 @@ NextCandidate:
|
||||||
ecdhePublic = elliptic.Marshal(curve, x, y)
|
ecdhePublic = elliptic.Marshal(curve, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://tools.ietf.org/html/rfc4492#section-5.4
|
// https://tools.ietf.org/html/rfc4492#section-5.4
|
||||||
serverECDHParams := make([]byte, 1+2+1+len(ecdhePublic))
|
serverECDHParams := make([]byte, 1+2+1+len(ecdhePublic))
|
||||||
serverECDHParams[0] = 3 // named curve
|
serverECDHParams[0] = 3 // named curve
|
||||||
serverECDHParams[1] = byte(ka.curveid >> 8)
|
serverECDHParams[1] = byte(ka.curveid >> 8)
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ func prfForVersion(version uint16, suite *cipherSuite) func(result, secret, labe
|
||||||
}
|
}
|
||||||
|
|
||||||
// masterFromPreMasterSecret generates the master secret from the pre-master
|
// masterFromPreMasterSecret generates the master secret from the pre-master
|
||||||
// secret. See http://tools.ietf.org/html/rfc5246#section-8.1
|
// secret. See https://tools.ietf.org/html/rfc5246#section-8.1
|
||||||
func masterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, clientRandom, serverRandom []byte) []byte {
|
func masterFromPreMasterSecret(version uint16, suite *cipherSuite, preMasterSecret, clientRandom, serverRandom []byte) []byte {
|
||||||
seed := make([]byte, 0, len(clientRandom)+len(serverRandom))
|
seed := make([]byte, 0, len(clientRandom)+len(serverRandom))
|
||||||
seed = append(seed, clientRandom...)
|
seed = append(seed, clientRandom...)
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ func (r RDNSequence) String() string {
|
||||||
type RelativeDistinguishedNameSET []AttributeTypeAndValue
|
type RelativeDistinguishedNameSET []AttributeTypeAndValue
|
||||||
|
|
||||||
// AttributeTypeAndValue mirrors the ASN.1 structure of the same name in
|
// AttributeTypeAndValue mirrors the ASN.1 structure of the same name in
|
||||||
// http://tools.ietf.org/html/rfc5280#section-4.1.2.4
|
// https://tools.ietf.org/html/rfc5280#section-4.1.2.4
|
||||||
type AttributeTypeAndValue struct {
|
type AttributeTypeAndValue struct {
|
||||||
Type asn1.ObjectIdentifier
|
Type asn1.ObjectIdentifier
|
||||||
Value interface{}
|
Value interface{}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ func init() {
|
||||||
}
|
}
|
||||||
if major := byte(v); major < 6 {
|
if major := byte(v); major < 6 {
|
||||||
// Windows XP SP2 and Windows 2003 do not support SHA2.
|
// Windows XP SP2 and Windows 2003 do not support SHA2.
|
||||||
// http://blogs.technet.com/b/pki/archive/2010/09/30/sha2-and-windows.aspx
|
// https://blogs.technet.com/b/pki/archive/2010/09/30/sha2-and-windows.aspx
|
||||||
supportSHA2 = false
|
supportSHA2 = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ func (n Number) Int64() (int64, error) {
|
||||||
func isValidNumber(s string) bool {
|
func isValidNumber(s string) bool {
|
||||||
// This function implements the JSON numbers grammar.
|
// This function implements the JSON numbers grammar.
|
||||||
// See https://tools.ietf.org/html/rfc7159#section-6
|
// See https://tools.ietf.org/html/rfc7159#section-6
|
||||||
// and http://json.org/number.gif
|
// and https://json.org/number.gif
|
||||||
|
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNumberIsValid(t *testing.T) {
|
func TestNumberIsValid(t *testing.T) {
|
||||||
// From: http://stackoverflow.com/a/13340826
|
// From: https://stackoverflow.com/a/13340826
|
||||||
var jsonNumberRegexp = regexp.MustCompile(`^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$`)
|
var jsonNumberRegexp = regexp.MustCompile(`^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$`)
|
||||||
|
|
||||||
validTests := []string{
|
validTests := []string{
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@
|
||||||
package xml
|
package xml
|
||||||
|
|
||||||
// References:
|
// References:
|
||||||
// Annotated XML spec: http://www.xml.com/axml/testaxml.htm
|
// Annotated XML spec: https://www.xml.com/axml/testaxml.htm
|
||||||
// XML name spaces: http://www.w3.org/TR/REC-xml-names/
|
// XML name spaces: https://www.w3.org/TR/REC-xml-names/
|
||||||
|
|
||||||
// TODO(rsc):
|
// TODO(rsc):
|
||||||
// Test error handling.
|
// Test error handling.
|
||||||
|
|
@ -271,7 +271,7 @@ func NewTokenDecoder(t TokenReader) *Decoder {
|
||||||
// it will return an error.
|
// it will return an error.
|
||||||
//
|
//
|
||||||
// Token implements XML name spaces as described by
|
// Token implements XML name spaces as described by
|
||||||
// http://www.w3.org/TR/REC-xml-names/. Each of the
|
// https://www.w3.org/TR/REC-xml-names/. Each of the
|
||||||
// Name structures contained in the Token has the Space
|
// Name structures contained in the Token has the Space
|
||||||
// set to the URL identifying its name space when known.
|
// set to the URL identifying its name space when known.
|
||||||
// If Token encounters an unrecognized name space prefix,
|
// If Token encounters an unrecognized name space prefix,
|
||||||
|
|
@ -863,7 +863,7 @@ func (d *Decoder) attrval() []byte {
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// http://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
|
// https://www.w3.org/TR/REC-html40/intro/sgmltut.html#h-3.2.2
|
||||||
if 'a' <= b && b <= 'z' || 'A' <= b && b <= 'Z' ||
|
if 'a' <= b && b <= 'z' || 'A' <= b && b <= 'Z' ||
|
||||||
'0' <= b && b <= '9' || b == '_' || b == ':' || b == '-' {
|
'0' <= b && b <= '9' || b == '_' || b == ':' || b == '-' {
|
||||||
d.buf.WriteByte(b)
|
d.buf.WriteByte(b)
|
||||||
|
|
@ -1134,7 +1134,7 @@ Input:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decide whether the given rune is in the XML Character Range, per
|
// Decide whether the given rune is in the XML Character Range, per
|
||||||
// the Char production of http://www.xml.com/axml/testaxml.htm,
|
// the Char production of https://www.xml.com/axml/testaxml.htm,
|
||||||
// Section 2.2 Characters.
|
// Section 2.2 Characters.
|
||||||
func isInCharacterRange(r rune) (inrange bool) {
|
func isInCharacterRange(r rune) (inrange bool) {
|
||||||
return r == 0x09 ||
|
return r == 0x09 ||
|
||||||
|
|
@ -1263,7 +1263,7 @@ func isNameString(s string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// These tables were generated by cut and paste from Appendix B of
|
// These tables were generated by cut and paste from Appendix B of
|
||||||
// the XML spec at http://www.xml.com/axml/testaxml.htm
|
// the XML spec at https://www.xml.com/axml/testaxml.htm
|
||||||
// and then reformatting. First corresponds to (Letter | '_' | ':')
|
// and then reformatting. First corresponds to (Letter | '_' | ':')
|
||||||
// and second corresponds to NameChar.
|
// and second corresponds to NameChar.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,12 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32,
|
// Package crc32 implements the 32-bit cyclic redundancy check, or CRC-32,
|
||||||
// checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for
|
// checksum. See https://en.wikipedia.org/wiki/Cyclic_redundancy_check for
|
||||||
// information.
|
// information.
|
||||||
//
|
//
|
||||||
// Polynomials are represented in LSB-first form also known as reversed representation.
|
// Polynomials are represented in LSB-first form also known as reversed representation.
|
||||||
//
|
//
|
||||||
// See http://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks#Reversed_representations_and_reciprocal_polynomials
|
// See https://en.wikipedia.org/wiki/Mathematics_of_cyclic_redundancy_checks#Reversed_representations_and_reciprocal_polynomials
|
||||||
// for information.
|
// for information.
|
||||||
package crc32
|
package crc32
|
||||||
|
|
||||||
|
|
@ -29,12 +29,12 @@ const (
|
||||||
|
|
||||||
// Castagnoli's polynomial, used in iSCSI.
|
// Castagnoli's polynomial, used in iSCSI.
|
||||||
// Has better error detection characteristics than IEEE.
|
// Has better error detection characteristics than IEEE.
|
||||||
// http://dx.doi.org/10.1109/26.231911
|
// https://dx.doi.org/10.1109/26.231911
|
||||||
Castagnoli = 0x82f63b78
|
Castagnoli = 0x82f63b78
|
||||||
|
|
||||||
// Koopman's polynomial.
|
// Koopman's polynomial.
|
||||||
// Also has better error detection characteristics than IEEE.
|
// Also has better error detection characteristics than IEEE.
|
||||||
// http://dx.doi.org/10.1109/DSN.2002.1028931
|
// https://dx.doi.org/10.1109/DSN.2002.1028931
|
||||||
Koopman = 0xeb31d82e
|
Koopman = 0xeb31d82e
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ GLOBL r4r3<>(SB),RODATA,$16
|
||||||
GLOBL rupoly<>(SB),RODATA,$16
|
GLOBL rupoly<>(SB),RODATA,$16
|
||||||
GLOBL r5<>(SB),RODATA,$8
|
GLOBL r5<>(SB),RODATA,$8
|
||||||
|
|
||||||
// Based on http://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
|
// Based on https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/fast-crc-computation-generic-polynomials-pclmulqdq-paper.pdf
|
||||||
// len(p) must be at least 64, and must be a multiple of 16.
|
// len(p) must be at least 64, and must be a multiple of 16.
|
||||||
|
|
||||||
// func ieeeCLMUL(crc uint32, p []byte) uint32
|
// func ieeeCLMUL(crc uint32, p []byte) uint32
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64,
|
// Package crc64 implements the 64-bit cyclic redundancy check, or CRC-64,
|
||||||
// checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for
|
// checksum. See https://en.wikipedia.org/wiki/Cyclic_redundancy_check for
|
||||||
// information.
|
// information.
|
||||||
package crc64
|
package crc64
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ import (
|
||||||
// other content, or affects the contents, idempotency, or credentials of a
|
// other content, or affects the contents, idempotency, or credentials of a
|
||||||
// network message, then the value in this map is contentTypeUnsafe.
|
// network message, then the value in this map is contentTypeUnsafe.
|
||||||
// This map is derived from HTML5, specifically
|
// This map is derived from HTML5, specifically
|
||||||
// http://www.w3.org/TR/html5/Overview.html#attributes-1
|
// https://www.w3.org/TR/html5/Overview.html#attributes-1
|
||||||
// as well as "%URI"-typed attributes from
|
// as well as "%URI"-typed attributes from
|
||||||
// http://www.w3.org/TR/html4/index/attributes.html
|
// https://www.w3.org/TR/html4/index/attributes.html
|
||||||
var attrTypeMap = map[string]contentType{
|
var attrTypeMap = map[string]contentType{
|
||||||
"accept": contentTypePlain,
|
"accept": contentTypePlain,
|
||||||
"accept-charset": contentTypeUnsafe,
|
"accept-charset": contentTypeUnsafe,
|
||||||
|
|
@ -90,7 +90,7 @@ var attrTypeMap = map[string]contentType{
|
||||||
"name": contentTypePlain,
|
"name": contentTypePlain,
|
||||||
"novalidate": contentTypeUnsafe,
|
"novalidate": contentTypeUnsafe,
|
||||||
// Skip handler names from
|
// Skip handler names from
|
||||||
// http://www.w3.org/TR/html5/webappapis.html#event-handlers-on-elements,-document-objects,-and-window-objects
|
// https://www.w3.org/TR/html5/webappapis.html#event-handlers-on-elements,-document-objects,-and-window-objects
|
||||||
// since we have special handling in attrType.
|
// since we have special handling in attrType.
|
||||||
"open": contentTypePlain,
|
"open": contentTypePlain,
|
||||||
"optimum": contentTypePlain,
|
"optimum": contentTypePlain,
|
||||||
|
|
@ -160,7 +160,7 @@ func attrType(name string) contentType {
|
||||||
|
|
||||||
// Heuristics to prevent "javascript:..." injection in custom
|
// Heuristics to prevent "javascript:..." injection in custom
|
||||||
// data attributes and custom attributes like g:tweetUrl.
|
// data attributes and custom attributes like g:tweetUrl.
|
||||||
// http://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes
|
// https://www.w3.org/TR/html5/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes
|
||||||
// "Custom data attributes are intended to store custom data
|
// "Custom data attributes are intended to store custom data
|
||||||
// private to the page or application, for which there are no
|
// private to the page or application, for which there are no
|
||||||
// more appropriate attributes or elements."
|
// more appropriate attributes or elements."
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ type (
|
||||||
// 2. The CSS3 rule production, such as `a[href=~"https:"].foo#bar`.
|
// 2. The CSS3 rule production, such as `a[href=~"https:"].foo#bar`.
|
||||||
// 3. CSS3 declaration productions, such as `color: red; margin: 2px`.
|
// 3. CSS3 declaration productions, such as `color: red; margin: 2px`.
|
||||||
// 4. The CSS3 value production, such as `rgba(0, 0, 255, 127)`.
|
// 4. The CSS3 value production, such as `rgba(0, 0, 255, 127)`.
|
||||||
// See http://www.w3.org/TR/css3-syntax/#parsing and
|
// See https://www.w3.org/TR/css3-syntax/#parsing and
|
||||||
// https://web.archive.org/web/20090211114933/http://w3.org/TR/css3-syntax#style
|
// https://web.archive.org/web/20090211114933/http://w3.org/TR/css3-syntax#style
|
||||||
//
|
//
|
||||||
// Use of this type presents a security risk:
|
// Use of this type presents a security risk:
|
||||||
|
|
@ -85,7 +85,7 @@ type (
|
||||||
URL string
|
URL string
|
||||||
|
|
||||||
// Srcset encapsulates a known safe srcset attribute
|
// Srcset encapsulates a known safe srcset attribute
|
||||||
// (see http://w3c.github.io/html/semantics-embedded-content.html#element-attrdef-img-srcset).
|
// (see https://w3c.github.io/html/semantics-embedded-content.html#element-attrdef-img-srcset).
|
||||||
//
|
//
|
||||||
// Use of this type presents a security risk:
|
// Use of this type presents a security risk:
|
||||||
// the encapsulated content should come from a trusted source,
|
// the encapsulated content should come from a trusted source,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
//
|
//
|
||||||
// The zero value of type context is the start context for a template that
|
// The zero value of type context is the start context for a template that
|
||||||
// produces an HTML fragment as defined at
|
// produces an HTML fragment as defined at
|
||||||
// http://www.w3.org/TR/html5/syntax.html#the-end
|
// https://www.w3.org/TR/html5/syntax.html#the-end
|
||||||
// where the context element is null.
|
// where the context element is null.
|
||||||
type context struct {
|
type context struct {
|
||||||
state state
|
state state
|
||||||
|
|
@ -98,7 +98,7 @@ const (
|
||||||
// stateHTMLCmt occurs inside an <!-- HTML comment -->.
|
// stateHTMLCmt occurs inside an <!-- HTML comment -->.
|
||||||
stateHTMLCmt
|
stateHTMLCmt
|
||||||
// stateRCDATA occurs inside an RCDATA element (<textarea> or <title>)
|
// stateRCDATA occurs inside an RCDATA element (<textarea> or <title>)
|
||||||
// as described at http://www.w3.org/TR/html5/syntax.html#elements-0
|
// as described at https://www.w3.org/TR/html5/syntax.html#elements-0
|
||||||
stateRCDATA
|
stateRCDATA
|
||||||
// stateAttr occurs inside an HTML attribute whose content is text.
|
// stateAttr occurs inside an HTML attribute whose content is text.
|
||||||
stateAttr
|
stateAttr
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func endsWithCSSKeyword(b []byte, kw string) bool {
|
||||||
}
|
}
|
||||||
// Many CSS keywords, such as "!important" can have characters encoded,
|
// Many CSS keywords, such as "!important" can have characters encoded,
|
||||||
// but the URI production does not allow that according to
|
// but the URI production does not allow that according to
|
||||||
// http://www.w3.org/TR/css3-syntax/#TOK-URI
|
// https://www.w3.org/TR/css3-syntax/#TOK-URI
|
||||||
// This does not attempt to recognize encoded keywords. For example,
|
// This does not attempt to recognize encoded keywords. For example,
|
||||||
// given "\75\72\6c" and "url" this return false.
|
// given "\75\72\6c" and "url" this return false.
|
||||||
return string(bytes.ToLower(b[i:])) == kw
|
return string(bytes.ToLower(b[i:])) == kw
|
||||||
|
|
@ -38,7 +38,7 @@ func endsWithCSSKeyword(b []byte, kw string) bool {
|
||||||
func isCSSNmchar(r rune) bool {
|
func isCSSNmchar(r rune) bool {
|
||||||
// Based on the CSS3 nmchar production but ignores multi-rune escape
|
// Based on the CSS3 nmchar production but ignores multi-rune escape
|
||||||
// sequences.
|
// sequences.
|
||||||
// http://www.w3.org/TR/css3-syntax/#SUBTOK-nmchar
|
// https://www.w3.org/TR/css3-syntax/#SUBTOK-nmchar
|
||||||
return 'a' <= r && r <= 'z' ||
|
return 'a' <= r && r <= 'z' ||
|
||||||
'A' <= r && r <= 'Z' ||
|
'A' <= r && r <= 'Z' ||
|
||||||
'0' <= r && r <= '9' ||
|
'0' <= r && r <= '9' ||
|
||||||
|
|
@ -53,7 +53,7 @@ func isCSSNmchar(r rune) bool {
|
||||||
// decodeCSS decodes CSS3 escapes given a sequence of stringchars.
|
// decodeCSS decodes CSS3 escapes given a sequence of stringchars.
|
||||||
// If there is no change, it returns the input, otherwise it returns a slice
|
// If there is no change, it returns the input, otherwise it returns a slice
|
||||||
// backed by a new array.
|
// backed by a new array.
|
||||||
// http://www.w3.org/TR/css3-syntax/#SUBTOK-stringchar defines stringchar.
|
// https://www.w3.org/TR/css3-syntax/#SUBTOK-stringchar defines stringchar.
|
||||||
func decodeCSS(s []byte) []byte {
|
func decodeCSS(s []byte) []byte {
|
||||||
i := bytes.IndexByte(s, '\\')
|
i := bytes.IndexByte(s, '\\')
|
||||||
if i == -1 {
|
if i == -1 {
|
||||||
|
|
@ -72,10 +72,10 @@ func decodeCSS(s []byte) []byte {
|
||||||
if len(s) < 2 {
|
if len(s) < 2 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// http://www.w3.org/TR/css3-syntax/#SUBTOK-escape
|
// https://www.w3.org/TR/css3-syntax/#SUBTOK-escape
|
||||||
// escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
|
// escape ::= unicode | '\' [#x20-#x7E#x80-#xD7FF#xE000-#xFFFD#x10000-#x10FFFF]
|
||||||
if isHex(s[1]) {
|
if isHex(s[1]) {
|
||||||
// http://www.w3.org/TR/css3-syntax/#SUBTOK-unicode
|
// https://www.w3.org/TR/css3-syntax/#SUBTOK-unicode
|
||||||
// unicode ::= '\' [0-9a-fA-F]{1,6} wc?
|
// unicode ::= '\' [0-9a-fA-F]{1,6} wc?
|
||||||
j := 2
|
j := 2
|
||||||
for j < len(s) && j < 7 && isHex(s[j]) {
|
for j < len(s) && j < 7 && isHex(s[j]) {
|
||||||
|
|
@ -222,7 +222,7 @@ func cssValueFilter(args ...interface{}) string {
|
||||||
b, id := decodeCSS([]byte(s)), make([]byte, 0, 64)
|
b, id := decodeCSS([]byte(s)), make([]byte, 0, 64)
|
||||||
|
|
||||||
// CSS3 error handling is specified as honoring string boundaries per
|
// CSS3 error handling is specified as honoring string boundaries per
|
||||||
// http://www.w3.org/TR/css3-syntax/#error-handling :
|
// https://www.w3.org/TR/css3-syntax/#error-handling :
|
||||||
// Malformed declarations. User agents must handle unexpected
|
// Malformed declarations. User agents must handle unexpected
|
||||||
// tokens encountered while parsing a declaration by reading until
|
// tokens encountered while parsing a declaration by reading until
|
||||||
// the end of the declaration, while observing the rules for
|
// the end of the declaration, while observing the rules for
|
||||||
|
|
|
||||||
|
|
@ -668,7 +668,7 @@ func (e *escaper) escapeText(c context, n *parse.TextNode) context {
|
||||||
} else if isComment(c.state) && c.delim == delimNone {
|
} else if isComment(c.state) && c.delim == delimNone {
|
||||||
switch c.state {
|
switch c.state {
|
||||||
case stateJSBlockCmt:
|
case stateJSBlockCmt:
|
||||||
// http://es5.github.com/#x7.4:
|
// https://es5.github.com/#x7.4:
|
||||||
// "Comments behave like white space and are
|
// "Comments behave like white space and are
|
||||||
// discarded except that, if a MultiLineComment
|
// discarded except that, if a MultiLineComment
|
||||||
// contains a line terminator character, then
|
// contains a line terminator character, then
|
||||||
|
|
@ -731,7 +731,7 @@ func contextAfterText(c context, s []byte) (context, int) {
|
||||||
i = len(s)
|
i = len(s)
|
||||||
}
|
}
|
||||||
if c.delim == delimSpaceOrTagEnd {
|
if c.delim == delimSpaceOrTagEnd {
|
||||||
// http://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
|
// https://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
|
||||||
// lists the runes below as error characters.
|
// lists the runes below as error characters.
|
||||||
// Error out because HTML parsers may differ on whether
|
// Error out because HTML parsers may differ on whether
|
||||||
// "<a id= onclick=f(" ends inside id's or onclick's value,
|
// "<a id= onclick=f(" ends inside id's or onclick's value,
|
||||||
|
|
|
||||||
|
|
@ -50,12 +50,12 @@ func htmlEscaper(args ...interface{}) string {
|
||||||
// htmlReplacementTable contains the runes that need to be escaped
|
// htmlReplacementTable contains the runes that need to be escaped
|
||||||
// inside a quoted attribute value or in a text node.
|
// inside a quoted attribute value or in a text node.
|
||||||
var htmlReplacementTable = []string{
|
var htmlReplacementTable = []string{
|
||||||
// http://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
|
// https://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
|
||||||
// U+0000 NULL Parse error. Append a U+FFFD REPLACEMENT
|
// U+0000 NULL Parse error. Append a U+FFFD REPLACEMENT
|
||||||
// CHARACTER character to the current attribute's value.
|
// CHARACTER character to the current attribute's value.
|
||||||
// "
|
// "
|
||||||
// and similarly
|
// and similarly
|
||||||
// http://www.w3.org/TR/html5/syntax.html#before-attribute-value-state
|
// https://www.w3.org/TR/html5/syntax.html#before-attribute-value-state
|
||||||
0: "\uFFFD",
|
0: "\uFFFD",
|
||||||
'"': """,
|
'"': """,
|
||||||
'&': "&",
|
'&': "&",
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
// "x = ++/foo/i" which is quite different than "x++/foo/i", but is not known to
|
// "x = ++/foo/i" which is quite different than "x++/foo/i", but is not known to
|
||||||
// fail on any known useful programs. It is based on the draft
|
// fail on any known useful programs. It is based on the draft
|
||||||
// JavaScript 2.0 lexical grammar and requires one token of lookbehind:
|
// JavaScript 2.0 lexical grammar and requires one token of lookbehind:
|
||||||
// http://www.mozilla.org/js/language/js20-2000-07/rationale/syntax.html
|
// https://www.mozilla.org/js/language/js20-2000-07/rationale/syntax.html
|
||||||
func nextJSCtx(s []byte, preceding jsCtx) jsCtx {
|
func nextJSCtx(s []byte, preceding jsCtx) jsCtx {
|
||||||
s = bytes.TrimRight(s, "\t\n\f\r \u2028\u2029")
|
s = bytes.TrimRight(s, "\t\n\f\r \u2028\u2029")
|
||||||
if len(s) == 0 {
|
if len(s) == 0 {
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ func TestJSStrEscaper(t *testing.T) {
|
||||||
{"</script>", `\x3c\/script\x3e`},
|
{"</script>", `\x3c\/script\x3e`},
|
||||||
{"<![CDATA[", `\x3c![CDATA[`},
|
{"<![CDATA[", `\x3c![CDATA[`},
|
||||||
{"]]>", `]]\x3e`},
|
{"]]>", `]]\x3e`},
|
||||||
// http://dev.w3.org/html5/markup/aria/syntax.html#escaping-text-span
|
// https://dev.w3.org/html5/markup/aria/syntax.html#escaping-text-span
|
||||||
// "The text in style, script, title, and textarea elements
|
// "The text in style, script, title, and textarea elements
|
||||||
// must not have an escaping text span start that is not
|
// must not have an escaping text span start that is not
|
||||||
// followed by an escaping text span end."
|
// followed by an escaping text span end."
|
||||||
|
|
@ -203,7 +203,7 @@ func TestJSStrEscaper(t *testing.T) {
|
||||||
// injection followed by an HTML text injection.
|
// injection followed by an HTML text injection.
|
||||||
{"<!--", `\x3c!--`},
|
{"<!--", `\x3c!--`},
|
||||||
{"-->", `--\x3e`},
|
{"-->", `--\x3e`},
|
||||||
// From http://code.google.com/p/doctype/wiki/ArticleUtf7
|
// From https://code.google.com/p/doctype/wiki/ArticleUtf7
|
||||||
{"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
|
{"+ADw-script+AD4-alert(1)+ADw-/script+AD4-",
|
||||||
`\x2bADw-script\x2bAD4-alert(1)\x2bADw-\/script\x2bAD4-`,
|
`\x2bADw-script\x2bAD4-alert(1)\x2bADw-\/script\x2bAD4-`,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,7 @@ func tURL(c context, s []byte) (context, int) {
|
||||||
c.urlPart = urlPartQueryOrFrag
|
c.urlPart = urlPartQueryOrFrag
|
||||||
} else if len(s) != eatWhiteSpace(s, 0) && c.urlPart == urlPartNone {
|
} else if len(s) != eatWhiteSpace(s, 0) && c.urlPart == urlPartNone {
|
||||||
// HTML5 uses "Valid URL potentially surrounded by spaces" for
|
// HTML5 uses "Valid URL potentially surrounded by spaces" for
|
||||||
// attrs: http://www.w3.org/TR/html5/index.html#attributes-1
|
// attrs: https://www.w3.org/TR/html5/index.html#attributes-1
|
||||||
c.urlPart = urlPartPreQuery
|
c.urlPart = urlPartPreQuery
|
||||||
}
|
}
|
||||||
return c, len(s)
|
return c, len(s)
|
||||||
|
|
@ -380,7 +380,7 @@ func tLineCmt(c context, s []byte) (context, int) {
|
||||||
// are supported by the 4 major browsers.
|
// are supported by the 4 major browsers.
|
||||||
// This defines line comments as
|
// This defines line comments as
|
||||||
// LINECOMMENT ::= "//" [^\n\f\d]*
|
// LINECOMMENT ::= "//" [^\n\f\d]*
|
||||||
// since http://www.w3.org/TR/css3-syntax/#SUBTOK-nl defines
|
// since https://www.w3.org/TR/css3-syntax/#SUBTOK-nl defines
|
||||||
// newlines:
|
// newlines:
|
||||||
// nl ::= #xA | #xD #xA | #xD | #xC
|
// nl ::= #xA | #xD #xA | #xD | #xC
|
||||||
default:
|
default:
|
||||||
|
|
@ -392,7 +392,7 @@ func tLineCmt(c context, s []byte) (context, int) {
|
||||||
return c, len(s)
|
return c, len(s)
|
||||||
}
|
}
|
||||||
c.state = endState
|
c.state = endState
|
||||||
// Per section 7.4 of EcmaScript 5 : http://es5.github.com/#x7.4
|
// Per section 7.4 of EcmaScript 5 : https://es5.github.com/#x7.4
|
||||||
// "However, the LineTerminator at the end of the line is not
|
// "However, the LineTerminator at the end of the line is not
|
||||||
// considered to be part of the single-line comment; it is
|
// considered to be part of the single-line comment; it is
|
||||||
// recognized separately by the lexical grammar and becomes part
|
// recognized separately by the lexical grammar and becomes part
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ func printWebSafe(w io.Writer) {
|
||||||
fmt.Fprintln(w, "// WebSafe is a 216-color palette that was popularized by early versions")
|
fmt.Fprintln(w, "// WebSafe is a 216-color palette that was popularized by early versions")
|
||||||
fmt.Fprintln(w, "// of Netscape Navigator. It is also known as the Netscape Color Cube.")
|
fmt.Fprintln(w, "// of Netscape Navigator. It is also known as the Netscape Color Cube.")
|
||||||
fmt.Fprintln(w, "//")
|
fmt.Fprintln(w, "//")
|
||||||
fmt.Fprintln(w, "// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.")
|
fmt.Fprintln(w, "// See https://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.")
|
||||||
fmt.Fprintln(w, "var WebSafe = []color.Color{")
|
fmt.Fprintln(w, "var WebSafe = []color.Color{")
|
||||||
for _, line := range lines {
|
for _, line := range lines {
|
||||||
fmt.Fprintln(w, line)
|
fmt.Fprintln(w, line)
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,7 @@ var Plan9 = []color.Color{
|
||||||
// WebSafe is a 216-color palette that was popularized by early versions
|
// WebSafe is a 216-color palette that was popularized by early versions
|
||||||
// of Netscape Navigator. It is also known as the Netscape Color Cube.
|
// of Netscape Navigator. It is also known as the Netscape Color Cube.
|
||||||
//
|
//
|
||||||
// See http://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.
|
// See https://en.wikipedia.org/wiki/Web_colors#Web-safe_colors for details.
|
||||||
var WebSafe = []color.Color{
|
var WebSafe = []color.Color{
|
||||||
color.RGBA{0x00, 0x00, 0x00, 0xff},
|
color.RGBA{0x00, 0x00, 0x00, 0xff},
|
||||||
color.RGBA{0x00, 0x00, 0x33, 0xff},
|
color.RGBA{0x00, 0x00, 0x33, 0xff},
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ func RGBToYCbCr(r, g, b uint8) (uint8, uint8, uint8) {
|
||||||
// Y' = 0.2990*R + 0.5870*G + 0.1140*B
|
// Y' = 0.2990*R + 0.5870*G + 0.1140*B
|
||||||
// Cb = -0.1687*R - 0.3313*G + 0.5000*B + 128
|
// Cb = -0.1687*R - 0.3313*G + 0.5000*B + 128
|
||||||
// Cr = 0.5000*R - 0.4187*G - 0.0813*B + 128
|
// Cr = 0.5000*R - 0.4187*G - 0.0813*B + 128
|
||||||
// http://www.w3.org/Graphics/JPEG/jfif3.pdf says Y but means Y'.
|
// https://www.w3.org/Graphics/JPEG/jfif3.pdf says Y but means Y'.
|
||||||
|
|
||||||
r1 := int32(r)
|
r1 := int32(r)
|
||||||
g1 := int32(g)
|
g1 := int32(g)
|
||||||
|
|
@ -60,7 +60,7 @@ func YCbCrToRGB(y, cb, cr uint8) (uint8, uint8, uint8) {
|
||||||
// R = Y' + 1.40200*(Cr-128)
|
// R = Y' + 1.40200*(Cr-128)
|
||||||
// G = Y' - 0.34414*(Cb-128) - 0.71414*(Cr-128)
|
// G = Y' - 0.34414*(Cb-128) - 0.71414*(Cr-128)
|
||||||
// B = Y' + 1.77200*(Cb-128)
|
// B = Y' + 1.77200*(Cb-128)
|
||||||
// http://www.w3.org/Graphics/JPEG/jfif3.pdf says Y but means Y'.
|
// https://www.w3.org/Graphics/JPEG/jfif3.pdf says Y but means Y'.
|
||||||
//
|
//
|
||||||
// Those formulae use non-integer multiplication factors. When computing,
|
// Those formulae use non-integer multiplication factors. When computing,
|
||||||
// integer math is generally faster than floating point math. We multiply
|
// integer math is generally faster than floating point math. We multiply
|
||||||
|
|
@ -163,7 +163,7 @@ func YCbCrToRGB(y, cb, cr uint8) (uint8, uint8, uint8) {
|
||||||
//
|
//
|
||||||
// Conversion between RGB and Y'CbCr is lossy and there are multiple, slightly
|
// Conversion between RGB and Y'CbCr is lossy and there are multiple, slightly
|
||||||
// different formulae for converting between the two. This package follows
|
// different formulae for converting between the two. This package follows
|
||||||
// the JFIF specification at http://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
// the JFIF specification at https://www.w3.org/Graphics/JPEG/jfif3.pdf.
|
||||||
type YCbCr struct {
|
type YCbCr struct {
|
||||||
Y, Cb, Cr uint8
|
Y, Cb, Cr uint8
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package gif implements a GIF image decoder and encoder.
|
// Package gif implements a GIF image decoder and encoder.
|
||||||
//
|
//
|
||||||
// The GIF specification is at http://www.w3.org/Graphics/GIF/spec-gif89a.txt.
|
// The GIF specification is at https://www.w3.org/Graphics/GIF/spec-gif89a.txt.
|
||||||
package gif
|
package gif
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package jpeg implements a JPEG image decoder and encoder.
|
// Package jpeg implements a JPEG image decoder and encoder.
|
||||||
//
|
//
|
||||||
// JPEG is defined in ITU-T T.81: http://www.w3.org/Graphics/JPEG/itu-t81.pdf.
|
// JPEG is defined in ITU-T T.81: https://www.w3.org/Graphics/JPEG/itu-t81.pdf.
|
||||||
package jpeg
|
package jpeg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -62,13 +62,13 @@ const (
|
||||||
comMarker = 0xfe // COMment.
|
comMarker = 0xfe // COMment.
|
||||||
// "APPlication specific" markers aren't part of the JPEG spec per se,
|
// "APPlication specific" markers aren't part of the JPEG spec per se,
|
||||||
// but in practice, their use is described at
|
// but in practice, their use is described at
|
||||||
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html
|
// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html
|
||||||
app0Marker = 0xe0
|
app0Marker = 0xe0
|
||||||
app14Marker = 0xee
|
app14Marker = 0xee
|
||||||
app15Marker = 0xef
|
app15Marker = 0xef
|
||||||
)
|
)
|
||||||
|
|
||||||
// See http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
// See https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
||||||
const (
|
const (
|
||||||
adobeTransformUnknown = 0
|
adobeTransformUnknown = 0
|
||||||
adobeTransformYCbCr = 1
|
adobeTransformYCbCr = 1
|
||||||
|
|
@ -684,7 +684,7 @@ func (d *decoder) applyBlack() (image.Image, error) {
|
||||||
|
|
||||||
// If the 4-component JPEG image isn't explicitly marked as "Unknown (RGB
|
// If the 4-component JPEG image isn't explicitly marked as "Unknown (RGB
|
||||||
// or CMYK)" as per
|
// or CMYK)" as per
|
||||||
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
||||||
// we assume that it is YCbCrK. This matches libjpeg's jdapimin.c.
|
// we assume that it is YCbCrK. This matches libjpeg's jdapimin.c.
|
||||||
if d.adobeTransform != adobeTransformUnknown {
|
if d.adobeTransform != adobeTransformUnknown {
|
||||||
// Convert the YCbCr part of the YCbCrK to RGB, invert the RGB to get
|
// Convert the YCbCr part of the YCbCrK to RGB, invert the RGB to get
|
||||||
|
|
@ -747,7 +747,7 @@ func (d *decoder) isRGB() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if d.adobeTransformValid && d.adobeTransform == adobeTransformUnknown {
|
if d.adobeTransformValid && d.adobeTransform == adobeTransformUnknown {
|
||||||
// http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe
|
||||||
// says that 0 means Unknown (and in practice RGB) and 1 means YCbCr.
|
// says that 0 means Unknown (and in practice RGB) and 1 means YCbCr.
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Package png implements a PNG image decoder and encoder.
|
// Package png implements a PNG image decoder and encoder.
|
||||||
//
|
//
|
||||||
// The PNG specification is at http://www.w3.org/TR/PNG/.
|
// The PNG specification is at https://www.w3.org/TR/PNG/.
|
||||||
package png
|
package png
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
@ -73,7 +73,7 @@ type interlaceScan struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// interlacing defines Adam7 interlacing, with 7 passes of reduced images.
|
// interlacing defines Adam7 interlacing, with 7 passes of reduced images.
|
||||||
// See http://www.w3.org/TR/PNG/#8Interlace
|
// See https://www.w3.org/TR/PNG/#8Interlace
|
||||||
var interlacing = []interlaceScan{
|
var interlacing = []interlaceScan{
|
||||||
{8, 8, 0, 0},
|
{8, 8, 0, 0},
|
||||||
{8, 8, 4, 0},
|
{8, 8, 4, 0},
|
||||||
|
|
@ -89,7 +89,7 @@ var interlacing = []interlaceScan{
|
||||||
// present), IDAT and IEND chunks must appear in that order. There may be
|
// present), IDAT and IEND chunks must appear in that order. There may be
|
||||||
// multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
|
// multiple IDAT chunks, and IDAT chunks must be sequential (i.e. they may not
|
||||||
// have any other chunks between them).
|
// have any other chunks between them).
|
||||||
// http://www.w3.org/TR/PNG/#5ChunkOrdering
|
// https://www.w3.org/TR/PNG/#5ChunkOrdering
|
||||||
const (
|
const (
|
||||||
dsStart = iota
|
dsStart = iota
|
||||||
dsSeenIHDR
|
dsSeenIHDR
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,14 @@ var canCancelIO bool // determines if CancelIoEx API is present
|
||||||
// synchronously. Unfortuently SetFileCompletionNotificationModes is not
|
// synchronously. Unfortuently SetFileCompletionNotificationModes is not
|
||||||
// available on Windows XP. Also there is a known bug where
|
// available on Windows XP. Also there is a known bug where
|
||||||
// SetFileCompletionNotificationModes crashes on some systems
|
// SetFileCompletionNotificationModes crashes on some systems
|
||||||
// (see http://support.microsoft.com/kb/2568167 for details).
|
// (see https://support.microsoft.com/kb/2568167 for details).
|
||||||
|
|
||||||
var useSetFileCompletionNotificationModes bool // determines is SetFileCompletionNotificationModes is present and safe to use
|
var useSetFileCompletionNotificationModes bool // determines is SetFileCompletionNotificationModes is present and safe to use
|
||||||
|
|
||||||
// checkSetFileCompletionNotificationModes verifies that
|
// checkSetFileCompletionNotificationModes verifies that
|
||||||
// SetFileCompletionNotificationModes Windows API is present
|
// SetFileCompletionNotificationModes Windows API is present
|
||||||
// on the system and is safe to use.
|
// on the system and is safe to use.
|
||||||
// See http://support.microsoft.com/kb/2568167 for details.
|
// See https://support.microsoft.com/kb/2568167 for details.
|
||||||
func checkSetFileCompletionNotificationModes() {
|
func checkSetFileCompletionNotificationModes() {
|
||||||
err := syscall.LoadSetFileCompletionNotificationModes()
|
err := syscall.LoadSetFileCompletionNotificationModes()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -383,7 +383,7 @@ func (fd *FD) Init(net string, pollable bool) (string, error) {
|
||||||
// We do not use events, so we can skip them always.
|
// We do not use events, so we can skip them always.
|
||||||
flags := uint8(syscall.FILE_SKIP_SET_EVENT_ON_HANDLE)
|
flags := uint8(syscall.FILE_SKIP_SET_EVENT_ON_HANDLE)
|
||||||
// It's not safe to skip completion notifications for UDP:
|
// It's not safe to skip completion notifications for UDP:
|
||||||
// http://blogs.technet.com/b/winserverperformance/archive/2008/06/26/designing-applications-for-high-performance-part-iii.aspx
|
// https://blogs.technet.com/b/winserverperformance/archive/2008/06/26/designing-applications-for-high-performance-part-iii.aspx
|
||||||
if net == "tcp" {
|
if net == "tcp" {
|
||||||
flags |= syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS
|
flags |= syscall.FILE_SKIP_COMPLETION_PORT_ON_SUCCESS
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ var vf = []float64{
|
||||||
}
|
}
|
||||||
|
|
||||||
// The expected results below were computed by the high precision calculators
|
// The expected results below were computed by the high precision calculators
|
||||||
// at http://keisan.casio.com/. More exact input values (array vf[], above)
|
// at https://keisan.casio.com/. More exact input values (array vf[], above)
|
||||||
// were obtained by printing them with "%.26f". The answers were calculated
|
// were obtained by printing them with "%.26f". The answers were calculated
|
||||||
// to 26 digits (by using the "Digit number" drop-down control of each
|
// to 26 digits (by using the "Digit number" drop-down control of each
|
||||||
// calculator).
|
// calculator).
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// This file implements multi-precision floating-point numbers.
|
// This file implements multi-precision floating-point numbers.
|
||||||
// Like in the GNU MPFR library (http://www.mpfr.org/), operands
|
// Like in the GNU MPFR library (https://www.mpfr.org/), operands
|
||||||
// can be of mixed precision. Unlike MPFR, the rounding mode is
|
// can be of mixed precision. Unlike MPFR, the rounding mode is
|
||||||
// not specified with each operation, but with each operand. The
|
// not specified with each operation, but with each operand. The
|
||||||
// rounding mode of the result operand determines the rounding
|
// rounding mode of the result operand determines the rounding
|
||||||
|
|
|
||||||
|
|
@ -1007,9 +1007,9 @@ func TestFloatFloat64(t *testing.T) {
|
||||||
{"0x.fffffffffffffp-1022", smallestNormalFloat64 - math.SmallestNonzeroFloat64, Exact},
|
{"0x.fffffffffffffp-1022", smallestNormalFloat64 - math.SmallestNonzeroFloat64, Exact},
|
||||||
{"4503599627370495p-1074", smallestNormalFloat64 - math.SmallestNonzeroFloat64, Exact},
|
{"4503599627370495p-1074", smallestNormalFloat64 - math.SmallestNonzeroFloat64, Exact},
|
||||||
|
|
||||||
// http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
// https://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
||||||
{"2.2250738585072011e-308", 2.225073858507201e-308, Below},
|
{"2.2250738585072011e-308", 2.225073858507201e-308, Below},
|
||||||
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
// https://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||||
{"2.2250738585072012e-308", 2.2250738585072014e-308, Above},
|
{"2.2250738585072012e-308", 2.2250738585072014e-308, Above},
|
||||||
} {
|
} {
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
|
|
|
||||||
|
|
@ -286,9 +286,9 @@ func TestFloat64Text(t *testing.T) {
|
||||||
{0.5, 'f', 0, "0"},
|
{0.5, 'f', 0, "0"},
|
||||||
{1.5, 'f', 0, "2"},
|
{1.5, 'f', 0, "2"},
|
||||||
|
|
||||||
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
// https://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||||
{2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"},
|
{2.2250738585072012e-308, 'g', -1, "2.2250738585072014e-308"},
|
||||||
// http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
// https://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
||||||
{2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"},
|
{2.2250738585072011e-308, 'g', -1, "2.225073858507201e-308"},
|
||||||
|
|
||||||
// Issue 2625.
|
// Issue 2625.
|
||||||
|
|
|
||||||
|
|
@ -131,11 +131,11 @@ NextRandom:
|
||||||
//
|
//
|
||||||
// Baillie and Wagstaff, "Lucas Pseudoprimes", Mathematics of Computation 35(152),
|
// Baillie and Wagstaff, "Lucas Pseudoprimes", Mathematics of Computation 35(152),
|
||||||
// October 1980, pp. 1391-1417, especially page 1401.
|
// October 1980, pp. 1391-1417, especially page 1401.
|
||||||
// http://www.ams.org/journals/mcom/1980-35-152/S0025-5718-1980-0583518-6/S0025-5718-1980-0583518-6.pdf
|
// https://www.ams.org/journals/mcom/1980-35-152/S0025-5718-1980-0583518-6/S0025-5718-1980-0583518-6.pdf
|
||||||
//
|
//
|
||||||
// Grantham, "Frobenius Pseudoprimes", Mathematics of Computation 70(234),
|
// Grantham, "Frobenius Pseudoprimes", Mathematics of Computation 70(234),
|
||||||
// March 2000, pp. 873-891.
|
// March 2000, pp. 873-891.
|
||||||
// http://www.ams.org/journals/mcom/2001-70-234/S0025-5718-00-01197-2/S0025-5718-00-01197-2.pdf
|
// https://www.ams.org/journals/mcom/2001-70-234/S0025-5718-00-01197-2/S0025-5718-00-01197-2.pdf
|
||||||
//
|
//
|
||||||
// Baillie, "Extra strong Lucas pseudoprimes", OEIS A217719, https://oeis.org/A217719.
|
// Baillie, "Extra strong Lucas pseudoprimes", OEIS A217719, https://oeis.org/A217719.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,13 @@ var primes = []string{
|
||||||
"98920366548084643601728869055592650835572950932266967461790948584315647051443",
|
"98920366548084643601728869055592650835572950932266967461790948584315647051443",
|
||||||
"94560208308847015747498523884063394671606671904944666360068158221458669711639",
|
"94560208308847015747498523884063394671606671904944666360068158221458669711639",
|
||||||
|
|
||||||
// http://primes.utm.edu/lists/small/small3.html
|
// https://primes.utm.edu/lists/small/small3.html
|
||||||
"449417999055441493994709297093108513015373787049558499205492347871729927573118262811508386655998299074566974373711472560655026288668094291699357843464363003144674940345912431129144354948751003607115263071543163",
|
"449417999055441493994709297093108513015373787049558499205492347871729927573118262811508386655998299074566974373711472560655026288668094291699357843464363003144674940345912431129144354948751003607115263071543163",
|
||||||
"230975859993204150666423538988557839555560243929065415434980904258310530753006723857139742334640122533598517597674807096648905501653461687601339782814316124971547968912893214002992086353183070342498989426570593",
|
"230975859993204150666423538988557839555560243929065415434980904258310530753006723857139742334640122533598517597674807096648905501653461687601339782814316124971547968912893214002992086353183070342498989426570593",
|
||||||
"5521712099665906221540423207019333379125265462121169655563495403888449493493629943498064604536961775110765377745550377067893607246020694972959780839151452457728855382113555867743022746090187341871655890805971735385789993",
|
"5521712099665906221540423207019333379125265462121169655563495403888449493493629943498064604536961775110765377745550377067893607246020694972959780839151452457728855382113555867743022746090187341871655890805971735385789993",
|
||||||
"203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123",
|
"203956878356401977405765866929034577280193993314348263094772646453283062722701277632936616063144088173312372882677123879538709400158306567338328279154499698366071906766440037074217117805690872792848149112022286332144876183376326512083574821647933992961249917319836219304274280243803104015000563790123",
|
||||||
|
|
||||||
// ECC primes: http://tools.ietf.org/html/draft-ladd-safecurves-02
|
// ECC primes: https://tools.ietf.org/html/draft-ladd-safecurves-02
|
||||||
"3618502788666131106986593281521497120414687020801267626233049500247285301239", // Curve1174: 2^251-9
|
"3618502788666131106986593281521497120414687020801267626233049500247285301239", // Curve1174: 2^251-9
|
||||||
"57896044618658097711785492504343953926634992332820282019728792003956564819949", // Curve25519: 2^255-19
|
"57896044618658097711785492504343953926634992332820282019728792003956564819949", // Curve25519: 2^255-19
|
||||||
"9850501549098619803069760025035903451269934817616361666987073351061430442874302652853566563721228910201656997576599", // E-382: 2^382-105
|
"9850501549098619803069760025035903451269934817616361666987073351061430442874302652853566563721228910201656997576599", // E-382: 2^382-105
|
||||||
|
|
|
||||||
|
|
@ -300,9 +300,9 @@ var float64inputs = []string{
|
||||||
// "1e-18446744073709551616",
|
// "1e-18446744073709551616",
|
||||||
// "1e+18446744073709551616",
|
// "1e+18446744073709551616",
|
||||||
|
|
||||||
// http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
// https://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||||
"2.2250738585072012e-308",
|
"2.2250738585072012e-308",
|
||||||
// http://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
// https://www.exploringbinary.com/php-hangs-on-numeric-value-2-2250738585072011e-308/
|
||||||
"2.2250738585072011e-308",
|
"2.2250738585072011e-308",
|
||||||
|
|
||||||
// A very large number (initially wrongly parsed by the fast algorithm).
|
// A very large number (initially wrongly parsed by the fast algorithm).
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ var vc = []complex128{
|
||||||
}
|
}
|
||||||
|
|
||||||
// The expected results below were computed by the high precision calculators
|
// The expected results below were computed by the high precision calculators
|
||||||
// at http://keisan.casio.com/. More exact input values (array vc[], above)
|
// at https://keisan.casio.com/. More exact input values (array vc[], above)
|
||||||
// were obtained by printing them with "%.26f". The answers were calculated
|
// were obtained by printing them with "%.26f". The answers were calculated
|
||||||
// to 26 digits (by using the "Digit number" drop-down control of each
|
// to 26 digits (by using the "Digit number" drop-down control of each
|
||||||
// calculator).
|
// calculator).
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ package math
|
||||||
|
|
||||||
// This implementation is based on the rational approximation
|
// This implementation is based on the rational approximation
|
||||||
// of percentage points of normal distribution available from
|
// of percentage points of normal distribution available from
|
||||||
// http://www.jstor.org/stable/2347330.
|
// https://www.jstor.org/stable/2347330.
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Coefficients for approximation to erf in |x| <= 0.85
|
// Coefficients for approximation to erf in |x| <= 0.85
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
// methods of elementary functions suitable for SIMD computation", Proc.
|
// methods of elementary functions suitable for SIMD computation", Proc.
|
||||||
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
|
// of International Supercomputing Conference 2010 (ISC'10), pp. 25 -- 32
|
||||||
// (May 2010). The paper is available at
|
// (May 2010). The paper is available at
|
||||||
// http://www.springerlink.com/content/340228x165742104/
|
// https://www.springerlink.com/content/340228x165742104/
|
||||||
//
|
//
|
||||||
// The original code and the constants below are from the author's
|
// The original code and the constants below are from the author's
|
||||||
// implementation available at http://freshmeat.net/projects/sleef.
|
// implementation available at http://freshmeat.net/projects/sleef.
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
*
|
*
|
||||||
* See "The Ziggurat Method for Generating Random Variables"
|
* See "The Ziggurat Method for Generating Random Variables"
|
||||||
* (Marsaglia & Tsang, 2000)
|
* (Marsaglia & Tsang, 2000)
|
||||||
* http://www.jstatsoft.org/v05/i08/paper [pdf]
|
* https://www.jstatsoft.org/v05/i08/paper [pdf]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ type Part struct {
|
||||||
// FormName returns the name parameter if p has a Content-Disposition
|
// FormName returns the name parameter if p has a Content-Disposition
|
||||||
// of type "form-data". Otherwise it returns the empty string.
|
// of type "form-data". Otherwise it returns the empty string.
|
||||||
func (p *Part) FormName() string {
|
func (p *Part) FormName() string {
|
||||||
// See http://tools.ietf.org/html/rfc2183 section 2 for EBNF
|
// See https://tools.ietf.org/html/rfc2183 section 2 for EBNF
|
||||||
// of Content-Disposition value format.
|
// of Content-Disposition value format.
|
||||||
if p.dispositionParams == nil {
|
if p.dispositionParams == nil {
|
||||||
p.parseContentDisposition()
|
p.parseContentDisposition()
|
||||||
|
|
@ -380,7 +380,7 @@ func (mr *Reader) isFinalBoundary(line []byte) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mr *Reader) isBoundaryDelimiterLine(line []byte) (ret bool) {
|
func (mr *Reader) isBoundaryDelimiterLine(line []byte) (ret bool) {
|
||||||
// http://tools.ietf.org/html/rfc2046#section-5.1
|
// https://tools.ietf.org/html/rfc2046#section-5.1
|
||||||
// The boundary delimiter line is then defined as a line
|
// The boundary delimiter line is then defined as a line
|
||||||
// consisting entirely of two hyphen characters ("-",
|
// consisting entirely of two hyphen characters ("-",
|
||||||
// decimal value 45) followed by the boundary parameter
|
// decimal value 45) followed by the boundary parameter
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ func TestRoundTrip(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From http://fr.wikipedia.org/wiki/Quoted-Printable
|
// From https://fr.wikipedia.org/wiki/Quoted-Printable
|
||||||
var testMsg = []byte("Quoted-Printable (QP) est un format d'encodage de données codées sur 8 bits, qui utilise exclusivement les caractères alphanumériques imprimables du code ASCII (7 bits).\r\n" +
|
var testMsg = []byte("Quoted-Printable (QP) est un format d'encodage de données codées sur 8 bits, qui utilise exclusivement les caractères alphanumériques imprimables du code ASCII (7 bits).\r\n" +
|
||||||
"\r\n" +
|
"\r\n" +
|
||||||
"En effet, les différents codages comprennent de nombreux caractères qui ne sont pas représentables en ASCII (par exemple les caractères accentués), ainsi que des caractères dits « non-imprimables ».\r\n" +
|
"En effet, les différents codages comprennent de nombreux caractères qui ne sont pas représentables en ASCII (par exemple les caractères accentués), ainsi que des caractères dits « non-imprimables ».\r\n" +
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,7 @@ func (c *conf) hostLookupOrder(r *Resolver, hostname string) (ret hostLookupOrde
|
||||||
}
|
}
|
||||||
lookup := c.resolv.lookup
|
lookup := c.resolv.lookup
|
||||||
if len(lookup) == 0 {
|
if len(lookup) == 0 {
|
||||||
// http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/resolv.conf.5
|
// https://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/resolv.conf.5
|
||||||
// "If the lookup keyword is not used in the
|
// "If the lookup keyword is not used in the
|
||||||
// system's resolv.conf file then the assumed
|
// system's resolv.conf file then the assumed
|
||||||
// order is 'bind file'"
|
// order is 'bind file'"
|
||||||
|
|
@ -203,7 +203,7 @@ func (c *conf) hostLookupOrder(r *Resolver, hostname string) (ret hostLookupOrde
|
||||||
}
|
}
|
||||||
if c.goos == "linux" {
|
if c.goos == "linux" {
|
||||||
// glibc says the default is "dns [!UNAVAIL=return] files"
|
// glibc says the default is "dns [!UNAVAIL=return] files"
|
||||||
// http://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-Configuration-File.html.
|
// https://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-Configuration-File.html.
|
||||||
return hostLookupDNSFiles
|
return hostLookupDNSFiles
|
||||||
}
|
}
|
||||||
return hostLookupFilesDNS
|
return hostLookupFilesDNS
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ func TestConfHostLookupOrder(t *testing.T) {
|
||||||
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupDNSFiles}},
|
hostTests: []nssHostTest{{"google.com", "myhostname", hostLookupDNSFiles}},
|
||||||
},
|
},
|
||||||
// glibc lacking an nsswitch.conf, per
|
// glibc lacking an nsswitch.conf, per
|
||||||
// http://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-Configuration-File.html
|
// https://www.gnu.org/software/libc/manual/html_node/Notes-on-NSS-Configuration-File.html
|
||||||
{
|
{
|
||||||
name: "linux_no_nsswitch.conf",
|
name: "linux_no_nsswitch.conf",
|
||||||
c: &conf{
|
c: &conf{
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ func dnsReadConfig(filename string) *dnsConfig {
|
||||||
|
|
||||||
case "lookup":
|
case "lookup":
|
||||||
// OpenBSD option:
|
// OpenBSD option:
|
||||||
// http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/resolv.conf.5
|
// https://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man5/resolv.conf.5
|
||||||
// "the legal space-separated values are: bind, file, yp"
|
// "the legal space-separated values are: bind, file, yp"
|
||||||
conf.lookup = f[1:]
|
conf.lookup = f[1:]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ func RequestFromMap(params map[string]string) (*http.Request, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// There's apparently a de-facto standard for this.
|
// There's apparently a de-facto standard for this.
|
||||||
// http://docstore.mik.ua/orelly/linux/cgi/ch03_02.htm#ch03-35636
|
// https://docstore.mik.ua/orelly/linux/cgi/ch03_02.htm#ch03-35636
|
||||||
if s := params["HTTPS"]; s == "on" || s == "ON" || s == "1" {
|
if s := params["HTTPS"]; s == "on" || s == "ON" || s == "1" {
|
||||||
r.TLS = &tls.ConnectionState{HandshakeComplete: true}
|
r.TLS = &tls.ConnectionState{HandshakeComplete: true}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ func setRequestCancel(req *Request, rt RoundTripper, deadline time.Time) (stopTi
|
||||||
return stopTimer, timedOut.isSet
|
return stopTimer, timedOut.isSet
|
||||||
}
|
}
|
||||||
|
|
||||||
// See 2 (end of page 4) http://www.ietf.org/rfc/rfc2617.txt
|
// See 2 (end of page 4) https://www.ietf.org/rfc/rfc2617.txt
|
||||||
// "To receive authorization, the client sends the userid and password,
|
// "To receive authorization, the client sends the userid and password,
|
||||||
// separated by a single colon (":") character, within a base64
|
// separated by a single colon (":") character, within a base64
|
||||||
// encoded string in the credentials."
|
// encoded string in the credentials."
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import (
|
||||||
// A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
|
// A Cookie represents an HTTP cookie as sent in the Set-Cookie header of an
|
||||||
// HTTP response or the Cookie header of an HTTP request.
|
// HTTP response or the Cookie header of an HTTP request.
|
||||||
//
|
//
|
||||||
// See http://tools.ietf.org/html/rfc6265 for details.
|
// See https://tools.ietf.org/html/rfc6265 for details.
|
||||||
type Cookie struct {
|
type Cookie struct {
|
||||||
Name string
|
Name string
|
||||||
Value string
|
Value string
|
||||||
|
|
@ -307,7 +307,7 @@ func sanitizeCookieName(n string) string {
|
||||||
return cookieNameSanitizer.Replace(n)
|
return cookieNameSanitizer.Replace(n)
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://tools.ietf.org/html/rfc6265#section-4.1.1
|
// https://tools.ietf.org/html/rfc6265#section-4.1.1
|
||||||
// cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
// cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
||||||
// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
// cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
||||||
// ; US-ASCII characters excluding CTLs,
|
// ; US-ASCII characters excluding CTLs,
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ var hopHeaders = []string{
|
||||||
"Proxy-Authenticate",
|
"Proxy-Authenticate",
|
||||||
"Proxy-Authorization",
|
"Proxy-Authorization",
|
||||||
"Te", // canonicalized version of "TE"
|
"Te", // canonicalized version of "TE"
|
||||||
"Trailer", // not Trailers per URL above; http://www.rfc-editor.org/errata_search.php?eid=4522
|
"Trailer", // not Trailers per URL above; https://www.rfc-editor.org/errata_search.php?eid=4522
|
||||||
"Transfer-Encoding",
|
"Transfer-Encoding",
|
||||||
"Upgrade",
|
"Upgrade",
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1059,7 +1059,7 @@ func checkWriteHeaderCode(code int) {
|
||||||
// Issue 22880: require valid WriteHeader status codes.
|
// Issue 22880: require valid WriteHeader status codes.
|
||||||
// For now we only enforce that it's three digits.
|
// For now we only enforce that it's three digits.
|
||||||
// In the future we might block things over 599 (600 and above aren't defined
|
// In the future we might block things over 599 (600 and above aren't defined
|
||||||
// at http://httpwg.org/specs/rfc7231.html#status.codes)
|
// at https://httpwg.org/specs/rfc7231.html#status.codes)
|
||||||
// and we might block under 200 (once we have more mature 1xx support).
|
// and we might block under 200 (once we have more mature 1xx support).
|
||||||
// But for now any three digits.
|
// But for now any three digits.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
const sniffLen = 512
|
const sniffLen = 512
|
||||||
|
|
||||||
// DetectContentType implements the algorithm described
|
// DetectContentType implements the algorithm described
|
||||||
// at http://mimesniff.spec.whatwg.org/ to determine the
|
// at https://mimesniff.spec.whatwg.org/ to determine the
|
||||||
// Content-Type of the given data. It considers at most the
|
// Content-Type of the given data. It considers at most the
|
||||||
// first 512 bytes of data. DetectContentType always returns
|
// first 512 bytes of data. DetectContentType always returns
|
||||||
// a valid MIME type: if it cannot determine a more specific one, it
|
// a valid MIME type: if it cannot determine a more specific one, it
|
||||||
|
|
|
||||||
|
|
@ -1846,7 +1846,7 @@ func (pc *persistConn) roundTrip(req *transportRequest) (resp *Response, err err
|
||||||
//
|
//
|
||||||
// Note that we don't request this for HEAD requests,
|
// Note that we don't request this for HEAD requests,
|
||||||
// due to a bug in nginx:
|
// due to a bug in nginx:
|
||||||
// http://trac.nginx.org/nginx/ticket/358
|
// https://trac.nginx.org/nginx/ticket/358
|
||||||
// https://golang.org/issue/5522
|
// https://golang.org/issue/5522
|
||||||
//
|
//
|
||||||
// We don't request gzip if the request is for a range, since
|
// We don't request gzip if the request is for a range, since
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ func (sd *sysDialer) doDialTCP(ctx context.Context, laddr, raddr *TCPAddr) (*TCP
|
||||||
// close the fd and try again. If it happens twice more, we relent and
|
// close the fd and try again. If it happens twice more, we relent and
|
||||||
// use the result. See also:
|
// use the result. See also:
|
||||||
// https://golang.org/issue/2690
|
// https://golang.org/issue/2690
|
||||||
// http://stackoverflow.com/questions/4949858/
|
// https://stackoverflow.com/questions/4949858/
|
||||||
//
|
//
|
||||||
// The opposite can also happen: if we ask the kernel to pick an appropriate
|
// The opposite can also happen: if we ask the kernel to pick an appropriate
|
||||||
// originating local address, sometimes it picks one that is already in use.
|
// originating local address, sometimes it picks one that is already in use.
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ func (r *Reader) ReadCodeLine(expectCode int) (code int, message string, err err
|
||||||
// with the same code followed by a space. Each line in message is
|
// with the same code followed by a space. Each line in message is
|
||||||
// separated by a newline (\n).
|
// separated by a newline (\n).
|
||||||
//
|
//
|
||||||
// See page 36 of RFC 959 (http://www.ietf.org/rfc/rfc959.txt) for
|
// See page 36 of RFC 959 (https://www.ietf.org/rfc/rfc959.txt) for
|
||||||
// details of another form of response accepted:
|
// details of another form of response accepted:
|
||||||
//
|
//
|
||||||
// code-message line 1
|
// code-message line 1
|
||||||
|
|
|
||||||
|
|
@ -290,7 +290,7 @@ var readResponseTests = []readResponseTest{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// See http://www.ietf.org/rfc/rfc959.txt page 36.
|
// See https://www.ietf.org/rfc/rfc959.txt page 36.
|
||||||
func TestRFC959Lines(t *testing.T) {
|
func TestRFC959Lines(t *testing.T) {
|
||||||
for i, tt := range readResponseTests {
|
for i, tt := range readResponseTests {
|
||||||
r := reader(tt.in + "\nFOLLOWING DATA")
|
r := reader(tt.in + "\nFOLLOWING DATA")
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ func TestClearenv(t *testing.T) {
|
||||||
defer func(origEnv []string) {
|
defer func(origEnv []string) {
|
||||||
for _, pair := range origEnv {
|
for _, pair := range origEnv {
|
||||||
// Environment variables on Windows can begin with =
|
// Environment variables on Windows can begin with =
|
||||||
// http://blogs.msdn.com/b/oldnewthing/archive/2010/05/06/10008132.aspx
|
// https://blogs.msdn.com/b/oldnewthing/archive/2010/05/06/10008132.aspx
|
||||||
i := strings.Index(pair[1:], "=") + 1
|
i := strings.Index(pair[1:], "=") + 1
|
||||||
if err := Setenv(pair[:i], pair[i+1:]); err != nil {
|
if err := Setenv(pair[:i], pair[i+1:]); err != nil {
|
||||||
t.Errorf("Setenv(%q, %q) failed during reset: %v", pair[:i], pair[i+1:], err)
|
t.Errorf("Setenv(%q, %q) failed during reset: %v", pair[:i], pair[i+1:], err)
|
||||||
|
|
|
||||||
|
|
@ -183,7 +183,7 @@ func openFileNolog(name string, flag int, perm FileMode) (*File, error) {
|
||||||
|
|
||||||
// On OS X, sigaction(2) doesn't guarantee that SA_RESTART will cause
|
// On OS X, sigaction(2) doesn't guarantee that SA_RESTART will cause
|
||||||
// open(2) to be restarted for regular files. This is easy to reproduce on
|
// open(2) to be restarted for regular files. This is easy to reproduce on
|
||||||
// fuse file systems (see http://golang.org/issue/11180).
|
// fuse file systems (see https://golang.org/issue/11180).
|
||||||
if runtime.GOOS == "darwin" && e == syscall.EINTR {
|
if runtime.GOOS == "darwin" && e == syscall.EINTR {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,6 @@ package os
|
||||||
// supportsCloseOnExec reports whether the platform supports the
|
// supportsCloseOnExec reports whether the platform supports the
|
||||||
// O_CLOEXEC flag.
|
// O_CLOEXEC flag.
|
||||||
// On Darwin, the O_CLOEXEC flag was introduced in OS X 10.7 (Darwin 11.0.0).
|
// On Darwin, the O_CLOEXEC flag was introduced in OS X 10.7 (Darwin 11.0.0).
|
||||||
// See http://support.apple.com/kb/HT1633.
|
// See https://support.apple.com/kb/HT1633.
|
||||||
// On FreeBSD, the O_CLOEXEC flag was introduced in version 8.3.
|
// On FreeBSD, the O_CLOEXEC flag was introduced in version 8.3.
|
||||||
const supportsCloseOnExec = true
|
const supportsCloseOnExec = true
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// A queue is a 'sparse array' holding pending threads of execution.
|
// A queue is a 'sparse array' holding pending threads of execution.
|
||||||
// See http://research.swtch.com/2008/03/using-uninitialized-memory-for-fun-and.html
|
// See https://research.swtch.com/2008/03/using-uninitialized-memory-for-fun-and.html
|
||||||
type queue struct {
|
type queue struct {
|
||||||
sparse []uint32
|
sparse []uint32
|
||||||
dense []entry
|
dense []entry
|
||||||
|
|
@ -27,7 +27,7 @@ type entry struct {
|
||||||
|
|
||||||
// A thread is the state of a single path through the machine:
|
// A thread is the state of a single path through the machine:
|
||||||
// an instruction and a corresponding capture array.
|
// an instruction and a corresponding capture array.
|
||||||
// See http://swtch.com/~rsc/regexp/regexp2.html
|
// See https://swtch.com/~rsc/regexp/regexp2.html
|
||||||
type thread struct {
|
type thread struct {
|
||||||
inst *syntax.Inst
|
inst *syntax.Inst
|
||||||
cap []int
|
cap []int
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue