shaka-packager/packager/file
Joey Parrish af98d48726
fix: Fix flush/close semantics for HTTP files, improve testing (#1232)
All HTTP-based tests now use an embedded test server instead of
httpbin.org, which makes them much faster and more reliable.

These more reliable tests also exposed some issues that began recently
with PR #1201.  HttpFile's Flush() semantics were different than those
documented for files in general.  Flush() used to close the file for
uploading, so that no further writes were allowed, but the documentation
stated that it would only flush data to its destination.  PR #1201
brought HttpFile's Flush() in line with the docs, but gave us no way to
terminate a chunked upload.

This adds a new method to File called CloseForWriting(), which
terminates a chunked upload for HttpFile.  The only other implementation
that does anything is UdpFile, which uses the socket library function
shutdown() to terminate writes while allowing reads.

This also tweaks HttpFile::CloseWithStatus() so that it will not
generate an error if the file is closed before the HTTP response is
written to the download cache.

This modifies the test HttpFileTest.MultipleWrites so that the file is
Flushed after each chunk.  This adds test coverage for the changes
introduced in PR #1201.

Fixes #1224 (missing test coverage for HttpFile::Flush)
2023-07-13 18:55:48 -07:00
..
public chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
CMakeLists.txt test: Add Mongoose embedded HTTP server (#1231) 2023-07-13 16:36:42 -07:00
callback_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
callback_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
callback_file_unittest.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
file.cc feat: port media/formats/webm to CMake (#1147) 2022-12-16 21:40:00 -08:00
file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
file_closer.h chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
file_test_util.cc feat: port media/event to CMake (#1222) 2023-07-13 16:25:42 -07:00
file_test_util.h feat: port media/event to CMake (#1222) 2023-07-13 16:25:42 -07:00
file_unittest.cc feat: port media/base (#1127) 2022-11-04 15:46:41 -07:00
file_util.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
file_util.h chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
file_util_unittest.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
http_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
http_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
http_file_unittest.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
io_cache.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
io_cache.h refactor: Rename common.h to macros.h, now that it only contains macros (#1113) 2022-10-24 19:08:18 -07:00
io_cache_unittest.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
local_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
local_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
memory_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
memory_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
memory_file_unittest.cc feat: First phase of CMake build system implementation (#1072) 2022-08-16 11:34:51 -07:00
thread_pool.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
thread_pool.h refactor: Rename common.h to macros.h, now that it only contains macros (#1113) 2022-10-24 19:08:18 -07:00
threaded_io_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
threaded_io_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
udp_file.cc fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
udp_file.h fix: Fix flush/close semantics for HTTP files, improve testing (#1232) 2023-07-13 18:55:48 -07:00
udp_options.cc feat: Replace arraysize with std::size (#1129) 2022-11-03 07:21:46 -07:00
udp_options.h chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00
udp_options_unittest.cc chore: Mass-update copyright headers (#1086) 2022-08-26 08:44:59 -07:00