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

fix ensure_digest(block=True) call if no headers_buffer is available: #85

Merged
merged 2 commits into from
Jul 12, 2019

Conversation

ikreymer
Copy link
Member

@ikreymer ikreymer commented Jul 12, 2019

Calling ensure_digest(block=True) on a record with no headers_buffer computed would cause an exception as RecordBuilder would access a self in a class method.

record.http_headers.compute_headers_buffer(self.header_filter)

Fixing so header_filter is now a member of RecordBuilder, and ensure_digest remains a regular method.
Added test for ensure_digest(block=True, payload=True)

Currently, Webrecorder is calling ensure_digest(block=True, payload=True) explicitly which might not be correct/necessary (https://github.com/webrecorder/webrecorder/blob/master/webrecorder/webrecorder/rec/webrecrecorder.py#L370) -- I think it does this for side-effect of computing the payload length for chunked payload and should be examined itself. Nevertheless, that should not cause warcio to break.

make ensure_digest() a regular method and move header_filter into RecordBuilder to
support optional filter of headers during record creation
add test for calling ensure_digest() on existing record
bump version to 1.7.1
@ikreymer ikreymer requested a review from N0taN3rd July 12, 2019 02:38
@codecov
Copy link

codecov bot commented Jul 12, 2019

Codecov Report

Merging #85 into master will increase coverage by 0.12%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage   98.37%   98.49%   +0.12%     
==========================================
  Files          18       18              
  Lines        1599     1598       -1     
  Branches      256      256              
==========================================
+ Hits         1573     1574       +1     
+ Misses          5        4       -1     
+ Partials       21       20       -1
Impacted Files Coverage Δ
warcio/warcwriter.py 97.8% <100%> (-0.03%) ⬇️
warcio/recordbuilder.py 95.07% <100%> (+1.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c3f0c0...c9e0e78. Read the comment docs.

@ikreymer ikreymer merged commit b963fef into master Jul 12, 2019
@ikreymer ikreymer deleted the fix-ensure-digest branch February 20, 2020 23:26
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.

None yet

2 participants