HTTPSocket>>argString:args

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

HTTPSocket>>argString:args

Ernst-2
Is there a bug in this method?
An association in the  args dictionary will contain the name of a prameter and its value as a string. The iteration    assoc value do: [ :value |    will operate on characters of the value which I think is not intended.
....
args associationsDo: [ :assoc |
                assoc value do: [ :value |
                        first ifTrue: [ first := false ] ifFalse: [ argsString nextPut: $& ].
                        argsString nextPutAll: assoc key encodeForHTTP.
                        argsString nextPut: $=.
                        argsString nextPutAll: value encodeForHTTP. ] ].

should be?
....
args associationsDo: [ :assoc |
                        first ifTrue: [ first := false ] ifFalse: [ argsString nextPut: $& ].
                        argsString nextPutAll: assoc key encodeForHTTP.
                        argsString nextPut: $=.
                        argsString nextPutAll: assoc value encodeForHTTP ].
Reply | Threaded
Open this post in threaded view
|

Re: HTTPSocket>>argString:args

Ernst-2
Just found out about HTTPSocket. It seems to be the class which should be used for http requests. It also can do basic authentication.
Thanks
ernst


ernst wrote
Is there a bug in this method?
An association in the  args dictionary will contain the name of a prameter and its value as a string. The iteration    assoc value do: [ :value |    will operate on characters of the value which I think is not intended.
....
args associationsDo: [ :assoc |
                assoc value do: [ :value |
                        first ifTrue: [ first := false ] ifFalse: [ argsString nextPut: $& ].
                        argsString nextPutAll: assoc key encodeForHTTP.
                        argsString nextPut: $=.
                        argsString nextPutAll: value encodeForHTTP. ] ].

should be?
....
args associationsDo: [ :assoc |
                        first ifTrue: [ first := false ] ifFalse: [ argsString nextPut: $& ].
                        argsString nextPutAll: assoc key encodeForHTTP.
                        argsString nextPut: $=.
                        argsString nextPutAll: assoc value encodeForHTTP ].