cesanta / mongoose

Embedded Web Server
https://mongoose.ws
Other
11.16k stars 2.73k forks source link

Fix #2871 - accept `*` in mg_http_serve_opts::mime_types #2881

Closed cpq closed 2 months ago

Keith-Cancel commented 2 months ago

I saw this in reference to my pull request. I will say though looking at the code when the wild card item gets used depends on the order of the list. If it's the first item it will always get used, if it's the last item it will get used if there are no other matches. Somewhere in the middle it depends. This can give potential confusing behavior on when it gets used. Since for some files it may get used or may not ect... for a user if they don't realize order matters.

Compared to what I written for https://github.com/cesanta/mongoose/pull/2871 https://github.com/cesanta/mongoose/blob/4ee43133aea4d31bb77877a5df2393ce719b450c/src/http.c#L534-L552

I first check to see if any extensions in the list match before using the wild card. I think that is a lot more consistent.

--Edit-- Also was there something wrong with the revision to the pull request I made? Style or something else? The only thing I may have missed to add was some unit tests since looking at this PR I do see a section of tests for this parameter.

cpq commented 2 months ago

The logic in this PR is exactly as it meant.

Keith-Cancel commented 2 months ago

The logic in this PR is exactly as it meant.

Why would you want the it depend on order though?