Skip to content

Content Negotiation #1719

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

Closed
wants to merge 1 commit into from

Conversation

alexkreidler
Copy link

PR Type

Feature

PR Checklist

Check your PR fulfills the following:

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made for the appropriate packages.
  • Format code with the latest stable rustfmt

Overview

Enables content negotiation in the actix-files FilesService. Uses built-in Actix Accept header parsing, sorts by q parameter, uses mime_guess to determine file extensions from the content-type. Tries all file exts for a given type, then tries the next content type.

TODOs:

  • make it optional, add a flag and method to enable in the ServiceFactory
  • add limits to the number of content types to try and the number of extensions for each content type to prevent DOS scenarios
  • think about/change error handling

Closes #1718

@codecov-commenter

This comment has been minimized.

@robjtede robjtede marked this pull request as draft October 5, 2020 15:19
@robjtede robjtede changed the title [WIP] Content Negotiation Content Negotiation Oct 5, 2020
@robjtede
Copy link
Member

Thanks for the submission, but I don't think this feature is strong enough to integrate into the official files lib. It seems to me you could build a service on top of actix-files to achieve this functionality.

@robjtede robjtede closed this Jun 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Content-Negotiation to actix-files
3 participants