Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-03-22
22:58 • Closed ticket [921072ffff]: Regexp misparses some URL plus 8 other changes artifact: 9abcd3210f user: dgp
15:35 • New ticket [921072ffff]. artifact: 75a56fd205 user: nobody

Regexp misparses some URL

Closed / Duplicate921072ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-03-22 15:35:40
A URL of the form
http://foo.com/@bar.com/url.ext
is misparsed with the host being bar.com instead of foo.com.

The problem is an attempt to parse [email protected] type URL

This code is where it happens:

       set exp {^(([^:]*)://)?([^@]+@)?([^/:]+)(:([0-9]+))?(/.*)?$}
       if {![regexp -nocase $exp $url x prefix proto user host y port srvurl]} {

This modification (adding a / to the unrecognzed characters as part of a 
"name@" field) solves the problem.
  
        set exp {^(([^:]*)://)?([^@/]+@)?([^/:]+)(:([0-9]+))?(/.*)?$}
        if {![regexp -nocase $exp $url x prefix proto user host y port srvurl]} {

Submitted by [email protected]
dgpplain2004-03-22 22:58:27
Logged In: YES 
user_id=80530


Dup. of 920728
Log in (anonymous is fine) to add a comment.