geturl http://192.168.0.2/test/test.php?userid=sip:[email protected]
Closed / Fixed1358369fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-11-16 19:35:29
http::geturl http://192.168.0.2/test/test.php?userid=sip:[email protected] will report an error. The regular expression set exp {^(([^:]*)://)?([^@]+@)?([^/:]+)(:([0-9]+))?(/.*)?$} will get confused by the '@' in the URL. -Xiaotao
hobbsplain2005-11-17 02:41:11
Logged In: YES user_id=72656 That is not a valid geturl request. The URL is not strictly valid - it should be encoded, which http provides the functions for. The query part should be formed by: (Tcl) 50 % http::formatQuery userid sip:[email protected] userid=sip%3ax%40abc.com that is proper URL formatting.
hobbs Ticket [1358369fff]: 2 changes
[History diff]2005-11-17 02:41:13
dkfplain2005-11-17 18:22:57
Logged In: YES
user_id=79902
On the other hand, handling URLs more robustly is a good
thing anyway. Tests indicate that the RE:
{(?x)
^
(?: (\w+) : )# <protocol>
(?: //
(?: ([^@/:#?]+) (?: : ([^@/#?]+) )? @ )?# <user> <pass>
( [^/:#?]+ )# <host>
(?: : (\d+) )?# <port>
)?
( / [^#]* )?# <path> (including query)
(?: \# (.*) )?# <fragment>
$
}
offers both robust parsing (including of a number of rarely
used parts of the URL spec) and yet is also fairly easy to
understand. It also doesn't capture bits that aren't
interesting.
hobbs Ticket [1358369fff]: 1 change
[History diff]2005-11-18 01:30:01
hobbsplain2005-11-18 01:30:02
Logged In: YES user_id=72656 Donal - you can reopen if you want to provide a better RE, but make sure to add more tests along with it. Regardless, better conformance to the x-url-encoding for users should be directed.
dkfplain2005-11-18 07:07:23
Logged In: YES user_id=79902 Reopening to stop me from losing the issue...
dkfplain2005-11-18 21:01:12
Logged In: YES user_id=79902 Added improved validator (I think it is compliant with RFC 3986, which I believe to be the most up-to-date URI spec) to HEAD using attached patch. I don't plan to backport this patch.
dkf Ticket [1358369fff]: 2 changes
[History diff]2005-11-18 21:01:13
dkfplain2005-11-18 21:01:15
File Added - 156758: httpparse.diff
dkfplain2005-11-18 22:21:38
Logged In: YES user_id=79902 backported after prodding from dgp
Log in (anonymous is fine) to add a comment.
Attachments:
- httpparse.diff [download] added by dkf on 2005-11-18 21:01:13. [details]