Skip to content

Commit 748cb78

Browse files
committed
Allow incoming options method
1 parent 533da33 commit 748cb78

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/http/request.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ F: Send + Sync + Fn(Request) -> Pin<Box<dyn Future<Output = Response> + Send>>
3939
match status_line {
4040
Some(status_line) => {
4141
let status_lower = status_line.to_lowercase();
42-
if status_lower.contains("http/1.") && (status_lower.starts_with("get") || status_lower.starts_with("post")) {
42+
if check_is_status_line(status_lower) {
4343
parse_request_status_line(status_line)
4444
} else {
4545
break 'root_loop;
@@ -214,6 +214,11 @@ F: Send + Sync + Fn(Request) -> Pin<Box<dyn Future<Output = Response> + Send>>
214214
}
215215
}
216216

217+
//allow http 1.* & POST, GET, OPTIONS methods
218+
fn check_is_status_line (line : String) -> bool {
219+
line.contains("http/1.") && (line.starts_with("get") || line.starts_with("options") || line.starts_with("post"))
220+
}
221+
217222
#[allow(dead_code)]
218223
fn hex_string_to_int(hex_string: &str) -> Option<u64> {
219224
match u64::from_str_radix(hex_string, 16) {

0 commit comments

Comments
 (0)