Adds support for serving statichit content out of a directory#9107
Adds support for serving statichit content out of a directory#9107zwoop merged 4 commits intoapache:masterfrom
Conversation
da247f4 to
4bc29f7
Compare
4bc29f7 to
d8e2c03
Compare
|
@zwoop You should really add labels to the PRs. |
|
As a side note for the curious reader, if this is acceptable by the community, I'd like to add support for the HTTPD |
| } | ||
| } | ||
| } else { | ||
| ret = {filePath}; |
There was a problem hiding this comment.
I guess clang doesn't like the braces cause you're using a conversion operator not a constructor: https://en.cppreference.com/w/cpp/string/basic_string/operator_basic_string_view
There was a problem hiding this comment.
Gah, thanks. I don't think it's a "clang" issue per se, it obviously worked with some clang compilers. Will look again when I get back.
|
[approve ci ubuntu] |
| TSHandleMLocRelease(reqp, hdr_loc, url_loc); | ||
| TSHandleMLocRelease(reqp, TS_NULL_MLOC, hdr_loc); | ||
|
|
||
| if (std::equal(dirPath.begin(), dirPath.end(), requested_file_path.begin()) && |
There was a problem hiding this comment.
Do we need a case insensitive comparison for OSX?
| int successCode = 200; | ||
| int failureCode = 404; | ||
| int maxAge = 0; | ||
| std::string mimeType = ""; |
There was a problem hiding this comment.
"" is the default value for std::string anyway.
| std::string_view filePath = tc->makePath(txn, output); | ||
|
|
||
| ifstr.open(tc->filePath); | ||
| VDEBUG("Requested file path: %s", filePath.data()); |
There was a problem hiding this comment.
You may spend centuries in Purgatory for assuming an std::string_view is null terminated. Especially when you could just have makePath() return std::string const &.
ywkaras
left a comment
There was a problem hiding this comment.
Please never tell Bjarne Stroustrup I approved this.
* Adds support for serving static files out of a directory * Change makePath to take a output container, and return string_view instead * Fixes per AMC's review * Make all clang compilers happy, maybe (cherry picked from commit e37b35d)
|
Cherry-picked to v9.2.x |
* asf/9.2.x: Revert "Make separate read and write vc_handlers (apache#8301)" AuTest: Update to Proxy Verifier 2.5.2 (apache#9223) AuTest: Update to Proxy Verifier v2.5.0 (apache#9221) Updated ChangeLog Adding back set_connect_fail for generic I/O error (apache#9181) AuTest: make MakeATSProcess accessible for TestRuns (apache#9195) Traffic Dump: Allow unlimited disk utilization (apache#9186) AuTest: bind stdout/stderr to traffic.out (apache#8919) Adds support for serving statichit content out of a directory (apache#9107)
This does some fairly expensive computations when producing the directory paths. This is intentional,
to make sure requests aren't escaping the specified directory and out elsewhere. This cleans out abusive
requests such as get
/../../etc/hostsetc.The idea is that rather than having to specify every individual file that the server should service, you can specify a
directory and every file (and subdirectory thereunder) can now be served.