1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

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

This commit is contained in:
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

View File

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