diff src/org/eclipse/jetty/http/HttpParser.java @ 1022:3718afd99988

HttpHeaders uses StringCache
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 01 Nov 2016 01:04:46 -0600
parents e350c11242be
children cf0367978d8b
line wrap: on
line diff
--- a/src/org/eclipse/jetty/http/HttpParser.java	Mon Oct 31 22:49:25 2016 -0600
+++ b/src/org/eclipse/jetty/http/HttpParser.java	Tue Nov 01 01:04:46 2016 -0600
@@ -21,7 +21,6 @@
 import java.io.IOException;
 
 import org.eclipse.jetty.io.Buffer;
-import org.eclipse.jetty.io.BufferCache.CachedBuffer;
 import org.eclipse.jetty.io.BufferUtil;
 import org.eclipse.jetty.io.Buffers;
 import org.eclipse.jetty.io.ByteArrayBuffer;
@@ -66,7 +65,7 @@
 	private Buffer _header; // Buffer for header data (and small _content)
 	private Buffer _body; // Buffer for large content
 	private Buffer _buffer; // The current buffer in use (either _header or _content)
-	private CachedBuffer _cached;
+	private String _cached;
 	private String _tok0; // Saved token: header name, request method or response version
 	private final View.CaseInsensitive _tok1 = new View.CaseInsensitive(); // Saved token: header value, request URI or response code
 	private String _multiLineValue;
@@ -436,7 +435,7 @@
 								// handler last header if any
 								if (_cached!=null || _tok0.length() > 0 || _tok1.length() > 0 || _multiLineValue != null)
 								{
-									String header = _cached!=null?_cached.toString():_tok0;
+									String header = _cached!=null ? _cached : _tok0;
 									_cached = null;
 									String value = _multiLineValue == null ? _tok1.toString() : _multiLineValue;
 
@@ -582,7 +581,8 @@
 									// try cached name!
 									if (array!=null)
 									{
-										_cached = HttpHeaders.CACHE.getBest(array, _buffer.markIndex(), length+1);
+										String s = new String(array, _buffer.markIndex(), length+1);
+										_cached = HttpHeaders.CACHE.getBest(s);
 
 										if (_cached!=null)
 										{