http-types icon indicating copy to clipboard operation
http-types copied to clipboard

merge tide-compress's mime db stuff into the Content-Type typed header

Open Fishrock123 opened this issue 3 years ago • 4 comments

basically, this but with the other fields that the json database provides: https://github.com/Fishrock123/tide-compress/blob/main/build.rs

see https://github.com/jshttp/mime-db/blob/master/db.json

Fishrock123 avatar Jun 21 '22 17:06 Fishrock123

@yoshuawuyts I think static file serving should probably also use this to attempt to determine mime type before sniffing

Fishrock123 avatar Jun 21 '22 17:06 Fishrock123

Oh yeah, this would be great! @Fishrock123 is this something you'd be able to contribute?

I'm thinking ideally we could move this from a build.rs script into a standalone command [^xtask] which we can run periodically instead of every time someone builds. Some systems intentionally lock down external network connection during building; but in general pre-building it / checking it into the repo should be faster for most builds. But no worries if we start with a build.rs script and then refactor it later.

[^xtask]: I'm a big fan of the matklad/cargo-xtask pattern for this. That would allow us to do something like cargo xtask codegen in the repo to generate all the code we need.

yoshuawuyts avatar Jul 18 '22 13:07 yoshuawuyts

I think a first step would be to do what you described in tide-compress then.

Fishrock123 avatar Jul 18 '22 18:07 Fishrock123

That's now been done in tide-compress: https://github.com/Fishrock123/tide-compress/commit/cc1551b6a8267cccb70fa3e84ee787e6aaad2fa0

I did not use xtask as that seemed like it added more unnecessary stuff, I just made a run-able subcrate which isn't publishable.

Fishrock123 avatar Jul 31 '22 22:07 Fishrock123