Hpack$Reader.smali 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936
  1. .class final Lokhttp3/internal/http2/Hpack$Reader;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # annotations
  5. .annotation system Ldalvik/annotation/EnclosingClass;
  6. value = Lokhttp3/internal/http2/Hpack;
  7. .end annotation
  8. .annotation system Ldalvik/annotation/InnerClass;
  9. accessFlags = 0x18
  10. name = "Reader"
  11. .end annotation
  12. # instance fields
  13. .field dynamicTable:[Lokhttp3/internal/http2/Header;
  14. .field dynamicTableByteCount:I
  15. .field headerCount:I
  16. .field private final headerList:Ljava/util/List;
  17. .annotation system Ldalvik/annotation/Signature;
  18. value = {
  19. "Ljava/util/List<",
  20. "Lokhttp3/internal/http2/Header;",
  21. ">;"
  22. }
  23. .end annotation
  24. .end field
  25. .field private final headerTableSizeSetting:I
  26. .field private maxDynamicTableByteCount:I
  27. .field nextHeaderIndex:I
  28. .field private final source:Lokio/BufferedSource;
  29. # direct methods
  30. .method constructor <init>(IILokio/Source;)V
  31. .locals 1
  32. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  33. new-instance v0, Ljava/util/ArrayList;
  34. invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
  35. iput-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  36. const/16 v0, 0x8
  37. new-array v0, v0, [Lokhttp3/internal/http2/Header;
  38. iput-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  39. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  40. array-length v0, v0
  41. add-int/lit8 v0, v0, -0x1
  42. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  43. const/4 v0, 0x0
  44. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  45. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  46. iput p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerTableSizeSetting:I
  47. iput p2, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  48. invoke-static {p3}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
  49. move-result-object p1
  50. iput-object p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  51. return-void
  52. .end method
  53. .method constructor <init>(ILokio/Source;)V
  54. .locals 0
  55. invoke-direct {p0, p1, p1, p2}, Lokhttp3/internal/http2/Hpack$Reader;-><init>(IILokio/Source;)V
  56. return-void
  57. .end method
  58. .method private adjustDynamicTableByteCount()V
  59. .locals 2
  60. iget v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  61. iget v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  62. if-ge v0, v1, :cond_1
  63. if-nez v0, :cond_0
  64. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->clearDynamicTable()V
  65. goto :goto_0
  66. :cond_0
  67. sub-int/2addr v1, v0
  68. invoke-direct {p0, v1}, Lokhttp3/internal/http2/Hpack$Reader;->evictToRecoverBytes(I)I
  69. :cond_1
  70. :goto_0
  71. return-void
  72. .end method
  73. .method private clearDynamicTable()V
  74. .locals 2
  75. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  76. const/4 v1, 0x0
  77. invoke-static {v0, v1}, Ljava/util/Arrays;->fill([Ljava/lang/Object;Ljava/lang/Object;)V
  78. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  79. array-length v0, v0
  80. add-int/lit8 v0, v0, -0x1
  81. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  82. const/4 v0, 0x0
  83. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  84. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  85. return-void
  86. .end method
  87. .method private dynamicTableIndex(I)I
  88. .locals 1
  89. iget v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  90. add-int/lit8 v0, v0, 0x1
  91. add-int/2addr v0, p1
  92. return v0
  93. .end method
  94. .method private evictToRecoverBytes(I)I
  95. .locals 4
  96. const/4 v0, 0x0
  97. if-lez p1, :cond_1
  98. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  99. array-length v1, v1
  100. add-int/lit8 v1, v1, -0x1
  101. :goto_0
  102. iget v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  103. if-lt v1, v2, :cond_0
  104. if-lez p1, :cond_0
  105. iget-object v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  106. aget-object v3, v2, v1
  107. iget v3, v3, Lokhttp3/internal/http2/Header;->hpackSize:I
  108. sub-int/2addr p1, v3
  109. iget v3, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  110. aget-object v2, v2, v1
  111. iget v2, v2, Lokhttp3/internal/http2/Header;->hpackSize:I
  112. sub-int/2addr v3, v2
  113. iput v3, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  114. iget v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  115. add-int/lit8 v2, v2, -0x1
  116. iput v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  117. add-int/lit8 v0, v0, 0x1
  118. add-int/lit8 v1, v1, -0x1
  119. goto :goto_0
  120. :cond_0
  121. iget-object p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  122. iget v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  123. add-int/lit8 v2, v1, 0x1
  124. add-int/lit8 v1, v1, 0x1
  125. add-int/2addr v1, v0
  126. iget v3, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  127. invoke-static {p1, v2, p1, v1, v3}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  128. iget p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  129. add-int/2addr p1, v0
  130. iput p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  131. :cond_1
  132. return v0
  133. .end method
  134. .method private getName(I)Lokio/ByteString;
  135. .locals 2
  136. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->isStaticHeader(I)Z
  137. move-result v0
  138. if-eqz v0, :cond_0
  139. sget-object v0, Lokhttp3/internal/http2/Hpack;->STATIC_HEADER_TABLE:[Lokhttp3/internal/http2/Header;
  140. aget-object p1, v0, p1
  141. :goto_0
  142. iget-object p1, p1, Lokhttp3/internal/http2/Header;->name:Lokio/ByteString;
  143. return-object p1
  144. :cond_0
  145. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  146. sget-object v1, Lokhttp3/internal/http2/Hpack;->STATIC_HEADER_TABLE:[Lokhttp3/internal/http2/Header;
  147. array-length v1, v1
  148. sub-int/2addr p1, v1
  149. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableIndex(I)I
  150. move-result p1
  151. aget-object p1, v0, p1
  152. goto :goto_0
  153. .end method
  154. .method private insertIntoDynamicTable(ILokhttp3/internal/http2/Header;)V
  155. .locals 5
  156. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  157. invoke-interface {v0, p2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  158. iget v0, p2, Lokhttp3/internal/http2/Header;->hpackSize:I
  159. const/4 v1, -0x1
  160. if-eq p1, v1, :cond_0
  161. iget-object v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  162. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableIndex(I)I
  163. move-result v3
  164. aget-object v2, v2, v3
  165. iget v2, v2, Lokhttp3/internal/http2/Header;->hpackSize:I
  166. sub-int/2addr v0, v2
  167. :cond_0
  168. iget v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  169. if-le v0, v2, :cond_1
  170. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->clearDynamicTable()V
  171. return-void
  172. :cond_1
  173. iget v3, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  174. add-int/2addr v3, v0
  175. sub-int/2addr v3, v2
  176. invoke-direct {p0, v3}, Lokhttp3/internal/http2/Hpack$Reader;->evictToRecoverBytes(I)I
  177. move-result v2
  178. if-ne p1, v1, :cond_3
  179. iget p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  180. add-int/lit8 p1, p1, 0x1
  181. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  182. array-length v2, v1
  183. if-le p1, v2, :cond_2
  184. array-length p1, v1
  185. mul-int/lit8 p1, p1, 0x2
  186. new-array p1, p1, [Lokhttp3/internal/http2/Header;
  187. const/4 v2, 0x0
  188. array-length v3, v1
  189. array-length v4, v1
  190. invoke-static {v1, v2, p1, v3, v4}, Ljava/lang/System;->arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V
  191. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  192. array-length v1, v1
  193. add-int/lit8 v1, v1, -0x1
  194. iput v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  195. iput-object p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  196. :cond_2
  197. iget p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  198. add-int/lit8 v1, p1, -0x1
  199. iput v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->nextHeaderIndex:I
  200. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  201. aput-object p2, v1, p1
  202. iget p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  203. add-int/lit8 p1, p1, 0x1
  204. iput p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerCount:I
  205. goto :goto_0
  206. :cond_3
  207. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableIndex(I)I
  208. move-result v1
  209. add-int/2addr v1, v2
  210. add-int/2addr p1, v1
  211. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  212. aput-object p2, v1, p1
  213. :goto_0
  214. iget p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  215. add-int/2addr p1, v0
  216. iput p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableByteCount:I
  217. return-void
  218. .end method
  219. .method private isStaticHeader(I)Z
  220. .locals 2
  221. const/4 v0, 0x1
  222. if-ltz p1, :cond_0
  223. sget-object v1, Lokhttp3/internal/http2/Hpack;->STATIC_HEADER_TABLE:[Lokhttp3/internal/http2/Header;
  224. array-length v1, v1
  225. sub-int/2addr v1, v0
  226. if-gt p1, v1, :cond_0
  227. goto :goto_0
  228. :cond_0
  229. const/4 v0, 0x0
  230. :goto_0
  231. return v0
  232. .end method
  233. .method private readByte()I
  234. .locals 1
  235. .annotation system Ldalvik/annotation/Throws;
  236. value = {
  237. Ljava/io/IOException;
  238. }
  239. .end annotation
  240. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  241. invoke-interface {v0}, Lokio/BufferedSource;->readByte()B
  242. move-result v0
  243. and-int/lit16 v0, v0, 0xff
  244. return v0
  245. .end method
  246. .method private readIndexedHeader(I)V
  247. .locals 3
  248. .annotation system Ldalvik/annotation/Throws;
  249. value = {
  250. Ljava/io/IOException;
  251. }
  252. .end annotation
  253. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->isStaticHeader(I)Z
  254. move-result v0
  255. if-eqz v0, :cond_0
  256. sget-object v0, Lokhttp3/internal/http2/Hpack;->STATIC_HEADER_TABLE:[Lokhttp3/internal/http2/Header;
  257. aget-object p1, v0, p1
  258. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  259. invoke-interface {v0, p1}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  260. goto :goto_0
  261. :cond_0
  262. sget-object v0, Lokhttp3/internal/http2/Hpack;->STATIC_HEADER_TABLE:[Lokhttp3/internal/http2/Header;
  263. array-length v0, v0
  264. sub-int v0, p1, v0
  265. invoke-direct {p0, v0}, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTableIndex(I)I
  266. move-result v0
  267. if-ltz v0, :cond_1
  268. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->dynamicTable:[Lokhttp3/internal/http2/Header;
  269. array-length v2, v1
  270. add-int/lit8 v2, v2, -0x1
  271. if-gt v0, v2, :cond_1
  272. iget-object p1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  273. aget-object v0, v1, v0
  274. invoke-interface {p1, v0}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  275. :goto_0
  276. return-void
  277. :cond_1
  278. new-instance v0, Ljava/io/IOException;
  279. new-instance v1, Ljava/lang/StringBuilder;
  280. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  281. const-string v2, "Header index too large "
  282. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  283. add-int/lit8 p1, p1, 0x1
  284. invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  285. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  286. move-result-object p1
  287. invoke-direct {v0, p1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  288. throw v0
  289. .end method
  290. .method private readLiteralHeaderWithIncrementalIndexingIndexedName(I)V
  291. .locals 2
  292. .annotation system Ldalvik/annotation/Throws;
  293. value = {
  294. Ljava/io/IOException;
  295. }
  296. .end annotation
  297. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->getName(I)Lokio/ByteString;
  298. move-result-object p1
  299. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  300. move-result-object v0
  301. new-instance v1, Lokhttp3/internal/http2/Header;
  302. invoke-direct {v1, p1, v0}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Lokio/ByteString;)V
  303. const/4 p1, -0x1
  304. invoke-direct {p0, p1, v1}, Lokhttp3/internal/http2/Hpack$Reader;->insertIntoDynamicTable(ILokhttp3/internal/http2/Header;)V
  305. return-void
  306. .end method
  307. .method private readLiteralHeaderWithIncrementalIndexingNewName()V
  308. .locals 3
  309. .annotation system Ldalvik/annotation/Throws;
  310. value = {
  311. Ljava/io/IOException;
  312. }
  313. .end annotation
  314. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  315. move-result-object v0
  316. invoke-static {v0}, Lokhttp3/internal/http2/Hpack;->checkLowercase(Lokio/ByteString;)Lokio/ByteString;
  317. move-result-object v0
  318. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  319. move-result-object v1
  320. new-instance v2, Lokhttp3/internal/http2/Header;
  321. invoke-direct {v2, v0, v1}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Lokio/ByteString;)V
  322. const/4 v0, -0x1
  323. invoke-direct {p0, v0, v2}, Lokhttp3/internal/http2/Hpack$Reader;->insertIntoDynamicTable(ILokhttp3/internal/http2/Header;)V
  324. return-void
  325. .end method
  326. .method private readLiteralHeaderWithoutIndexingIndexedName(I)V
  327. .locals 3
  328. .annotation system Ldalvik/annotation/Throws;
  329. value = {
  330. Ljava/io/IOException;
  331. }
  332. .end annotation
  333. invoke-direct {p0, p1}, Lokhttp3/internal/http2/Hpack$Reader;->getName(I)Lokio/ByteString;
  334. move-result-object p1
  335. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  336. move-result-object v0
  337. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  338. new-instance v2, Lokhttp3/internal/http2/Header;
  339. invoke-direct {v2, p1, v0}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Lokio/ByteString;)V
  340. invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  341. return-void
  342. .end method
  343. .method private readLiteralHeaderWithoutIndexingNewName()V
  344. .locals 4
  345. .annotation system Ldalvik/annotation/Throws;
  346. value = {
  347. Ljava/io/IOException;
  348. }
  349. .end annotation
  350. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  351. move-result-object v0
  352. invoke-static {v0}, Lokhttp3/internal/http2/Hpack;->checkLowercase(Lokio/ByteString;)Lokio/ByteString;
  353. move-result-object v0
  354. invoke-virtual {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByteString()Lokio/ByteString;
  355. move-result-object v1
  356. iget-object v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  357. new-instance v3, Lokhttp3/internal/http2/Header;
  358. invoke-direct {v3, v0, v1}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Lokio/ByteString;)V
  359. invoke-interface {v2, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  360. return-void
  361. .end method
  362. # virtual methods
  363. .method public getAndResetHeaderList()Ljava/util/List;
  364. .locals 2
  365. .annotation system Ldalvik/annotation/Signature;
  366. value = {
  367. "()",
  368. "Ljava/util/List<",
  369. "Lokhttp3/internal/http2/Header;",
  370. ">;"
  371. }
  372. .end annotation
  373. new-instance v0, Ljava/util/ArrayList;
  374. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  375. invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
  376. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerList:Ljava/util/List;
  377. invoke-interface {v1}, Ljava/util/List;->clear()V
  378. return-object v0
  379. .end method
  380. .method maxDynamicTableByteCount()I
  381. .locals 1
  382. iget v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  383. return v0
  384. .end method
  385. .method readByteString()Lokio/ByteString;
  386. .locals 5
  387. .annotation system Ldalvik/annotation/Throws;
  388. value = {
  389. Ljava/io/IOException;
  390. }
  391. .end annotation
  392. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByte()I
  393. move-result v0
  394. and-int/lit16 v1, v0, 0x80
  395. const/16 v2, 0x80
  396. if-ne v1, v2, :cond_0
  397. const/4 v1, 0x1
  398. goto :goto_0
  399. :cond_0
  400. const/4 v1, 0x0
  401. :goto_0
  402. const/16 v2, 0x7f
  403. invoke-virtual {p0, v0, v2}, Lokhttp3/internal/http2/Hpack$Reader;->readInt(II)I
  404. move-result v0
  405. if-eqz v1, :cond_1
  406. invoke-static {}, Lokhttp3/internal/http2/Huffman;->get()Lokhttp3/internal/http2/Huffman;
  407. move-result-object v1
  408. iget-object v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  409. int-to-long v3, v0
  410. invoke-interface {v2, v3, v4}, Lokio/BufferedSource;->readByteArray(J)[B
  411. move-result-object v0
  412. invoke-virtual {v1, v0}, Lokhttp3/internal/http2/Huffman;->decode([B)[B
  413. move-result-object v0
  414. invoke-static {v0}, Lokio/ByteString;->of([B)Lokio/ByteString;
  415. move-result-object v0
  416. return-object v0
  417. :cond_1
  418. iget-object v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  419. int-to-long v2, v0
  420. invoke-interface {v1, v2, v3}, Lokio/BufferedSource;->readByteString(J)Lokio/ByteString;
  421. move-result-object v0
  422. return-object v0
  423. .end method
  424. .method readHeaders()V
  425. .locals 3
  426. .annotation system Ldalvik/annotation/Throws;
  427. value = {
  428. Ljava/io/IOException;
  429. }
  430. .end annotation
  431. :goto_0
  432. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  433. invoke-interface {v0}, Lokio/BufferedSource;->exhausted()Z
  434. move-result v0
  435. if-nez v0, :cond_8
  436. iget-object v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->source:Lokio/BufferedSource;
  437. invoke-interface {v0}, Lokio/BufferedSource;->readByte()B
  438. move-result v0
  439. and-int/lit16 v0, v0, 0xff
  440. const/16 v1, 0x80
  441. if-eq v0, v1, :cond_7
  442. and-int/lit16 v2, v0, 0x80
  443. if-ne v2, v1, :cond_0
  444. const/16 v1, 0x7f
  445. invoke-virtual {p0, v0, v1}, Lokhttp3/internal/http2/Hpack$Reader;->readInt(II)I
  446. move-result v0
  447. add-int/lit8 v0, v0, -0x1
  448. invoke-direct {p0, v0}, Lokhttp3/internal/http2/Hpack$Reader;->readIndexedHeader(I)V
  449. goto :goto_0
  450. :cond_0
  451. const/16 v1, 0x40
  452. if-ne v0, v1, :cond_1
  453. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readLiteralHeaderWithIncrementalIndexingNewName()V
  454. goto :goto_0
  455. :cond_1
  456. and-int/lit8 v2, v0, 0x40
  457. if-ne v2, v1, :cond_2
  458. const/16 v1, 0x3f
  459. invoke-virtual {p0, v0, v1}, Lokhttp3/internal/http2/Hpack$Reader;->readInt(II)I
  460. move-result v0
  461. add-int/lit8 v0, v0, -0x1
  462. invoke-direct {p0, v0}, Lokhttp3/internal/http2/Hpack$Reader;->readLiteralHeaderWithIncrementalIndexingIndexedName(I)V
  463. goto :goto_0
  464. :cond_2
  465. and-int/lit8 v1, v0, 0x20
  466. const/16 v2, 0x20
  467. if-ne v1, v2, :cond_4
  468. const/16 v1, 0x1f
  469. invoke-virtual {p0, v0, v1}, Lokhttp3/internal/http2/Hpack$Reader;->readInt(II)I
  470. move-result v0
  471. iput v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  472. iget v0, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  473. if-ltz v0, :cond_3
  474. iget v1, p0, Lokhttp3/internal/http2/Hpack$Reader;->headerTableSizeSetting:I
  475. if-gt v0, v1, :cond_3
  476. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->adjustDynamicTableByteCount()V
  477. goto :goto_0
  478. :cond_3
  479. new-instance v0, Ljava/io/IOException;
  480. new-instance v1, Ljava/lang/StringBuilder;
  481. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  482. const-string v2, "Invalid dynamic table size update "
  483. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  484. iget v2, p0, Lokhttp3/internal/http2/Hpack$Reader;->maxDynamicTableByteCount:I
  485. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  486. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  487. move-result-object v1
  488. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  489. throw v0
  490. :cond_4
  491. const/16 v1, 0x10
  492. if-eq v0, v1, :cond_6
  493. if-nez v0, :cond_5
  494. goto :goto_1
  495. :cond_5
  496. const/16 v1, 0xf
  497. invoke-virtual {p0, v0, v1}, Lokhttp3/internal/http2/Hpack$Reader;->readInt(II)I
  498. move-result v0
  499. add-int/lit8 v0, v0, -0x1
  500. invoke-direct {p0, v0}, Lokhttp3/internal/http2/Hpack$Reader;->readLiteralHeaderWithoutIndexingIndexedName(I)V
  501. goto/16 :goto_0
  502. :cond_6
  503. :goto_1
  504. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readLiteralHeaderWithoutIndexingNewName()V
  505. goto/16 :goto_0
  506. :cond_7
  507. new-instance v0, Ljava/io/IOException;
  508. const-string v1, "index == 0"
  509. invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  510. throw v0
  511. :cond_8
  512. return-void
  513. .end method
  514. .method readInt(II)I
  515. .locals 2
  516. .annotation system Ldalvik/annotation/Throws;
  517. value = {
  518. Ljava/io/IOException;
  519. }
  520. .end annotation
  521. and-int/2addr p1, p2
  522. if-ge p1, p2, :cond_0
  523. return p1
  524. :cond_0
  525. const/4 p1, 0x0
  526. :goto_0
  527. invoke-direct {p0}, Lokhttp3/internal/http2/Hpack$Reader;->readByte()I
  528. move-result v0
  529. and-int/lit16 v1, v0, 0x80
  530. if-eqz v1, :cond_1
  531. and-int/lit8 v0, v0, 0x7f
  532. shl-int/2addr v0, p1
  533. add-int/2addr p2, v0
  534. add-int/lit8 p1, p1, 0x7
  535. goto :goto_0
  536. :cond_1
  537. shl-int p1, v0, p1
  538. add-int/2addr p2, p1
  539. return p2
  540. .end method