New handling for URI scheme handlers

François Revol revol at free.fr
Tue Oct 5 12:57:12 PDT 2010


(sorry for breaking the thread I get mime digests but OSX Mail.app doesn't like them)

Hi,

> This morning I implemented in GNOME use of the x-scheme-handler/*
> mime-type for applications to register their interest in handling
> particular URI schemes.
> 
> I posted about it in:
> http://www.hadess.net/2010/10/new-control-center-and-you.html
> And have a blocker bug for GNOME applications in:
> https://bugzilla.gnome.org/show_bug.cgi?id=631433
> 
> The attached patch is changes to the shared-mime-info spec to mention
> the use of x-scheme-handler/* mime-types.
> 
> Any comments?

"BeOS did this 15 years ago" ? ;-)

FWIW Yeah really in BeOS we have them mapped as application/x-vnd.Be.URL.foo and that's what we use in Haiku as well.
cf.
http://dev.haiku-os.org/browser/haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.http
http://dev.haiku-os.org/browser/haiku/trunk/src/data/beos_mime/application/x-vnd.be.url.ssh
...
http://dev.haiku-os.org/browser/haiku/trunk/src/bin/urlwrapper.cpp
http://dev.haiku-os.org/browser/haiku/trunk/src/bin/urlwrapper.rdef

I suppose we could push Haiku to switch to this supertype too...
Does the IANA actually allow vendor-specific supertypes ?

Nice to see we had it right ;)

> On Tuesday, October 5, 2010, Bastien Nocera wrote:
>> The attached patch is changes to the shared-mime-info spec to mention
>> the use of x-scheme-handler/* mime-types.
>> 
>> Any comments?
> 
> i suggested to use the mimetype database in a very similar way for default 
> applications (default terminal, web browser, etc). this idea was denied 
> because it was "misusing the mimetype database for non-mimetype data". if this 
> does indeed become part of the fd.o spec, can we also add something in there 
> for default apps at the same time that uses it in the same/similar manner?

I don't see what's wrong with this...

"BeOS did this 15 years ago" also with applications, they all have a mime signature anyway ;-)

For example the default browser is the preferred app for text/html, same for text/email :

$ setmime -dump text/html
/bin/setmime -set text/html -short "HTML File" -preferredAppSig application/x-vnd.Firefox -sniffRule '0.40          [0:64]( -i "<HTML" | "<HEAD" | "<TITLE" | "<BODY" | "<TABLE" | "<!--" | "<META" | "<CENTER")' -extension htm -extension html
$ setmime -dump text/x-email
/bin/setmime -set text/x-email -short "E-mail" -long "Electronic Mail Message" -preferredAppSig application/x-vnd.Be-MAIL


>> But to come back to your use case, all urls with a given scheme, no mimetype 
>> at all, then OK. I just hope nobody installs a desktop file with x-scheme-
>> handler/http ever...
> 
> Apart from web browsers, nothing should. And the cleverness for that
> particular codepath is still there.

In Haiku /bin/urlwrapper accepts http: and calls wget, which can be useful as default when no browser is installed...

> The main use though would be when applications handle *all* the files on
> the URI scheme, such as:
> - MMS, RTSP, RTP URIs -> movie player
> - FEED, ZCAST, ITPC -> podcast manager
> - MAILTO -> mail client
> etc.

Exactly.

urlwrapper here starts Terminal with the corresponding command for ssh:, telnet:, sh: (with a warning :p) :-)

I even wrote 
http://dev.haiku-os.org/browser/haiku/trunk/src/bin/checkitout.cpp
which accepts git: svn: and friends and asks you where you want the sources checked out :-)

François.


More information about the xdg mailing list