Extensions with content type of application/octet-stream won't install

Description

The content type application/octet-stream is supposed to represent binary, but apparently it is also used by many web servers as a default MIME type if it really doesn't know better.

Lucee incorrectly identifies HTTP responses of type application/octet-stream as plain text instead of binary which causes a very nasty error when you try to install an extension whose actual lex download URL returns application/octet-stream. Lucee tries to use the actual binary of the file as the local path which causes the entire binary file to be output to the browser as part of the error message!!!

My first suggestion is to improve cfthttps detection of plain text, but if that causes issues with backwards compat, at least the improve the extension installation to be smarter. This example code will show the issue.

1 2 3 4 http url="http://s3.amazonaws.com/downloads.ortussolutions.com/ortussolutions/couchbase-extension/test_file.lex" result="local.http"; dump( local.http.mimetype ); // outputs application/octet-stream dump( isSImpleValue( local.http.filecontent ) ); // Outputs true (incorrect) dump( local.http.text ); // Outputs true (incorrect)

And here is the code in Lucee's Admin.java that is messing up the extension installation:

1 2 3 4 5 6 7 8 // this can be a binary that represent the extension or a string that is a path to the extension Object obj = getObject("admin", "UpdateRHExtensions", "source"); // path if(obj instanceof String) { Resource src = ResourceUtil.toResourceExisting(config, (String)obj); XMLConfigAdmin._updateRHExtension(config, src, true); }

Environment

None

Status

Assignee

Michael Offner

Reporter

Brad Wood

Labels

None

Sprint

None

Fix versions

Priority

Major