Exemplo n.º 1
0
 private void readHeaders(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt2 == 0) {
     throw Http2.ioException("PROTOCOL_ERROR: TYPE_HEADERS streamId == 0", new Object[0]);
   }
   boolean bool;
   if ((paramByte & 0x1) != 0) {
     bool = true;
   } else {
     bool = false;
   }
   short s;
   if ((paramByte & 0x8) != 0) {
     s = (short)(this.source.readByte() & 0xFF);
   } else {
     s = 0;
   }
   int i = paramInt1;
   if ((paramByte & 0x20) != 0)
   {
     readPriority(paramHandler, paramInt2);
     i = paramInt1 - 5;
   }
   paramHandler.headers(false, bool, paramInt2, -1, readHeaderBlock(Http2.lengthWithoutPadding(i, paramByte, s), s, paramByte, paramInt2), HeadersMode.HTTP_20_HEADERS);
 }
Exemplo n.º 2
0
 private void readData(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   boolean bool;
   if ((paramByte & 0x1) != 0) {
     bool = true;
   } else {
     bool = false;
   }
   int i;
   if ((paramByte & 0x20) != 0) {
     i = 1;
   } else {
     i = 0;
   }
   if (i != 0) {
     throw Http2.ioException("PROTOCOL_ERROR: FLAG_COMPRESSED without SETTINGS_COMPRESS_DATA", new Object[0]);
   }
   short s;
   if ((paramByte & 0x8) != 0) {
     s = (short)(this.source.readByte() & 0xFF);
   } else {
     s = 0;
   }
   paramInt1 = Http2.lengthWithoutPadding(paramInt1, paramByte, s);
   paramHandler.data(bool, paramInt2, this.source, paramInt1);
   this.source.ᵋ(s);
 }
Exemplo n.º 3
0
 private void readPriority(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt1 != 5) {
     throw Http2.ioException("TYPE_PRIORITY length: %d != 5", new Object[] { Integer.valueOf(paramInt1) });
   }
   if (paramInt2 == 0) {
     throw Http2.ioException("TYPE_PRIORITY streamId == 0", new Object[0]);
   }
   readPriority(paramHandler, paramInt2);
 }
Exemplo n.º 4
0
 public boolean nextFrame(FrameReader.Handler paramHandler)
 {
   try
   {
     this.source.ᔇ(9L);
   }
   catch (IOException paramHandler)
   {
     return false;
   }
   int i = Http2.readMedium(this.source);
   if ((i < 0) || (i > 16384)) {
     throw Http2.ioException("FRAME_SIZE_ERROR: %s", new Object[] { Integer.valueOf(i) });
   }
   byte b1 = (byte)(this.source.readByte() & 0xFF);
   byte b2 = (byte)(this.source.readByte() & 0xFF);
   int j = this.source.readInt() & 0x7FFFFFFF;
   if (Http2.logger.isLoggable(Level.FINE)) {
     Http2.logger.fine(Http2.FrameLogger.formatHeader(true, j, i, b1, b2));
   }
   switch (b1)
   {
   default: 
     break;
   case 0: 
     readData(paramHandler, i, b2, j);
     break;
   case 1: 
     readHeaders(paramHandler, i, b2, j);
     break;
   case 2: 
     readPriority(paramHandler, i, b2, j);
     break;
   case 3: 
     readRstStream(paramHandler, i, b2, j);
     break;
   case 4: 
     readSettings(paramHandler, i, b2, j);
     break;
   case 5: 
     readPushPromise(paramHandler, i, b2, j);
     break;
   case 6: 
     readPing(paramHandler, i, b2, j);
     break;
   case 7: 
     readGoAway(paramHandler, i, b2, j);
     break;
   case 8: 
     readWindowUpdate(paramHandler, i, b2, j);
     break;
   }
   this.source.ᵋ(i);
   return true;
 }
Exemplo n.º 5
0
 private void readWindowUpdate(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt1 != 4) {
     throw Http2.ioException("TYPE_WINDOW_UPDATE length !=4: %s", new Object[] { Integer.valueOf(paramInt1) });
   }
   long l = this.source.readInt() & 0x7FFFFFFF;
   if (l == 0L) {
     throw Http2.ioException("windowSizeIncrement was 0", new Object[] { Long.valueOf(l) });
   }
   paramHandler.windowUpdate(paramInt2, l);
 }
Exemplo n.º 6
0
 private void readRstStream(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt1 != 4) {
     throw Http2.ioException("TYPE_RST_STREAM length: %d != 4", new Object[] { Integer.valueOf(paramInt1) });
   }
   if (paramInt2 == 0) {
     throw Http2.ioException("TYPE_RST_STREAM streamId == 0", new Object[0]);
   }
   paramInt1 = this.source.readInt();
   ErrorCode localErrorCode = ErrorCode.fromHttp2(paramInt1);
   if (localErrorCode == null) {
     throw Http2.ioException("TYPE_RST_STREAM unexpected error code: %d", new Object[] { Integer.valueOf(paramInt1) });
   }
   paramHandler.rstStream(paramInt2, localErrorCode);
 }
Exemplo n.º 7
0
 void frameHeader(int paramInt1, int paramInt2, byte paramByte1, byte paramByte2)
 {
   if (Http2.logger.isLoggable(Level.FINE)) {
     Http2.logger.fine(Http2.FrameLogger.formatHeader(false, paramInt1, paramInt2, paramByte1, paramByte2));
   }
   if (paramInt2 > this.maxFrameSize) {
     throw Http2.illegalArgument("FRAME_SIZE_ERROR length > %d: %d", new Object[] { Integer.valueOf(this.maxFrameSize), Integer.valueOf(paramInt2) });
   }
   if ((0x80000000 & paramInt1) != 0) {
     throw Http2.illegalArgument("reserved bit set: %s", new Object[] { Integer.valueOf(paramInt1) });
   }
   Http2.writeMedium(this.sink, paramInt2);
   this.sink.ɟ(paramByte1 & 0xFF);
   this.sink.ɟ(paramByte2 & 0xFF);
   this.sink.ǀ(0x7FFFFFFF & paramInt1);
 }
Exemplo n.º 8
0
 private void readPing(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt1 != 8) {
     throw Http2.ioException("TYPE_PING length != 8: %s", new Object[] { Integer.valueOf(paramInt1) });
   }
   if (paramInt2 != 0) {
     throw Http2.ioException("TYPE_PING streamId != 0", new Object[0]);
   }
   paramInt1 = this.source.readInt();
   paramInt2 = this.source.readInt();
   boolean bool;
   if ((paramByte & 0x1) != 0) {
     bool = true;
   } else {
     bool = false;
   }
   paramHandler.ping(bool, paramInt1, paramInt2);
 }
Exemplo n.º 9
0
 private void readContinuationHeader()
 {
   int i = this.streamId;
   int j = Http2.readMedium(this.source);
   this.left = j;
   this.length = j;
   byte b = (byte)(this.source.readByte() & 0xFF);
   this.flags = ((byte)(this.source.readByte() & 0xFF));
   if (Http2.logger.isLoggable(Level.FINE)) {
     Http2.logger.fine(Http2.FrameLogger.formatHeader(true, this.streamId, this.length, b, this.flags));
   }
   this.streamId = (this.source.readInt() & 0x7FFFFFFF);
   if (b != 9) {
     throw Http2.ioException("%s != TYPE_CONTINUATION", new Object[] { Byte.valueOf(b) });
   }
   if (this.streamId != i) {
     throw Http2.ioException("TYPE_CONTINUATION streamId changed", new Object[0]);
   }
 }
Exemplo n.º 10
0
 private void readGoAway(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt1 < 8) {
     throw Http2.ioException("TYPE_GOAWAY length < 8: %s", new Object[] { Integer.valueOf(paramInt1) });
   }
   if (paramInt2 != 0) {
     throw Http2.ioException("TYPE_GOAWAY streamId != 0", new Object[0]);
   }
   paramByte = this.source.readInt();
   paramInt2 = this.source.readInt();
   paramInt1 -= 8;
   ErrorCode localErrorCode = ErrorCode.fromHttp2(paramInt2);
   if (localErrorCode == null) {
     throw Http2.ioException("TYPE_GOAWAY unexpected error code: %d", new Object[] { Integer.valueOf(paramInt2) });
   }
   uj localuj = uj.ZJ;
   if (paramInt1 > 0) {
     localuj = this.source.ᗮ(paramInt1);
   }
   paramHandler.goAway(paramByte, localErrorCode, localuj);
 }
Exemplo n.º 11
0
 public void readConnectionPreface()
 {
   if (this.client) {
     return;
   }
   uj localuj = this.source.ᗮ(Http2.CONNECTION_PREFACE.size());
   if (Http2.logger.isLoggable(Level.FINE)) {
     Http2.logger.fine(String.format("<< CONNECTION %s", new Object[] { localuj.el() }));
   }
   if (!Http2.CONNECTION_PREFACE.equals(localuj)) {
     throw Http2.ioException("Expected a connection header but was %s", new Object[] { localuj.ei() });
   }
 }
Exemplo n.º 12
0
 private void readPushPromise(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt2 == 0) {
     throw Http2.ioException("PROTOCOL_ERROR: TYPE_PUSH_PROMISE streamId == 0", new Object[0]);
   }
   short s;
   if ((paramByte & 0x8) != 0) {
     s = (short)(this.source.readByte() & 0xFF);
   } else {
     s = 0;
   }
   paramHandler.pushPromise(paramInt2, this.source.readInt() & 0x7FFFFFFF, readHeaderBlock(Http2.lengthWithoutPadding(paramInt1 - 4, paramByte, s), s, paramByte, paramInt2));
 }
Exemplo n.º 13
0
 public void goAway(int paramInt, ErrorCode paramErrorCode, byte[] paramArrayOfByte)
 {
   try
   {
     if (this.closed) {
       throw new IOException("closed");
     }
     if (paramErrorCode.httpCode == -1) {
       throw Http2.illegalArgument("errorCode.httpCode == -1", new Object[0]);
     }
     frameHeader(0, paramArrayOfByte.length + 8, (byte)7, (byte)0);
     this.sink.ǀ(paramInt);
     this.sink.ǀ(paramErrorCode.httpCode);
     if (paramArrayOfByte.length > 0) {
       this.sink.ᐧ(paramArrayOfByte);
     }
     this.sink.flush();
     return;
   }
   finally {}
 }
Exemplo n.º 14
0
 public void windowUpdate(int paramInt, long paramLong)
 {
   for (;;)
   {
     try
     {
       if (!this.closed) {
         break label76;
       }
       throw new IOException("closed");
     }
     finally {}
     throw Http2.illegalArgument("windowSizeIncrement == 0 || windowSizeIncrement > 0x7fffffffL: %s", new Object[] { Long.valueOf(paramLong) });
     frameHeader(paramInt, 4, (byte)8, (byte)0);
     this.sink.ǀ((int)paramLong);
     this.sink.flush();
     return;
     label76:
     if (paramLong != 0L) {
       if (paramLong <= 2147483647L) {}
     }
   }
 }
Exemplo n.º 15
0
 private void readSettings(FrameReader.Handler paramHandler, int paramInt1, byte paramByte, int paramInt2)
 {
   if (paramInt2 != 0) {
     throw Http2.ioException("TYPE_SETTINGS streamId != 0", new Object[0]);
   }
   if ((paramByte & 0x1) != 0)
   {
     if (paramInt1 != 0) {
       throw Http2.ioException("FRAME_SIZE_ERROR ack frame should be empty!", new Object[0]);
     }
     paramHandler.ackSettings();
     return;
   }
   if (paramInt1 % 6 != 0) {
     throw Http2.ioException("TYPE_SETTINGS length %% 6 != 0: %s", new Object[] { Integer.valueOf(paramInt1) });
   }
   Settings localSettings = new Settings();
   paramByte = 0;
   while (paramByte < paramInt1)
   {
     int i = this.source.readShort();
     int j = this.source.readInt();
     switch (i)
     {
     default: 
       break;
     case 1: 
       paramInt2 = i;
       break;
     case 2: 
       paramInt2 = i;
       if (j == 0) {
         break label270;
       }
       paramInt2 = i;
       if (j == 1) {
         break label270;
       }
       throw Http2.ioException("PROTOCOL_ERROR SETTINGS_ENABLE_PUSH != 0 or 1", new Object[0]);
     case 3: 
       paramInt2 = 4;
       break;
     case 4: 
       paramInt2 = 7;
       if (j >= 0) {
         break label270;
       }
       throw Http2.ioException("PROTOCOL_ERROR SETTINGS_INITIAL_WINDOW_SIZE > 2^31 - 1", new Object[0]);
     case 5: 
       if (j >= 16384)
       {
         paramInt2 = i;
         if (j <= 16777215) {
           break label270;
         }
       }
       throw Http2.ioException("PROTOCOL_ERROR SETTINGS_MAX_FRAME_SIZE: %s", new Object[] { Integer.valueOf(j) });
     case 6: 
       paramInt2 = i;
       break;
     }
     throw Http2.ioException("PROTOCOL_ERROR invalid settings id: %s", new Object[] { Short.valueOf(i) });
     label270:
     localSettings.set(paramInt2, 0, j);
     paramByte += 6;
   }
   paramHandler.settings(false, localSettings);
   if (localSettings.getHeaderTableSize() >= 0) {
     this.hpackReader.headerTableSizeSetting(localSettings.getHeaderTableSize());
   }
 }