Hi Olivier, On 22 Oct 2013, at 09:57, Olivier Auverlot <olivier.auver...@gmail.com> wrote:
> Hi, > > I work actually on a framework to manage a Proxmox server. The Proxmox > solution is based on a strange REST APIā¦ :-( > > To get informations about an user, I must send a string with the login and > the authentication domain. The two values are separated by a character @. > > For example: GET /api2/extjs/access/users/auverlot@LIFL > > My first problem with Zinc is that the client find the character @ and the > client think that this is an URL with authentication. I tried to use an > encoding string with %40 but Proxmox don't find the user. According to http://en.wikipedia.org/wiki/Urlencoding and thus http://tools.ietf.org/html/rfc3986 which is the URI spec, @ is a reserved character and has to be encoded. Which means that both as input for parsing as well as in rendered output it should be percent encoded, at least that is how I understand it. Do you have a different opinion ? Can you make the REST call using curl ? > The solution must be to modify the method ZnUrl>>#parseAuthority:from:to: to > do a better detection of authentication pattern: > > parseAuthority: string from: start to: stop > | index | > > index := string indexOf: $@ startingAt: start. > > (index > 0 and: [ (string indexOf: $: startingAt: start) < index and: [ > index < (string indexOf: $/ startingAt: start) ] ]) > ifTrue: [ > self parseUserInfo: (ReadStream on: string from: start > to: index - 1). > self parseHostPort: (ReadStream on: string from: index > 1 to: stop ) > ] > ifFalse: [ self parseHostPort: (ReadStream on: string from: > start to: stop ) ] I am not convinced (yet) that the parser have to change. I guess one hack could be to subclass ZnUrl and overwrite #encode:on: to use a customised ZnPercentEncoder where @ is in the safe set. Sven > But, it's not the end of the road :-( Because in the next steps, Zinc encodes > the character @ in the url. How to disabled the automatic encoding and using > special characters in the url ? > > Thanks for your help. > > Best regards > Olivier ;-)