Extended file server capabilities#14
Merged
Merged
Conversation
Fix misplaced modulo operator in response header setter. This fix corrects headers overridden with incorrect index. Add unit tests to verify the correct behavior. Also introduce getter method for testing and and future usage.
Allow multiple path segments to be matched with "{segment:path}",
where ":path" indicates that multiple segments can be matched.
Such patterns are useful for using the same callback function
for resources represented by multiple path segments (e.g. files
with directory structure).
Allow examples to run directly on unix port with "make run-unix". Deduplicate boot.py in examples by replacing with symlinks.
Extend response handling to support chunked responses when the transfer-encoding header is set.
Add session counter to uniquely identify HTTP sessions for facilitating stateful application behavior.
Allow registered callback functions to return None instead of content-type, and response body tuple. In such case, the application is expected to set these using the passed state machine context object. Additionally remove the option to register file paths as endpoints. File serving will get major improvements in the following commits.
- Convert file server state machine extensions to registered endpoints. When enabled, callback functions are registered under the /files endpoint. - Basic file retrieval feature is included by default in the main http module, restricting read access to /www. - Add the following features in the revised file server module: - retrieve directory structure in json format when the request refers to a directory - support single/bulk file uploads under a predefined directory, with chunked and partial upload handling - allow uploaded files to be deleted - Move path normalization helper to utils.helpers, and restructure related unit tests.
- reorganize test modules, split large test units - override HTTP configuration explicitely in each unit test; avoid relying on defaults - create an additional test for multipart chunked file uploads to verify that file chunks are correctly consumed per file regardless of ordering - fix linting issues
- fix file path validation to enforce absolute paths - reject "." and ".." used as absolute path segments, always expect normalized paths - add unit tests covering the aforementioned requirements
- 'http_serve_files' is ambiguous; rename it to 'http_files_api' to indicate that it only applies to the optional file serving API - set the default of http_file_api to false, as basic file serving is enabled by default as a state machine extension (_fs_retrieve_st) - add API documentation about /files
Improve the phrasing and structure, include a simple application as an example. Add clear API stability policy and project status section.
This file contains hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.