add http/2

This commit is contained in:
mtgmonkey 2025-06-19 06:41:31 -04:00
parent 02acb04f65
commit cbb5a444d5

View file

@ -52,7 +52,7 @@ fn parse_connection_to_header(stream: &TcpStream) -> Result<String, HTTP_RESPONS
} }
fn parse_header_to_filepath(request: String) -> Result<String, HTTP_RESPONSE_CODE> { fn parse_header_to_filepath(request: String) -> Result<String, HTTP_RESPONSE_CODE> {
let regex = Regex::new(r"GET /(?<path>[^/].*|) HTTP/1\.1").unwrap(); let regex = Regex::new(r"GET /(?<path>[^/].*|) HTTP/(1\.1|2)").unwrap();
match regex.captures(&request) { match regex.captures(&request) {
Some(captures) => Ok(captures["path"].to_string()), Some(captures) => Ok(captures["path"].to_string()),
None => Err(HTTP_400_BAD_REQUEST), None => Err(HTTP_400_BAD_REQUEST),