OBEX SPIN files showing up as text.
Publison
Posts: 12,366
This has been around for quite a while, a I can't remember the exact date when the OBEX got broken, but it showed up today as a new user tried to download a SPIN file.
This is an example. http://obex.parallax.com/object/73
Clicking on the SPIN file brings up a text page. I should download the spin file. ZIP files download OK.
This problem is at least 6 months old if not more.
Jim
This is an example. http://obex.parallax.com/object/73
Clicking on the SPIN file brings up a text page. I should download the spin file. ZIP files download OK.
This problem is at least 6 months old if not more.
Jim
Comments
Strange! I right-clicked the link and chose "Save Target as..." and changed the extension to ".spin" and downloaded the file OK.
Temporary work-around...
-Phil
Yes Phil,
But when the new OBEX, (and the Old OBEX) were working correctly, a click on the SPIN file would download it, not display it.
I am using Chrome, so something may have changed in it?
Phil is correct, OBEX is currently handling the downloads of non-zip files as it should. We are not planning to make any changes or 'fixes', so your options are to put all downloads into zip files or use the workaround mentioned by various others in this thread and in the thread below:
- http://forums.parallax.com/showthread.php/155011-OBEX-code-samples
Alternately, if you are savvy with your browser you can play around with the settings that might be preventing some files from downloading properly.
Thanks for chiming in Courtney,
I guess my question here is, why in the forums I click on a SPIN file, it downloads, but in the OBEX it does not.? Same browser.
Jim
Though it isn't required, we strongly recommend all files posted here to be zipped.
Thanks for the clarification. And I totally agree with the ZIP format.
Jim
It turns out that there is a problem with the OBEX download. When Publison said that the forum and OBEX behave differently, I decided more investigation was called for. So I did some packet sniffing on the returned Spin file from the OBEX and discovered that there is no Content-type line in the HTTP header. There should be a line that reads: Content-type: text/plain like there is for Spin downloads from the forum. This is something that should easily be fixed in the Apache config file for your server.
-Phil
Here's the header for a Spin file from the OBEX:
Here's the header for a Spin file from the forum:
The Content-disposition line is probably important, too.
If you have specific suggestions of this nature, I suggest emailing the Parallax webmaster.
No decisions of this nature can be made via the forums.
-Phil
file to the client. For this issue, the new OBEX site is not mapping the
.spin file extension to a particular MIME type, hence, the missing
Content-Type in the response headers. We had a challenge on the Forums site
because of the proliferation of file extensions and the need to support
them all. The new OBEX site is configured to minimize the number of file
extensions that needed to be supported.
Back to those .spin files. I need to look at the site to verify that the
Content-Type is not being altered in the Drupal framework before I set a
Mime type mapping for .spin files. This does open a slippery slope for
other file types, which I would like to avoid if at all possible.
I'll post on the forum thread after I place the update on the OBEX site.
-Phil
There was a concern raised with regards to forcing the "Save As..." dialog when the link is selected. The way it works now, one can view the source file in the browser or right-click the link and save the file to storage. If the behaviour is changed to always download the file, the steps required to view the file gets a bit longer. For certain file types, such as archives, downloading is the only option. What should be the default behaviour for human-readable files?
- Jim
I think this is desirable behavior, since you have a choice of viewing the file in its native environment (Propeller Tool) or saving it. The content-disposition line in the HTTP header is what produces the above dialog. Given a choice, I think most would prefer this over viewing the file in the browser.
-Phil
Hi Jim,
I for one would never have a need to view the file. I have always like the old way just to down load the file on demand and load it in the tool.
So many thing can get broken in the text view, ie tabs and such.
My opinion, others may vary.
Jim
If you want to look at a spin file you better do that in the PropTool as in the browser.
just my 2 cents
Enjoy!
Mike
Chrome does not give that option. That's nice.
Time to revisit Firefox.
Jim
Jim
Content-Encoding: gzip
which would not be the case for Spin files.
-Phil
The error might be specific to a combination of browser / Linux versions. I used the link at the beginning of this thread in a Ubuntu Workstation 13.10 / Firefox 28.0. The link appears to work correctly in that environment.
The content-encoding header defines an encoding mechanism that extends the encoding for a specific media type. The server and browser are supposed to agree on this encoding before it is used. The application is typically to compress the page content to help deliver it to the browser faster by sending fewer bytes.