]> Cypherpunks repositories - gostls13.git/commit
encoding/pem: change Encode, EncodeToMemory not to generate partial PEM blocks
authorRuss Cox <rsc@golang.org>
Tue, 5 Dec 2017 19:38:50 +0000 (14:38 -0500)
committerBrad Fitzpatrick <bradfitz@golang.org>
Wed, 6 Dec 2017 03:59:41 +0000 (03:59 +0000)
commitc3fa046f543526cf1fd15d9d2b995f57511837c1
treea0b3d9c3d132441afbb447f917d6410d6da3dac9
parent358d7c93e2df39e1e76d27d79fa18e584dca9d5a
encoding/pem: change Encode, EncodeToMemory not to generate partial PEM blocks

Originally these routines could not fail except by
returning errors from the underlying writer.

Then we realized that header keys containing colons
needed to be rejected, and we started returning an error
from Encode. But that only happens after writing a
partial PEM block to the underlying writer, which is
unfortunate, but at least it was undocumented.

CL 77790 then documented this unfortunate behavior.

Instead of documenting unfortunate behavior, fix it.

Change-Id: Ic7467a576c4cecd16a99138571a1269cc4f96204
Reviewed-on: https://go-review.googlesource.com/82076
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/encoding/pem/pem.go
src/encoding/pem/pem_test.go