Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(50)

Issue 4629047: code review 4629047: http: add FileSystem interface, make FileServer use it (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 6 months ago by bradfitz
Modified:
13 years, 6 months ago
Reviewers:
CC:
r, rsc, gri, adg, dsymonds, r2, gri1, golang-dev
Visibility:
Public.

Description

http: add FileSystem interface, make FileServer use it Permits serving from virtual filesystems, such as files linked into a binary, or from a zip file. Also adds a gofix for: http.FileServer(root, prefix) -> http.StripPrefix(prefix, http.FileServer(http.Dir(root)))

Patch Set 1 #

Patch Set 2 : diff -r f14c3722f737 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f14c3722f737 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 4 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Patch Set 5 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Total comments: 10

Patch Set 6 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Patch Set 7 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Patch Set 8 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Total comments: 1

Patch Set 9 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Total comments: 8

Patch Set 10 : diff -r 02ee07e29061 https://go.googlecode.com/hg #

Patch Set 11 : diff -r 18ca1820cfb1 https://go.googlecode.com/hg #

Unified diffs Side-by-side diffs Delta from patch set Stats (+264 lines, -23 lines) Patch
M src/cmd/godoc/godoc.go View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M src/cmd/gofix/Makefile View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
A src/cmd/gofix/httpfs.go View 1 2 3 4 5 6 1 chunk +63 lines, -0 lines 0 comments Download
A src/cmd/gofix/httpfs_test.go View 1 2 3 4 5 6 1 chunk +47 lines, -0 lines 0 comments Download
M src/pkg/http/fs.go View 1 2 3 4 5 6 7 8 9 7 chunks +48 lines, -12 lines 0 comments Download
M src/pkg/http/fs_test.go View 1 2 3 4 5 6 7 8 9 1 chunk +66 lines, -0 lines 0 comments Download
M src/pkg/http/readrequest_test.go View 1 2 3 4 8 chunks +38 lines, -10 lines 0 comments Download

Messages

Total messages: 38
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 6 months ago (2011-06-17 19:30:09 UTC) #1
r
LGTM but wait for others does this help godoc?
13 years, 6 months ago (2011-06-17 23:28:01 UTC) #2
adg
Maybe I missed an earlier discussion, but this seems too general for just http. I ...
13 years, 6 months ago (2011-06-18 01:28:18 UTC) #3
adg
Yes, I missed it. On 18 June 2011 11:27, Andrew Gerrand <adg@golang.org> wrote: > Maybe ...
13 years, 6 months ago (2011-06-18 01:39:37 UTC) #4
dsymonds
Should it be called ServeFileFromFS (s/Fs/FS/)? Dave.
13 years, 6 months ago (2011-06-18 01:40:44 UTC) #5
r2
ServeOverHTTPTheFileSystemNamedInTheArgumentsSpecificallyProvidedNamely -rob
13 years, 6 months ago (2011-06-18 01:42:45 UTC) #6
dsymonds
On Sat, Jun 18, 2011 at 11:42 AM, Rob 'Commander' Pike <r@google.com> wrote: > ServeOverHTTPTheFileSystemNamedInTheArgumentsSpecificallyProvidedNamely ...
13 years, 6 months ago (2011-06-18 01:52:32 UTC) #7
dsymonds
On Sat, Jun 18, 2011 at 3:34 PM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > Oh, is ...
13 years, 6 months ago (2011-06-18 05:47:29 UTC) #8
bradfitz
Oh, is that the convention? I didn't look around too much for initials in methods ...
13 years, 6 months ago (2011-06-18 05:50:22 UTC) #9
gri1
I think FileInfo should be abstract as well. Also, do you need the Readdir functionality ...
13 years, 6 months ago (2011-06-20 20:11:05 UTC) #10
rsc
On Mon, Jun 20, 2011 at 16:11, <gri@google.com> wrote: > I think FileInfo should be ...
13 years, 6 months ago (2011-06-20 20:20:07 UTC) #11
bradfitz
On Mon, Jun 20, 2011 at 1:11 PM, <gri@google.com> wrote: > I think FileInfo should ...
13 years, 6 months ago (2011-06-20 20:22:33 UTC) #12
gri1
On Mon, Jun 20, 2011 at 1:20 PM, Russ Cox <rsc@golang.org> wrote: > On Mon, ...
13 years, 6 months ago (2011-06-20 20:40:43 UTC) #13
rsc
> I wouldn't know what to fill in for the Dev, Ino, Nlink, Rdev, > ...
13 years, 6 months ago (2011-06-20 20:45:39 UTC) #14
gri1
On Mon, Jun 20, 2011 at 1:45 PM, Russ Cox <rsc@golang.org> wrote: >> I wouldn't ...
13 years, 6 months ago (2011-06-20 20:55:40 UTC) #15
rsc
> All I am saying is that I would keep them abstract. Personal preference. All ...
13 years, 6 months ago (2011-06-20 20:58:20 UTC) #16
gri1
I guess we have different notions of what abstract means. - Robert On Mon, Jun ...
13 years, 6 months ago (2011-06-20 21:10:27 UTC) #17
bradfitz
Ping. Can I check this in? (after renaming it to capital FS) r@ gave an ...
13 years, 6 months ago (2011-06-22 01:50:26 UTC) #18
rsc
On Tue, Jun 21, 2011 at 21:50, <bradfitz@golang.org> wrote: > Ping. Can I check this ...
13 years, 6 months ago (2011-06-22 02:04:31 UTC) #19
bradfitz
Sounds like a plan. On Tue, Jun 21, 2011 at 7:04 PM, Russ Cox <rsc@golang.org> ...
13 years, 6 months ago (2011-06-22 02:09:14 UTC) #20
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 18:48:46 UTC) #21
bradfitz
Hold on review. Or consider it a checkpoint. This needs tests and I don't like ...
13 years, 6 months ago (2011-06-27 19:28:37 UTC) #22
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 20:19:43 UTC) #23
bradfitz
PTAL. hg mail email seems to be backed up. On Mon, Jun 27, 2011 at ...
13 years, 6 months ago (2011-06-27 20:23:03 UTC) #24
rsc
LGTM http://codereview.appspot.com/4629047/diff/10005/src/pkg/http/fs.go File src/pkg/http/fs.go (right): http://codereview.appspot.com/4629047/diff/10005/src/pkg/http/fs.go#newcode26 src/pkg/http/fs.go:26: return os.Open(filepath.Join(string(d), filepath.Clean("/"+name))) This will return a non-nil ...
13 years, 6 months ago (2011-06-27 20:31:35 UTC) #25
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 20:50:35 UTC) #26
bradfitz
http://codereview.appspot.com/4629047/diff/10005/src/pkg/http/fs.go File src/pkg/http/fs.go (right): http://codereview.appspot.com/4629047/diff/10005/src/pkg/http/fs.go#newcode26 src/pkg/http/fs.go:26: return os.Open(filepath.Join(string(d), filepath.Clean("/"+name))) On 2011/06/27 20:31:35, rsc wrote: > ...
13 years, 6 months ago (2011-06-27 20:50:42 UTC) #27
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 20:57:52 UTC) #28
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 21:01:03 UTC) #29
bradfitz
Updated gofix to ignore "" prefix (like it did for "/") and gofix'd godoc. On ...
13 years, 6 months ago (2011-06-27 21:03:16 UTC) #30
rsc
Let's require the paths to be /-separated. http://codereview.appspot.com/4629047/diff/19002/src/pkg/http/fs.go File src/pkg/http/fs.go (right): http://codereview.appspot.com/4629047/diff/19002/src/pkg/http/fs.go#newcode33 src/pkg/http/fs.go:33: // The ...
13 years, 6 months ago (2011-06-27 21:11:41 UTC) #31
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 21:25:10 UTC) #32
bradfitz
On Mon, Jun 27, 2011 at 2:11 PM, <rsc@golang.org> wrote: > Let's require the paths ...
13 years, 6 months ago (2011-06-27 21:25:58 UTC) #33
rsc
http://codereview.appspot.com/4629047/diff/4012/src/pkg/http/fs.go File src/pkg/http/fs.go (right): http://codereview.appspot.com/4629047/diff/4012/src/pkg/http/fs.go#newcode28 src/pkg/http/fs.go:28: string(d), filepath.Clean(string(filepath.Separator)+filepath.FromSlash(name)))) // Reject paths using the alternate separator ...
13 years, 6 months ago (2011-06-27 21:42:33 UTC) #34
bradfitz
http://codereview.appspot.com/4629047/diff/4012/src/pkg/http/fs.go File src/pkg/http/fs.go (right): http://codereview.appspot.com/4629047/diff/4012/src/pkg/http/fs.go#newcode28 src/pkg/http/fs.go:28: string(d), filepath.Clean(string(filepath.Separator)+filepath.FromSlash(name)))) On 2011/06/27 21:42:34, rsc wrote: > // ...
13 years, 6 months ago (2011-06-27 22:16:03 UTC) #35
bradfitz
Hello r@golang.org, rsc@golang.org, gri@golang.org, adg@golang.org, dsymonds@golang.org, r@google.com, gri@google.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 6 months ago (2011-06-27 22:16:14 UTC) #36
rsc
LGTM
13 years, 6 months ago (2011-06-27 22:20:56 UTC) #37
bradfitz
13 years, 6 months ago (2011-06-27 22:26:43 UTC) #38
*** Submitted as http://code.google.com/p/go/source/detail?r=850d94a4feca ***

http: add FileSystem interface, make FileServer use it

Permits serving from virtual filesystems, such as files linked
into a binary, or from a zip file.

Also adds a gofix for:

http.FileServer(root, prefix) -> http.StripPrefix(prefix,
http.FileServer(http.Dir(root)))

R=r, rsc, gri, adg, dsymonds, r, gri
CC=golang-dev
http://codereview.appspot.com/4629047
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b