{"record":{"id":"9070f32d86cf2a7b","repo":"epi052/feroxbuster","slug":"invalid-request-empty-request-line","errorCode":null,"errorMessage":"Invalid request: Empty request line","messagePattern":"Invalid request: Empty request line","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/config/utils.rs","lineNumber":486,"sourceCode":"\n    // normalize line endings in the decoded head\n    let normalized = head.replace(\"\\r\\n\", \"\\n\");\n\n    // we only want to use the request's body bytes if the user hasn't\n    // overridden it on the cli\n    if config.data.is_empty() {\n        config.data = body_bytes.to_vec();\n    }\n\n    // begin parsing the request line and normalized headers\n    let mut head_parts = normalized.split(\"\\n\");\n\n    let Some(request_line) = head_parts.next() else {\n        bail!(\"Invalid request: Missing request line\");\n    };\n\n    if request_line.is_empty() {\n        bail!(\"Invalid request: Empty request line\");\n    }\n\n    let mut request_parts = request_line.split_whitespace();\n\n    let Some(method) = request_parts.next() else {\n        bail!(\"Invalid request: Missing method\");\n    };\n\n    if method.is_empty() {\n        bail!(\"Invalid request: Empty method\");\n    }\n\n    let method = method.to_string();\n\n    if !config.methods.contains(&method) {\n        config.methods.push(method);\n    }\n","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/epi052/feroxbuster/blob/1f595dab5c76858d5a14fbc47dabf2563d729c62/src/config/utils.rs#L468-L504","documentation":"parse_request_file takes the first line of the request head as the request line and requires it to be non-empty. An empty first line means the file starts with a blank line instead of a `METHOD /path HTTP/x.x` request line, so parsing cannot proceed and the function throws. It catches files whose request line was lost or replaced by a newline.","triggerScenarios":"A `--request-file` that begins with a blank line (e.g. leading `\\n` or `\\r\\n` before the actual request), leaving an empty request line after the head is split on `\\n`.","commonSituations":"Copy-paste operations that insert a leading newline, editors adding a blank first line, or log excerpts that include a preceding empty line before the request.","solutions":["Delete the leading blank line so the file starts with the request line (`GET / HTTP/1.1`)","Re-copy the raw request ensuring no whitespace precedes the method","Trim leading newlines from the request file before running"],"exampleFix":"// before (request.txt)\n\\nGET / HTTP/1.1\nHost: example.com\n\n// after\nGET / HTTP/1.1\nHost: example.com\n\n","handlingStrategy":"validation","validationCode":"let text = std::fs::read_to_string(&path)?;\nif text.starts_with(['\\n', '\\r']) { return Err(anyhow!(\"request file must not start with a blank line\")); }","typeGuard":null,"tryCatchPattern":"match parse_request_file(&mut config) {\n    Ok(()) => {},\n    Err(e) => eprintln!(\"bad --request-file: {e}; remove leading blank lines\"),\n}","preventionTips":["Trim leading newlines from the file or the clipboard paste before saving","Disable editor features that insert a blank first line","Verify the file's first characters are the HTTP method"],"tags":["request-file","http","malformed-input","rust"],"backgroundTag":"invalid-argument-format","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"}