As for the error condition, I've been thinking about it more, and I'm pretty 
sure that uri:serialize() needs to enforce at least the following rules:

1. You can specify opaque-part, OR some subset of 
host/port/path/user-info/query. Not both. (Put another way: If opaque-part is 
specified, then only scheme and fragment may be additionally be specified.)

2. If you specify opaque-part, scheme is required.

3. If you specify a scheme and a path, then the path MUST start with a / 
character.

I would suggest introducing a zerr:ZURI0001 "malformed URI components" error 
message for uri:serialize() which is thrown if any of the above rules are 
broken, as well as some new test cases for each of them. It might be nice to 
have separate errors for each, I guess - ZURI0001 "cannot specify opaque-part 
in conjunction with host/port/path/user-info/query", ZURI0002 "scheme required 
when specifying opaque-part", and ZURI0003 "path component of absolute URI (ie, 
one with a scheme) must begin with /".
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-867376/+merge/159233
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to