diff --git a/src/config/container.rs b/src/config/container.rs index 06ddf598..7bf8eb75 100644 --- a/src/config/container.rs +++ b/src/config/container.rs @@ -620,7 +620,7 @@ impl Configuration { update_config_if_present!(&mut config.resume_from, args, "resume_from", String); if let Ok(Some(inner)) = args.try_get_one::("time_limit") { - config.time_limit = inner.to_owned(); + inner.clone_into(&mut config.time_limit); } if let Some(arg) = args.get_many::("status_codes") { @@ -644,7 +644,7 @@ impl Configuration { .collect(); } else { // not passed in by the user, use whatever value is held in status_codes - config.replay_codes = config.status_codes.clone(); + config.replay_codes.clone_from(&config.status_codes); } if let Some(arg) = args.get_many::("filter_status") { @@ -956,15 +956,27 @@ impl Configuration { config.headers.insert( // we know the header name is always "cookie" "Cookie".to_string(), - // on splitting, there should be only two elements, - // a key and a value cookies - .map(|cookie| cookie.split('=').collect::>()[..].to_owned()) - .filter(|parts| parts.len() == 2) - .map(|parts| format!("{}={}", parts[0].trim(), parts[1].trim())) - // trim the spaces, join with an equals sign + .flat_map(|cookie| { + cookie.split(';').filter_map(|part| { + // trim the spaces + let trimmed = part.trim(); + if trimmed.is_empty() { + None + } else { + // join with an equals sign + let parts = trimmed.split('=').collect::>(); + Some(format!( + "{}={}", + parts[0].trim(), + parts[1..].join("").trim() + )) + } + }) + }) .collect::>() - .join("; "), // join all the cookies with semicolons for the final header + // join all the cookies with semicolons for the final header + .join("; "), ); }