Discussion:
New handling for URI scheme handlers
Bastien Nocera
2010-10-05 15:32:25 UTC
Permalink
Heya,

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?

Cheers
Damjan Jovanovic
2010-10-05 15:36:52 UTC
Permalink
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
Cheers
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
I love it. Does it work in KDE?
Bastien Nocera
2010-10-05 15:45:18 UTC
Permalink
Post by Damjan Jovanovic
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
Cheers
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
I love it. Does it work in KDE?
Not sure what you mean exactly. But if your app registered
x-scheme-handler/foo and you tried to launch it using a GIO-based
application, it would be considered at the same level as a GNOME
application.

I don't know which process KDE itself uses to register URI scheme
handlers, but I'm guessing it's either something similar, or another key
in .desktop file. Am I correct?

Cheers
Thiago Macieira
2010-10-05 16:01:38 UTC
Permalink
Post by Damjan Jovanovic
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I love it. Does it work in KDE?
No.

KDE requires that you install a .protocol file (which is just a .desktop file
with a different extension) in /usr/share/kde4/services.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358

Qt Developer Days 2010 - Munich Oct 11-13 - San Francisco Nov 1-3
For more information and to register: http://qt.nokia.com/qtdevdays2010
Bastien Nocera
2010-10-05 16:10:57 UTC
Permalink
Post by Thiago Macieira
Post by Damjan Jovanovic
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I love it. Does it work in KDE?
No.
KDE requires that you install a .protocol file (which is just a .desktop file
with a different extension) in /usr/share/kde4/services.
I should add that using a mime-type means that you get to have an
mmap'ed binary cache, which is probably the only gain above the KDE
implementation.

And you could keep both implementations as well...

Cheers
Aaron J. Seigo
2010-10-05 16:35:46 UTC
Permalink
Post by Bastien Nocera
Post by Thiago Macieira
Post by Damjan Jovanovic
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I love it. Does it work in KDE?
No.
KDE requires that you install a .protocol file (which is just a .desktop
file with a different extension) in /usr/share/kde4/services.
I should add that using a mime-type means that you get to have an
mmap'ed binary cache, which is probably the only gain above the KDE
implementation.
KDE provides a mmap'd binary cache of the contents of the .protocol files. it
would be far too slow otherwise. i think the general implementation is not
that different, only in the detail of "is the mimetype system a good place to
put additional sort-of-like-but-not-quite application associations?" question.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
Thiago Macieira
2010-10-05 16:36:38 UTC
Permalink
Post by Bastien Nocera
Post by Thiago Macieira
No.
KDE requires that you install a .protocol file (which is just a .desktop
file with a different extension) in /usr/share/kde4/services.
I should add that using a mime-type means that you get to have an
mmap'ed binary cache, which is probably the only gain above the KDE
implementation.
And you could keep both implementations as well...
KDE has a binary, mmap()able cache of its configuration already, but the file
format is not standardised (in fact, it changes from version to version of KDE
and is regenerated as necessary).

I'm not arguing against (or for) the new scheme. I'm merely stating how KDE
does this now.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358

Qt Developer Days 2010 - Munich Oct 11-13 - San Francisco Nov 1-3
For more information and to register: http://qt.nokia.com/qtdevdays2010
Aaron J. Seigo
2010-10-05 16:20:10 UTC
Permalink
Post by Bastien Nocera
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?

if consistency reigns and this addition does not achieve consensus approval,
we do have .protocol files in KDE already and it would be nice (and sensible)
to use something that already exists instead of reinventing new wheels of
incompatibility.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Qt Development Frameworks
Thiago Macieira
2010-10-05 16:42:11 UTC
Permalink
Post by Aaron J. Seigo
Post by Bastien Nocera
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?
if consistency reigns and this addition does not achieve consensus
approval, we do have .protocol files in KDE already and it would be nice
(and sensible) to use something that already exists instead of reinventing
new wheels of incompatibility.
KDE would require changes anyway. Two reasons that come to mind already:

1) KDE 4 moved the files from /usr/share/services to /usr/share/kde4/services
to avoid clashing with the KDE 3 settings

2) the same .protocol files store KIO-related information, like which ioslave
to launch for doing data transfers and whether the protocol/implementation
supports certain features (server-side moves, hard linking, etc.)
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358

Qt Developer Days 2010 - Munich Oct 11-13 - San Francisco Nov 1-3
For more information and to register: http://qt.nokia.com/qtdevdays2010
David Faure
2010-10-05 18:04:48 UTC
Permalink
Post by Thiago Macieira
Post by Aaron J. Seigo
Post by Bastien Nocera
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?
if consistency reigns and this addition does not achieve consensus
approval, we do have .protocol files in KDE already and it would be nice
(and sensible) to use something that already exists instead of
reinventing new wheels of incompatibility.
1) KDE 4 moved the files from /usr/share/services to
/usr/share/kde4/services to avoid clashing with the KDE 3 settings
2) the same .protocol files store KIO-related information, like which
ioslave to launch for doing data transfers and whether the
protocol/implementation supports certain features (server-side moves, hard
linking, etc.)
Yes, it doesn't make sense to try standardizing on our current dual-purpose
.protocol files.

I don't see any reason not to convert telnet.protocol into a
ktelnetservice.desktop with Exec=ktelnetservice %u and
MimeType=x-scheme-handler/telnet. The effort takes less time than to write this
mail (ok, almost) and I can't think of a migration issue, since the files are
installed together with the code that handles it...


What annoys me a little bit is just that at mimetype-database-generation time
we don't know which x-scheme-handler/* mimetypes are going to exist, it comes
from reading the .desktop files, which is usually done later on... This makes
the implementation more tricky than just "piggybacking the existing mimetype
implementation completely". Or are we requiring the installation of a
packages/telnet.xml mimetype definition?
Post by Thiago Macieira
For the default web browser, and default e-mail client, you'd use the
handlers for the x-scheme-handler/http and x-scheme-handler/mailto
mime-types, respectively.
I really object to x-scheme-handler/http. When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser. Or
at least give the option of either one, like we do in KDE ("open best app for
the job" vs "always open web browser"). But as soon as someone installs a x-
scheme-handler/http app, it will break the "open the best app" possibility.
Well, that's because I'm assuming that we'll all give priority to the scheme-
based lookup over the mimetype-based lookup, since the primary goal is to
handle schemes where mimetypes don't even make sense, like mms:/, feed:/,
telnet:/. In KDE we actually quite a number of these: mailto, mms, mmst, mmsu,
pnm, rlogin, rtsp, rtspt, rtspu, ssh, telnet, aim, callto, feed, news, magnet,
irc.
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
Bastien Nocera
2010-10-05 23:38:40 UTC
Permalink
Post by David Faure
Post by Thiago Macieira
Post by Aaron J. Seigo
Post by Bastien Nocera
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?
if consistency reigns and this addition does not achieve consensus
approval, we do have .protocol files in KDE already and it would be nice
(and sensible) to use something that already exists instead of
reinventing new wheels of incompatibility.
1) KDE 4 moved the files from /usr/share/services to
/usr/share/kde4/services to avoid clashing with the KDE 3 settings
2) the same .protocol files store KIO-related information, like which
ioslave to launch for doing data transfers and whether the
protocol/implementation supports certain features (server-side moves, hard
linking, etc.)
Yes, it doesn't make sense to try standardizing on our current dual-purpose
.protocol files.
I don't see any reason not to convert telnet.protocol into a
ktelnetservice.desktop with Exec=ktelnetservice %u and
MimeType=x-scheme-handler/telnet. The effort takes less time than to write this
mail (ok, almost) and I can't think of a migration issue, since the files are
installed together with the code that handles it...
What annoys me a little bit is just that at mimetype-database-generation time
we don't know which x-scheme-handler/* mimetypes are going to exist, it comes
from reading the .desktop files, which is usually done later on... This makes
the implementation more tricky than just "piggybacking the existing mimetype
implementation completely". Or are we requiring the installation of a
packages/telnet.xml mimetype definition?
Why would you need a mimetype definition? You actually don't...
Post by David Faure
Post by Thiago Macieira
For the default web browser, and default e-mail client, you'd use the
handlers for the x-scheme-handler/http and x-scheme-handler/mailto
mime-types, respectively.
I really object to x-scheme-handler/http.
I guess that's something that I'd need to look into a bit more. I
believe that, in GNOME, asking for a movie on http to be launched would
just launch the default web browser with this URL, which would then pass
it on to something that handled the data type.

So the decision is made solely with the framework libraries, not with
the application.
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
Post by David Faure
Or
at least give the option of either one, like we do in KDE ("open best app for
the job" vs "always open web browser"). But as soon as someone installs a x-
scheme-handler/http app, it will break the "open the best app" possibility.
No, it wouldn't. The only thing this would change is where the setting
is saved. In GNOME, it wouldn't make an once of difference whether it's
in GConf somewhere, or in the mime-types.
Post by David Faure
Well, that's because I'm assuming that we'll all give priority to the scheme-
based lookup over the mimetype-based lookup, since the primary goal is to
handle schemes where mimetypes don't even make sense, like mms:/, feed:/,
telnet:/. In KDE we actually quite a number of these: mailto, mms, mmst, mmsu,
pnm, rlogin, rtsp, rtspt, rtspu, ssh, telnet, aim, callto, feed, news, magnet,
irc.
I think it's a problem with how your framework makes the decision on
which handler to use, rather than the spec changes.

Looking up the mime-type for http://foo.org/bar.avi would still return
video/x-ms-avi, not x-scheme-handler/http. x-scheme-handler/http also
doesn't mean "I can handle http URIs", it would mean "I should be
handling all the http URIs, when the decision is made solely on the
grounds of URI scheme".

I hope this clears it up.

Cheers
David Faure
2013-12-01 23:59:30 UTC
Permalink
(very old mail, but this is bugging me again :)

Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).

Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).

Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).

So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
Jerome Leclanche
2013-12-02 05:55:36 UTC
Permalink
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
I'm lost on context here but Id like to share some thoughts on that subject.
Post by David Faure
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
In an ideal setup, no, it would start in the appropriate application.
But not every setup is appropriate; the "base case" I believe is fine
as such. File gets downloaded, browser handles the mime type lookup
(through xdg-open in most cases).

This is a really interesting subject to me and it seems like a really,
really old question that will never be properly answered. One of the
issues comes from an expectation: if I open
http://example.com/file.avi, should vlc open it directly since it can
stream by http? Should it be downloaded *first* and then ran? Etc,
we've all been through this.

In the case you're describing of email client -> click -> browser ->
download -> run, the browser acts as a middleman that downloads the
file, figures out the mime type and opens it with the appropriate app.
This is a perfectly fine scenario. But if you want your users to skip
that step, you still need a middleman that will download the file and
get its mime type (forgetting the case of abstracting protocols for a
minute).
It seems to me that what you want is a dispatcher that would associate
itself with x-scheme-handler/whatever-is-supported at a higher
priority than the browser. The dispatcher would be called for all http
links in this case, so it would first figure out whether the http link
is interesting (eg. do a name match on the url), see if it's possibly
a file to download. If it is, do an HTTP HEAD on it (or similar), and
if it's still interesting, download the file and hand it off to the
associated app; otherwise directly hand it off to the next app in the
list of associations with x-scheme-handler/http.
The worst case here would be a file appropriate for the browser with a
weird url (eg. /file.avi) and that wouldn't support HTTP HEAD; three
requests. The more common case would be two requests (HEAD + GET, or
IIRC in KDE's optimized case just a reused GET), and for most urls it
would be seamless.
Post by David Faure
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
Understood. With what I described, there's no need for such hack, just
an app with a higher priority than the others with such an
association.
Post by David Faure
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
--
Working on KDE, in particular KDE Frameworks 5
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Bastien Nocera
2013-12-02 07:13:40 UTC
Permalink
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
I wish it worked like that as well, but you've just broken one-time URLs
and tried to open a login page in LibreOffice if you don't share cookie
jars between all the clients.
Jerome Leclanche
2013-12-02 07:49:25 UTC
Permalink
Post by Bastien Nocera
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
I wish it worked like that as well, but you've just broken one-time URLs
and tried to open a login page in LibreOffice if you don't share cookie
jars between all the clients.
With a middleman client this is a solved issue; it would be identified
as a page to take care of in the browser.
Post by Bastien Nocera
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
Bastien Nocera
2013-12-02 07:57:19 UTC
Permalink
Post by Jerome Leclanche
Post by Bastien Nocera
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
I wish it worked like that as well, but you've just broken one-time URLs
and tried to open a login page in LibreOffice if you don't share cookie
jars between all the clients.
With a middleman client this is a solved issue; it would be identified
as a page to take care of in the browser.
Let me know when you have that middle man client implemented :)

I wonder how you'll handover to the dozen of different web browsers,
read their cookie jars, or get applications with links to use your
middle man client instead of whatever HTTP library they want to use.

It's a nice idea, but it's just not feasible without a clean slate. I
think that GNOME's current approach is more pragmatic, especially with
HTTP's baggage.
Jerome Leclanche
2013-12-02 09:40:00 UTC
Permalink
Post by Bastien Nocera
Post by Jerome Leclanche
Post by Bastien Nocera
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a
web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
I wish it worked like that as well, but you've just broken one-time URLs
and tried to open a login page in LibreOffice if you don't share cookie
jars between all the clients.
With a middleman client this is a solved issue; it would be identified
as a page to take care of in the browser.
Let me know when you have that middle man client implemented :)
I wonder how you'll handover to the dozen of different web browsers,
read their cookie jars, or get applications with links to use your
middle man client instead of whatever HTTP library they want to use.
It's a nice idea, but it's just not feasible without a clean slate. I
think that GNOME's current approach is more pragmatic, especially with
HTTP's baggage.
I think you're confused about the complexity of the task.

All the client does is, for http:
- Parse the url given to it
- Identify whether it's potentially a file through its name (get a
filename if there's one)
- If it is, run a match against the xdg patterns on it
- If there's any match that is not an app that is associated with
x-scheme-handler/http(s), do HTTP HEAD on the url
- If the HEAD was successful and returns a mime type in the mime type
db and the mime type is associated with an app, *download* the file
-> Hand off downloaded file to the associated app
* If any step fails, hand off to web browser

This could be a simple script, or it could be a more involved download
manager that would integrate with the desktop (a neat system-wide
download bar such and such).

J. Leclanche
Bastien Nocera
2013-12-02 14:01:44 UTC
Permalink
Post by Jerome Leclanche
Post by Bastien Nocera
Post by Jerome Leclanche
Post by Bastien Nocera
Post by David Faure
(very old mail, but this is bugging me again :)
Context: I believe that associating a webbrowser with x-scheme-handler/http is
wrong.
Post by Bastien Nocera
Post by David Faure
When you click a http URL that
points to an .odt document, you want to launch openoffice, not a
web-browser.
If you're already in a web browser, yes, but in this case, the lookup
shouldn't be including a scheme handler lookup, just an application that
handles that particular mime-type.
But what if you're not in a webbrowser in the first place?
E.g. in a desktop email application, you click on an HTTP link to a .odt
document. Should that really start firefox, just so that it can then launch
openoffice?
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Note that at this point we have no clue about the mimetype. We can start a
download and find it out, but the first question is: should we do that, or
just blindly trust the app that says it wants all URLs with this scheme (http,
in my example).
Since we don't want this to happen in KDE, I had to write code such as "if KIO
supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". (for the special case of http,
there is actually a user setting for "send all http urls to this particular
app", but that's not the default setting).
I don't like it very much though, it feels like a hack :)
But I guess it makes sense, since in KDE we prefer to open HTTP urls by
mimetype, while IIUC in Gnome you prefer to open them with a single scheme-
associated application (i.e. webbrowser).
So, it's all fine, I'm just curious about what happens in your case when the
user isn't in a webbrowser in the first place (and to pick the worst case - if
it's not running yet, which means a long delay coming from the startup of two
large applications one after the other).
I wish it worked like that as well, but you've just broken one-time URLs
and tried to open a login page in LibreOffice if you don't share cookie
jars between all the clients.
With a middleman client this is a solved issue; it would be identified
as a page to take care of in the browser.
Let me know when you have that middle man client implemented :)
I wonder how you'll handover to the dozen of different web browsers,
read their cookie jars, or get applications with links to use your
middle man client instead of whatever HTTP library they want to use.
It's a nice idea, but it's just not feasible without a clean slate. I
think that GNOME's current approach is more pragmatic, especially with
HTTP's baggage.
I think you're confused about the complexity of the task.
- Parse the url given to it
- Identify whether it's potentially a file through its name (get a
filename if there's one)
This might fail if you need to log in, because the file type on the end
of the call is HTML when the URI tells you otherwise.
Post by Jerome Leclanche
- If it is, run a match against the xdg patterns on it
- If there's any match that is not an app that is associated with
x-scheme-handler/http(s), do HTTP HEAD on the url
The HTTP HEAD just ate your one-time URL.
Post by Jerome Leclanche
- If the HEAD was successful and returns a mime type in the mime type
db and the mime type is associated with an app, *download* the file
-> Hand off downloaded file to the associated app
* If any step fails, hand off to web browser
This could be a simple script, or it could be a more involved download
manager that would integrate with the desktop (a neat system-wide
download bar such and such).
It seems that I didn't explain myself well enough. You cannot access the
URLs given to you from outside the client that will ultimately handle it
because you might be using up a one-time URL. You also cannot rely on
filenames because that's not how HTTP mime-types are conveyed.
Simon McVittie
2013-12-02 15:44:58 UTC
Permalink
Post by Jerome Leclanche
- Identify whether it's potentially a file through its name (get a
filename if there's one)
That's not how http works. https://en.wikipedia.org/wiki/Favicon.ico is
text/html, not image/x-icon; conversely, if you have a URL like
http://example.com/generate-graph.php it's probably image/png or something.

S
David Faure
2013-12-03 08:32:31 UTC
Permalink
Post by Jerome Leclanche
- Parse the url given to it
- Identify whether it's potentially a file through its name (get a
filename if there's one)
That's broken. http://www.davidfaure.fr/kde, is that a file or a directory?
In a way that one is both, actually. It returns HTML so it's a file, but it
contains other files so it's a directory :)
Post by Jerome Leclanche
- If it is, run a match against the xdg patterns on it
That's broken. http://example.org/cgi-bin/script.pl looks like a perl script
but actually returns HTML. There are a thousand more examples like that.
Extensions over HTTP cannot be trusted.
Post by Jerome Leclanche
- If there's any match that is not an app that is associated with
x-scheme-handler/http(s), do HTTP HEAD on the url
That's broken. HTTP HEAD is badly implemented by many many webservers.
We used to use it, but we don't any longer. Instead we start a HTTP GET, to
get the headers, extract the mimetype, put the download on hold, and resume it
from the launched app. Works great for one-time urls too -- but yeah, it
relies on using the same underlying http technology and being able to resume a
transfer started by another app [which we can do in KIO since the transfer is
handled by a separate process].
Post by Jerome Leclanche
- If the HEAD was successful and returns a mime type in the mime type
db and the mime type is associated with an app, *download* the file
-> Hand off downloaded file to the associated app
Downloading into a temporary file means no incremental rendering
(e.g. for a long text, or image, or worse, movie).
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
Jerome Leclanche
2013-12-03 09:10:55 UTC
Permalink
Post by David Faure
Post by Jerome Leclanche
- Parse the url given to it
- Identify whether it's potentially a file through its name (get a
filename if there's one)
That's broken. http://www.davidfaure.fr/kde, is that a file or a directory?
In a way that one is both, actually. It returns HTML so it's a file, but it
contains other files so it's a directory :)
Neither; it's an html document. Just to be clear, in the vocabulary I
used, a "file" is anything that is not an html document (and that
should be read by something else than the browser). http has no
concept of directories.
Post by David Faure
Post by Jerome Leclanche
- If it is, run a match against the xdg patterns on it
That's broken. http://example.org/cgi-bin/script.pl looks like a perl script
but actually returns HTML. There are a thousand more examples like that.
Extensions over HTTP cannot be trusted.
My apologies, I see that my reply to that point was only sent to
Simon, pasting it below. The gist of it is that false positives are
fine.

"""
I'm aware, hence the "potentially".
There will be false positives, and the false positives will go one of two ways:
- URL wrongly identified as a non-file when it is
(show-image.php?id=123): the browser will end up being the middleman,
as per current behaviour
- URL wrongly identified as a file when it's not (/wiki/favicon.ico):
non-ideal as we have one extra request, but HEAD takes care of that.
In your case, Content-Type: text/html; charset=UTF-8

As I said, the worst case is when a potential match
(/wiki/favicon.ico) rejects HEAD for whatever reason. In this case,
it's passed to the browser and the usual fallback happens.

This is no different than using the mime db to only match by name and
not content because of performance concerns. As we all know, foo.txt
may as well be an application/zip, but it's rare enough that it
doesn't warrant reading everything just to display a file type. It
only becomes"
"""
Post by David Faure
Post by Jerome Leclanche
- If there's any match that is not an app that is associated with
x-scheme-handler/http(s), do HTTP HEAD on the url
That's broken. HTTP HEAD is badly implemented by many many webservers.
We used to use it, but we don't any longer. Instead we start a HTTP GET, to
get the headers, extract the mimetype, put the download on hold, and resume it
from the launched app. Works great for one-time urls too -- but yeah, it
relies on using the same underlying http technology and being able to resume a
transfer started by another app [which we can do in KIO since the transfer is
handled by a separate process].
HEAD support is a bit of a concern, I agree (if nothing supports HEAD,
we always end up on the fallback case). One-time URLs should not break
with GET (since they dont return their body), but web devs doing
stupid things is not something we can really prevent.
What I described will work without issues for a lot of cases. It will
work for any webserver that serves files directly (and hasn't been
specifically configured to reject HEAD). It will work as expected for
99% of document URLs (text/plain and all its children will have to be
special-cased to always open in a web browser, of course, otherwise
every .php url will trigger the HEAD)

So all in all, it theoretically works for most scenarios. If I get
some free time I'll write and use a prototype handler over the next
few days to see how well this theory holds up.
Post by David Faure
Post by Jerome Leclanche
- If the HEAD was successful and returns a mime type in the mime type
db and the mime type is associated with an app, *download* the file
-> Hand off downloaded file to the associated app
Downloading into a temporary file means no incremental rendering
(e.g. for a long text, or image, or worse, movie).
On anything else than NTFS, streamable formats are perfectly readable
while they're being written. If you download a large video file and
start playing it immediately, it will stream just fine.
Of course it's a different concern for other file types. Text editors
will spam you with "this file has been modified by an external
process". Image viewers will render half an image and not care
anymore. That's down to expectations. But all that is something that
can be handled in the download manager itself.

I love what you guys did with KIO but it's non-ideal for other reasons.
I need to think about all this, because it actually conflicts with an
unrelated component I wanted to work on (binding apps to domains).
Post by David Faure
--
Working on KDE, in particular KDE Frameworks 5
David Faure
2013-12-21 09:10:34 UTC
Permalink
Post by Jerome Leclanche
This is no different than using the mime db to only match by name and
not content because of performance concerns. As we all know, foo.txt
may as well be an application/zip, but it's rare enough that it
doesn't warrant reading everything just to display a file type. It
only becomes.
[last sentence was truncated?]

I disagree: if foo.txt is a zip file, but the user named it foo.txt, then we
treat it as a text file, at least in file managers (a ZIP application might
want to use content-matching instead, once we open the file there).
This gives full power to the user, and is necessary since some magic-matching
isn't fully reliable. The main point is: if the user wants to fix a wrongly
named file, he/she can.

However trusting extensions in an HTTP URL is completely wrong, I gave
examples already. And this is something the user cannot do anything to fix.
You say it works in 99% of the cases, I say
1) this number is smaller
2) any number that is not 100% means bugs, i.e. bug reports and unhappy users.

You cannot design solutions that sometimes break, in perfectly valid use
cases.
Post by Jerome Leclanche
[rendering while downloading to a temp file]
Of course it's a different concern for other file types.
So there again it's not a fully working solution, unless the application
itself decides on the approach (incremental rendering or full download first).
This is exactly what we do in KIO. Doing it outside the app will lead to all
the bugs you mentionned (broken images, text editors warning of outside
changes, etc.). As you yourself pointed out, this would just be completely
broken.
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
Jerome Leclanche
2013-12-21 10:11:10 UTC
Permalink
Post by David Faure
Post by Jerome Leclanche
This is no different than using the mime db to only match by name and
not content because of performance concerns. As we all know, foo.txt
may as well be an application/zip, but it's rare enough that it
doesn't warrant reading everything just to display a file type. It
only becomes.
[last sentence was truncated?]
I disagree: if foo.txt is a zip file, but the user named it foo.txt, then we
treat it as a text file, at least in file managers (a ZIP application might
want to use content-matching instead, once we open the file there).
This gives full power to the user, and is necessary since some magic-matching
isn't fully reliable. The main point is: if the user wants to fix a wrongly
named file, he/she can.
I agree, and I think we're saying the same thing here.
Post by David Faure
However trusting extensions in an HTTP URL is completely wrong, I gave
examples already. And this is something the user cannot do anything to fix.
You say it works in 99% of the cases, I say
1) this number is smaller
2) any number that is not 100% means bugs, i.e. bug reports and unhappy users.
You cannot design solutions that sometimes break, in perfectly valid use
cases.
You don't trust the extension. You make a reasonable, inconsequential
assumption based on the extension. If the extension is all wrong, what
currently happens for everything... happens. As a fallback.

Funny story: I wrote a proof of concept intercepter (replacing
xdg-open) to try out the idea after I sent the last email. I then got
caught up in some other work and completely forgot about it; your
reply just reminded me of it. Turns out it's been intercepting my
clicks for the past two weeks and I wasn't even noticing *because*
it's seamless and the fallback is expected.
Post by David Faure
Post by Jerome Leclanche
[rendering while downloading to a temp file]
Of course it's a different concern for other file types.
So there again it's not a fully working solution, unless the application
itself decides on the approach (incremental rendering or full download first).
This is exactly what we do in KIO. Doing it outside the app will lead to all
the bugs you mentionned (broken images, text editors warning of outside
changes, etc.). As you yourself pointed out, this would just be completely
broken.
I honestly think KIO is doing it the only sensible, fully-functional
way. But KIO's solution is not interoperable with other toolkits/libs
(and I don't realistically think it can be). The advantage of what I'm
describing is that it's extremely simple to implement (as evidenced by
the working proof of concept).
Post by David Faure
--
Working on KDE, in particular KDE Frameworks 5
Nicolas Mailhot
2013-12-02 08:40:12 UTC
Permalink
Post by David Faure
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)

So giving any http link to anything but a browser is a recipe for multiple
crashes and errors as soon as your network conditions become non-trivial.
--
Nicolas Mailhot
Kevin Krammer
2013-12-02 14:16:02 UTC
Permalink
Post by Nicolas Mailhot
Post by David Faure
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)
David obviously looks at this from a KDE perspective, where the same HTTP
implemention is used by all applications, including the browser.
IIRC it can even transfer a session from one application to another, e.g.
avoiding the one-time-URL problem.

Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
Bastien Nocera
2013-12-02 14:34:34 UTC
Permalink
Post by Kevin Krammer
Post by Nicolas Mailhot
Post by David Faure
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)
David obviously looks at this from a KDE perspective, where the same HTTP
implemention is used by all applications, including the browser.
IIRC it can even transfer a session from one application to another, e.g.
avoiding the one-time-URL problem.
If I use Opera, Firefox or Chrome in KDE, I'm not sure it magically uses
the same HTTP implementation.
Kevin Krammer
2013-12-02 14:53:13 UTC
Permalink
Post by Bastien Nocera
Post by Kevin Krammer
Post by Nicolas Mailhot
Post by David Faure
(same with any other content application that can handle HTTP urls on
its
own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)
David obviously looks at this from a KDE perspective, where the same HTTP
implemention is used by all applications, including the browser.
IIRC it can even transfer a session from one application to another, e.g.
avoiding the one-time-URL problem.
If I use Opera, Firefox or Chrome in KDE, I'm not sure it magically uses
the same HTTP implementation.
Sure, but David also mentioned that we enable users to tell our URL handling
code to delegate HTTP always to a certain program/browser and was, in my
interpretation, discussing the implications on the standard setup.

So, within this assumed context, I was pointing out to Nicolas that the HTTP
implemention in question was "browser capable".

Cheers,
Kevin
--
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
Bastien Nocera
2013-12-02 15:05:56 UTC
Permalink
Post by Kevin Krammer
Post by Bastien Nocera
Post by Kevin Krammer
Post by Nicolas Mailhot
Post by David Faure
(same with any other content application that can handle HTTP urls on
its
own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)
David obviously looks at this from a KDE perspective, where the same HTTP
implemention is used by all applications, including the browser.
IIRC it can even transfer a session from one application to another, e.g.
avoiding the one-time-URL problem.
If I use Opera, Firefox or Chrome in KDE, I'm not sure it magically uses
the same HTTP implementation.
Sure, but David also mentioned that we enable users to tell our URL handling
code to delegate HTTP always to a certain program/browser and was, in my
interpretation, discussing the implications on the standard setup.
So, within this assumed context, I was pointing out to Nicolas that the HTTP
implemention in question was "browser capable".
It's certainly possible to implement this feature the way mentioned when
you know that the default HTTP handler will be able to transfer/share
session information with the browser.

But David's original request was for this to work the same way across
desktops. We don't have any such support in GNOME, and I don't see it as
something that's worth the effort either. I guess that brings David's
question to a close.
David Faure
2013-12-21 10:01:36 UTC
Permalink
Post by Bastien Nocera
But David's original request was for this to work the same way across
desktops.
Not really, actually.

We use a different approach. That's fine.

My request is that they don't step on each other's toes :)

Installing a desktop file with x-scheme-handler/http breaks the KDE solution,
so I was hoping to get an agreement on not installing such desktop files.

But I'm starting to see that this won't happen, so I guess I'll stick to "if
KIO supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". If anyone complains that this
isn't xdg-spec-compliant, I want it to be said already that this is because
the spec doesn't make room for our solution...
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
Bastien Nocera
2014-01-07 13:42:13 UTC
Permalink
Post by David Faure
Post by Bastien Nocera
But David's original request was for this to work the same way across
desktops.
Not really, actually.
We use a different approach. That's fine.
My request is that they don't step on each other's toes :)
Installing a desktop file with x-scheme-handler/http breaks the KDE solution,
so I was hoping to get an agreement on not installing such desktop files.
But I'm starting to see that this won't happen, so I guess I'll stick to "if
KIO supports a scheme and an app exists for the mimetype x-scheme-
handler/<scheme>, then give priority to KIO". If anyone complains that this
isn't xdg-spec-compliant, I want it to be said already that this is because
the spec doesn't make room for our solution...
That sounds fine by me. Given that I don't agree that it's a good idea
to implement it that way, I'd rather it be hidden inside one
implementation instead of mandated in the spec :)

David Faure
2013-12-03 08:35:43 UTC
Permalink
Post by Nicolas Mailhot
Post by David Faure
(same with any other content application that can handle HTTP urls on its own;
same with other schemes that apps might support, like FTP).
Having managed a very large proxy configuration for some years (150k+
users, high-availability) I can tell you that pretty much any application
that pretends talking http lies, and only full browsers implement (mostly)
the complete http spec (including error handling)
Well, in KDE the http implementation used by browsers and the one used by
applications is exactly the same.... the same kio_http process handles both.

Same thing in pure Qt applications (QtWebKit uses QNetworkAccessManager, which
is available to all Qt applications).
Post by Nicolas Mailhot
So giving any http link to anything but a browser is a recipe for multiple
crashes and errors as soon as your network conditions become non-trivial.
I'll let the gimp authors reply (to pick one example of an app I know, that
supports HTTP without using KIO).
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
Bastien Nocera
2010-10-05 16:42:49 UTC
Permalink
Post by Aaron J. Seigo
Post by Bastien Nocera
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?
For me, using this for default apps would be one step too far. It's true
that URI schemes aren't file or stream data, but they're closer to the
subject than random "preferred" applications.

For the default web browser, and default e-mail client, you'd use the
handlers for the x-scheme-handler/http and x-scheme-handler/mailto
mime-types, respectively.

Trying to extend this to other applications is a strenuous link at best.
Post by Aaron J. Seigo
if consistency reigns and this addition does not achieve consensus approval,
we do have .protocol files in KDE already and it would be nice (and sensible)
to use something that already exists instead of reinventing new wheels of
incompatibility.
For me, pretty much all the applications you'd list as "preferred
applications" that don't use URI schemes should probably stay
desktop-specific.

In GNOME we currently have preferred application settings for:
- web browser (handled through URI scheme)
- mailer (ditto)
- multimedia player (probably a bad idea to have this in the first
place, I'll take the blame here)
- terminal
- visual and mobility a11y apps (magnifier, on screen keyboard)

The latter two we will have directly in gnome-shell for GNOME 3.x, which
leaves us with the terminal.

Is your experience of this any different?

Cheers
David Faure
2010-10-05 22:36:06 UTC
Permalink
Post by Aaron J. Seigo
if consistency reigns and this addition does not achieve consensus
approval, we do have .protocol files in KDE already and it would be nice
(and sensible) to use something that already exists instead of reinventing
new wheels of incompatibility.
In fact our current system sucks because the definition of the protocol file
also includes the associated application, so you can't possibly have two
applications registering for the same protocol, they would try to install the
same file (or if they use a different filename, the winner is undefined).
On the other hand the mimetype system already solves all these issues, by
putting the information of "app X can handle Y" in X.desktop, not in a file
describing Y.

However I understand that your reaction was mostly to the rejected "default
terminal" proposal; IMHO we could implement that on top of the x-scheme-
handler mechanism, by simply agreeing on a (fake) scheme name for opening a
terminal ;)
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
Bastien Nocera
2010-10-05 23:27:52 UTC
Permalink
Post by David Faure
Post by Aaron J. Seigo
if consistency reigns and this addition does not achieve consensus
approval, we do have .protocol files in KDE already and it would be nice
(and sensible) to use something that already exists instead of reinventing
new wheels of incompatibility.
In fact our current system sucks because the definition of the protocol file
also includes the associated application, so you can't possibly have two
applications registering for the same protocol, they would try to install the
same file (or if they use a different filename, the winner is undefined).
On the other hand the mimetype system already solves all these issues, by
putting the information of "app X can handle Y" in X.desktop, not in a file
describing Y.
Right. That one of the problems we had with our system before as well,
where one application would say "I handle scheme foo", and it would
create problems when another application tried to say "I handle scheme
foo as well".
Post by David Faure
However I understand that your reaction was mostly to the rejected "default
terminal" proposal; IMHO we could implement that on top of the x-scheme-
handler mechanism, by simply agreeing on a (fake) scheme name for opening a
terminal ;)
If you wanted to twist the changes I'm proposing that way, yes, you
could do that, but I'd probably try to avoid implementing it in GNOME ;)
Bastien Nocera
2010-10-05 16:36:55 UTC
Permalink
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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.
I'm in favour of the addition if it's only used in these special cases you
mention, where we want to send *all* urls with a given scheme to an
application, so this indeed *replaces* any mimetype-based lookup.
This is orthogonal to the use cases like "we have a HTTP URL pointing to an
image, we need an application which supports image/png -and- which supports
HTTP" - this is another unresolved issue (in KDE we started using X-KDE-
Protocols for that, but let's talk about that in another thread, to not mix up
the issues). In that case both criterias must be met, so x-scheme-handler/http
would not work if it's just another mimetype, this is why I'm clearly
separating the two issues.
Right, completely agreed here, though that particular problem isn't so
visible on GNOME, given that we can access files through FUSE when gvfs
supports the protocol/scheme.
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.

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.

Cheers
David Faure
2010-10-05 16:27:16 UTC
Permalink
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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.
I'm in favour of the addition if it's only used in these special cases you
mention, where we want to send *all* urls with a given scheme to an
application, so this indeed *replaces* any mimetype-based lookup.

This is orthogonal to the use cases like "we have a HTTP URL pointing to an
image, we need an application which supports image/png -and- which supports
HTTP" - this is another unresolved issue (in KDE we started using X-KDE-
Protocols for that, but let's talk about that in another thread, to not mix up
the issues). In that case both criterias must be met, so x-scheme-handler/http
would not work if it's just another mimetype, this is why I'm clearly
separating the two issues.

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...
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
François Revol
2010-10-05 19:57:12 UTC
Permalink
(sorry for breaking the thread I get mime digests but OSX Mail.app doesn't like them)

Hi,
Post by Bastien Nocera
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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 ;)
Post by Bastien Nocera
Post by Bastien Nocera
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
Post by Bastien Nocera
Post by Bastien Nocera
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...
Post by Bastien Nocera
The main use though would be when applications handle *all* the files on
- 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.
Marius Vollmer
2010-10-06 07:39:55 UTC
Permalink
Post by Bastien Nocera
Any comments?
This is very nicely aligned with what we do in Maemo / MeeGo, via the
libcontentaction library.

Libcontentaction implements the same extension as proposed here, but
with "x-maemo-urischeme/*" instead of "x-scheme-handler/*". (And we are
happy to adopt any official standard of course.)

Libcontenaction also uses the same approach to define actions for
content in Tracker (x-maemo-nepomuk/*), and for things like phone
numbers in text messages (x-maemo-highlight/*).

Source:
http://maemo.gitorious.org/maemo-af/libcontentaction

Docs:
http://zagadka.vm.bytemark.co.uk/docboy/libcontentaction/

(Apologies for staying underground with that library until now and not
pushing for a proper standardization here.)
Bastien Nocera
2010-10-08 13:24:31 UTC
Permalink
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I committed the changes to the spec to shared-mime-info, with the
addition of a clarification paragraph to mention that the mime-type
should not be used to advertise supported URI schemes.

Cheers
David Faure
2010-10-11 21:59:14 UTC
Permalink
Post by Bastien Nocera
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I committed the changes to the spec to shared-mime-info, with the
addition of a clarification paragraph to mention that the mime-type
should not be used to advertise supported URI schemes.
I just committed support for x-scheme-handler/* to KDE, it will be in KDE SC 4.6.

=====================

Add support for defining "helper protocols" (e.g. "mailto URLs should launch the executable kmailservice")
using .desktop files (with a custom mimetype, x-scheme-handler/mailto, as added to shared-mime-info recently)
rather than using .protocol files (which are KDE-specific). Converted the two in KIO, but the code can still
handle old-style .protocol files. Unit-tested.

M +1 -0 kdecore/services/kmimetype.cpp
M +1 -0 kdecore/services/kmimetypetrader.cpp
M +17 -9 kdecore/sycoca/kprotocolinfo.cpp
M +18 -0 kdecore/tests/kmimetypetest.cpp
M +1 -0 kdecore/tests/kmimetypetest.h
M +13 -10 kded/kbuildmimetypefactory.cpp
M +2 -0 kded/kbuildmimetypefactory.h
M +10 -3 kded/kbuildservicefactory.cpp
M +3 -3 kio/misc/CMakeLists.txt
A kio/misc/kmailservice.desktop kio/misc/kmailservice.protocol#1184154
D kio/misc/kmailservice.protocol
A kio/misc/ktelnetservice.desktop kio/misc/telnet.protocol#1184154
D kio/misc/rlogin.protocol
D kio/misc/ssh.protocol
D kio/misc/telnet.protocol
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).
Bastien Nocera
2010-10-11 22:24:23 UTC
Permalink
Post by David Faure
Post by Bastien Nocera
Post by Bastien Nocera
Heya,
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.
http://www.hadess.net/2010/10/new-control-center-and-you.html
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?
I committed the changes to the spec to shared-mime-info, with the
addition of a clarification paragraph to mention that the mime-type
should not be used to advertise supported URI schemes.
I just committed support for x-scheme-handler/* to KDE, it will be in KDE SC 4.6.
Thanks, much appreciated.
Loading...