Overview
Features
Download
Documentation
Community
Add-Ons & Services

HTTP question

Please post support and help requests here.

HTTP question

Postby AeroFox » 23 Jan 2008, 13:34

I have this code.

string
grab_ticket(string& address, string& email, string& password, string &ticket)
{
string auth("Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=");
replace_all(email, "@", "%40");
auth.append(email);
auth.append(",pwd=");
auth.append(password);
auth.append(",");
auth.append(ticket);
auth.append("
");

string mainAddy("http://");
mainAddy.append(address);
URI uri(mainAddy);

try
{
while(true)
{
string path(uri.getPath());

HTTPClientSession server(uri.getHost());
HTTPRequest request(HTTPRequest::HTTP_GET, path, HTTPRequest::HTTP_1_0);
request.add("Authorization", auth);
server.sendRequest(request);

HTTPResponse response;
server.receiveResponse(response);

if(response.getStatus() == HTTPResponse::HTTP_OK)
{
if(response.has("Authentication-Info"))
return response.get("Authentication-Info");
}
else if(response.getStatus() == HTTPResponse::HTTP_UNAUTHORIZED)
{
string authInfo = response.get("WWW-Authentication");
return authInfo;
}
else if(response.getStatus() == HTTPResponse::HTTP_FOUND)
{
uri = response.get("Location");
}
}
}
catch(Exception& exc)
{
cout << exc.message() << endl;
}
return "";
}

I need to put auth string into a header called Authorization. Then grab Authentication-Info afterwards from the headers. And I've tried get() set() and nothing. I either get unauthroize, or the headers return blank or something like that. Any ideas how I can add headers and get frojm the headers, if i'm doing this wrong?
AeroFox
 
Posts: 1
Joined: 22 Jan 2008, 17:27

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron