all repos — captcha @ 316aacb9c04c6035277402f39fa8e40688258a7d

Go package captcha implements generation and verification of image and audio CAPTCHAs.

Server: disable uppercase extensions (.PNG, .WAV).

Also fixes comment typo.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 00:41:52 +0200
commit

316aacb9c04c6035277402f39fa8e40688258a7d

parent

0052db45f8f49f85e2d405951d3dd4c99079224e

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M captcha.gocaptcha.go

@@ -210,15 +210,15 @@ if ext == "" || id == "" {

http.NotFound(w, r) return } - var err os.Error if r.FormValue("reload") != "" { Reload(id) } + var err os.Error switch ext { - case ".png", ".PNG": + case ".png": w.Header().Set("Content-Type", "image/png") err = WriteImage(w, id, h.imgWidth, h.imgHeight) - case ".wav", ".WAV": + case ".wav": if r.URL.RawQuery == "get" { w.Header().Set("Content-Type", "application/octet-stream") } else {

@@ -227,7 +227,7 @@ }

//err = WriteAudio(w, id) //XXX(dchest) Workaround for Chrome: it wants content-length, //or else will start playing NOT from the beginning. - //File issue: http://code.google.com/p/chromium/issues/detail?id=80565 + //Filed issue: http://code.google.com/p/chromium/issues/detail?id=80565 d := globalStore.Get(id, false) if d == nil { err = ErrNotFound