code review 7312075: go-playground: redirect from foo.play.golang.org to pla... (issue 7312075)

17 views
Skip to first unread message

a...@golang.org

unread,
Feb 11, 2013, 2:19:02 AM2/11/13
to r...@golang.org, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: rsc,

Message:
Hello rsc (cc: golan...@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go-playground


Description:
go-playground: redirect from foo.play.golang.org to play.golang.org

Fixes Go project issue 4780.

Please review this at https://codereview.appspot.com/7312075/

Affected files:
M goplay/edit.go


Index: goplay/edit.go
===================================================================
--- a/goplay/edit.go
+++ b/goplay/edit.go
@@ -12,6 +12,8 @@
"text/template"
)

+const hostname = "play.golang.org"
+
func init() {
http.HandleFunc("/", edit)
}
@@ -23,6 +25,12 @@
}

func edit(w http.ResponseWriter, r *http.Request) {
+ // Redirect foo.play.golang.org to play.golang.org.
+ if strings.HasSuffix(r.Host, "."+hostname) {
+ http.Redirect(w, r, "http://"+hostname, http.StatusFound)
+ return
+ }
+
snip := &Snippet{Body: []byte(hello)}
if strings.HasPrefix(r.URL.Path, "/p/") {
c := appengine.NewContext(r)


David Symonds

unread,
Feb 11, 2013, 2:32:33 AM2/11/13
to Andrew Gerrand, re...@codereview-hr.appspotmail.com, golan...@googlegroups.com, r...@golang.org

LGTM

a...@golang.org

unread,
Feb 11, 2013, 3:07:02 AM2/11/13
to a...@golang.org, r...@golang.org, dsym...@golang.org, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reply all
Reply to author
Forward
0 new messages