do not index content-length
This commit is contained in:
parent
d4e7c0a279
commit
a639359a7b
|
@ -70,13 +70,6 @@ public class HpackEncoder
|
||||||
EnumSet.of(HttpHeader.SET_COOKIE,
|
EnumSet.of(HttpHeader.SET_COOKIE,
|
||||||
HttpHeader.SET_COOKIE2);
|
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
|
static
|
||||||
{
|
{
|
||||||
for (HttpStatus.Code code : HttpStatus.Code.values())
|
for (HttpStatus.Code code : HttpStatus.Code.values())
|
||||||
|
@ -182,6 +175,7 @@ public class HpackEncoder
|
||||||
private void encode(ByteBuffer buffer, HttpField field)
|
private void encode(ByteBuffer buffer, HttpField field)
|
||||||
{
|
{
|
||||||
final int p=LOG.isDebugEnabled()?buffer.position():-1;
|
final int p=LOG.isDebugEnabled()?buffer.position():-1;
|
||||||
|
|
||||||
String encoding=null;
|
String encoding=null;
|
||||||
|
|
||||||
// TODO currently we do not check if there is enough space, so we will always
|
// TODO currently we do not check if there is enough space, so we will always
|
||||||
|
@ -207,10 +201,10 @@ public class HpackEncoder
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
encoding="IdxField";
|
|
||||||
|
|
||||||
// So we can emit the index and add the entry to the reference Set
|
// So we can emit the index and add the entry to the reference Set
|
||||||
int index=_context.index(entry);
|
int index=_context.index(entry);
|
||||||
|
if (p>=0)
|
||||||
|
encoding="IdxField"+(1+NBitInteger.octectsNeeded(7,index));
|
||||||
buffer.put((byte)0x80);
|
buffer.put((byte)0x80);
|
||||||
NBitInteger.encode(buffer,7,index);
|
NBitInteger.encode(buffer,7,index);
|
||||||
}
|
}
|
||||||
|
@ -226,7 +220,6 @@ public class HpackEncoder
|
||||||
final boolean never_index;
|
final boolean never_index;
|
||||||
final boolean huffman;
|
final boolean huffman;
|
||||||
final boolean indexed;
|
final boolean indexed;
|
||||||
final boolean date;
|
|
||||||
final int name_bits;
|
final int name_bits;
|
||||||
final byte mask;
|
final byte mask;
|
||||||
if (header==null)
|
if (header==null)
|
||||||
|
@ -234,7 +227,6 @@ public class HpackEncoder
|
||||||
never_index=false;
|
never_index=false;
|
||||||
huffman=true;
|
huffman=true;
|
||||||
indexed=true;
|
indexed=true;
|
||||||
date=false;
|
|
||||||
name_bits = 6;
|
name_bits = 6;
|
||||||
mask=(byte)0x40;
|
mask=(byte)0x40;
|
||||||
}
|
}
|
||||||
|
@ -242,17 +234,23 @@ public class HpackEncoder
|
||||||
{
|
{
|
||||||
indexed=false;
|
indexed=false;
|
||||||
never_index=__NEVER_INDEX.contains(header);
|
never_index=__NEVER_INDEX.contains(header);
|
||||||
date=__DATE_HEADER.contains(header);
|
|
||||||
huffman=!__DO_NOT_HUFFMAN.contains(header);
|
huffman=!__DO_NOT_HUFFMAN.contains(header);
|
||||||
name_bits = 4;
|
name_bits = 4;
|
||||||
mask=never_index?(byte)0x01:(byte)0x00;
|
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
|
else
|
||||||
{
|
{
|
||||||
indexed=true;
|
indexed=true;
|
||||||
never_index=false;
|
never_index=false;
|
||||||
huffman=!__DO_NOT_HUFFMAN.contains(header);
|
huffman=!__DO_NOT_HUFFMAN.contains(header);
|
||||||
date=__DATE_HEADER.contains(header);
|
|
||||||
name_bits = 6;
|
name_bits = 6;
|
||||||
mask=(byte)0x40;
|
mask=(byte)0x40;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +264,7 @@ public class HpackEncoder
|
||||||
if (p>=0)
|
if (p>=0)
|
||||||
{
|
{
|
||||||
encoding="Lit"+
|
encoding="Lit"+
|
||||||
((name_entry==null)?"HuffName":"IdxName")+
|
((name_entry==null)?"HuffName":("IdxName"+(_context.index(name_entry)<64?'1':'X')))+
|
||||||
(huffman?"HuffVal":"LitVal")+
|
(huffman?"HuffVal":"LitVal")+
|
||||||
(indexed?"Idxd":(never_index?"NeverIdx":""));
|
(indexed?"Idxd":(never_index?"NeverIdx":""));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
org.eclipse.jetty.util.log.class=org.eclipse.jetty.util.log.StdErrLog
|
||||||
org.eclipse.jetty.http2.LEVEL=INFO
|
org.eclipse.jetty.http2.LEVEL=INFO
|
||||||
|
org.eclipse.jetty.http2.hpack.LEVEL=DEBUG
|
||||||
|
|
Loading…
Reference in New Issue