Problems requesting login assertion from server

Note: I do see the server is down as of the time of posting. The problem I'm describing exists when the server is up too.

I'm not trying to connect with a browser, that works fine. What I'm trying to do is connect through faye-websocket, and that's working fine.

However, when I try to send a post request to get my login assertion, the server returns a blank string with mime type "text/html".

Here's the relevant code I'm using (Ruby), and please don't try that password I swear it's not the right one ok
Code:
    message = event.data.split("|")

    case message[1]
    when "challstr"

      $data[:challenge] = message[3]
      $data[:challengekeyid] = message[2]

      uri = URI.parse("http://play.pokemonshowdown.com/action.php")
      http = Net::HTTP.new(uri.host, uri.port)

      request = Net::HTTP::Post.new(uri.request_uri)
      request.set_form_data "act" => "login",
        "user" => "stretcher",
        "pass" => "secret",
        "challengekeyid" => $data[:challengekeyid].to_i,
        "challenge" => $data[:challenge]

      $data[:response] = http.request(request)
      p $data[:response].body  #=> ""
If that messy code doesn't make sense, what I'm trying to do is send a POST request to the login server (specified by https://github.com/Zarel/Pokemon-Showdown/blob/master/protocol-doc.md), with the params shown here:

protocol-doc.md said:
Otherwise, you'll need to make an HTTP POST request to http://play.pokemonshowdown.com/action.php with the data
Code:
act=login&user=USERNAME&pass=PASSWORD&challengekeyid=KEYID&challenge=CHALLENGE
and a blank body. If this isn't how it's done, I'd be glad to know.

It's interesting though, if I change my 'act' param to something random, the returned value has the correct mime type (something JSON) and contains the expected string ("][]")

If I modify the code to use HTTPS, the same thing happens. I've also tried it while logged out from my browser, if that's messing it up.

Thanks for any help.

ps sorry for making a thread I tried posting in the technical q's thread but it was getting spammed out by people when the server died
 

Zarel

Not a Yuyuko fan
is a Site Content Manageris a Battle Simulator Administratoris a Programmeris a Pokemon Researcheris an Administrator
Creator of PS
lol, shoulda tagged me earlier, pick.

Anyway, I typoed protocol-doc.md (it's fixed now). It should be name=USERNAME, not user=USERNAME.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top