• Sending cookies with OOSocks
    3 replies, posted
This script is based on my friend's script, but he doesn't know what's wrong, and I don't know a lot about how sockets work. [url]http://iriz.pastebin.com/gDaDYa27[/url] I can get a new cookie just fine with alan.AssignCookie(uniqueid, callback), but when I use that cookie in alan.SendQuestion(uniqueid, question, callback) like so: [lua]socket:SendLine(Format("GET %s&question=%s HTTP/1.1", AlanURL(), URLEscape(question))) socket:SendLine("Host: www.a-i.com") socket:SendLine(Format("Cookie: ASPSESSIONIDACRQSRQC=%s", cookies[uniqueid])) socket:SendLine("")[/lua] It doesn't set the cookie properly. Instead it gives me a new cookie that differs from the one I sent. When I run the script it calls the example code at the bottom of the script, this is the output: [code]SET COOKIE TO: ONCFJJCBPEFPBCMPJEAEKBEM COOKIE FOUND IN ANSWER BUT IT DOESN'T MATCH ANY OF THE LOCALLY STORED COOKIES THE COOKIE FOUND WAS: PNCFJJCBDEBPCEPPDFMPHNJH[/code] Here is the script I based it on: [url]http://danielga.bplaced.net/Uploads/chatbot_example.lua[/url] And here is the old one I used using luasocket (which is now broken, so I wanted to remake it): [url]http://code.google.com/p/alanthefairy/source/browse/trunk/lua/entities/gmod_alan/sv_alan.lua[/url]
-snip-
Oh and ralle suggested that I should try and send it all in one go with socket:Send() and concatenate strings and add newlines. That didn't work either.
I managed to receive a cookie (Set-Cookie) but it differs from the one I sent. new paste: [url]http://iriz.pastebin.com/gDaDYa27[/url]
Sorry, you need to Log In to post a reply to this thread.