Shop OBEX P1 Docs P2 Docs Learn Events
OBEX SPIN files showing up as text. — Parallax Forums

OBEX SPIN files showing up as text.

PublisonPublison Posts: 12,366
edited 2014-04-02 23:38 in General Discussion
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

Comments

  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2014-04-01 13:52
    Publison wrote: »
    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

    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 Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-01 13:58
    I think the correct MIME type for Spin files really is text/plain, so having it display in a browser page is probalby the correct behavior. Right clicking and Save-as is the way to go for saving. Besides, most OBEX files are zip archives anyway, aren't they? At least they should be uploaded that way.

    -Phil
  • PublisonPublison Posts: 12,366
    edited 2014-04-01 14:04
    I think the correct MIME type for Spin files really is text/plain, so having it display in a browser page is probalby the correct behavior. Right clicking and Save-as is the way to go for saving. Besides, most OBEX files are zip archives anyway, aren't they? At least they should be uploaded that way.

    -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?
  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2014-04-01 15:05
    This is not a new issue. Web standards are no longer what they once were; these days it isn't advisable to "force" a Save As dialog box and browsers often work against doing so for security reasons.

    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.
  • PublisonPublison Posts: 12,366
    edited 2014-04-01 15:20
    This is not a new issue. Web standards are no longer what they once were; these days it isn't advisable to "force" a Save As dialog box and browsers often work against doing so for security reasons.

    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
  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2014-04-01 15:48
    The forums and OBEX are two different sites. Despite our preference otherwise, the forums are currently still forcing downloads.

    Though it isn't required, we strongly recommend all files posted here to be zipped.
  • PublisonPublison Posts: 12,366
    edited 2014-04-01 15:55
    The forums and OBEX are two different sites. Despite our preference otherwise, the forums are currently still forcing downloads.

    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
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-01 16:44
    Courtney,

    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:
    HTTP/1.1 200 OK
    Date: Tue, 01 Apr 2014 23:37:54 GMT
    Server: Apache/2.2.22 (Ubuntu)
    Last-Modified: Mon, 01 Apr 2013 16:48:42 GMT
    ETag: "260410-97c0-4d94f64b3ee80"
    Accept-Ranges: bytes
    Content-Length: 38848
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    

    Here's the header for a Spin file from the forum:
    HTTP/1.1 200 OK
    Date: Tue, 01 Apr 2014 23:50:16 GMT
    Server: Apache/2.2.14 (Ubuntu)
    X-Powered-By: PHP/5.3.2-1ubuntu4.20
    Cache-Control: max-age=31536000, private
    Vary: User-Agent,Accept-Encoding
    Pragma: 
    Expires: Wed, 01 Apr 2015 23:50:16 GMT
    Last-Modified: Tue, 17 Mar 2009 22:56:03 GMT
    ETag: "59411"
    Accept-Ranges: bytes
    [b]Content-disposition: attachment; filename="FireFox Test.spin"[/b]
    X-Content-Type-Options: nosniff
    X-Permitted-Cross-Domain-Policies: none
    Content-Encoding: gzip
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Transfer-Encoding: chunked
    [b]Content-Type: text/plain[/b]
    

    The Content-disposition line is probably important, too.
  • Courtney JacobsCourtney Jacobs Posts: 903
    edited 2014-04-01 16:53
    Phil,

    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 Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-01 17:00
    Will do, Courtney. Thanks.

    -Phil
  • infoinfo Posts: 31
    edited 2014-04-01 17:43
    This website has more problems than just file download. There are missing pictures when you get to product description page, in my browser text and image overlay each other so you either can't read the text or can't see the full picture, etc. New websites suck. There isn't page formatting or text formatting. I wonder why e-commerce website owners put up with Smile that costs them loss of sales when the website doesn't display correctly or crashes. Old 1990's websites even e-commerce websites work in old browsers, new browsers and cellphones. Just about all brands of cellphone can read and display html, php, javascript, you name it, so there is no need for "mobile website". Sometimes the old is better than new. In my line of work we're replacing electronic sensors with plain switch because it is more reliable. Frequent failures are not an option. Remember KISS? Keep it simple ...
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-01 23:19
    From Parallax's webmaster (via email):
    Generally speaking, we should always return a Content-Type when sending a
    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
  • Jim EwaldJim Ewald Posts: 733
    edited 2014-04-02 11:55
    The OBEX site has been updated so that it now returns a content-type of text/plain when accessing a .spin file. The testing we conducted this morning indicates that this change will still result in the content of the .spin file appearing in the browser window.

    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
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-02 12:16
    Spin files clicked on in the forum produce this dialog in Firefox under Windows:

    attachment.php?attachmentid=107929&d=1396466148

    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
    402 x 301 - 11K
  • PublisonPublison Posts: 12,366
    edited 2014-04-02 12:17
    Jim Ewald wrote: »
    The OBEX site has been updated so that it now returns a content-type of text/plain when accessing a .spin file. The testing we conducted this morning indicates that this change will still result in the content of the .spin file appearing in the browser window.

    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

    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
  • msrobotsmsrobots Posts: 3,709
    edited 2014-04-02 12:17
    I think you should use application/octet stream for spin and content-disposition attachment which usually results in a download with open and save.

    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
  • PublisonPublison Posts: 12,366
    edited 2014-04-02 12:19
    Just noticed Phil's post.

    Chrome does not give that option. That's nice.

    Time to revisit Firefox.

    Jim
  • Jim EwaldJim Ewald Posts: 733
    edited 2014-04-02 15:57
    The OBEX is now shipping .spin files as downloads rather than browsable files. We'll monitor the new setting for a while and make changes if needed. Thanks everyone for your insight on this issue.

    Jim
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-04-02 16:22
    Thanks, Jim! It works fine here on Windows with Opera and Firefox, and on OS/X with Safari. Firefox on Linux reports a "Content Encoding Error", though. I checked the headers again and note a line that reads:

    Content-Encoding: gzip

    which would not be the case for Spin files.

    -Phil
  • Jim EwaldJim Ewald Posts: 733
    edited 2014-04-02 23:38
    Thanks, Jim! It works fine here on Windows with Opera and Firefox, and on OS/X with Safari. Firefox on Linux reports a "Content Encoding Error", though. I checked the headers again and note a line that reads:

    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.
Sign In or Register to comment.