WAT: Duplicated payload metadata values for "Actual-Content-Length" and "Trailing-Slop-Length" #103
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.
This is a stupid regression of the multi-valued metadata (#98): in the payload metadata of WAT records the values of "Actual-Content-Length" and "Trailing-Slop-Length" are now duplicated. Here one example:
The reason is that these values are set (or appended) from the classes WARCResource and WARCMetaDataResourceFactory resp. HTTPHeadersResourceFactory. Because no other factory classes set these payload metadata headers, only WARC metadata and WARC response records are affected:
4
is set in WARCResource while0
is set in the factory classes. Before Make MetaData multi-valued to preserve values of repeating WARC and HTTP headers #98, only the last value0
made into the WAT record.4
), as the value is set only once and is never overwritten.\r\n\r\n
) used as WARC record separator resp. zero superfluous bytes.This PR changes the affected classes, so that additional values are only appended if they differ from already set values and (for "Trailing-Slop-Length") are not
0
.The solution looks overtly complex, but I decided to keep possible changes at a minimum. The matrix required for exhaustive testing is large because it's a combination of WARC and ARC, compressed or not, all WARC record types. The unit tests added cover only uncompressed ARC and WARC files with the record types contained in already provided test files.