diff src/org/eclipse/jetty/http/HttpParser.java @ 1020:6be43ef1eb96

HttpHeaderValues uses StringCache
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 31 Oct 2016 22:24:41 -0600
parents f126d30e04a4
children e350c11242be
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java	Mon Oct 31 03:33:42 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Mon Oct 31 22:24:41 2016 -0600
@@ -438,7 +438,7 @@
 								{
 									Buffer header=_cached!=null?_cached:HttpHeaders.CACHE.lookup(_tok0);
 									_cached=null;
-									Buffer value=_multiLineValue == null ? _tok1 : new ByteArrayBuffer(_multiLineValue);
+									String value = _multiLineValue == null ? _tok1.toString() : _multiLineValue;
 
 									int ho=HttpHeaders.CACHE.getOrdinal(header);
 									if (ho >= 0)
@@ -465,17 +465,16 @@
 												break;
 
 											case HttpHeaders.TRANSFER_ENCODING_ORDINAL:
-												value=HttpHeaderValues.CACHE.lookup(value);
-												vo=HttpHeaderValues.CACHE.getOrdinal(value);
+//												value=HttpHeaderValues.CACHE.lookup(value);
+												vo = HttpHeaderValues.CACHE.getOrdinal(value);
 												if (HttpHeaderValues.CHUNKED_ORDINAL == vo)
 													_contentLength=HttpTokens.CHUNKED_CONTENT;
 												else
 												{
-													String c=value.toString(StringUtil.__ISO_8859_1);
-													if (c.endsWith(HttpHeaderValues.CHUNKED))
+													if (value.endsWith(HttpHeaderValues.CHUNKED))
 														_contentLength=HttpTokens.CHUNKED_CONTENT;
 
-													else if (c.indexOf(HttpHeaderValues.CHUNKED) >= 0)
+													else if (value.indexOf(HttpHeaderValues.CHUNKED) >= 0)
 														throw new HttpException(400,null);
 												}
 												break;
@@ -493,7 +492,7 @@
 
 													case -1: // No match, may be multi valued
 													{
-														for (String v : value.toString().split(","))
+														for (String v : value.split(","))
 														{
 															switch(HttpHeaderValues.CACHE.getOrdinal(v.trim()))
 															{
@@ -1143,7 +1142,7 @@
 		/**
 		 * This is the method called by parser when a HTTP Header name and value is found
 		 */
-		public void parsedHeader(Buffer name, Buffer value) throws IOException;
+		public void parsedHeader(Buffer name, String value) throws IOException;
 
 		/**
 		 * This is the method called by parser when the HTTP request line is parsed