Skip to content

Add a Mime Type for .exe and .dll files. #21805

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
3 commits merged into from
Jun 5, 2020

Conversation

KirillOsenkov
Copy link
Member

Useful for serving downloads of installers.
Could be application/octet-stream, but I hear application/vnd.microsoft.portable-executable is specified by IANA here:

https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable

Useful for serving downloads of installers.
Could be application/octet-stream, but I hear application/vnd.microsoft.portable-executable is specified by IANA here:

https://www.iana.org/assignments/media-types/application/vnd.microsoft.portable-executable
@KirillOsenkov KirillOsenkov requested a review from Tratcher as a code owner May 14, 2020 00:05
@ghost ghost added the area-middleware label May 14, 2020
@Tratcher Tratcher requested a review from shirhatti May 14, 2020 16:17
@shirhatti
Copy link
Contributor

// Notes:
// - This table was initially copied from IIS and has many legacy entries we will maintain for backwards compatibility.
// - We only plan to add new entries where we expect them to be applicable to a majority of developers such as being
// used in the project templates.

@KirillOsenkov
Copy link
Member Author

I'm guessing a lot of people publish installers, downloaders, setup.exe etc. It is a bit counter-intuitive that this doesn't work out of the box.

@Tratcher
Copy link
Member

Historically IIS didn't include these because the static files directory and your app directory were the same, it didn't want to expose your app assemblies as static files. That's less of an issue in AspNetCore since we separate out static content to a subdirectory in the default layout.

Useful for serving downloads of installers.

I buy that for exes, but what about dlls?

@KirillOsenkov
Copy link
Member Author

Yes, I can image .dll download is not such a common scenario.

@Tratcher
Copy link
Member

@shirhatti we should consider adding exe's as they are quite common.

@KirillOsenkov
Copy link
Member Author

For my own curiosity, what are the concerns with adding mime types to this list? From my naive perspective this should be pretty much benign?

@Tratcher
Copy link
Member

For my own curiosity, what are the concerns with adding mime types to this list? From my naive perspective this should be pretty much benign?

The list is already enormous and likely causing some performance issues. We also get very frequent requests to add new entries so we tried to establish clear criteria.

@Tratcher Tratcher self-assigned this May 18, 2020
@KirillOsenkov
Copy link
Member Author

Performance issues should be an orthogonal concern from delivering a good default experience to our users.

If the performance is inadequate, let's prove it, let's measure it and let's fix it. I don't believe having more extensions in that dictionary should affect performance in any way if we do it right.

This raises questions: why is this dictionary created as an instance every time we create the class? Why isn't there a shared static Dictionary somewhere that this falls back to?

I honestly would optimize for the principle of least surprise: as a user, I just want to serve some static files. I shouldn't be thinking about Mime types, IIS, or some legacy reasons. My out of the box experience is that I serve a file, of any IANA supported extension, and it just magically works out of the box, no assembly required.

Thanks!

@Tratcher
Copy link
Member

Fair, the performance comment was lazy on my part, I don't have the data handy to prove that.

why is this dictionary created as an instance every time we create the class

There's commonly only one instance of this class an application anyways.

Let me clarify the other comment. We get very frequent requests for additions to this list and many of them are for esoteric extensions that do not have broad usage or well defined standards. Adding such content provides little value, we'd rather those developers edit their own list locally.

@KirillOsenkov
Copy link
Member Author

OK understood.

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Triage: We should add exe support, but we don't plan on adding dll support.

I do want to try this and see how browsers handle that "application/vnd.microsoft.portable-executable" content-type.

@Tratcher Tratcher added this to the 5.0.0-preview7 milestone Jun 2, 2020
@ghost
Copy link

ghost commented Jun 2, 2020

Hello @Tratcher!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@Tratcher
Copy link
Member

Tratcher commented Jun 2, 2020

Thanks

@ghost ghost merged commit 0e7ca74 into dotnet:master Jun 5, 2020
@amcasey amcasey added the area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares label Jun 2, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants