Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-07-19
02:36 • Closed ticket [759888ffff]: http::geturl fails on URIs with username/password in... artifact: 9be9e2016c user: hobbs
2003-06-24
22:46 • Ticket [759888ffff]: 4 changes artifact: 15c38fed78 user: dossy
15:40 • New ticket [759888ffff]. artifact: 7928309dd0 user: dossy

http::geturl fails on URIs with username/password in them

Closed / Fixed759888ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-06-24 15:40:40
http::geturl throws an error when presented a URI that 
has a username and/or password embedded in the URI.  
Here's an example:

% package require http
2.4.2
% ::http::geturl http://username:password@localhost/
Unsupported URL: http://username:password@localhost/

What needs to be fixed is http2.4/http.tcl, lines 290--
296:

    290     # Validate URL, determine the server host and 
port, and check proxy         case
    291 
    292     if {![regexp -nocase {^(([^:]*)://)?([^/:]+)(:
([0-9]+))?(/.*)?$} $ur        l \
    293         x prefix proto host y port srvurl]} {
    294     unset $token
    295     return -code error "Unsupported URL: $url"
    296     } 

I'm working on writting a better regexp to handle better 
(and hopefully, complete) URI parsing.  I'll attach it as a 
patch as soon as I get it working and tested, unless 
someone beats me to it.

-- Dossy
dossyplain2003-06-24 22:46:36
Logged In: YES 
user_id=21885

Here's a revised regexp that at least fits my needs --

if {![regexp -nocase {^(([^:]*)://)?([^@]+@)?([^/:]+)(:([0-
9]+))?(/.*)?$} $url \

-- Dossy
hobbsplain2003-07-19 02:36:15
Logged In: YES 
user_id=72656

added to 8.5a and 8.4.4 for http 2.4.4.
Log in (anonymous is fine) to add a comment.