From d8c94cd1fd6fe31781ea71472b5830b3ccad601c Mon Sep 17 00:00:00 2001 From: Louis Schmieder Date: Thu, 21 Jan 2021 20:16:25 +0100 Subject: [PATCH] vweb: make multipart Content-Type header detection case-insensitive (#8255) --- vlib/vweb/vweb.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/vweb/vweb.v b/vlib/vweb/vweb.v index 4a4899fa70..e166e1ae53 100644 --- a/vlib/vweb/vweb.v +++ b/vlib/vweb/vweb.v @@ -336,7 +336,7 @@ fn handle_conn(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(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') }