RetryAndFollowUpInterceptor.smali 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. .class public final Lokhttp3/internal/http/RetryAndFollowUpInterceptor;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # interfaces
  5. .implements Lokhttp3/Interceptor;
  6. # static fields
  7. .field private static final MAX_FOLLOW_UPS:I = 0x14
  8. # instance fields
  9. .field private callStackTrace:Ljava/lang/Object;
  10. .field private volatile canceled:Z
  11. .field private final client:Lokhttp3/OkHttpClient;
  12. .field private final forWebSocket:Z
  13. .field private streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  14. # direct methods
  15. .method public constructor <init>(Lokhttp3/OkHttpClient;Z)V
  16. .locals 0
  17. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  18. iput-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  19. iput-boolean p2, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->forWebSocket:Z
  20. return-void
  21. .end method
  22. .method private createAddress(Lokhttp3/HttpUrl;)Lokhttp3/Address;
  23. .locals 17
  24. move-object/from16 v0, p0
  25. invoke-virtual/range {p1 .. p1}, Lokhttp3/HttpUrl;->isHttps()Z
  26. move-result v1
  27. const/4 v2, 0x0
  28. if-eqz v1, :cond_0
  29. iget-object v1, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  30. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->sslSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
  31. move-result-object v2
  32. iget-object v1, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  33. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->hostnameVerifier()Ljavax/net/ssl/HostnameVerifier;
  34. move-result-object v1
  35. iget-object v3, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  36. invoke-virtual {v3}, Lokhttp3/OkHttpClient;->certificatePinner()Lokhttp3/CertificatePinner;
  37. move-result-object v3
  38. move-object v10, v1
  39. move-object v9, v2
  40. move-object v11, v3
  41. goto :goto_0
  42. :cond_0
  43. move-object v9, v2
  44. move-object v10, v9
  45. move-object v11, v10
  46. :goto_0
  47. new-instance v1, Lokhttp3/Address;
  48. invoke-virtual/range {p1 .. p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  49. move-result-object v5
  50. invoke-virtual/range {p1 .. p1}, Lokhttp3/HttpUrl;->port()I
  51. move-result v6
  52. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  53. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->dns()Lokhttp3/Dns;
  54. move-result-object v7
  55. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  56. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->socketFactory()Ljavax/net/SocketFactory;
  57. move-result-object v8
  58. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  59. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->proxyAuthenticator()Lokhttp3/Authenticator;
  60. move-result-object v12
  61. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  62. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->proxy()Ljava/net/Proxy;
  63. move-result-object v13
  64. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  65. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->protocols()Ljava/util/List;
  66. move-result-object v14
  67. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  68. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->connectionSpecs()Ljava/util/List;
  69. move-result-object v15
  70. iget-object v2, v0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  71. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->proxySelector()Ljava/net/ProxySelector;
  72. move-result-object v16
  73. move-object v4, v1
  74. invoke-direct/range {v4 .. v16}, Lokhttp3/Address;-><init>(Ljava/lang/String;ILokhttp3/Dns;Ljavax/net/SocketFactory;Ljavax/net/ssl/SSLSocketFactory;Ljavax/net/ssl/HostnameVerifier;Lokhttp3/CertificatePinner;Lokhttp3/Authenticator;Ljava/net/Proxy;Ljava/util/List;Ljava/util/List;Ljava/net/ProxySelector;)V
  75. return-object v1
  76. .end method
  77. .method private followUpRequest(Lokhttp3/Response;)Lokhttp3/Request;
  78. .locals 7
  79. .annotation system Ldalvik/annotation/Throws;
  80. value = {
  81. Ljava/io/IOException;
  82. }
  83. .end annotation
  84. if-eqz p1, :cond_13
  85. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  86. invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->connection()Lokhttp3/internal/connection/RealConnection;
  87. move-result-object v0
  88. const/4 v1, 0x0
  89. if-eqz v0, :cond_0
  90. invoke-interface {v0}, Lokhttp3/Connection;->route()Lokhttp3/Route;
  91. move-result-object v0
  92. goto :goto_0
  93. :cond_0
  94. move-object v0, v1
  95. :goto_0
  96. invoke-virtual {p1}, Lokhttp3/Response;->code()I
  97. move-result v2
  98. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  99. move-result-object v3
  100. invoke-virtual {v3}, Lokhttp3/Request;->method()Ljava/lang/String;
  101. move-result-object v3
  102. const/16 v4, 0x133
  103. const-string v5, "GET"
  104. if-eq v2, v4, :cond_9
  105. const/16 v4, 0x134
  106. if-eq v2, v4, :cond_9
  107. const/16 v4, 0x191
  108. if-eq v2, v4, :cond_8
  109. const/16 v4, 0x197
  110. if-eq v2, v4, :cond_5
  111. const/16 v0, 0x198
  112. if-eq v2, v0, :cond_1
  113. packed-switch v2, :pswitch_data_0
  114. return-object v1
  115. :cond_1
  116. iget-object v2, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  117. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->retryOnConnectionFailure()Z
  118. move-result v2
  119. if-nez v2, :cond_2
  120. return-object v1
  121. :cond_2
  122. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  123. move-result-object v2
  124. invoke-virtual {v2}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
  125. move-result-object v2
  126. instance-of v2, v2, Lokhttp3/internal/http/UnrepeatableRequestBody;
  127. if-eqz v2, :cond_3
  128. return-object v1
  129. :cond_3
  130. invoke-virtual {p1}, Lokhttp3/Response;->priorResponse()Lokhttp3/Response;
  131. move-result-object v2
  132. if-eqz v2, :cond_4
  133. invoke-virtual {p1}, Lokhttp3/Response;->priorResponse()Lokhttp3/Response;
  134. move-result-object v2
  135. invoke-virtual {v2}, Lokhttp3/Response;->code()I
  136. move-result v2
  137. if-ne v2, v0, :cond_4
  138. return-object v1
  139. :cond_4
  140. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  141. move-result-object p1
  142. return-object p1
  143. :cond_5
  144. if-eqz v0, :cond_6
  145. invoke-virtual {v0}, Lokhttp3/Route;->proxy()Ljava/net/Proxy;
  146. move-result-object v1
  147. goto :goto_1
  148. :cond_6
  149. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  150. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->proxy()Ljava/net/Proxy;
  151. move-result-object v1
  152. :goto_1
  153. invoke-virtual {v1}, Ljava/net/Proxy;->type()Ljava/net/Proxy$Type;
  154. move-result-object v1
  155. sget-object v2, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
  156. if-ne v1, v2, :cond_7
  157. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  158. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->proxyAuthenticator()Lokhttp3/Authenticator;
  159. move-result-object v1
  160. invoke-interface {v1, v0, p1}, Lokhttp3/Authenticator;->authenticate(Lokhttp3/Route;Lokhttp3/Response;)Lokhttp3/Request;
  161. move-result-object p1
  162. return-object p1
  163. :cond_7
  164. new-instance p1, Ljava/net/ProtocolException;
  165. const-string v0, "Received HTTP_PROXY_AUTH (407) code while not using proxy"
  166. invoke-direct {p1, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
  167. throw p1
  168. :cond_8
  169. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  170. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->authenticator()Lokhttp3/Authenticator;
  171. move-result-object v1
  172. invoke-interface {v1, v0, p1}, Lokhttp3/Authenticator;->authenticate(Lokhttp3/Route;Lokhttp3/Response;)Lokhttp3/Request;
  173. move-result-object p1
  174. return-object p1
  175. :cond_9
  176. invoke-virtual {v3, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  177. move-result v0
  178. if-nez v0, :cond_a
  179. const-string v0, "HEAD"
  180. invoke-virtual {v3, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  181. move-result v0
  182. if-nez v0, :cond_a
  183. return-object v1
  184. :cond_a
  185. :pswitch_0
  186. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  187. invoke-virtual {v0}, Lokhttp3/OkHttpClient;->followRedirects()Z
  188. move-result v0
  189. if-nez v0, :cond_b
  190. return-object v1
  191. :cond_b
  192. const-string v0, "Location"
  193. invoke-virtual {p1, v0}, Lokhttp3/Response;->header(Ljava/lang/String;)Ljava/lang/String;
  194. move-result-object v0
  195. if-nez v0, :cond_c
  196. return-object v1
  197. :cond_c
  198. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  199. move-result-object v2
  200. invoke-virtual {v2}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  201. move-result-object v2
  202. invoke-virtual {v2, v0}, Lokhttp3/HttpUrl;->resolve(Ljava/lang/String;)Lokhttp3/HttpUrl;
  203. move-result-object v0
  204. if-nez v0, :cond_d
  205. return-object v1
  206. :cond_d
  207. invoke-virtual {v0}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  208. move-result-object v2
  209. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  210. move-result-object v4
  211. invoke-virtual {v4}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  212. move-result-object v4
  213. invoke-virtual {v4}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  214. move-result-object v4
  215. invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  216. move-result v2
  217. if-nez v2, :cond_e
  218. iget-object v2, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  219. invoke-virtual {v2}, Lokhttp3/OkHttpClient;->followSslRedirects()Z
  220. move-result v2
  221. if-nez v2, :cond_e
  222. return-object v1
  223. :cond_e
  224. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  225. move-result-object v2
  226. invoke-virtual {v2}, Lokhttp3/Request;->newBuilder()Lokhttp3/Request$Builder;
  227. move-result-object v2
  228. invoke-static {v3}, Lokhttp3/internal/http/HttpMethod;->permitsRequestBody(Ljava/lang/String;)Z
  229. move-result v4
  230. if-eqz v4, :cond_11
  231. invoke-static {v3}, Lokhttp3/internal/http/HttpMethod;->redirectsWithBody(Ljava/lang/String;)Z
  232. move-result v4
  233. invoke-static {v3}, Lokhttp3/internal/http/HttpMethod;->redirectsToGet(Ljava/lang/String;)Z
  234. move-result v6
  235. if-eqz v6, :cond_f
  236. invoke-virtual {v2, v5, v1}, Lokhttp3/Request$Builder;->method(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;
  237. goto :goto_2
  238. :cond_f
  239. if-eqz v4, :cond_10
  240. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  241. move-result-object v1
  242. invoke-virtual {v1}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
  243. move-result-object v1
  244. :cond_10
  245. invoke-virtual {v2, v3, v1}, Lokhttp3/Request$Builder;->method(Ljava/lang/String;Lokhttp3/RequestBody;)Lokhttp3/Request$Builder;
  246. :goto_2
  247. if-nez v4, :cond_11
  248. const-string v1, "Transfer-Encoding"
  249. invoke-virtual {v2, v1}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
  250. const-string v1, "Content-Length"
  251. invoke-virtual {v2, v1}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
  252. const-string v1, "Content-Type"
  253. invoke-virtual {v2, v1}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
  254. :cond_11
  255. invoke-direct {p0, p1, v0}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->sameConnection(Lokhttp3/Response;Lokhttp3/HttpUrl;)Z
  256. move-result p1
  257. if-nez p1, :cond_12
  258. const-string p1, "Authorization"
  259. invoke-virtual {v2, p1}, Lokhttp3/Request$Builder;->removeHeader(Ljava/lang/String;)Lokhttp3/Request$Builder;
  260. :cond_12
  261. invoke-virtual {v2, v0}, Lokhttp3/Request$Builder;->url(Lokhttp3/HttpUrl;)Lokhttp3/Request$Builder;
  262. move-result-object p1
  263. invoke-virtual {p1}, Lokhttp3/Request$Builder;->build()Lokhttp3/Request;
  264. move-result-object p1
  265. return-object p1
  266. :cond_13
  267. new-instance p1, Ljava/lang/IllegalStateException;
  268. invoke-direct {p1}, Ljava/lang/IllegalStateException;-><init>()V
  269. throw p1
  270. nop
  271. :pswitch_data_0
  272. .packed-switch 0x12c
  273. :pswitch_0
  274. :pswitch_0
  275. :pswitch_0
  276. :pswitch_0
  277. .end packed-switch
  278. .end method
  279. .method private isRecoverable(Ljava/io/IOException;Z)Z
  280. .locals 3
  281. instance-of v0, p1, Ljava/net/ProtocolException;
  282. const/4 v1, 0x0
  283. if-eqz v0, :cond_0
  284. return v1
  285. :cond_0
  286. instance-of v0, p1, Ljava/io/InterruptedIOException;
  287. const/4 v2, 0x1
  288. if-eqz v0, :cond_2
  289. instance-of p1, p1, Ljava/net/SocketTimeoutException;
  290. if-eqz p1, :cond_1
  291. if-nez p2, :cond_1
  292. const/4 v1, 0x1
  293. :cond_1
  294. return v1
  295. :cond_2
  296. instance-of p2, p1, Ljavax/net/ssl/SSLHandshakeException;
  297. if-eqz p2, :cond_3
  298. invoke-virtual {p1}, Ljava/io/IOException;->getCause()Ljava/lang/Throwable;
  299. move-result-object p2
  300. instance-of p2, p2, Ljava/security/cert/CertificateException;
  301. if-eqz p2, :cond_3
  302. return v1
  303. :cond_3
  304. instance-of p1, p1, Ljavax/net/ssl/SSLPeerUnverifiedException;
  305. if-eqz p1, :cond_4
  306. return v1
  307. :cond_4
  308. return v2
  309. .end method
  310. .method private recover(Ljava/io/IOException;ZLokhttp3/Request;)Z
  311. .locals 2
  312. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  313. invoke-virtual {v0, p1}, Lokhttp3/internal/connection/StreamAllocation;->streamFailed(Ljava/io/IOException;)V
  314. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  315. invoke-virtual {v0}, Lokhttp3/OkHttpClient;->retryOnConnectionFailure()Z
  316. move-result v0
  317. const/4 v1, 0x0
  318. if-nez v0, :cond_0
  319. return v1
  320. :cond_0
  321. if-eqz p2, :cond_1
  322. invoke-virtual {p3}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
  323. move-result-object p3
  324. instance-of p3, p3, Lokhttp3/internal/http/UnrepeatableRequestBody;
  325. if-eqz p3, :cond_1
  326. return v1
  327. :cond_1
  328. invoke-direct {p0, p1, p2}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->isRecoverable(Ljava/io/IOException;Z)Z
  329. move-result p1
  330. if-nez p1, :cond_2
  331. return v1
  332. :cond_2
  333. iget-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  334. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->hasMoreRoutes()Z
  335. move-result p1
  336. if-nez p1, :cond_3
  337. return v1
  338. :cond_3
  339. const/4 p1, 0x1
  340. return p1
  341. .end method
  342. .method private sameConnection(Lokhttp3/Response;Lokhttp3/HttpUrl;)Z
  343. .locals 2
  344. invoke-virtual {p1}, Lokhttp3/Response;->request()Lokhttp3/Request;
  345. move-result-object p1
  346. invoke-virtual {p1}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  347. move-result-object p1
  348. invoke-virtual {p1}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  349. move-result-object v0
  350. invoke-virtual {p2}, Lokhttp3/HttpUrl;->host()Ljava/lang/String;
  351. move-result-object v1
  352. invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  353. move-result v0
  354. if-eqz v0, :cond_0
  355. invoke-virtual {p1}, Lokhttp3/HttpUrl;->port()I
  356. move-result v0
  357. invoke-virtual {p2}, Lokhttp3/HttpUrl;->port()I
  358. move-result v1
  359. if-ne v0, v1, :cond_0
  360. invoke-virtual {p1}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  361. move-result-object p1
  362. invoke-virtual {p2}, Lokhttp3/HttpUrl;->scheme()Ljava/lang/String;
  363. move-result-object p2
  364. invoke-virtual {p1, p2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
  365. move-result p1
  366. if-eqz p1, :cond_0
  367. const/4 p1, 0x1
  368. goto :goto_0
  369. :cond_0
  370. const/4 p1, 0x0
  371. :goto_0
  372. return p1
  373. .end method
  374. # virtual methods
  375. .method public cancel()V
  376. .locals 1
  377. const/4 v0, 0x1
  378. iput-boolean v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->canceled:Z
  379. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  380. if-eqz v0, :cond_0
  381. invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->cancel()V
  382. :cond_0
  383. return-void
  384. .end method
  385. .method public intercept(Lokhttp3/Interceptor$Chain;)Lokhttp3/Response;
  386. .locals 14
  387. .annotation system Ldalvik/annotation/Throws;
  388. value = {
  389. Ljava/io/IOException;
  390. }
  391. .end annotation
  392. invoke-interface {p1}, Lokhttp3/Interceptor$Chain;->request()Lokhttp3/Request;
  393. move-result-object v0
  394. check-cast p1, Lokhttp3/internal/http/RealInterceptorChain;
  395. invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->call()Lokhttp3/Call;
  396. move-result-object v7
  397. invoke-virtual {p1}, Lokhttp3/internal/http/RealInterceptorChain;->eventListener()Lokhttp3/EventListener;
  398. move-result-object v8
  399. new-instance v9, Lokhttp3/internal/connection/StreamAllocation;
  400. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  401. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->connectionPool()Lokhttp3/ConnectionPool;
  402. move-result-object v2
  403. invoke-virtual {v0}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  404. move-result-object v1
  405. invoke-direct {p0, v1}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->createAddress(Lokhttp3/HttpUrl;)Lokhttp3/Address;
  406. move-result-object v3
  407. iget-object v6, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->callStackTrace:Ljava/lang/Object;
  408. move-object v1, v9
  409. move-object v4, v7
  410. move-object v5, v8
  411. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/connection/StreamAllocation;-><init>(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/Call;Lokhttp3/EventListener;Ljava/lang/Object;)V
  412. iput-object v9, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  413. const/4 v9, 0x0
  414. const/4 v10, 0x0
  415. move-object v1, v10
  416. const/4 v2, 0x0
  417. :goto_0
  418. iget-boolean v3, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->canceled:Z
  419. if-nez v3, :cond_a
  420. :try_start_0
  421. iget-object v3, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  422. invoke-virtual {p1, v0, v3, v10, v10}, Lokhttp3/internal/http/RealInterceptorChain;->proceed(Lokhttp3/Request;Lokhttp3/internal/connection/StreamAllocation;Lokhttp3/internal/http/HttpCodec;Lokhttp3/internal/connection/RealConnection;)Lokhttp3/Response;
  423. move-result-object v0
  424. :try_end_0
  425. .catch Lokhttp3/internal/connection/RouteException; {:try_start_0 .. :try_end_0} :catch_1
  426. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
  427. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  428. if-eqz v1, :cond_0
  429. invoke-virtual {v0}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
  430. move-result-object v0
  431. invoke-virtual {v1}, Lokhttp3/Response;->newBuilder()Lokhttp3/Response$Builder;
  432. move-result-object v1
  433. invoke-virtual {v1, v10}, Lokhttp3/Response$Builder;->body(Lokhttp3/ResponseBody;)Lokhttp3/Response$Builder;
  434. move-result-object v1
  435. invoke-virtual {v1}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
  436. move-result-object v1
  437. invoke-virtual {v0, v1}, Lokhttp3/Response$Builder;->priorResponse(Lokhttp3/Response;)Lokhttp3/Response$Builder;
  438. move-result-object v0
  439. invoke-virtual {v0}, Lokhttp3/Response$Builder;->build()Lokhttp3/Response;
  440. move-result-object v0
  441. :cond_0
  442. invoke-direct {p0, v0}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->followUpRequest(Lokhttp3/Response;)Lokhttp3/Request;
  443. move-result-object v11
  444. if-nez v11, :cond_2
  445. iget-boolean p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->forWebSocket:Z
  446. if-nez p1, :cond_1
  447. iget-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  448. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  449. :cond_1
  450. return-object v0
  451. :cond_2
  452. invoke-virtual {v0}, Lokhttp3/Response;->body()Lokhttp3/ResponseBody;
  453. move-result-object v1
  454. invoke-static {v1}, Lokhttp3/internal/Util;->closeQuietly(Ljava/io/Closeable;)V
  455. add-int/lit8 v12, v2, 0x1
  456. const/16 v1, 0x14
  457. if-gt v12, v1, :cond_6
  458. invoke-virtual {v11}, Lokhttp3/Request;->body()Lokhttp3/RequestBody;
  459. move-result-object v1
  460. instance-of v1, v1, Lokhttp3/internal/http/UnrepeatableRequestBody;
  461. if-nez v1, :cond_5
  462. invoke-virtual {v11}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  463. move-result-object v1
  464. invoke-direct {p0, v0, v1}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->sameConnection(Lokhttp3/Response;Lokhttp3/HttpUrl;)Z
  465. move-result v1
  466. if-nez v1, :cond_3
  467. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  468. invoke-virtual {v1}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  469. new-instance v13, Lokhttp3/internal/connection/StreamAllocation;
  470. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->client:Lokhttp3/OkHttpClient;
  471. invoke-virtual {v1}, Lokhttp3/OkHttpClient;->connectionPool()Lokhttp3/ConnectionPool;
  472. move-result-object v2
  473. invoke-virtual {v11}, Lokhttp3/Request;->url()Lokhttp3/HttpUrl;
  474. move-result-object v1
  475. invoke-direct {p0, v1}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->createAddress(Lokhttp3/HttpUrl;)Lokhttp3/Address;
  476. move-result-object v3
  477. iget-object v6, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->callStackTrace:Ljava/lang/Object;
  478. move-object v1, v13
  479. move-object v4, v7
  480. move-object v5, v8
  481. invoke-direct/range {v1 .. v6}, Lokhttp3/internal/connection/StreamAllocation;-><init>(Lokhttp3/ConnectionPool;Lokhttp3/Address;Lokhttp3/Call;Lokhttp3/EventListener;Ljava/lang/Object;)V
  482. iput-object v13, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  483. goto :goto_1
  484. :cond_3
  485. iget-object v1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  486. invoke-virtual {v1}, Lokhttp3/internal/connection/StreamAllocation;->codec()Lokhttp3/internal/http/HttpCodec;
  487. move-result-object v1
  488. if-nez v1, :cond_4
  489. :goto_1
  490. move-object v1, v0
  491. move-object v0, v11
  492. move v2, v12
  493. goto :goto_0
  494. :cond_4
  495. new-instance p1, Ljava/lang/IllegalStateException;
  496. new-instance v1, Ljava/lang/StringBuilder;
  497. invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
  498. const-string v2, "Closing the body of "
  499. invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  500. invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  501. const-string v0, " didn\'t close its backing stream. Bad interceptor?"
  502. invoke-virtual {v1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  503. invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  504. move-result-object v0
  505. invoke-direct {p1, v0}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
  506. throw p1
  507. :cond_5
  508. iget-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  509. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  510. new-instance p1, Ljava/net/HttpRetryException;
  511. invoke-virtual {v0}, Lokhttp3/Response;->code()I
  512. move-result v0
  513. const-string v1, "Cannot retry streamed HTTP body"
  514. invoke-direct {p1, v1, v0}, Ljava/net/HttpRetryException;-><init>(Ljava/lang/String;I)V
  515. throw p1
  516. :cond_6
  517. iget-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  518. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  519. new-instance p1, Ljava/net/ProtocolException;
  520. new-instance v0, Ljava/lang/StringBuilder;
  521. invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V
  522. const-string v1, "Too many follow-up requests: "
  523. invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  524. invoke-virtual {v0, v12}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
  525. invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  526. move-result-object v0
  527. invoke-direct {p1, v0}, Ljava/net/ProtocolException;-><init>(Ljava/lang/String;)V
  528. throw p1
  529. :catchall_0
  530. move-exception p1
  531. goto :goto_3
  532. :catch_0
  533. move-exception v3
  534. :try_start_1
  535. instance-of v4, v3, Lokhttp3/internal/http2/ConnectionShutdownException;
  536. if-nez v4, :cond_7
  537. const/4 v4, 0x1
  538. goto :goto_2
  539. :cond_7
  540. const/4 v4, 0x0
  541. :goto_2
  542. invoke-direct {p0, v3, v4, v0}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->recover(Ljava/io/IOException;ZLokhttp3/Request;)Z
  543. move-result v4
  544. if-eqz v4, :cond_8
  545. goto/16 :goto_0
  546. :cond_8
  547. throw v3
  548. :catch_1
  549. move-exception v3
  550. invoke-virtual {v3}, Lokhttp3/internal/connection/RouteException;->getLastConnectException()Ljava/io/IOException;
  551. move-result-object v4
  552. invoke-direct {p0, v4, v9, v0}, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->recover(Ljava/io/IOException;ZLokhttp3/Request;)Z
  553. move-result v4
  554. if-eqz v4, :cond_9
  555. goto/16 :goto_0
  556. :cond_9
  557. invoke-virtual {v3}, Lokhttp3/internal/connection/RouteException;->getLastConnectException()Ljava/io/IOException;
  558. move-result-object p1
  559. throw p1
  560. :try_end_1
  561. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  562. :goto_3
  563. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  564. invoke-virtual {v0, v10}, Lokhttp3/internal/connection/StreamAllocation;->streamFailed(Ljava/io/IOException;)V
  565. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  566. invoke-virtual {v0}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  567. throw p1
  568. :cond_a
  569. iget-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  570. invoke-virtual {p1}, Lokhttp3/internal/connection/StreamAllocation;->release()V
  571. new-instance p1, Ljava/io/IOException;
  572. const-string v0, "Canceled"
  573. invoke-direct {p1, v0}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
  574. goto :goto_5
  575. :goto_4
  576. throw p1
  577. :goto_5
  578. goto :goto_4
  579. .end method
  580. .method public isCanceled()Z
  581. .locals 1
  582. iget-boolean v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->canceled:Z
  583. return v0
  584. .end method
  585. .method public setCallStackTrace(Ljava/lang/Object;)V
  586. .locals 0
  587. iput-object p1, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->callStackTrace:Ljava/lang/Object;
  588. return-void
  589. .end method
  590. .method public streamAllocation()Lokhttp3/internal/connection/StreamAllocation;
  591. .locals 1
  592. iget-object v0, p0, Lokhttp3/internal/http/RetryAndFollowUpInterceptor;->streamAllocation:Lokhttp3/internal/connection/StreamAllocation;
  593. return-object v0
  594. .end method