-
-
Notifications
You must be signed in to change notification settings - Fork 94
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
Content types added into header while serving static files #41
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
cong1920
commented
Nov 14, 2020
- Added a step in CMake to generate file content_types.hh to have a full list of common static files' content type strings. The list is stored as unordered_map<> for quick search in code. The sources file is actually http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
- In http_serve.hh: send_static_file(const char* path), added some code to parse out file extension and use it to search its content type string, store it along with file content in unordered_map<> static_files, and output in header before sending content.
…tml, css, javascript and pictures. Going to have longer list of common static files' types next.
…e during building. Will try to make it better and integrate to http_backend code build.
…to generated during building process.
Thanks @cong1920 for the PR. Looks good, I'm reviewing it. |
matt-42
requested changes
Nov 14, 2020
… to multiple lines for readibility. And moved the path from /include/li/* to /libraries/http_server/* as project owner suggested.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.