1. 03 Dec, 2015 13 commits
  2. 02 Dec, 2015 17 commits
  3. 01 Dec, 2015 10 commits
    • Russ Cox's avatar
      encoding/base64: add package-level example · e4e49423
      Russ Cox authored
      Fixes #13011.
      
      Change-Id: Ia4c67880fca83f4298ff6bb1b217ec26c8c83427
      Reviewed-on: https://go-review.googlesource.com/17231Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      e4e49423
    • Russ Cox's avatar
      regexp/syntax: fix handling of \Q...\E · 0680e9c0
      Russ Cox authored
      It's not a group: must handle the inside as a sequence of literal chars,
      not a single literal string.
      
      That is, \Qab\E+ is the same as ab+, not (ab)+.
      
      Fixes #11187.
      
      Change-Id: I5406d05ccf7efff3a7f15395bdb0cfb2bd23a8ed
      Reviewed-on: https://go-review.googlesource.com/17233Reviewed-by: 's avatarDavid Crawshaw <crawshaw@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0680e9c0
    • Carlos Cirello's avatar
      net/http/httputil: add package level examples · 5fc58385
      Carlos Cirello authored
      Change-Id: I5be18b68602a7ebb740cf05924236ce17e386e55
      Reviewed-on: https://go-review.googlesource.com/17295
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      5fc58385
    • Russ Cox's avatar
      testing: document that T and B are safe for concurrent calls · e2071ecd
      Russ Cox authored
      Fixes #13108.
      
      Change-Id: I474cc2a3b7ced1c9eb978fc815f9c6bae9fb3ecc
      Reviewed-on: https://go-review.googlesource.com/17235Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      e2071ecd
    • Blake Gentry's avatar
      net/http: retry idempotent HTTP reqs on dead reused conns · 5dd372bd
      Blake Gentry authored
      If we try to reuse a connection that the server is in the process of
      closing, we may end up successfully writing out our request (or a
      portion of our request) only to find a connection error when we try to
      read from (or finish writing to) the socket. This manifests as an EOF
      returned from the Transport's RoundTrip.
      
      The issue, among others, is described in #4677.
      
      This change follows some of the Chromium guidelines for retrying
      idempotent requests only when the connection has been already been used
      successfully and no header data has yet been received for the response.
      
      As part of this change, an unexported error was defined for
      errMissingHost, which was previously defined inline. errMissingHost is
      the only non-network error returned from a Request's Write() method.
      
      Additionally, this breaks TestLinuxSendfile because its test server
      explicitly triggers the type of scenario this change is meant to retry
      on. Because that test server stops accepting conns on the test listener
      before the retry, the test would time out. To fix this, the test was
      altered to use a non-idempotent test type (POST).
      
      Change-Id: I1ca630b944f0ed7ec1d3d46056a50fb959481a16
      Reviewed-on: https://go-review.googlesource.com/3210Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      5dd372bd
    • David Benjamin's avatar
      encoding/asn1: Reject invalid INTEGERs. · 7c20ea93
      David Benjamin authored
      The empty string is not a valid DER integer. DER also requires that values be
      minimally-encoded, so excess padding with leading 0s (0xff for negative
      numbers) is forbidden. (These rules also apply to BER, incidentally.)
      
      Fixes #12622.
      
      Change-Id: I041f94e34a8afa29dbf94dd8fc450944bc91c9c3
      Reviewed-on: https://go-review.googlesource.com/17008Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7c20ea93
    • Joe Tsai's avatar
      archive/tar: fix issues with readGNUSparseMap1x0 · 7823197e
      Joe Tsai authored
      Motivations:
      * Use of strconv.ParseInt does not properly treat integers as 64bit,
      preventing this function from working properly on 32bit machines.
      * Use of io.ReadFull does not properly detect truncated streams
      when the file suddenly ends on a block boundary.
      * The function blindly trusts user input for numEntries and allocates
      memory accordingly.
      * The function does not validate that numEntries is not negative,
      allowing a malicious sparse file to cause a panic during make.
      
      In general, this function was overly complicated for what it was
      accomplishing and it was hard to reason that it was free from
      bounds errors. Instead, it has been rewritten and relies on
      bytes.Buffer.ReadString to do the main work. So long as invariants
      about the number of '\n' in the buffer are maintained, it is much
      easier to see why this approach is correct.
      
      Change-Id: Ibb12c4126c26e0ea460ea063cd17af68e3cf609e
      Reviewed-on: https://go-review.googlesource.com/15174Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      7823197e
    • Joe Tsai's avatar
      archive/tar: properly handle header-only "files" in Reader · dd5e14a7
      Joe Tsai authored
      Certain special type-flags, specifically 1, 2, 3, 4, 5, 6,
      do not have a data section. Thus, regardless of what the size field
      says, we should not attempt to read any data for these special types.
      
      The relevant PAX and USTAR specification says:
      <<<
      If the typeflag field is set to specify a file to be of type 1 (a link)
      or 2 (a symbolic link), the size field shall be specified as zero.
      If the typeflag field is set to specify a file of type 5 (directory),
      the size field shall be interpreted as described under the definition
      of that record type. No data logical records are stored for types 1, 2, or 5.
      If the typeflag field is set to 3 (character special file),
      4 (block special file), or 6 (FIFO), the meaning of the size field is
      unspecified by this volume of POSIX.1-2008, and no data logical records shall
      be stored on the medium.
      Additionally, for type 6, the size field shall be ignored when reading.
      If the typeflag field is set to any other value, the number of logical
      records written following the header shall be (size+511)/512, ignoring
      any fraction in the result of the division.
      >>>
      
      Contrary to the specification, we do not assert that the size field
      is zero for type 1 and 2 since we liberally accept non-conforming formats.
      
      Change-Id: I666b601597cb9d7a50caa081813d90ca9cfc52ed
      Reviewed-on: https://go-review.googlesource.com/16614Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dd5e14a7
    • Russ Cox's avatar
      bufio: clarify Read docs · 829425d3
      Russ Cox authored
      Or at least make them true.
      
      Fixes #12237.
      
      Change-Id: I3c92a07233b2174c5731d6fa7fbb9ca3a97beb6b
      Reviewed-on: https://go-review.googlesource.com/17237Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      829425d3
    • Colin Cross's avatar
      archive/zip: enable overriding (de)compressors per file · 46300a05
      Colin Cross authored
      Implement setting the compression level for a zip archive by registering
      a per-Writer compressor through Writer.RegisterCompressor.  If no
      compressors are registered, fall back to the ones registered at the
      package level.  Also implements per-Reader decompressors.
      
      Fixes #8359
      
      Change-Id: I93b27c81947b0f817b42e0067aa610ff267fdb21
      Reviewed-on: https://go-review.googlesource.com/16669Reviewed-by: 's avatarJoe Tsai <joetsai@digital-static.net>
      Run-TryBot: Joe Tsai <joetsai@digital-static.net>
      Reviewed-by: 's avatarKlaus Post <klauspost@gmail.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      46300a05