Skip to content
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
merged 15 commits into from
Nov 15, 2020

Conversation

cong1920
Copy link
Contributor

  • 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.

@matt-42
Copy link
Owner

matt-42 commented Nov 14, 2020

Thanks @cong1920 for the PR. Looks good, I'm reviewing it.

… to multiple lines for readibility. And moved the path from /include/li/* to /libraries/http_server/* as project owner suggested.
@matt-42 matt-42 merged commit 6277b58 into matt-42:master Nov 15, 2020
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.

2 participants