TUriParser problem

Login to reply to this topic.
Wed, 2007-10-10 12:21
Joined: 2006-09-18
Forum posts: 68

Hi, I seem to have a problem using TUriParser.

When passing a DNS name ie "http://www.example.com" it works correctly,
but when passing an IP address ie "http://192.168.1.1" it doesn't work correctly.

This is what I do:

_LIT(KAddress,"http://192.168.1.1");
User::LeaveIfError( uri.Parse(KAddress) );
HBufC* hostName = uri.DisplayFormL(EUriHost);

hostName only contains garbage.

_LIT(KAddress,"http://www.example.com");
User::LeaveIfError( uri.Parse(KAddress) );
HBufC* hostName = uri.DisplayFormL(EUriHost);

hostName contains www.example.com


Wed, 2007-10-10 15:06
Joined: 2005-11-20
Forum posts: 1242
Re: TUriParser problem

I would try what happens with "http://192.168.1.1/" (adding a trailing slash). Maybe the URI parser needs that in case of an IP adress.

I could not find out whether that slash is formally needed, according to URI syntax definition, however.


René Brunner

Wed, 2007-10-10 21:08
Joined: 2006-09-18
Forum posts: 68
Re: TUriParser problem

I found the problem, sorry I was an Idiot.
I didn't post the actual code I used, just something which I thought would reproduce the error. I'm sorry.
Any way the problem was that I used an RBuf which I manipulated and then passed to TUriParser, this worked fine, problem was after I passed it to TUriParser I closed the RBuf. TUriParser doesn't keep any copy of the data passed to it, therefore I got garbage.

It works with or without trailing slash.

  • Login to reply to this topic.