Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

HTTP and spaces

Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
09-18-2006 23:01
Hi,

I have a small problem with llHTTPRequest that I am sure is common
( just I cant find the answer in the millions of google answers I get )

I am sending Avatar name and some chat via HTTP ( using get ) to my site - querying it and replying.

Everything was working ok -

Then I came to store the data so I could look at it later and noticed that all of the spaces are being stripped out of the name and chat
( didnt notice before as I was searching the chat for triggers not looking at it as a whole )

I am sure I read somewhere about PHP and whitespace removal, but cant for the life of me find it now.

Can anyone point me in the right direction of how to stop it ?
( I dont really want to have to replace all spaces with %20 from LSL --- slooowww )

PS
If I enter the site manually and type in a response it keeps the space so I am assuming the browser is doinf some translation.
_____________________
Maker of quality Gadgets
Caligari Designs Store
Don Misfit
Registered User
Join date: 1 Jun 2006
Posts: 60
09-18-2006 23:26
Use llEscapeURL():

CODE
 
string lsName = llEscapeURL ( "Adriana Caligari" ) ;
string lsMsg = llEscapeURL ( "This is some chat text." ) ;
Adriana Caligari
Registered User
Join date: 21 Apr 2005
Posts: 458
09-19-2006 10:09
Thanks

Will give it a try
_____________________
Maker of quality Gadgets
Caligari Designs Store
Tuach Noh
Ignorant Knowlessman
Join date: 2 Aug 2006
Posts: 79
09-19-2006 13:18
Don't use GET to send data to the HTTP server. GET retrieves (gets) data from the server. To send data to an HTTP server, use PUT or POST.
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
09-19-2006 14:04
The GET method works just fine in my experience, both in llHTTPRequest and in straight PHP.
_____________________
Eloise's MiniMall
Visit Eloise's Minimall
New, smaller footprint, same great materials.

Check out the new blog
Tuach Noh
Ignorant Knowlessman
Join date: 2 Aug 2006
Posts: 79
09-22-2006 16:26
From: Eloise Pasteur
The GET method works just fine in my experience, both in llHTTPRequest and in straight PHP.


Sure, and I could also drive all the way to grocery store in reverse just fine. But it would still be backwards, illegal and unsafe.

RFC 2616 defines the HTTP protocol.

From: RFC 2616
In particular, the convention has been established that the GET and HEAD methods SHOULD NOT have the significance of taking an action other than retrieval. These methods ought to be considered "safe".


From: someone
9.3 GET
The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.


From: someone
9.5 POST
The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line.


From: someone
9.6 PUT
The PUT method requests that the enclosed entity be stored under the supplied Request-URI.


The one-size-GETs-all approach is completely wrong, no matter how common it is. By using GET when you should be using PUT/POST:

- you end up cramming junk into the URI that doesn't belong there
- you have to apply a very inefficient encoding to that junk
- you write all your data directly into one or more logfiles
- you blow off great opportunities to perform simple and effective reader-versus-writer access control
- you end up writing more code that's harder to debug

I guess this is "fine" for some people, but intentionally getting things wrong while simultaneously making them unnecessarily complicated doesn't sound that great to me.