Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Auto merge of #4808 - NickLaMuro:add_url_for_debug_http_response, r=s…
Browse files Browse the repository at this point in the history
…egiddins

Add URI to http response output in debug mode

Map request response to original URI when printing debug output for http responses for `bundler/fetcher/downloader`.

Overview
--------
I have recently been debugging some bundler stalling issues and found this addition to the debug output helpful when ruling out if a particular URL was timing out with the `CompactIndex` fetcher as it does it's requests over 25 threads and returns them asynchronously.  Getting a bunch of `HTTP 304 Not Modified` isn't as helpful if you are trying to determine how a thread is locking up.

Incidentally, this didn't end up helping solving some issues (further PRs will address this), but it seems like a simple debugging addition that could help rule out specific endpoint issues without requiring more [advanced debugging setups](https://gist.github.com/NickLaMuro/e923fc4e55307437a8f0e97ee6429410).
  • Loading branch information
homu committed Jul 26, 2016
2 parents f26eec7 + 4df7986 commit 32fa2f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/fetcher/downloader.rb
Expand Up @@ -14,7 +14,7 @@ def fetch(uri, options = {}, counter = 0)
raise HTTPError, "Too many redirects" if counter >= redirect_limit

response = request(uri, options)
Bundler.ui.debug("HTTP #{response.code} #{response.message}")
Bundler.ui.debug("HTTP #{response.code} #{response.message} #{uri}")

case response
when Net::HTTPSuccess, Net::HTTPNotModified
Expand Down
2 changes: 1 addition & 1 deletion spec/bundler/fetcher/downloader_spec.rb
Expand Up @@ -31,7 +31,7 @@
let(:http_response) { Net::HTTPSuccess.new("1.1", 200, "Success") }

it "should log the HTTP response code and message to debug" do
expect(Bundler).to receive_message_chain(:ui, :debug).with("HTTP 200 Success")
expect(Bundler).to receive_message_chain(:ui, :debug).with("HTTP 200 Success #{uri}")
subject.fetch(uri, options, counter)
end
end
Expand Down

0 comments on commit 32fa2f7

Please sign in to comment.