Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2014-07-18 07:23:44 +0000
committerGreg Wilkins2014-07-18 07:23:44 +0000
commita639359a7bcb0c72587435e014fc08ef7de9b695 (patch)
tree09200024a14402a855e89f828283617ebedc03bb /jetty-http2/http2-hpack
parentd4e7c0a2799f4881d0e3b062b273e0db55cbab05 (diff)
downloadorg.eclipse.jetty.project-a639359a7bcb0c72587435e014fc08ef7de9b695.tar.gz
org.eclipse.jetty.project-a639359a7bcb0c72587435e014fc08ef7de9b695.tar.xz
org.eclipse.jetty.project-a639359a7bcb0c72587435e014fc08ef7de9b695.zip
do not index content-length
Diffstat (limited to 'jetty-http2/http2-hpack')
-rw-r--r--jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java30
-rw-r--r--jetty-http2/http2-hpack/src/test/resources/jetty-logging.properties2
2 files changed, 15 insertions, 17 deletions
diff --git a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java
index ee2ca7e653..9420dbb093 100644
--- a/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java
+++ b/jetty-http2/http2-hpack/src/main/java/org/eclipse/jetty/http2/hpack/HpackEncoder.java
@@ -69,14 +69,7 @@ public class HpackEncoder
private final static EnumSet<HttpHeader> __NEVER_INDEX =
EnumSet.of(HttpHeader.SET_COOKIE,
HttpHeader.SET_COOKIE2);
-
- private final static EnumSet<HttpHeader> __DATE_HEADER =
- EnumSet.of(HttpHeader.IF_MODIFIED_SINCE,
- HttpHeader.DATE,
- HttpHeader.EXPIRES,
- HttpHeader.LAST_MODIFIED,
- HttpHeader.IF_UNMODIFIED_SINCE);
-
+
static
{
for (HttpStatus.Code code : HttpStatus.Code.values())
@@ -182,6 +175,7 @@ public class HpackEncoder
private void encode(ByteBuffer buffer, HttpField field)
{
final int p=LOG.isDebugEnabled()?buffer.position():-1;
+
String encoding=null;
// TODO currently we do not check if there is enough space, so we will always
@@ -207,10 +201,10 @@ public class HpackEncoder
}
else
{
- encoding="IdxField";
-
// So we can emit the index and add the entry to the reference Set
int index=_context.index(entry);
+ if (p>=0)
+ encoding="IdxField"+(1+NBitInteger.octectsNeeded(7,index));
buffer.put((byte)0x80);
NBitInteger.encode(buffer,7,index);
}
@@ -226,7 +220,6 @@ public class HpackEncoder
final boolean never_index;
final boolean huffman;
final boolean indexed;
- final boolean date;
final int name_bits;
final byte mask;
if (header==null)
@@ -234,7 +227,6 @@ public class HpackEncoder
never_index=false;
huffman=true;
indexed=true;
- date=false;
name_bits = 6;
mask=(byte)0x40;
}
@@ -242,17 +234,23 @@ public class HpackEncoder
{
indexed=false;
never_index=__NEVER_INDEX.contains(header);
- date=__DATE_HEADER.contains(header);
huffman=!__DO_NOT_HUFFMAN.contains(header);
name_bits = 4;
mask=never_index?(byte)0x01:(byte)0x00;
}
+ else if (header==HttpHeader.CONTENT_LENGTH && field.getValue().length()>1)
+ {
+ indexed=false;
+ never_index=false;
+ huffman=true;
+ name_bits = 4;
+ mask=(byte)0x00;
+ }
else
{
indexed=true;
never_index=false;
huffman=!__DO_NOT_HUFFMAN.contains(header);
- date=__DATE_HEADER.contains(header);
name_bits = 6;
mask=(byte)0x40;
}
@@ -266,7 +264,7 @@ public class HpackEncoder
if (p>=0)
{
encoding="Lit"+
- ((name_entry==null)?"HuffName":"IdxName")+
+ ((name_entry==null)?"HuffName":("IdxName"+(_context.index(name_entry)<64?'1':'X')))+
(huffman?"HuffVal":"LitVal")+
(indexed?"Idxd":(never_index?"NeverIdx":""));
}
@@ -316,6 +314,6 @@ public class HpackEncoder
int e=buffer.position();
if (LOG.isDebugEnabled())
LOG.debug("encoded '{}' by {} to '{}'",field,encoding,TypeUtil.toHexString(buffer.array(),buffer.arrayOffset()+p,e-p));
- }
+ }
}
}
diff --git a/jetty-http2/http2-hpack/src/test/resources/jetty-logging.properties b/jetty-http2/http2-hpack/src/test/resources/jetty-logging.properties
index 3d1e404e15..d33a7c3277 100644
--- a/jetty-http2/http2-hpack/src/test/resources/jetty-logging.properties
+++ b/jetty-http2/http2-hpack/src/test/resources/jetty-logging.properties
@@ -1,3 +1,3 @@
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
org.eclipse.jetty.http2.LEVEL=INFO
-
+org.eclipse.jetty.http2.hpack.LEVEL=DEBUG

Back to the top