epi052/feroxbuster · error

Invalid request: Missing request line

Error message

Invalid request: Missing request line

What it means

After locating the head/body separator, parse_request_file splits the (normalized) head into lines and takes the first as the HTTP request line. If the head section splits into no parts at all, there is no request line, so the function throws. This is a defensive branch — an empty head is normally caught by earlier checks, but normalization can still leave a head that yields nothing.

Solutions

  1. Add a valid request line (e.g. `GET /path HTTP/1.1`) as the first line of the request file
  2. Re-copy the complete raw request including its request line
  3. Verify the file starts with the method rather than a blank line or separator

Example fix

// before (request.txt)
Host: example.com

// after
GET / HTTP/1.1
Host: example.com

Defensive patterns

Strategy: validation

Validate before calling

let text = String::from_utf8_lossy(&contents);
let head = text.split("\n\n").next().unwrap_or("");
if head.trim().is_empty() { return Err(anyhow!("request file has no request line")); }

Try / catch

match parse_request_file(&mut config) {
    Ok(()) => {},
    Err(e) => eprintln!("bad --request-file: {e}; first line must be a request line like 'GET / HTTP/1.1'"),
}

Prevention

When it happens

Trigger: A `--request-file` whose head section contains no lines after normalization — e.g. the file consists only of a separator (`\r\n\r\n`), or whitespace that normalizes away entirely.

Common situations: Files containing only the CRLF CRLF separator pasted from a clipboard, requests where the request line was accidentally deleted leaving headers plus blank line, or empty-body-only dumps.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of epi052/feroxbuster@1f595dab5c (2026-09-13). Data as JSON: /api/errors/eb5309f9354529ba. Report an issue: GitHub.

Appendix: source

Thrown at src/config/utils.rs:482

    // decode only the head; HTTP framing is generally ascii/utf-8
    // compatible
    let head = std::str::from_utf8(head_bytes)
        .map_err(|_| anyhow::anyhow!("Request headers contain invalid UTF-8"))?;

    // normalize line endings in the decoded head
    let normalized = head.replace("\r\n", "\n");

    // we only want to use the request's body bytes if the user hasn't
    // overridden it on the cli
    if config.data.is_empty() {
        config.data = body_bytes.to_vec();
    }

    // begin parsing the request line and normalized headers
    let mut head_parts = normalized.split("\n");

    let Some(request_line) = head_parts.next() else {
        bail!("Invalid request: Missing request line");
    };

    if request_line.is_empty() {
        bail!("Invalid request: Empty request line");
    }

    let mut request_parts = request_line.split_whitespace();

    let Some(method) = request_parts.next() else {
        bail!("Invalid request: Missing method");
    };

    if method.is_empty() {
        bail!("Invalid request: Empty method");
    }

    let method = method.to_string();

View on GitHub (pinned to 1f595dab5c)