insomnia-lab / libreant

{,e}Book archive, focused on small grassroot archives, distributed search, support to different kind of objects
GNU Affero General Public License v3.0
18 stars 8 forks source link

opensearch mimetype #31

Open ael-code opened 9 years ago

ael-code commented 9 years ago

@boyska are you really sure that the mime-type of the opensearch results is correct ? https://github.com/insomnia-lab/libreant/blob/master/webant/webant.py#L78

( same code in agherant.py )

boyska commented 9 years ago

This is a tricky question, but I'll try to answer! First of all, I think you noticed the misalignment: sometimes application/rss+xml is used, while other times text/xml is used. text/xml should always be used, but the opensearch library has a bug about it ( edsu/opensearch#6 ). In b746e3b I make clear that using application/rss+xml is just a way to workaround it.

I filed the bug (edsu/opensearch#6 ), proposed a VERY SIMPLE patch that fixes it (edsu/opensearch#7), and also tried to contact the author (@edsu) personally. No answer received.

Back to your question: text/xml is technically correct (xml has more than one valid mimetype, depending on the intended usage of it) and has the advantage that browsers will display it in a nice way (because of the text/ prefix, I suppose).

ael-code commented 9 years ago

Oke. I followed the issue on the library repo, but I did not really understood the point at that time. Now it's clear.

But i have a dubt: Now we use text/xml as the response mime if the client make a request with the header Accept: application/opensearchdescription+xml isn't a wired behaviour ?

boyska commented 9 years ago

yes.

But even being coherent on doing crazy workaround on silly bugs would be quite wierd.