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

Make debugging macros insert branches on DEBUG_LEVEL #356

Merged
merged 2 commits into from
Dec 16, 2021
Merged

Conversation

ararslan
Copy link
Member

@ararslan ararslan commented Dec 1, 2018

This now makes them behave as expected after #354:

julia> HTTP.AWS4AuthRequest.sign_aws4!("GET",
                                       URI("https://example.amazonaws.com/"),
                                       Headers([]),
                                       UInt8[];
                                       timestamp=DateTime(2015, 8, 30, 12, 36),
                                       aws_service="service",
                                       aws_region="us-east-1")
"Authorization" => "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=content-md5;x-amz-content-sha256;x-amz-date, Signature=4308f0826e002c8afb1beba5866ac50182d4958a2bdbb85177c1397b769c322f"

julia> HTTP.DEBUG_LEVEL[] = 3
3

julia> HTTP.AWS4AuthRequest.sign_aws4!("GET",
                                       URI("https://example.amazonaws.com/"),
                                       Headers([]),
                                       UInt8[];
                                       timestamp=DateTime(2015, 8, 30, 12, 36),
                                       aws_service="service",
                                       aws_region="us-east-1")
DEBUG: 2018-11-30T16:28:35.053 9f6b AWS4 canonical_form: GET
/

content-md5:1B2M2Y8AsgTpgAmY7PhCfg==
x-amz-content-sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date:20150830T123600Z

content-md5;x-amz-content-sha256;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
DEBUG: 2018-11-30T16:28:35.053 9f6b AWS4 string_to_sign: AWS4-HMAC-SHA256
20150830T123600Z
20150830/us-east-1/service/aws4_request
5f231d3262389a81a957ee6120f6c3eafac690d565baae5f8aeff146ea759baf
DEBUG: 2018-11-30T16:28:35.053 9f6b AWS4 signature: 4308f0826e002c8afb1beba5866ac50182d4958a2bdbb85177c1397b769c322f
"Authorization" => "AWS4-HMAC-SHA256 Credential=AKIDEXAMPLE/20150830/us-east-1/service/aws4_request, SignedHeaders=content-md5;x-amz-content-sha256;x-amz-date, Signature=4308f0826e002c8afb1beba5866ac50182d4958a2bdbb85177c1397b769c322f"

@omus
Copy link
Contributor

omus commented Dec 14, 2018

Some benchmarks would be nice here

@quinnj
Copy link
Member

quinnj commented May 30, 2019

@ararslan, what are your thoughts here? Sorry for the slow delay; I'm going to try and make a push on things here. I'd support having DEBUG be a Ref; the perf cost would be minimal and makes things easily configurable (as long we keep the debug statements at reasonable levels).

@ararslan
Copy link
Member Author

Haven't thought about this for a while. Not sure how best to benchmark it, but I agree, I think something like this would be nice. Don't know when I'll have time to revisit this PR though.

@codecov-commenter
Copy link

codecov-commenter commented Dec 16, 2021

Codecov Report

Merging #356 (f641b5f) into master (09e03d1) will decrease coverage by 0.02%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #356      +/-   ##
==========================================
- Coverage   76.84%   76.81%   -0.03%     
==========================================
  Files          39       39              
  Lines        2500     2502       +2     
==========================================
+ Hits         1921     1922       +1     
- Misses        579      580       +1     
Impacted Files Coverage Δ
src/debug.jl 83.33% <50.00%> (-2.39%) ⬇️

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 09e03d1...f641b5f. Read the comment docs.

@quinnj quinnj merged commit 46687c8 into master Dec 16, 2021
@quinnj quinnj deleted the aa/debug-macro branch December 16, 2021 17:40
@quinnj
Copy link
Member

quinnj commented Dec 16, 2021

Merging as I've wanted this for a while; I know we want to overhaul the overall logging/debugging situation in HTTP.jl, but that doesn't prevent us from having this in the mean time.

@ararslan
Copy link
Member Author

Holy cow, this is an old one, I had forgotten all about it. Glad it's useful!

quinnj added a commit that referenced this pull request Mar 10, 2022
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.

4 participants