use std::collections::BTreeMap;
use std::fs::{self, File};
use std::iter::repeat;
+use std::str;
use std::time::Duration;
use std::{cmp, env};
-use curl::easy::{Easy, SslOpt};
+use log::Level;
+use curl::easy::{Easy, SslOpt, InfoType};
use git2;
use registry::{NewCrate, NewCrateDependency, Registry};
} else {
handle.useragent(&version().to_string())?;
}
+
+ if let Some(true) = config.get::<Option<bool>>("http.debug")? {
+ handle.verbose(true)?;
+ handle.debug_function(|kind, data| {
+ let (prefix, level) = match kind {
+ InfoType::Text => ("*", Level::Debug),
+ InfoType::HeaderIn => ("<", Level::Debug),
+ InfoType::HeaderOut => (">", Level::Debug),
+ InfoType::DataIn => ("{", Level::Trace),
+ InfoType::DataOut => ("}", Level::Trace),
+ InfoType::SslDataIn |
+ InfoType::SslDataOut => return,
+ _ => return,
+ };
+ match str::from_utf8(data) {
+ Ok(s) => {
+ for line in s.lines() {
+ log!(level, "http-debug: {} {}", prefix, line);
+ }
+ }
+ Err(_) => {
+ log!(level, "http-debug: {} ({} bytes of data)", prefix, data.len());
+ }
+ }
+ })?;
+ }
Ok(())
}
low-speed-limit = 5 # Lower threshold for bytes/sec (10 = default, 0 = disabled)
multiplexing = false # whether or not to use HTTP/2 multiplexing where possible
+# This setting can be used to help debug what's going on with HTTP requests made
+# by Cargo. When set to `true` then Cargo's normal debug logging will be filled
+# in with HTTP information, which you can extract with
+# `RUST_LOG=cargo::ops::registry=debug` (and `trace` may print more).
+#
+# Be wary when posting these logs elsewhere though, it may be the case that a
+# header has an authentication token in it you don't want leaked! Be sure to
+# briefly review logs before posting them.
+debug = false
+
[build]
jobs = 1 # number of parallel jobs, defaults to # of CPUs
rustc = "rustc" # the rust compiler tool