SRL Archive - Discussions and Debates

InitializeHTTPClient not properly holding cookies?


Harry

2012-03-22 04:42:01

Does anyone have any ideas why this doesn't work? It logs in and goes to the redirect, but then gives 400 error, which they claim is a problem with cookies.

Sex informs me that InitializeHTTPClient's "cookie jar" isn't working for Simba properly. Is this the case, or can you guys see anything I might be doing wrong?

In the case it is broken, is there any way you guys would suggest working around it? Set-Cookie's are sent properly from Google, as I can tell from GetRawHeaders.

Script (is going to be used to send SMS from Google Voice):
program GoogleVoiceSMSSender;

procedure FetchGoogle;
var TheClient:integer;
LoginPage,thekeys,final,thegoto,mainPage:string;
begin
cleardebug;
Writeln('Logging into Google Voice...');
TheClient := InitializeHTTPClient(True);
SetHTTPUserAgent(TheClient,'Simba Voice');
LoginPage := GetHTTPPage(TheClient,'https://accounts.google.com/ServiceLogin?passive=true&service=grandcentral');
if (length(loginpage) < 10) then
begin
WriteLn('Perkele! You don''t have SSL libs for your Simba, or Google will not load for you.');
TerminateScript;
end;

thekeys := Between('name="GALX"','><',loginpage);
writeln(thekeys);
thekeys := between(' value="','">',thekeys);
writeln(thekeys);

addpostvariable(theclient,'Email','YOUREMAIL@gmail.com');
addpostvariable(theclient,'Passwd','YOURPASSWORD');
addpostvariable(theclient,'continue','https://www.google.com/voice/account/signin');
addpostvariable(theclient,'service','grandcentral');
addpostvariable(theclient,'GALX',thekeys);

final := posthttppageex(theclient,'https://accounts.google.com/ServiceLoginAuth');
ClearPostData(theclient); // aaaaa? maybe not needed.
writeln(final);

if (pos('LoginDoneHtml',final) <> 0) then
writeln('login werked!')
else
writeln('failed :(');

thegoto := Between('HREF="','">here',final);

mainPage := GetHTTPPage(TheClient,thegoto);

writeln(mainPage);

FreeHTTPClient(TheClient);
end;

begin
FetchGoogle;
end.

You will need to extract those DLLs attached to the post to your Simba folder to run the script, as Simba isn't shipped with the SSL libs yet
PS: I posted this in SRL Members section since I am pretty sure it's technically illegal to redistribute the compiled SSL libs, etc.

Kyle Undefined

2012-03-22 10:36:47

I thought that the HTTPClient didn't handle cookies?