Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Additional HTTP request headers with llHTTPRequest?

Chance Takashi
Inimitable
Join date: 22 Feb 2006
Posts: 25
08-25-2006 12:42
Hi, all.

I'm trying to send authentication information via llHTTPRequest, but can't figure out how to add extra headers. For example, if one is doing basic HTTP authentication, one sends something like
CODE
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==

Which goes in the HTTP header. However, I've bene unable to figure out how to do this with llHTTPRequest. I've tried putting it as the first line of the body, followed by two blank lines, but no dice.

I tried tricking LSL with a juiced up mime type header:

CODE
reqID = llHTTPRequest(myURL,  [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded\nAuthorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
"], body);


But LSL was too smart and told me that the HTTP_MIMETYPE was invalid. No joy in Mudville.

Anyone have any pointers?
_____________________
Blatant self-aggrandizement:

Blog: SL Musings
My SL Profile
My Profile in the SL Herald
Kristian Ming
Head Like A Hole
Join date: 5 Feb 2005
Posts: 404
08-28-2006 10:09
Hmm. What about the http://yourusername:yourpassword@yourhost.com method. Does LSL support that? I'd been meaning to test but haven't got around to it yet.
_____________________
"When you're going through hell, keep going!" -- Winston Churchill
Lee Dimsum
Registered User
Join date: 22 Feb 2006
Posts: 118
08-28-2006 10:09
use webforms authentication?
Chance Takashi
Inimitable
Join date: 22 Feb 2006
Posts: 25
08-28-2006 10:26
From: Kristian Ming
Hmm. What about the http://yourusername:yourpassword@yourhost.com method. Does LSL support that? I'd been meaning to test but haven't got around to it yet.


Actually, while that's a valid URL, HTTP (the protocol) doesn't use full URLs when making a request. The browser (or other user agent) takes the URL apart and uses the relevant parts to do the request. Thus the yourusername:yourpassword is (in the case of basic authentication) hashed into a base64 string and sent in the appropriate header.

That being said, LL may have written llHTTPRequest such that it recognizes those sorts of URLs, which means it'd be worth a try at least. However, I was giving basic authentication as an example. The authentication scheme I was looking to use is different, but works the same way, using the Authentication header, and there's no way to specify via URL which sort of authentication to do, AFAIK.

There are also other headers I'd like to be able to use, such as If-Modified-Since (to get only new files) and Range (to grab chunks of a file, not the whole thing).

Thanks for the suggestion, though! I'll definitely check to see if they built in the URL-based authentication you suggested, even if it's not suited to my application, just to see! Good idea!
_____________________
Blatant self-aggrandizement:

Blog: SL Musings
My SL Profile
My Profile in the SL Herald
Peter Newell
Registered User
Join date: 17 Feb 2006
Posts: 20
08-30-2006 15:48
This method does work for simple http authentication, as I just tested in world.

Good stuff.
Dragon Keen
Registered User
Join date: 24 Apr 2006
Posts: 245
08-30-2006 19:07
why not just do whatever.com?password=SOME MD5 HASH&variables here

thats another simpler way.... parse it with php/whatever to make sure it matches
Ben Fassbinder
Registered User
Join date: 16 Jun 2005
Posts: 13
12-04-2006 20:51
Dragon, that works if you are writing a script to talk to your own server. On the other hand, if you want your script to talk to a third party server that uses an "Authentication:" header, this will obviously not work.
SpaceQ Isan
Registered User
Join date: 20 Oct 2006
Posts: 22
12-05-2006 03:17
url authentication u suggesting is no protection at all.. every url logger will catch it and its much easier to reuse it. If you dont have way how to authenticate securly ... kerberos/ntlm just POST authentication token(one time password ticket ). This of course require to use you own web server so you can support it
or you can make 2 key system encryption with LSL :)(not worth it as lindel will include IMHO signing functions soon) just for beginning of connection
SSL anyway uses it only at the beginning of connection then its plain one key encrypting
Ben Fassbinder
Registered User
Join date: 16 Jun 2005
Posts: 13
12-06-2006 01:21
I have created a feature request proposal for this:

http://secondlife.com/vote/vote.php?get_id=2462