Tk Library Source Code

View Ticket
Login
Ticket UUID: 545368
Title: uri default scheme
Type: RFE Version: None
Submitter: markgsaye Created on: 2002-04-17 21:04:05
Subsystem: uri Assigned To: andreas_kupries
Priority: 8 Severity:
Status: Closed Last Modified: 2003-04-15 03:34:49
Resolution: Closed By: andreas_kupries
    Closed on: 2003-04-14 20:34:49
Description:
I've noticed that the uri package defaults to a http
scheme when none is specified:

% package require uri
1.1
% uri::split ftp.somewhere.com
port {} path ftp.somewhere.com scheme http host {}
query {}
                               ^^^^^^^^^^^
Wouldn't it make more sense for it to return a scheme
of {} ? Then an application could default to http if
required. In my case, I want to default to ftp, but
need to know if the url contains another scheme
specifier.

I suppose the uri::split needs to assume a default
scheme to that it knows which sub-proc to call (i.e.
uri::SplitFtp, uri::SplitHttp) Perhaps the uri::split
proc could take an optional arg to specify the default
scheme?

% uri::split ftp.somewhere.com ftp

This addition is trivial to implement.

proc uri::split {url {scheme {}}} {
 ...
}

or even make it more flexible with 'args' (but right
now I don't see any need to specify defaults for
anything other than the scheme)
User Comments: andreas_kupries added on 2003-04-15 03:34:49:
Logged In: YES 
user_id=75003

Accepted, with slight changes. To stay API compatible with 
existing application the 'defaultscheme' argument defaults to 
http, and not the empty string. That way applications not 
using th new argument are not affected by its absence, the 
pre-existing behaviour is unchanged.

andreas_kupries added on 2003-04-12 05:36:28:
Logged In: YES 
user_id=75003

Raising the priority of the item because its inclusion in the 
upcoming release was proposed in the Tcllib-devel mailing list.

Supporting or contrarian statements should be made on the 
referenced mailing list for public discussion.

pointsman added on 2002-06-16 02:54:17:
Logged In: YES 
user_id=13222

I still would find this a very useful enhancement of the uri
package. The original submitter need ftp as default, I
sometimes need file as default

As far, as I see, the suggested simple implementation seem fine.

Are there any objections against this proposal, that should
be disussed? 

Would it help, to submit a patch (even for such a small change)?

rolf

nobody added on 2002-04-18 05:25:07:
Logged In: NO 

I second to not hard wire http as default scheme.
The suggested solution would be OK with me (and would be
better than the behavior, as it is now).