Http2.smali 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615
  1. .class public final Lokhttp3/internal/http2/Http2;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # static fields
  5. .field static final BINARY:[Ljava/lang/String;
  6. .field static final CONNECTION_PREFACE:Lokio/ByteString;
  7. .field static final FLAGS:[Ljava/lang/String;
  8. .field static final FLAG_ACK:B = 0x1t
  9. .field static final FLAG_COMPRESSED:B = 0x20t
  10. .field static final FLAG_END_HEADERS:B = 0x4t
  11. .field static final FLAG_END_PUSH_PROMISE:B = 0x4t
  12. .field static final FLAG_END_STREAM:B = 0x1t
  13. .field static final FLAG_NONE:B = 0x0t
  14. .field static final FLAG_PADDED:B = 0x8t
  15. .field static final FLAG_PRIORITY:B = 0x20t
  16. .field private static final FRAME_NAMES:[Ljava/lang/String;
  17. .field static final INITIAL_MAX_FRAME_SIZE:I = 0x4000
  18. .field static final TYPE_CONTINUATION:B = 0x9t
  19. .field static final TYPE_DATA:B = 0x0t
  20. .field static final TYPE_GOAWAY:B = 0x7t
  21. .field static final TYPE_HEADERS:B = 0x1t
  22. .field static final TYPE_PING:B = 0x6t
  23. .field static final TYPE_PRIORITY:B = 0x2t
  24. .field static final TYPE_PUSH_PROMISE:B = 0x5t
  25. .field static final TYPE_RST_STREAM:B = 0x3t
  26. .field static final TYPE_SETTINGS:B = 0x4t
  27. .field static final TYPE_WINDOW_UPDATE:B = 0x8t
  28. # direct methods
  29. .method static constructor <clinit>()V
  30. .locals 16
  31. const-string v0, "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
  32. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  33. move-result-object v0
  34. sput-object v0, Lokhttp3/internal/http2/Http2;->CONNECTION_PREFACE:Lokio/ByteString;
  35. const/16 v0, 0xa
  36. new-array v0, v0, [Ljava/lang/String;
  37. const/4 v1, 0x0
  38. const-string v2, "DATA"
  39. aput-object v2, v0, v1
  40. const/4 v2, 0x1
  41. const-string v3, "HEADERS"
  42. aput-object v3, v0, v2
  43. const-string v3, "PRIORITY"
  44. const/4 v4, 0x2
  45. aput-object v3, v0, v4
  46. const/4 v4, 0x3
  47. const-string v5, "RST_STREAM"
  48. aput-object v5, v0, v4
  49. const/4 v5, 0x4
  50. const-string v6, "SETTINGS"
  51. aput-object v6, v0, v5
  52. const/4 v6, 0x5
  53. const-string v7, "PUSH_PROMISE"
  54. aput-object v7, v0, v6
  55. const/4 v6, 0x6
  56. const-string v7, "PING"
  57. aput-object v7, v0, v6
  58. const/4 v6, 0x7
  59. const-string v7, "GOAWAY"
  60. aput-object v7, v0, v6
  61. const/16 v6, 0x8
  62. const-string v7, "WINDOW_UPDATE"
  63. aput-object v7, v0, v6
  64. const/16 v7, 0x9
  65. const-string v8, "CONTINUATION"
  66. aput-object v8, v0, v7
  67. sput-object v0, Lokhttp3/internal/http2/Http2;->FRAME_NAMES:[Ljava/lang/String;
  68. const/16 v0, 0x40
  69. new-array v0, v0, [Ljava/lang/String;
  70. sput-object v0, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  71. const/16 v0, 0x100
  72. new-array v0, v0, [Ljava/lang/String;
  73. sput-object v0, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  74. const/4 v0, 0x0
  75. :goto_0
  76. sget-object v7, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  77. array-length v8, v7
  78. const/16 v9, 0x20
  79. if-ge v0, v8, :cond_0
  80. new-array v8, v2, [Ljava/lang/Object;
  81. invoke-static {v0}, Ljava/lang/Integer;->toBinaryString(I)Ljava/lang/String;
  82. move-result-object v10
  83. aput-object v10, v8, v1
  84. const-string v10, "%8s"
  85. invoke-static {v10, v8}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  86. move-result-object v8
  87. const/16 v10, 0x30
  88. invoke-virtual {v8, v9, v10}, Ljava/lang/String;->replace(CC)Ljava/lang/String;
  89. move-result-object v8
  90. aput-object v8, v7, v0
  91. add-int/lit8 v0, v0, 0x1
  92. goto :goto_0
  93. :cond_0
  94. sget-object v0, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  95. const-string v7, ""
  96. aput-object v7, v0, v1
  97. const-string v7, "END_STREAM"
  98. aput-object v7, v0, v2
  99. new-array v7, v2, [I
  100. aput v2, v7, v1
  101. const-string v2, "PADDED"
  102. aput-object v2, v0, v6
  103. array-length v0, v7
  104. const/4 v2, 0x0
  105. :goto_1
  106. const-string v8, "|PADDED"
  107. if-ge v2, v0, :cond_1
  108. aget v10, v7, v2
  109. sget-object v11, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  110. or-int/lit8 v12, v10, 0x8
  111. new-instance v13, Ljava/lang/StringBuilder;
  112. invoke-direct {v13}, Ljava/lang/StringBuilder;-><init>()V
  113. sget-object v14, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  114. aget-object v10, v14, v10
  115. invoke-virtual {v13, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  116. invoke-virtual {v13, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  117. invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  118. move-result-object v8
  119. aput-object v8, v11, v12
  120. add-int/lit8 v2, v2, 0x1
  121. goto :goto_1
  122. :cond_1
  123. sget-object v0, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  124. const-string v2, "END_HEADERS"
  125. aput-object v2, v0, v5
  126. aput-object v3, v0, v9
  127. const/16 v2, 0x24
  128. const-string v3, "END_HEADERS|PRIORITY"
  129. aput-object v3, v0, v2
  130. new-array v0, v4, [I
  131. fill-array-data v0, :array_0
  132. array-length v2, v0
  133. const/4 v3, 0x0
  134. :goto_2
  135. if-ge v3, v2, :cond_3
  136. aget v4, v0, v3
  137. array-length v5, v7
  138. const/4 v9, 0x0
  139. :goto_3
  140. if-ge v9, v5, :cond_2
  141. aget v10, v7, v9
  142. sget-object v11, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  143. or-int v12, v10, v4
  144. new-instance v13, Ljava/lang/StringBuilder;
  145. invoke-direct {v13}, Ljava/lang/StringBuilder;-><init>()V
  146. sget-object v14, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  147. aget-object v14, v14, v10
  148. invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  149. const/16 v14, 0x7c
  150. invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  151. sget-object v15, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  152. aget-object v15, v15, v4
  153. invoke-virtual {v13, v15}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  154. invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  155. move-result-object v13
  156. aput-object v13, v11, v12
  157. sget-object v11, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  158. or-int/2addr v12, v6
  159. new-instance v13, Ljava/lang/StringBuilder;
  160. invoke-direct {v13}, Ljava/lang/StringBuilder;-><init>()V
  161. sget-object v15, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  162. aget-object v10, v15, v10
  163. invoke-virtual {v13, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  164. invoke-virtual {v13, v14}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
  165. sget-object v10, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  166. aget-object v10, v10, v4
  167. invoke-virtual {v13, v10}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  168. invoke-virtual {v13, v8}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  169. invoke-virtual {v13}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  170. move-result-object v10
  171. aput-object v10, v11, v12
  172. add-int/lit8 v9, v9, 0x1
  173. goto :goto_3
  174. :cond_2
  175. add-int/lit8 v3, v3, 0x1
  176. goto :goto_2
  177. :cond_3
  178. :goto_4
  179. sget-object v0, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  180. array-length v2, v0
  181. if-ge v1, v2, :cond_5
  182. aget-object v2, v0, v1
  183. if-nez v2, :cond_4
  184. sget-object v2, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  185. aget-object v2, v2, v1
  186. aput-object v2, v0, v1
  187. :cond_4
  188. add-int/lit8 v1, v1, 0x1
  189. goto :goto_4
  190. :cond_5
  191. return-void
  192. nop
  193. :array_0
  194. .array-data 4
  195. 0x4
  196. 0x20
  197. 0x24
  198. .end array-data
  199. .end method
  200. .method private constructor <init>()V
  201. .locals 0
  202. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  203. return-void
  204. .end method
  205. .method static formatFlags(BB)Ljava/lang/String;
  206. .locals 2
  207. if-nez p1, :cond_0
  208. const-string p0, ""
  209. return-object p0
  210. :cond_0
  211. const/4 v0, 0x2
  212. if-eq p0, v0, :cond_6
  213. const/4 v0, 0x3
  214. if-eq p0, v0, :cond_6
  215. const/4 v0, 0x4
  216. if-eq p0, v0, :cond_4
  217. const/4 v0, 0x6
  218. if-eq p0, v0, :cond_4
  219. const/4 v0, 0x7
  220. if-eq p0, v0, :cond_6
  221. const/16 v0, 0x8
  222. if-eq p0, v0, :cond_6
  223. sget-object v0, Lokhttp3/internal/http2/Http2;->FLAGS:[Ljava/lang/String;
  224. array-length v1, v0
  225. if-ge p1, v1, :cond_1
  226. aget-object v0, v0, p1
  227. goto :goto_0
  228. :cond_1
  229. sget-object v0, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  230. aget-object v0, v0, p1
  231. :goto_0
  232. const/4 v1, 0x5
  233. if-ne p0, v1, :cond_2
  234. and-int/lit8 v1, p1, 0x4
  235. if-eqz v1, :cond_2
  236. const-string p0, "HEADERS"
  237. const-string p1, "PUSH_PROMISE"
  238. invoke-virtual {v0, p0, p1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
  239. move-result-object p0
  240. return-object p0
  241. :cond_2
  242. if-nez p0, :cond_3
  243. and-int/lit8 p0, p1, 0x20
  244. if-eqz p0, :cond_3
  245. const-string p0, "PRIORITY"
  246. const-string p1, "COMPRESSED"
  247. invoke-virtual {v0, p0, p1}, Ljava/lang/String;->replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String;
  248. move-result-object p0
  249. return-object p0
  250. :cond_3
  251. return-object v0
  252. :cond_4
  253. const/4 p0, 0x1
  254. if-ne p1, p0, :cond_5
  255. const-string p0, "ACK"
  256. goto :goto_1
  257. :cond_5
  258. sget-object p0, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  259. aget-object p0, p0, p1
  260. :goto_1
  261. return-object p0
  262. :cond_6
  263. sget-object p0, Lokhttp3/internal/http2/Http2;->BINARY:[Ljava/lang/String;
  264. aget-object p0, p0, p1
  265. return-object p0
  266. .end method
  267. .method static frameLog(ZIIBB)Ljava/lang/String;
  268. .locals 4
  269. sget-object v0, Lokhttp3/internal/http2/Http2;->FRAME_NAMES:[Ljava/lang/String;
  270. array-length v1, v0
  271. const/4 v2, 0x0
  272. const/4 v3, 0x1
  273. if-ge p3, v1, :cond_0
  274. aget-object v0, v0, p3
  275. goto :goto_0
  276. :cond_0
  277. new-array v0, v3, [Ljava/lang/Object;
  278. invoke-static {p3}, Ljava/lang/Byte;->valueOf(B)Ljava/lang/Byte;
  279. move-result-object v1
  280. aput-object v1, v0, v2
  281. const-string v1, "0x%02x"
  282. invoke-static {v1, v0}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  283. move-result-object v0
  284. :goto_0
  285. invoke-static {p3, p4}, Lokhttp3/internal/http2/Http2;->formatFlags(BB)Ljava/lang/String;
  286. move-result-object p3
  287. const/4 p4, 0x5
  288. new-array p4, p4, [Ljava/lang/Object;
  289. if-eqz p0, :cond_1
  290. const-string p0, "<<"
  291. goto :goto_1
  292. :cond_1
  293. const-string p0, ">>"
  294. :goto_1
  295. aput-object p0, p4, v2
  296. invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  297. move-result-object p0
  298. aput-object p0, p4, v3
  299. const/4 p0, 0x2
  300. invoke-static {p2}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;
  301. move-result-object p1
  302. aput-object p1, p4, p0
  303. const/4 p0, 0x3
  304. aput-object v0, p4, p0
  305. const/4 p0, 0x4
  306. aput-object p3, p4, p0
  307. const-string p0, "%s 0x%08x %5d %-13s %s"
  308. invoke-static {p0, p4}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  309. move-result-object p0
  310. return-object p0
  311. .end method
  312. .method static varargs illegalArgument(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/IllegalArgumentException;
  313. .locals 1
  314. new-instance v0, Ljava/lang/IllegalArgumentException;
  315. invoke-static {p0, p1}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  316. move-result-object p0
  317. invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
  318. throw v0
  319. .end method
  320. .method static varargs ioException(Ljava/lang/String;[Ljava/lang/Object;)Ljava/io/IOException;
  321. .locals 1
  322. .annotation system Ldalvik/annotation/Throws;
  323. value = {
  324. Ljava/io/IOException;
  325. }
  326. .end annotation
  327. new-instance v0, Ljava/io/IOException;
  328. invoke-static {p0, p1}, Lokhttp3/internal/Util;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
  329. move-result-object p0
  330. invoke-direct {v0, p0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  331. throw v0
  332. .end method