[squeak-dev] HTTPSocket url encoding (Re:
[CryptographyTeam]Re:DigitalSignatureAlgorithm>>#initRandomNonInteractivelyisnotrandom)
Andreas Raab
andreas.raab at gmx.de
Sat Sep 4 18:41:42 UTC 2010
On 9/3/2010 11:57 PM, Levente Uzonyi wrote:
> On Fri, 3 Sep 2010, Andreas Raab wrote:
>
>> On 9/3/2010 4:25 PM, Levente Uzonyi wrote:
>>> And ConfigurationOfVMMaker can't load VMMaker, because there's a bug in
>>> HTTPSocket class >> #httpRequest:url:headers:content:response:. It
>>> double encodes the value of rawUrl. This prevents the code to load
>>> "Freetype-Plugin-John M McIntosh.55.mcz" because the filename contains
>>> spaces (initials shouldn't contain spaces...). Which are encoded to %20,
>>> then %20 is encoded to %2520 which results in a 404 error.
>>
>> Ouch. What's the easiest way to reproduce this problem?
>
> repository := MCHttpRepository
> location: 'http://source.impara.de/freetype'
> user: ''
> password: ''.
> repository readStreamForFileNamed: 'Freetype-Plugin-John M
> McIntosh.55.mcz' do: [ :contents | 'ok' ].
>
> This should print 'ok' instead of nil. Debug it for details.
Thanks, fixed now. Looking at 4.1 it's clear that the incoming URLs are
all assumed to be encoded already (which isn't a bad idea for
consistency) so I just took that encoding out and added a more
straightforward way to escape incoming URLs by means of
String>>urlEncoded, i.e.,
'http://squeak.org/name with space?key=value' urlEncoded.
=> 'http://squeak.org/name%20with%20space?key=value'
Not to be confused with #encodeForHTTP which would yield:
'http://squeak.org/name with space?key=value' encodeForHTTP.
=> 'http%3A%2F%2Fsqueak.org%2Fname%20with%20space%3Fkey%3Dvalue'
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|