Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0007149 [Squeak] Network minor always 08-07-08 17:21 08-07-08 17:21
Reporter Assargadon View Status public  
Assigned To cdegroot
Priority normal Resolution open  
Status assigned   Product Version 3.9
Summary 0007149: HTTPSocket>>argString: do not parses the dictionaries
Description It works:

res:=HTTPSocket httpPostDocument:'http://api.eve-online.com/corp/AccountBalance.xml.aspx' [^] args: 'userid=2280839&apikey=SRXvw1AFaUAMJGcpGFVoqwoaPqC16CqJLa0BbZDsW8p4Ka6LxaauMyUG3rBUO6Wj&characterid=1379701681'.

And it doesn't:

args:=(Dictionary with:'userid'->'2280839' with: 'apikey'->'SRXvw1AFaUAMJGcpGFVoqwoaPqC16CqJLa0BbZDsW8p4Ka6LxaauMyUG3rBUO6Wj' with: 'characterid'->'1379701681').
res:=HTTPSocket httpPostDocument:'http://api.eve-online.com/corp/AccountBalance.xml.aspx' [^] args: args.

Error appears in argString:, and it tries to use encodeForHTTP for symbol. And the loop for working with dictionaries looks weird.

After my modifications (see below) everything becomes OK.
Additional Information ========OLD code:===========
argString: args
        "Return the args in a long string, as encoded in a url"

        | argsString first |
        args isString ifTrue: ["sent in as a string, not a dictionary"
                ^ (args first = $? ifTrue: [''] ifFalse: ['?']), args].
        argsString _ WriteStream on: String new.
        argsString nextPut: $?.
        first _ true.
        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. ] ].
        ^ argsString contents
============================

I do not anderstand the meaning of inner loop ("assoc value do: [ :value |...") - it tries to loop on assosiation's value...hm. So I just removed it.

========NEW code:===========
argString: args
        "Return the args in a long string, as encoded in a url"

        | argsString first |
        args isString ifTrue: ["sent in as a string, not a dictionary"
                ^ (args first = $? ifTrue: [''] ifFalse: ['?']), args].
        argsString _ WriteStream on: String new.
        argsString nextPut: $?.
        first _ true.
        args associationsDo: [ :assoc |
                        first ifTrue: [ first _ false ] ifFalse: [ argsString nextPut: $& ].
                        argsString nextPutAll: assoc key encodeForHTTP.
                        argsString nextPut: $=.
                        argsString nextPutAll: assoc value encodeForHTTP. ].
        ^ argsString contents
============================
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
08-07-08 17:21 Assargadon New Issue
08-07-08 17:21 Assargadon Status new => assigned
08-07-08 17:21 Assargadon Assigned To  => cdegroot
08-07-08 17:22 Assargadon Issue Monitored: Assargadon


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
32 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker