Add accept-encoding header - fixing "403 Forbidden" #3

merged 2 commits into from Sep 10, 2013

2 participants


This fixes 403 Forbidden responses for me.

 "sessionid"=>"\n<head><title>403 Forbidden</title></head>",
 "logurl"=>"\n<body bgcolor=\"white\">",
 "vText8"=>"\n<center><h1>403 Forbidden</h1></center>",

Thanks for this. It looks like Cleverbot has updated their protocol a bit since I last took a look at it. I'll review the protocol and see what needs to be updated.

Were you getting 403s sporadically or on every request?


Also, would you mind changing x-gzip to gzip?


I was getting them on every request.
Looks like it's still not perfect though, I'm getting 'DENIED' randomly now.
Only 'deflate' seems to be working every time, but I'm having a hard time getting httparty to encode the response properly.

pry> post(PATH, :body => body, :headers => { 'Accept-Encoding' => 'deflate' })
Zlib::DataError: incorrect header check
from /.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http/response.rb:357:in `finish'

I can see the response is correct but it's raising the exception on parse. Any thoughts on this? Are you getting 403s as well?


Ok, changed to gzip. Not sure about these 'DENIED' responses, it might have been not related.

@benmanns benmanns merged commit 390eeb1 into benmanns:master Sep 10, 2013

1 check passed

Details default The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment