recaptcha always gives response false - incorrect-captcha-sol

1,209 views
Skip to first unread message

hansamann

unread,
Aug 6, 2009, 12:45:10 AM8/6/09
to reCAPTCHA
Hi all,

I once had recaptcha successfully implemented over at
grailspodcast.com for the comments, but since the last update
something must have gone wrong.

One the site, I always get incorrect-captcha-sol as a response. The
captchas are sometimes not that hard to read, so I am really sure that
it was at least a couple of times correct.

Also getting this error really means only the captcha itself is wrong,
right?

I am also URLEncoding the parameter captcha when I construct the post
body:

def data = "privatekey=${privateKey}&remoteip=${remoteIP}&challenge=$
{challenge}&response=${captcha}"

--

The funny thing is if I fake a captcha request locally from some
script (in which case I take the challenge from the captcha displayed
on grailspodcast.com, then use 127.0.0.1 as remoteAddr and the captcha
response) it works...

I am already replaying the entered text on the error page so I can
verify the text really is sent to the server and received correctly.

Has anyone had such an issue? Any tips what I could look into?

Cheers
Sven

hansamann

unread,
Aug 6, 2009, 1:32:59 AM8/6/09
to reCAPTCHA
This is my groovy code:

def survivedCaptcha = recaptchaService.validate(request.getHeader('X-
Forwarded-For'), params.recaptcha_challenge_field,
params.recaptcha_response_field)

and then in my service that is called:

def validate(remoteIP, challenge, captcha) {
def privateKey = "private key here"
captcha = URLEncoder.encode(captcha, "UTF-8")

def con = new URL('http://api-verify.recaptcha.net/
verify').openConnection()
con.doOutput = true
con.outputStream.withWriter { w ->
def data = "privatekey=${privateKey}&remoteip=${remoteIP}
&challenge=${challenge}&response=${captcha}"
w.print(data)
}

def responseLines = con.inputStream.readLines()

return responseLines.join(',')
}

This always gives me 'false,incorrect-captcha-sol'. I am just
URLencoding the captcha, but this should be fine as there are no
special characters that need encoding in the other fields.... (and
this used to work, too).

Anyone?

Cheers
Sven

Gopal vadhavani

unread,
Aug 6, 2009, 3:03:33 AM8/6/09
to reca...@googlegroups.com


recaptcha always gives response false
This is my groovy code:500
 
   Usermame
   Password 
I m Not Given ID
 
Rikves To Mail
Or Re captcha

 
  

hansamann

unread,
Aug 6, 2009, 9:32:40 AM8/6/09
to reCAPTCHA
What do you mean?

On Aug 6, 12:03 am, Gopal vadhavani <gopal.vadhav...@gmail.com> wrote:
> *recaptcha always gives response false *

hansamann

unread,
Aug 7, 2009, 12:28:14 AM8/7/09
to reCAPTCHA
I continue to investigate the issues I have, always getting incorrect-
captcha-sol.

In the recent change, I switched from using the Java
HttpServletRequest.getRemoteAddr() which actually gave me the address
of a proxy and not the real client IP address. I am now using the X-
Forwarded-For header, which reveals the real client IP.

What is really strange is that the old implementation, using the
remoteAddr (that acutally pointed to a proxy IP, not the client IP),
seemed to work for some time. The issue is that the real client IP
must have been different, still recaptcha was working as some
comments on grailspodcast.com proove.

Since I changed this I experience the issues with incorrect-captcha-
sol.

Changing it back does not make sense to me....

Are the recapthca error messages really accurate? Are they sometimes
inappropriate so I should focus on the IP instead of the
captcha_response?

Cheers
Sven

hansamann

unread,
Aug 7, 2009, 1:23:42 AM8/7/09
to reCAPTCHA
Strangely, recaptcha now seems to work for me again. I was just
implementing a hack for the top commenters, a secret password that
let's them submit anyway, and then started another test with a real
captcha. It worked. This leaves me completely puzzled and the only
explanation I really have is that recaptcha was somehow not working as
expected the last couple of days for my site (grailspodcast.com)

Again, I am still trying to figure out what happened.... please let me
know your comments.

Cheers
Sven

Kevin Harville

unread,
Sep 18, 2009, 11:37:21 PM9/18/09
to reCAPTCHA
I just changed the method from GET to POST to get it to work.
-----------------------------------------------------------------------------------------
Reply all
Reply to author
Forward
0 new messages