{"record":{"id":"dbf92764a518e0de","repo":"epi052/feroxbuster","slug":"empty-header-name-provided","errorCode":null,"errorMessage":"Empty header name provided","messagePattern":"Empty header name provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/utils.rs","lineNumber":316,"sourceCode":"///   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\n        let trimmed = value.trim_start();\n        Ok((name, trimmed.to_string()))\n    } else {\n        Ok((name, value))\n    }\n}\n\n/// Combines two `Cookie` header strings into a single, unified `Cookie` header string.\n///","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/utils.rs#L298-L334","documentation":"split_header requires a non-empty header name before the first `:`. If the input starts with `:` (or the name is only whitespace after trimming), no header name exists and the function throws. Unlike the multiple-colon case, the value may still contain colons — only the name may not be empty.","triggerScenarios":"Calling split_header(\":value\") or split_header(\" :value\") — everything before the first `:` is empty after trim.","commonSituations":"Typos where the header name was deleted (`-H \": Bearer xyz\"`), templated request files where the header-name variable was empty, or hand-edited header lines missing `Authorization:` etc.","solutions":["Add the missing header name before the colon (e.g. `Authorization: Bearer xyz`)","Check templated request files for header-name variables that expand to empty strings","Validate each header entry matches `Name: value` before passing it to the parser"],"exampleFix":"// before\nxatu --header \": application/json\"\n// after\nxatu --header \"Content-Type: application/json\"","handlingStrategy":"validation","validationCode":"if !h.trim().is_empty() && !h.trim_start().starts_with(':') { /* safe to parse */ }","typeGuard":null,"tryCatchPattern":"match split_header(entry) {\n    Ok((name, value)) => insert_header(name, value),\n    Err(e) => eprintln!(\"invalid header entry '{entry}': {e}\"),\n}","preventionTips":["Always include the header name before the colon","Verify templated header lines have non-empty name variables","Lint header entries for a leading ':' before passing them to the parser"],"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"}