all repos — captcha @ a7f7c639889a03d14f48f4c01e9cbe3282369ebc

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

server: better names for arguments to Server.
Dmitry Chestnykh dmitry@codingrobots.com
Wed, 27 Apr 2011 23:17:28 +0200
commit

a7f7c639889a03d14f48f4c01e9cbe3282369ebc

parent

647026ab1a1a56143b88e0ae50bf26f2ed53770e

2 files changed, 6 insertions(+), 4 deletions(-)

jump to
M README.mdREADME.md

@@ -118,7 +118,7 @@ will write the new one).

### func Server - func Server(w, h int) http.Handler + func Server(imgWidth, imgHeight int) http.Handler Server returns a handler that serves HTTP requests with image or audio representations of captchas. Image dimensions are accepted as

@@ -131,7 +131,7 @@ with id "B9QTvDV1RXbVJ3Ac", and for "B9QTvDV1RXbVJ3Ac.wav" it serves the

same captcha in audio format. To serve a captcha as a downloadable file, the URL must be constructed in -such a way as if the file to serve is in "download" subdirectory: +such a way as if the file to serve is in the "download" subdirectory: "/download/B9QTvDV1RXbVJ3Ac.wav". To reload captcha (get a different solution for the same captcha id), append
M server.goserver.go

@@ -23,14 +23,16 @@ // with id "B9QTvDV1RXbVJ3Ac", and for "B9QTvDV1RXbVJ3Ac.wav" it serves the

// same captcha in audio format. // // To serve a captcha as a downloadable file, the URL must be constructed in -// such a way as if the file to serve is in "download" subdirectory: +// such a way as if the file to serve is in the "download" subdirectory: // "/download/B9QTvDV1RXbVJ3Ac.wav". // // To reload captcha (get a different solution for the same captcha id), append // "?reload=x" to URL, where x may be anything (for example, current time or a // random number to make browsers refetch an image instead of loading it from // cache). -func Server(w, h int) http.Handler { return &captchaHandler{w, h} } +func Server(imgWidth, imgHeight int) http.Handler { + return &captchaHandler{imgWidth, imgHeight} +} func (h *captchaHandler) serve(w http.ResponseWriter, id, ext string, download bool) os.Error { if download {