{"record":{"id":"48f056fd6269608a","repo":"epi052/feroxbuster","slug":"empty-header-provided","errorCode":null,"errorMessage":"Empty header provided","messagePattern":"Empty header provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/utils.rs","lineNumber":307,"sourceCode":"/// malformed (e.g., empty or missing a key), it returns an error.\n///\n/// # Arguments\n///\n/// * `header` - A string slice that holds the header string to be split.\n///\n/// # Returns\n///\n/// * `Result<(String, String)>` - A tuple containing the key and value as `String`s,\n///   or an error if the input is invalid.\n///\n/// # Errors\n///\n/// This function will return an error if:\n/// * The input string is empty.\n/// * The key part of the header string is empty (i.e., if the string starts with `\":\"`).\npub fn split_header(header: &str) -> Result<(String, String)> {\n    if header.is_empty() {\n        bail!(\"Empty header provided\");\n    }\n\n    let mut split_val = header.split(':');\n\n    // explicitly take first split value as header's name\n    let name = split_val.next().unwrap().trim().to_string();\n\n    if name.is_empty() {\n        bail!(\"Empty header name provided\");\n    }\n\n    // all other items in the iterator returned by split, when combined with the\n    // original split deliminator (:), make up the header's final value\n    let value = split_val.collect::<Vec<&str>>().join(\":\");\n\n    if value.starts_with(' ') && !value.starts_with(\"  \") {\n        // first character is a space and the second character isn't\n        // we can trim the leading space","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/utils.rs#L289-L325","documentation":"split_header parses an `Name: value` header string and rejects completely empty input. With no characters at all there is neither a header name nor a value, so the function throws immediately. This validates each `--header` argument or request-file header line at the entry point.","triggerScenarios":"Calling split_header(\"\") directly; passing an empty string as a `-H/--header` CLI argument; a request-file header entry that expands to an empty string.","commonSituations":"Empty environment variables in headers (`-H \"$AUTH_HEADER\"` with the var unset), loop-generated header lists containing blanks, or malformed quoting producing an empty argument.","solutions":["Remove the empty header argument from the CLI invocation or request file","Ensure environment variables interpolated into header arguments are set and non-empty","Filter empty strings out of any dynamically built header list before parsing"],"exampleFix":"// before\nlet headers: Vec<String> = raw_headers; // may contain \"\"\n// after\nlet headers: Vec<String> = raw_headers.into_iter().filter(|h| !h.is_empty()).collect();","handlingStrategy":"validation","validationCode":"let headers: Vec<&str> = raw.iter().map(|s| s.as_str()).filter(|h| !h.trim().is_empty()).collect();","typeGuard":null,"tryCatchPattern":"match split_header(h) {\n    Ok((name, value)) => insert_header(name, value),\n    Err(e) => eprintln!(\"skipping invalid header '{h}': {e}\"),\n}","preventionTips":["Never pass empty strings as -H/--header values","Default-check environment variables used in headers (e.g. ${AUTH_HEADER:?unset})","Filter blank entries out of generated header lists before parsing"],"tags":["cli","http-headers","validation","rust"],"backgroundTag":"empty-required-field","analyzedSha":"1f595dab5c76858d5a14fbc47dabf2563d729c62","analyzedAt":"2026-09-13T19:33:06.208Z","contentChangedAt":"2026-09-13T19:33:06.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}