Http2Codec.smali 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814
  1. .class public final Lokhttp3/internal/http2/Http2Codec;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/internal/http/HttpCodec;
  6. # annotations
  7. .annotation system Ldalvik/annotation/MemberClasses;
  8. value = {
  9. Lokhttp3/internal/http2/Http2Codec$StreamFinishingSource;
  10. }
  11. .end annotation
  12. # static fields
  13. .field private static final CONNECTION:Lokio/ByteString;
  14. .field private static final ENCODING:Lokio/ByteString;
  15. .field private static final HOST:Lokio/ByteString;
  16. .field private static final HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List;
  17. .annotation system Ldalvik/annotation/Signature;
  18. value = {
  19. "Ljava/util/List<",
  20. "Lokio/ByteString;",
  21. ">;"
  22. }
  23. .end annotation
  24. .end field
  25. .field private static final HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List;
  26. .annotation system Ldalvik/annotation/Signature;
  27. value = {
  28. "Ljava/util/List<",
  29. "Lokio/ByteString;",
  30. ">;"
  31. }
  32. .end annotation
  33. .end field
  34. .field private static final KEEP_ALIVE:Lokio/ByteString;
  35. .field private static final PROXY_CONNECTION:Lokio/ByteString;
  36. .field private static final TE:Lokio/ByteString;
  37. .field private static final TRANSFER_ENCODING:Lokio/ByteString;
  38. .field private static final UPGRADE:Lokio/ByteString;
  39. # instance fields
  40. .field private final chain:Lokhttp3/Interceptor$Chain;
  41. .field private final client:Lokhttp3/OkHttpClient;
  42. .field private final connection:Lokhttp3/internal/http2/Http2Connection;
  43. .field private stream:Lokhttp3/internal/http2/Http2Stream;
  44. .field final streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  45. # direct methods
  46. .method static constructor <clinit>()V
  47. .locals 12
  48. const-string v0, "connection"
  49. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  50. move-result-object v0
  51. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->CONNECTION:Lokio/ByteString;
  52. const-string v0, "host"
  53. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  54. move-result-object v0
  55. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->HOST:Lokio/ByteString;
  56. const-string v0, "keep-alive"
  57. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  58. move-result-object v0
  59. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->KEEP_ALIVE:Lokio/ByteString;
  60. const-string v0, "proxy-connection"
  61. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  62. move-result-object v0
  63. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->PROXY_CONNECTION:Lokio/ByteString;
  64. const-string v0, "transfer-encoding"
  65. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  66. move-result-object v0
  67. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->TRANSFER_ENCODING:Lokio/ByteString;
  68. const-string v0, "te"
  69. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  70. move-result-object v0
  71. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->TE:Lokio/ByteString;
  72. const-string v0, "encoding"
  73. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  74. move-result-object v0
  75. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->ENCODING:Lokio/ByteString;
  76. const-string v0, "upgrade"
  77. invoke-static {v0}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  78. move-result-object v0
  79. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->UPGRADE:Lokio/ByteString;
  80. const/16 v0, 0xc
  81. new-array v0, v0, [Lokio/ByteString;
  82. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->CONNECTION:Lokio/ByteString;
  83. const/4 v2, 0x0
  84. aput-object v1, v0, v2
  85. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->HOST:Lokio/ByteString;
  86. const/4 v3, 0x1
  87. aput-object v1, v0, v3
  88. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->KEEP_ALIVE:Lokio/ByteString;
  89. const/4 v4, 0x2
  90. aput-object v1, v0, v4
  91. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->PROXY_CONNECTION:Lokio/ByteString;
  92. const/4 v5, 0x3
  93. aput-object v1, v0, v5
  94. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->TE:Lokio/ByteString;
  95. const/4 v6, 0x4
  96. aput-object v1, v0, v6
  97. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->TRANSFER_ENCODING:Lokio/ByteString;
  98. const/4 v7, 0x5
  99. aput-object v1, v0, v7
  100. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->ENCODING:Lokio/ByteString;
  101. const/4 v8, 0x6
  102. aput-object v1, v0, v8
  103. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->UPGRADE:Lokio/ByteString;
  104. const/4 v9, 0x7
  105. aput-object v1, v0, v9
  106. sget-object v1, Lokhttp3/internal/http2/Header;->TARGET_METHOD:Lokio/ByteString;
  107. const/16 v10, 0x8
  108. aput-object v1, v0, v10
  109. sget-object v1, Lokhttp3/internal/http2/Header;->TARGET_PATH:Lokio/ByteString;
  110. const/16 v11, 0x9
  111. aput-object v1, v0, v11
  112. sget-object v1, Lokhttp3/internal/http2/Header;->TARGET_SCHEME:Lokio/ByteString;
  113. const/16 v11, 0xa
  114. aput-object v1, v0, v11
  115. sget-object v1, Lokhttp3/internal/http2/Header;->TARGET_AUTHORITY:Lokio/ByteString;
  116. const/16 v11, 0xb
  117. aput-object v1, v0, v11
  118. invoke-static {v0}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
  119. move-result-object v0
  120. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List;
  121. new-array v0, v10, [Lokio/ByteString;
  122. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->CONNECTION:Lokio/ByteString;
  123. aput-object v1, v0, v2
  124. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->HOST:Lokio/ByteString;
  125. aput-object v1, v0, v3
  126. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->KEEP_ALIVE:Lokio/ByteString;
  127. aput-object v1, v0, v4
  128. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->PROXY_CONNECTION:Lokio/ByteString;
  129. aput-object v1, v0, v5
  130. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->TE:Lokio/ByteString;
  131. aput-object v1, v0, v6
  132. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->TRANSFER_ENCODING:Lokio/ByteString;
  133. aput-object v1, v0, v7
  134. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->ENCODING:Lokio/ByteString;
  135. aput-object v1, v0, v8
  136. sget-object v1, Lokhttp3/internal/http2/Http2Codec;->UPGRADE:Lokio/ByteString;
  137. aput-object v1, v0, v9
  138. invoke-static {v0}, Lokhttp3/internal/Util;->immutableList([Ljava/lang/Object;)Ljava/util/List;
  139. move-result-object v0
  140. sput-object v0, Lokhttp3/internal/http2/Http2Codec;->HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List;
  141. return-void
  142. .end method
  143. .method public constructor <init>(Lokhttp3/OkHttpClient;Lokhttp3/Interceptor$Chain;Lokhttp3/internal/connection/StreamAllocation;Lokhttp3/internal/http2/Http2Connection;)V
  144. .locals 0
  145. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  146. iput-object p1, p0, Lokhttp3/internal/http2/Http2Codec;->client:Lokhttp3/OkHttpClient;
  147. iput-object p2, p0, Lokhttp3/internal/http2/Http2Codec;->chain:Lokhttp3/Interceptor$Chain;
  148. iput-object p3, p0, Lokhttp3/internal/http2/Http2Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  149. iput-object p4, p0, Lokhttp3/internal/http2/Http2Codec;->connection:Lokhttp3/internal/http2/Http2Connection;
  150. return-void
  151. .end method
  152. .method public static http2HeadersList(Lokhttp3/Request;)Ljava/util/List;
  153. .locals 6
  154. .annotation system Ldalvik/annotation/Signature;
  155. value = {
  156. "(",
  157. "Lokhttp3/Request;",
  158. ")",
  159. "Ljava/util/List<",
  160. "Lokhttp3/internal/http2/Header;",
  161. ">;"
  162. }
  163. .end annotation
  164. invoke-virtual {p0}, Lokhttp3/Request;->headers()Lokhttp3/Headers;
  165. move-result-object v0
  166. new-instance v1, Ljava/util/ArrayList;
  167. invoke-virtual {v0}, Lokhttp3/Headers;->size()I
  168. move-result v2
  169. add-int/lit8 v2, v2, 0x4
  170. invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(I)V
  171. new-instance v2, Lokhttp3/internal/http2/Header;
  172. sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_METHOD:Lokio/ByteString;
  173. invoke-virtual {p0}, Lokhttp3/Request;->method()Ljava/lang/String;
  174. move-result-object v4
  175. invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
  176. invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  177. new-instance v2, Lokhttp3/internal/http2/Header;
  178. sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_PATH:Lokio/ByteString;
  179. invoke-virtual {p0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  180. move-result-object v4
  181. invoke-static {v4}, Lokhttp3/internal/http/RequestLine;->requestPath(Lokhttp3/HttpUrl;)Ljava/lang/String;
  182. move-result-object v4
  183. invoke-direct {v2, v3, v4}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
  184. invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  185. const-string v2, "Host"
  186. invoke-virtual {p0, v2}, Lokhttp3/Request;->header(Ljava/lang/String;)Ljava/lang/String;
  187. move-result-object v2
  188. if-eqz v2, :cond_0
  189. new-instance v3, Lokhttp3/internal/http2/Header;
  190. sget-object v4, Lokhttp3/internal/http2/Header;->TARGET_AUTHORITY:Lokio/ByteString;
  191. invoke-direct {v3, v4, v2}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
  192. invoke-interface {v1, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  193. :cond_0
  194. new-instance v2, Lokhttp3/internal/http2/Header;
  195. sget-object v3, Lokhttp3/internal/http2/Header;->TARGET_SCHEME:Lokio/ByteString;
  196. invoke-virtual {p0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  197. move-result-object p0
  198. invoke-virtual {p0}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  199. move-result-object p0
  200. invoke-direct {v2, v3, p0}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
  201. invoke-interface {v1, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  202. const/4 p0, 0x0
  203. invoke-virtual {v0}, Lokhttp3/Headers;->size()I
  204. move-result v2
  205. :goto_0
  206. if-ge p0, v2, :cond_2
  207. invoke-virtual {v0, p0}, Lokhttp3/Headers;->name(I)Ljava/lang/String;
  208. move-result-object v3
  209. sget-object v4, Ljava/util/Locale;->US:Ljava/util/Locale;
  210. invoke-virtual {v3, v4}, Ljava/lang/String;->toLowerCase(Ljava/util/Locale;)Ljava/lang/String;
  211. move-result-object v3
  212. invoke-static {v3}, Lokio/ByteString;->encodeUtf8(Ljava/lang/String;)Lokio/ByteString;
  213. move-result-object v3
  214. sget-object v4, Lokhttp3/internal/http2/Http2Codec;->HTTP_2_SKIPPED_REQUEST_HEADERS:Ljava/util/List;
  215. invoke-interface {v4, v3}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
  216. move-result v4
  217. if-nez v4, :cond_1
  218. new-instance v4, Lokhttp3/internal/http2/Header;
  219. invoke-virtual {v0, p0}, Lokhttp3/Headers;->value(I)Ljava/lang/String;
  220. move-result-object v5
  221. invoke-direct {v4, v3, v5}, Lokhttp3/internal/http2/Header;-><init>(Lokio/ByteString;Ljava/lang/String;)V
  222. invoke-interface {v1, v4}, Ljava/util/List;->add(Ljava/lang/Object;)Z
  223. :cond_1
  224. add-int/lit8 p0, p0, 0x1
  225. goto :goto_0
  226. :cond_2
  227. return-object v1
  228. .end method
  229. .method public static readHttp2HeadersList(Ljava/util/List;)Lokhttp3/Response$Builder;
  230. .locals 8
  231. .annotation system Ldalvik/annotation/Signature;
  232. value = {
  233. "(",
  234. "Ljava/util/List<",
  235. "Lokhttp3/internal/http2/Header;",
  236. ">;)",
  237. "Lokhttp3/Response$Builder;"
  238. }
  239. .end annotation
  240. .annotation system Ldalvik/annotation/Throws;
  241. value = {
  242. Ljava/io/IOException;
  243. }
  244. .end annotation
  245. new-instance v0, Lokhttp3/Headers$Builder;
  246. invoke-direct {v0}, Lokhttp3/Headers$Builder;-><init>()V
  247. invoke-interface {p0}, Ljava/util/List;->size()I
  248. move-result v1
  249. const/4 v2, 0x0
  250. const/4 v3, 0x0
  251. move-object v4, v0
  252. move-object v0, v2
  253. :goto_0
  254. if-ge v3, v1, :cond_3
  255. invoke-interface {p0, v3}, Ljava/util/List;->get(I)Ljava/lang/Object;
  256. move-result-object v5
  257. check-cast v5, Lokhttp3/internal/http2/Header;
  258. if-nez v5, :cond_0
  259. if-eqz v0, :cond_2
  260. iget v5, v0, Lokhttp3/internal/http/StatusLine;->code:I
  261. const/16 v6, 0x64
  262. if-ne v5, v6, :cond_2
  263. new-instance v0, Lokhttp3/Headers$Builder;
  264. invoke-direct {v0}, Lokhttp3/Headers$Builder;-><init>()V
  265. move-object v4, v0
  266. move-object v0, v2
  267. goto :goto_1
  268. :cond_0
  269. iget-object v6, v5, Lokhttp3/internal/http2/Header;->name:Lokio/ByteString;
  270. iget-object v5, v5, Lokhttp3/internal/http2/Header;->value:Lokio/ByteString;
  271. invoke-virtual {v5}, Lokio/ByteString;->utf8()Ljava/lang/String;
  272. move-result-object v5
  273. sget-object v7, Lokhttp3/internal/http2/Header;->RESPONSE_STATUS:Lokio/ByteString;
  274. invoke-virtual {v6, v7}, Lokio/ByteString;->equals(Ljava/lang/Object;)Z
  275. move-result v7
  276. if-eqz v7, :cond_1
  277. new-instance v0, Ljava/lang/StringBuilder;
  278. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  279. const-string v6, "HTTP/1.1 "
  280. invoke-virtual {v0, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  281. invoke-virtual {v0, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  282. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  283. move-result-object v0
  284. invoke-static {v0}, Lokhttp3/internal/http/StatusLine;->parse(Ljava/lang/String;)Lokhttp3/internal/http/StatusLine;
  285. move-result-object v0
  286. goto :goto_1
  287. :cond_1
  288. sget-object v7, Lokhttp3/internal/http2/Http2Codec;->HTTP_2_SKIPPED_RESPONSE_HEADERS:Ljava/util/List;
  289. invoke-interface {v7, v6}, Ljava/util/List;->contains(Ljava/lang/Object;)Z
  290. move-result v7
  291. if-nez v7, :cond_2
  292. sget-object v7, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  293. invoke-virtual {v6}, Lokio/ByteString;->utf8()Ljava/lang/String;
  294. move-result-object v6
  295. invoke-virtual {v7, v4, v6, v5}, Lokhttp3/internal/Internal;->addLenient(Lokhttp3/Headers$Builder;Ljava/lang/String;Ljava/lang/String;)V
  296. :cond_2
  297. :goto_1
  298. add-int/lit8 v3, v3, 0x1
  299. goto :goto_0
  300. :cond_3
  301. if-eqz v0, :cond_4
  302. new-instance p0, Lokhttp3/Response$Builder;
  303. invoke-direct {p0}, Lokhttp3/Response$Builder;-><init>()V
  304. sget-object v1, Lokhttp3/Protocol;->HTTP_2:Lokhttp3/Protocol;
  305. invoke-virtual {p0, v1}, Lokhttp3/Response$Builder;->protocol(Lokhttp3/Protocol;)Lokhttp3/Response$Builder;
  306. move-result-object p0
  307. iget v1, v0, Lokhttp3/internal/http/StatusLine;->code:I
  308. invoke-virtual {p0, v1}, Lokhttp3/Response$Builder;->code(I)Lokhttp3/Response$Builder;
  309. move-result-object p0
  310. iget-object v0, v0, Lokhttp3/internal/http/StatusLine;->message:Ljava/lang/String;
  311. invoke-virtual {p0, v0}, Lokhttp3/Response$Builder;->message(Ljava/lang/String;)Lokhttp3/Response$Builder;
  312. move-result-object p0
  313. invoke-virtual {v4}, Lokhttp3/Headers$Builder;->build()Lokhttp3/Headers;
  314. move-result-object v0
  315. invoke-virtual {p0, v0}, Lokhttp3/Response$Builder;->headers(Lokhttp3/Headers;)Lokhttp3/Response$Builder;
  316. move-result-object p0
  317. return-object p0
  318. :cond_4
  319. new-instance p0, Ljava/net/ProtocolException;
  320. const-string v0, "Expected \':status\' header not present"
  321. invoke-direct {p0, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
  322. goto :goto_3
  323. :goto_2
  324. throw p0
  325. :goto_3
  326. goto :goto_2
  327. .end method
  328. # virtual methods
  329. .method public cancel()V
  330. .locals 2
  331. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  332. if-eqz v0, :cond_0
  333. sget-object v1, Lokhttp3/internal/http2/ErrorCode;->CANCEL:Lokhttp3/internal/http2/ErrorCode;
  334. invoke-virtual {v0, v1}, Lokhttp3/internal/http2/Http2Stream;->closeLater(Lokhttp3/internal/http2/ErrorCode;)V
  335. :cond_0
  336. return-void
  337. .end method
  338. .method public createRequestBody(Lokhttp3/Request;J)Lokio/Sink;
  339. .locals 0
  340. iget-object p1, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  341. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->getSink()Lokio/Sink;
  342. move-result-object p1
  343. return-object p1
  344. .end method
  345. .method public finishRequest()V
  346. .locals 1
  347. .annotation system Ldalvik/annotation/Throws;
  348. value = {
  349. Ljava/io/IOException;
  350. }
  351. .end annotation
  352. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  353. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->getSink()Lokio/Sink;
  354. move-result-object v0
  355. invoke-interface {v0}, Lokio/Sink;->close()V
  356. return-void
  357. .end method
  358. .method public flushRequest()V
  359. .locals 1
  360. .annotation system Ldalvik/annotation/Throws;
  361. value = {
  362. Ljava/io/IOException;
  363. }
  364. .end annotation
  365. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->connection:Lokhttp3/internal/http2/Http2Connection;
  366. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Connection;->flush()V
  367. return-void
  368. .end method
  369. .method public openResponseBody(Lokhttp3/Response;)Lokhttp3/ResponseBody;
  370. .locals 4
  371. .annotation system Ldalvik/annotation/Throws;
  372. value = {
  373. Ljava/io/IOException;
  374. }
  375. .end annotation
  376. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  377. iget-object v1, v0, Lokhttp3/internal/connection/StreamAllocation;->eventListener:Lokhttp3/EventListener;
  378. iget-object v0, v0, Lokhttp3/internal/connection/StreamAllocation;->call:Lokhttp3/Call;
  379. invoke-virtual {v1, v0}, Lokhttp3/EventListener;->responseBodyStart(Lokhttp3/Call;)V
  380. const-string v0, "Content-Type"
  381. invoke-virtual {p1, v0}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
  382. move-result-object v0
  383. invoke-static {p1}, Lokhttp3/internal/http/HttpHeaders;->contentLength(Lokhttp3/Response;)J
  384. move-result-wide v1
  385. new-instance p1, Lokhttp3/internal/http2/Http2Codec$StreamFinishingSource;
  386. iget-object v3, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  387. invoke-virtual {v3}, Lokhttp3/internal/http2/Http2Stream;->getSource()Lokio/Source;
  388. move-result-object v3
  389. invoke-direct {p1, p0, v3}, Lokhttp3/internal/http2/Http2Codec$StreamFinishingSource;-><init>(Lokhttp3/internal/http2/Http2Codec;Lokio/Source;)V
  390. new-instance v3, Lokhttp3/internal/http/RealResponseBody;
  391. invoke-static {p1}, Lokio/Okio;->buffer(Lokio/Source;)Lokio/BufferedSource;
  392. move-result-object p1
  393. invoke-direct {v3, v0, v1, v2, p1}, Lokhttp3/internal/http/RealResponseBody;-><init>(Ljava/lang/String;JLokio/BufferedSource;)V
  394. return-object v3
  395. .end method
  396. .method public readResponseHeaders(Z)Lokhttp3/Response$Builder;
  397. .locals 2
  398. .annotation system Ldalvik/annotation/Throws;
  399. value = {
  400. Ljava/io/IOException;
  401. }
  402. .end annotation
  403. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  404. invoke-virtual {v0}, Lokhttp3/internal/http2/Http2Stream;->takeResponseHeaders()Ljava/util/List;
  405. move-result-object v0
  406. invoke-static {v0}, Lokhttp3/internal/http2/Http2Codec;->readHttp2HeadersList(Ljava/util/List;)Lokhttp3/Response$Builder;
  407. move-result-object v0
  408. if-eqz p1, :cond_0
  409. sget-object p1, Lokhttp3/internal/Internal;->instance:Lokhttp3/internal/Internal;
  410. invoke-virtual {p1, v0}, Lokhttp3/internal/Internal;->code(Lokhttp3/Response$Builder;)I
  411. move-result p1
  412. const/16 v1, 0x64
  413. if-ne p1, v1, :cond_0
  414. const/4 p1, 0x0
  415. return-object p1
  416. :cond_0
  417. return-object v0
  418. .end method
  419. .method public writeRequestHeaders(Lokhttp3/Request;)V
  420. .locals 3
  421. .annotation system Ldalvik/annotation/Throws;
  422. value = {
  423. Ljava/io/IOException;
  424. }
  425. .end annotation
  426. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  427. if-eqz v0, :cond_0
  428. return-void
  429. :cond_0
  430. invoke-virtual {p1}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
  431. move-result-object v0
  432. if-eqz v0, :cond_1
  433. const/4 v0, 0x1
  434. goto :goto_0
  435. :cond_1
  436. const/4 v0, 0x0
  437. :goto_0
  438. invoke-static {p1}, Lokhttp3/internal/http2/Http2Codec;->http2HeadersList(Lokhttp3/Request;)Ljava/util/List;
  439. move-result-object p1
  440. iget-object v1, p0, Lokhttp3/internal/http2/Http2Codec;->connection:Lokhttp3/internal/http2/Http2Connection;
  441. invoke-virtual {v1, p1, v0}, Lokhttp3/internal/http2/Http2Connection;->newStream(Ljava/util/List;Z)Lokhttp3/internal/http2/Http2Stream;
  442. move-result-object p1
  443. iput-object p1, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  444. iget-object p1, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  445. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->readTimeout()Lokio/Timeout;
  446. move-result-object p1
  447. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->chain:Lokhttp3/Interceptor$Chain;
  448. invoke-interface {v0}, Lokhttp3/Interceptor$Chain;->readTimeoutMillis()I
  449. move-result v0
  450. int-to-long v0, v0
  451. sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  452. invoke-virtual {p1, v0, v1, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  453. iget-object p1, p0, Lokhttp3/internal/http2/Http2Codec;->stream:Lokhttp3/internal/http2/Http2Stream;
  454. invoke-virtual {p1}, Lokhttp3/internal/http2/Http2Stream;->writeTimeout()Lokio/Timeout;
  455. move-result-object p1
  456. iget-object v0, p0, Lokhttp3/internal/http2/Http2Codec;->chain:Lokhttp3/Interceptor$Chain;
  457. invoke-interface {v0}, Lokhttp3/Interceptor$Chain;->writeTimeoutMillis()I
  458. move-result v0
  459. int-to-long v0, v0
  460. sget-object v2, Ljava/util/concurrent/TimeUnit;->MILLISECONDS:Ljava/util/concurrent/TimeUnit;
  461. invoke-virtual {p1, v0, v1, v2}, Lokio/Timeout;->timeout(JLjava/util/concurrent/TimeUnit;)Lokio/Timeout;
  462. return-void
  463. .end method