# HG changeset patch # User Ivo Smits # Date 1413029192 -7200 # Node ID a03e6ad0051f2e9e1c9b878bcf73f8f57d5986c6 # Parent 4ba4fd48e1dad930f7095929968f29a5cdb2d11b HTTP: Fixed request header handling diff -r 4ba4fd48e1da -r a03e6ad0051f Net/HTTP.cs --- a/Net/HTTP.cs Sat Oct 11 14:06:11 2014 +0200 +++ b/Net/HTTP.cs Sat Oct 11 14:06:32 2014 +0200 @@ -470,14 +470,22 @@ RequestPath = Uri.UnescapeDataString(request[0]); RequestQuery = request.Length > 1 ? request[1] : null; RequestHeaders = new List(); + String headerName = null, headerValue = null; while (true) { line = ReadLine(); if (line == null) goto SendError400AndClose; if (line.Length == 0) break; - request = line.Split(new String[] { ": " }, 2, StringSplitOptions.None); - if (request.Length != 2) goto SendError400AndClose; - RequestHeaders.Add(new HTTPHeader(request[0], request[1])); + if (line[0] == ' ' || line[0] == '\t') { + headerValue += line; + } else { + if (headerName != null) RequestHeaders.Add(new HTTPHeader(headerName, (headerValue ?? String.Empty).TrimStart())); + request = line.Split(new Char[] { ':' }, 2, StringSplitOptions.None); + if (request.Length != 2) goto SendError400AndClose; + headerName = request[0]; + headerValue = request[1]; + } } + if (headerName != null) RequestHeaders.Add(new HTTPHeader(headerName, (headerValue ?? String.Empty).TrimStart())); IHTTPContentProvider content = Server.ContentProvider; if (content == null) goto SendError500AndClose; State = HTTPConnectionState.ProcessingRequest;