how to generate session url's

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

RE: is there url encoding in Seaside or Squeak?

Ramon Leon-5
> Hello,
>
> I have a string that I need to 'url encode' as specified in
> RFC 1738 (see http://www.rfc-editor.org/rfc/rfc1738.txt )
>
> Does anybody know of an existing method that already does that?
> There is code in WAUrlEncoder and WAUrl but if I am correct
> that has nothing to do with 'url encoding' as meant in RFC 1738.
> Maybe there is some code that does a simple parse of a string
> and replaces it with values from a table that I can use as a model?
>
>
> An example of url encoding:
>
> The url:   'xmlPath=http://localhost:9090/seaside/tests/facade?
> 24&_k=QfTdFUeY&_s=FSxTGyuBNcNckyjq'
>
> can be encoded as:  'xmlPath%3Dhttp%3A%2F%2Flocalhost%3A9090%2Fseaside
> %2Ftests%2Ffacade%3F24%26%5Fk%3DQfTdFUeY%26%5Fs%3DFSxTGyuBNcNckyjq'

Why would you think WAUrlEncoder has nothing to do with url encoding?

url :=
'xmlPath=http://localhost:9090/seaside/tests/facade?24&_k=QfTdFUeY&_s=FSxTGy
uBNcNckyjq'.

String streamContents: [:stream |  
        url do: [:each | (WAUrlEncoder encode: each on: stream)]]

It just encodes on character at a time.  Which gives you an identical answer
up until _k, where I notice that Seaside doesn't encode _'s like your
examples do, but I believe Seaside is correct here, _'s don't need encoding.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: is there url encoding in Seaside or Squeak?

Merik Voswinkel
>> I  have a string that I need to 'url encode' as specified in
>> RFC 1738 (see http://www.rfc-editor.org/rfc/rfc1738.txt )
>>
>> Does anybody know of an existing method that already does that?
>> There is code in WAUrlEncoder and WAUrl but if I am correct
>> that has nothing to do with 'url encoding' as meant in RFC 1738.
>> Maybe there is some code that does a simple parse of a string
>> and replaces it with values from a table that I can use as a model?
>>
>>
>> An example of url encoding:
>>
>> The url:   'xmlPath=http://localhost:9090/seaside/tests/facade?
>> 24&_k=QfTdFUeY&_s=FSxTGyuBNcNckyjq'
>>
>> can be encoded as:  'xmlPath%3Dhttp%3A%2F%2Flocalhost%3A9090%
>> 2Fseaside
>> %2Ftests%2Ffacade%3F24%26%5Fk%3DQfTdFUeY%26%5Fs%3DFSxTGyuBNcNckyjq'
>
> Why would you think WAUrlEncoder has nothing to do with url encoding?
>
> url :=
> 'xmlPath=http://localhost:9090/seaside/tests/facade?
> 24&_k=QfTdFUeY&_s=FSxTGy
> uBNcNckyjq'.
>
> String streamContents: [:stream |
> url do: [:each | (WAUrlEncoder encode: each on: stream)]]
>
> It just encodes on character at a time.  Which gives you an  
> identical answer
> up until _k, where I notice that Seaside doesn't encode _'s like your
> examples do, but I believe Seaside is correct here, _'s don't need  
> encoding.
>
> Ramon Leon

My mistake because I was looking for something to encode the whole  
url, not one character.
After two hours I have found what I was looking for: String>>>  
encodeForHTTP encodes the whole string:

xmlUrl := xmlUrl encodeForHTTP.

But it does not encode all (just like Seaside), it does not encode  
the '_' and the '.' as you can see from this result:

xmlPath%3Dhttp%3A%2F%2Fwww.macmerik.nl%3A9090%2Fseaside%2Ftests%
2Ffacade%3F14%26_k%3DzllSchmY%26_s%3DqzSqkxyQfMWoNLdV

So I will rewrite it to encode those characters as well, like the  
tool at http://www.dommermuth-1.com/protosite/experiments/encode/ 
index.html .
This tool is written in Flash and does encode the '_' and '.'  also.  
I need the conversion Flash uses because it is for passing url's with  
FlashVars to Flash.

The question that remains is why some characters are not encoded and  
others are.

Thank you for the help


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: is there url encoding in Seaside or Squeak?

Stuart Herring
On 9/30/07, Merik Voswinkel <[hidden email]> wrote:

> My mistake because I was looking for something to encode the whole
> url, not one character.
> After two hours I have found what I was looking for: String>>>
> encodeForHTTP encodes the whole string:
>
> xmlUrl := xmlUrl encodeForHTTP.
>
> But it does not encode all (just like Seaside), it does not encode
> the '_' and the '.' as you can see from this result:
>
> xmlPath%3Dhttp%3A%2F%2Fwww.macmerik.nl%3A9090%2Fseaside%2Ftests%
> 2Ffacade%3F14%26_k%3DzllSchmY%26_s%3DqzSqkxyQfMWoNLdV
>
> So I will rewrite it to encode those characters as well, like the
> tool at http://www.dommermuth-1.com/protosite/experiments/encode/
> index.html .
> This tool is written in Flash and does encode the '_' and '.'  also.
> I need the conversion Flash uses because it is for passing url's with
> FlashVars to Flash.
>
> The question that remains is why some characters are not encoded and
> others are.
Why would you encode '_' or '.'?  They have no special meaning in a
URL or in HTTP and they both fall within the 7 bit ASCII character set
as standard printable characters.
Encoding them would produce a needlessly long URL and waste CPU cycles
at both ends.

>From the RFC you quoted above:
   Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
   reserved characters used for their reserved purposes may be used
   unencoded within a URL.

'_' and '.' are explicitly mentioned as not needing to be encoded

>From your examples it's apparent that you don't want _every_ character
encoded as you're not expecting the standard alpha-numeric characters
to be encoded, so why underscore and full-stop?
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: is there url encoding in Seaside or Squeak?

Merik Voswinkel

On Oct 3, 2007, at 12:30 PM, Stuart Herring wrote:

> On 9/30/07, Merik Voswinkel <[hidden email]> wrote:
>> My mistake because I was looking for something to encode the whole
>> url, not one character.
>> After two hours I have found what I was looking for: String>>>
>> encodeForHTTP encodes the whole string:
>>
>> xmlUrl := xmlUrl encodeForHTTP.
>>
>> But it does not encode all (just like Seaside), it does not encode
>> the '_' and the '.' as you can see from this result:
>>
>> xmlPath%3Dhttp%3A%2F%2Fwww.macmerik.nl%3A9090%2Fseaside%2Ftests%
>> 2Ffacade%3F14%26_k%3DzllSchmY%26_s%3DqzSqkxyQfMWoNLdV
>>
>> So I will rewrite it to encode those characters as well, like the
>> tool at http://www.dommermuth-1.com/protosite/experiments/encode/
>> index.html .
>> This tool is written in Flash and does encode the '_' and '.'  also.
>> I need the conversion Flash uses because it is for passing url's with
>> FlashVars to Flash.
>>
>> The question that remains is why some characters are not encoded and
>> others are.
> Why would you encode '_' or '.'?  They have no special meaning in a
> URL or in HTTP and they both fall within the 7 bit ASCII character set
> as standard printable characters.
> Encoding them would produce a needlessly long URL and waste CPU cycles
> at both ends.

It is what FlashVars demand (I think it is typical of Adobe Flash, i  
vastly prefer Open Source Flash)

>
>> From the RFC you quoted above:
>    Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>    reserved characters used for their reserved purposes may be used
>    unencoded within a URL.
>
> '_' and '.' are explicitly mentioned as not needing to be encoded
>
It still must be done, i tested it. Flashvars is not documented so  
this is how you must find out.
I have it running and implemented a special encodeForHTTPandFlashVars

>> From your examples it's apparent that you don't want _every_  
>> character
> encoded as you're not expecting the standard alpha-numeric characters
> to be encoded, so why underscore and full-stop?

Again, it must be so as the tests prove.

Merik
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: is there url encoding in Seaside or Squeak?

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Merik Voswinkel
Re: [Seaside] is there url encoding in Seaside or Squeak?

Really? I use existing encoding to pass URLs to Flash components via vars and never noticed needing to change encoding to include underscore and period chars as it worked just fine so far.

Cheers!

-Boris
(Sent from a BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Seaside - general discussion <[hidden email]>
Sent: Wed Oct 03 04:50:34 2007
Subject: Re: [Seaside] is there url encoding in Seaside or Squeak?


On Oct 3, 2007, at 12:30 PM, Stuart Herring wrote:

> On 9/30/07, Merik Voswinkel <[hidden email]> wrote:
>> My mistake because I was looking for something to encode the whole
>> url, not one character.
>> After two hours I have found what I was looking for: String>>>
>> encodeForHTTP encodes the whole string:
>>
>> xmlUrl := xmlUrl encodeForHTTP.
>>
>> But it does not encode all (just like Seaside), it does not encode
>> the '_' and the '.' as you can see from this result:
>>
>> xmlPath%3Dhttp%3A%2F%2Fwww.macmerik.nl%3A9090%2Fseaside%2Ftests%
>> 2Ffacade%3F14%26_k%3DzllSchmY%26_s%3DqzSqkxyQfMWoNLdV
>>
>> So I will rewrite it to encode those characters as well, like the
>> tool at http://www.dommermuth-1.com/protosite/experiments/encode/
>> index.html .
>> This tool is written in Flash and does encode the '_' and '.'  also.
>> I need the conversion Flash uses because it is for passing url's with
>> FlashVars to Flash.
>>
>> The question that remains is why some characters are not encoded and
>> others are.
> Why would you encode '_' or '.'?  They have no special meaning in a
> URL or in HTTP and they both fall within the 7 bit ASCII character set
> as standard printable characters.
> Encoding them would produce a needlessly long URL and waste CPU cycles
> at both ends.

It is what FlashVars demand (I think it is typical of Adobe Flash, i 
vastly prefer Open Source Flash)

>
>> From the RFC you quoted above:
>    Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>    reserved characters used for their reserved purposes may be used
>    unencoded within a URL.
>
> '_' and '.' are explicitly mentioned as not needing to be encoded
>
It still must be done, i tested it. Flashvars is not documented so 
this is how you must find out.
I have it running and implemented a special encodeForHTTPandFlashVars

>> From your examples it's apparent that you don't want _every_ 
>> character
> encoded as you're not expecting the standard alpha-numeric characters
> to be encoded, so why underscore and full-stop?

Again, it must be so as the tests prove.

Merik
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
12