vweb: make multipart Content-Type header detection case-insensitive (#8255)

pull/8244/head
Louis Schmieder 2021-01-21 20:16:25 +01:00 committed by GitHub
parent d1286dbf18
commit d8c94cd1fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -336,7 +336,7 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
}
sline := strip(line)
// Parse content type
if sline.len >= 14 && sline[..14] == 'Content-Type: ' {
if sline.len >= 14 && sline[..14].to_lower() == 'content-type: ' {
args := sline[14..].split('; ')
ct = args[0]
if args.len > 1 {
@ -367,7 +367,7 @@ fn handle_conn<T>(mut conn net.TcpConn, mut app T) {
}
if in_headers {
headers << sline
if sline.starts_with('Content-Length') {
if sline.to_lower().starts_with('content-length') {
len = sline.all_after(': ').int()
// println('GOT CL=$len')
}