updates from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-05-23 12:33:35 +02:00
parent 4dc004cf96
commit 53dc425bde
2 changed files with 6 additions and 8 deletions

View File

@ -66,7 +66,7 @@ public class HttpFields implements Iterable<HttpField>
*/
public HttpFields()
{
this(16 ); // TODO tune default. Currently based on small same of Chrome requests.
this(16); // TODO tune default. Currently based on small sample of Chrome requests.
}
/**
@ -116,7 +116,7 @@ public class HttpFields implements Iterable<HttpField>
public Stream<HttpField> stream()
{
return Arrays.stream(_fields).filter(f->f!=null);
return Arrays.stream(_fields).limit(_size);
}
/**

View File

@ -666,13 +666,11 @@ public class Request implements HttpServletRequest
{
if (_characterEncoding==null)
{
if (_contentType==null)
getContentType();
if (_contentType!=null)
String contentType = getContentType();
if (contentType!=null)
{
MimeTypes.Type mime = MimeTypes.CACHE.get(_contentType);
String charset = (mime == null || mime.getCharset() == null) ? MimeTypes.getCharsetFromContentType(_contentType) : mime.getCharset().toString();
MimeTypes.Type mime = MimeTypes.CACHE.get(contentType);
String charset = (mime == null || mime.getCharset() == null) ? MimeTypes.getCharsetFromContentType(contentType) : mime.getCharset().toString();
if (charset != null)
_characterEncoding=charset;
}