{"record":{"id":"06f41e564de95beb","repo":"affaan-m/ECC","slug":"missing-http-method","errorCode":null,"errorMessage":"Missing HTTP method","messagePattern":"Missing HTTP method","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"ecc2/src/main.rs","lineNumber":4219,"sourceCode":"        if let Some(index) = buffer.windows(4).position(|window| window == b\"\\r\\n\\r\\n\") {\n            break index + 4;\n        }\n        if buffer.len() > 64 * 1024 {\n            anyhow::bail!(\"HTTP request headers too large\");\n        }\n    };\n\n    let header_text = String::from_utf8(buffer[..header_end].to_vec())\n        .context(\"HTTP request headers were not valid UTF-8\")?;\n    let mut lines = header_text.split(\"\\r\\n\");\n    let request_line = lines\n        .next()\n        .filter(|line| !line.trim().is_empty())\n        .ok_or_else(|| anyhow::anyhow!(\"Missing HTTP request line\"))?;\n    let mut request_parts = request_line.split_whitespace();\n    let method = request_parts\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Missing HTTP method\"))?\n        .to_string();\n    let path = request_parts\n        .next()\n        .ok_or_else(|| anyhow::anyhow!(\"Missing HTTP path\"))?\n        .to_string();\n\n    let mut headers = BTreeMap::new();\n    for line in lines {\n        if line.is_empty() {\n            break;\n        }\n        if let Some((key, value)) = line.split_once(':') {\n            headers.insert(key.trim().to_ascii_lowercase(), value.trim().to_string());\n        }\n    }\n\n    let content_length = headers\n        .get(\"content-length\")","sourceCodeStart":4201,"sourceCodeEnd":4237,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/main.rs#L4201-L4237","documentation":"A sibling parse error in the same HTTP request reader: the request line existed, but splitting it on whitespace produced no method token, so `request_parts.next()` returned `None`. Since every HTTP request line must begin with a method (GET, POST, ...), the parser rejects the input with this message.","triggerScenarios":"A request line consisting solely of whitespace/`\u000b` characters that survived the earlier empty-line filter; garbled binary sent where the method should be; a client writing only a path or headers without `METHOD PATH VERSION`.","commonSituations":"Fuzzing or malformed client traffic hitting the dev server; protocol confusion (e.g. sending PROXY protocol or TLS bytes); hand-crafted socket scripts with wrong formatting; truncated writes that clip the method.","solutions":["Ensure the request line follows `METHOD SP PATH SP HTTP/x.x` format with real spaces.","Check the client isn't sending binary/TLS data to this plain-HTTP listener.","Reproduce with curl to confirm the server works with standard clients.","If handling a proxy, account for PROXY protocol headers or disable that on the port."],"exampleFix":"// before\n$ printf '\\r\\n/foo HTTP/1.1\\r\\n\\r\\n' | nc localhost 8080\nerror: Missing HTTP method\n// after\n$ printf 'GET /foo HTTP/1.1\\r\\nHost: localhost\\r\\n\\r\\n' | nc localhost 8080","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Client side: always emit a canonical request line\nlet request = format!(\"GET {path} HTTP/1.1\\r\\nHost: {host}\\r\\n\\r\\n\");\nstream.write_all(request.as_bytes())?;","preventionTips":["Follow the strict `METHOD SP PATH SP HTTP/x.x` request-line format with single spaces.","Avoid hand-crafted socket scripts; use a standard HTTP client.","If a proxy sits in front, ensure it doesn't prepend PROXY-protocol bytes the server can't parse."],"tags":["http","parsing","malformed-request","network"],"backgroundTag":"invalid-argument-format","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}