Explorar o código

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

Also fixes comment typo.
Dmitry Chestnykh %!s(int64=14) %!d(string=hai) anos
pai
achega
316aacb9c0
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      captcha.go

+ 4 - 4
captcha.go

@@ -210,15 +210,15 @@ func (h *captchaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		http.NotFound(w, r)
 		http.NotFound(w, r)
 		return
 		return
 	}
 	}
-	var err os.Error
 	if r.FormValue("reload") != "" {
 	if r.FormValue("reload") != "" {
 		Reload(id)
 		Reload(id)
 	}
 	}
+	var err os.Error
 	switch ext {
 	switch ext {
-	case ".png", ".PNG":
+	case ".png":
 		w.Header().Set("Content-Type", "image/png")
 		w.Header().Set("Content-Type", "image/png")
 		err = WriteImage(w, id, h.imgWidth, h.imgHeight)
 		err = WriteImage(w, id, h.imgWidth, h.imgHeight)
-	case ".wav", ".WAV":
+	case ".wav":
 		if r.URL.RawQuery == "get" {
 		if r.URL.RawQuery == "get" {
 			w.Header().Set("Content-Type", "application/octet-stream")
 			w.Header().Set("Content-Type", "application/octet-stream")
 		} else {
 		} else {
@@ -227,7 +227,7 @@ func (h *captchaHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		//err = WriteAudio(w, id)
 		//err = WriteAudio(w, id)
 		//XXX(dchest) Workaround for Chrome: it wants content-length,
 		//XXX(dchest) Workaround for Chrome: it wants content-length,
 		//or else will start playing NOT from the beginning.
 		//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)
 		d := globalStore.Get(id, false)
 		if d == nil {
 		if d == nil {
 			err = ErrNotFound
 			err = ErrNotFound