]> Cypherpunks repositories - gostls13.git/commit
net/http: escape contents of the directory indexes generated by FileServer
authorMichael Kelly <mjk@google.com>
Tue, 14 Jan 2014 20:55:12 +0000 (12:55 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Tue, 14 Jan 2014 20:55:12 +0000 (12:55 -0800)
commit26cc10289f6e0dd2cebf0195f1351d6790ed7a9e
tree4f6431bce57bfbcc2ae3dc00635d92706e79dc35
parent3be4d95731a17073afb1f69bde264eecbdfa32bb
net/http: escape contents of the directory indexes generated by FileServer

      Previously, filenames containing special characters could:
      1) Escape the <a> tag, with a file called something like: ">foo
      2) Break the links in the index by prematurely ending the path portion
      of the url, with a file called: foo?bar

      In order to avoid a forbidden dependency on the html package, I'm
      using htmlReplacer from net/http/server.go, which is equivalent to
      html.EscapeString.

      This change also expands fakeFile.Readdir to better emulate
os.File.Readdir.

R=golang-codereviews, rsc, gobot, bradfitz, josharian, mikioh.mikioh
CC=golang-codereviews
https://golang.org/cl/37440043
src/pkg/net/http/fs.go
src/pkg/net/http/fs_test.go