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

Add convenience debugging for HTTP requests in Cargo #6166

Merged
merged 1 commit into from
Oct 12, 2018

Conversation

alexcrichton
Copy link
Member

This is something we probably should have added long long ago given the
number of network issues that arise over time. This adds a new
configuration setting for Cargo, http.debug, which activates curl's
verbose interface which prints out information like redirects and
headers flying back and forth. This is by default routed through Cargo's
normal debug logging facilities, meaning one way to use this could be:

CARGO_HTTP_DEBUG=true \
  RUST_LOG=cargo::ops::registry \
  cargo build

and you should get lots of nice verbose logs as a result! This should
hopefully make it much easier to remotely debug HTTP issues as we can in
theory do a lot less guessing and a lot more manual inspection.

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @ehuss

@rust-highfive rust-highfive assigned ehuss and unassigned matklad Oct 11, 2018
@alexcrichton
Copy link
Member Author

An example of this for normal noop builds looks like -- https://gist.github.com/alexcrichton/fa637aa0a15eb948eb972b535d2dbc40

@ehuss
Copy link
Contributor

ehuss commented Oct 11, 2018

Nice! Is there any risk this may leak sensitive information like access tokens? I'd be remiss if I asked someone to post it to help debug something and it included too much info.

@alexcrichton
Copy link
Member Author

Ah yes there is indeed! In general though I think that's largely only applicable to the registry calls which are rarely the ones being debugged. Do you think though a blurb in the docs would be good enough to warn against this?

@ehuss
Copy link
Contributor

ehuss commented Oct 11, 2018

Do you think though a blurb in the docs would be good enough to warn against this?

Yea, I think that is plenty sufficient!

This is something we probably should have added long long ago given the
number of network issues that arise over time. This adds a new
configuration setting for Cargo, `http.debug`, which activates curl's
`verbose` interface which prints out information like redirects and
headers flying back and forth. This is by default routed through Cargo's
normal debug logging facilities, meaning one way to use this could be:

    CARGO_HTTP_DEBUG=true \
      RUST_LOG=cargo::ops::registry \
      cargo build

and you should get lots of nice verbose logs as a result! This should
hopefully make it much easier to remotely debug HTTP issues as we can in
theory do a lot less guessing and a lot more manual inspection.
@alexcrichton
Copy link
Member Author

Updated!

@ehuss
Copy link
Contributor

ehuss commented Oct 12, 2018

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 12, 2018

📌 Commit ba37581 has been approved by ehuss

@bors
Copy link
Collaborator

bors commented Oct 12, 2018

⌛ Testing commit ba37581 with merge b490af4...

bors added a commit that referenced this pull request Oct 12, 2018
Add convenience debugging for HTTP requests in Cargo

This is something we probably should have added long long ago given the
number of network issues that arise over time. This adds a new
configuration setting for Cargo, `http.debug`, which activates curl's
`verbose` interface which prints out information like redirects and
headers flying back and forth. This is by default routed through Cargo's
normal debug logging facilities, meaning one way to use this could be:

    CARGO_HTTP_DEBUG=true \
      RUST_LOG=cargo::ops::registry \
      cargo build

and you should get lots of nice verbose logs as a result! This should
hopefully make it much easier to remotely debug HTTP issues as we can in
theory do a lot less guessing and a lot more manual inspection.
@bors
Copy link
Collaborator

bors commented Oct 12, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: ehuss
Pushing b490af4 to master...

@bors bors merged commit ba37581 into rust-lang:master Oct 12, 2018
@alexcrichton alexcrichton deleted the debug-curl branch October 12, 2018 17:23
@ehuss ehuss added this to the 1.31.0 milestone Feb 6, 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.

5 participants